-This is SMESH V2.0.0
-
+This is the version 2.1.0 of SMESH
Compatible with :
- GEOM V2_0_0
- KERNEL V2_0_0
- MED V2_0_0
+ - KERNEL 2.1.0
+ - GEOM 2.1.0
+ - MED 2.1.0
mesh_tree_group.png \
mesh_edit_group.png \
mesh_make_group.png \
+mesh_union2tri.png \
+mesh_uniontri.png \
+mesh_cutquad.png \
+mesh_smoothing.png \
+mesh_renumbering_nodes.png \
+mesh_renumbering_elements.png \
+mesh_extrusion.png \
+mesh_revolution.png \
ModuleMesh.png \
+mesh_unionGroups.png \
+mesh_intersectGroups.png \
+mesh_cutGroups.png \
+mesh_deleteGroups.png \
+mesh_translation_vector.png \
+mesh_translation_points.png \
+mesh_rotation.png \
+mesh_symmetry_point.png \
+mesh_symmetry_axis.png \
+mesh_symmetry_plane.png \
+mesh_sew_freeborders.png \
+mesh_sew_conform_freeborders.png \
+mesh_sew_bordertoside.png \
+mesh_sew_sideelements.png \
+mesh_merge_nodes.png \
select1.png \
SMESH_en.xml \
SMESH.config \
StdMeshers.xml \
SMESHCatalog.xml \
-flight_solid.brep
+flight_solid.brep \
+mesh_pattern.png \
+pattern_sample_2d.png \
+pattern_sample_3D.png
BIN_SCRIPT= \
VERSION
# GEOM_ROOT_DIR environment variable defined
GEOM_DIR=$GEOM_ROOT_DIR
- else
-
- # search Geom binaries in PATH variable
- AC_PATH_PROG(TEMP, libGEOM_Swig.py)
- if test "x$TEMP" != "x" ; then
- GEOM_BIN_DIR=`dirname $TEMP`
- GEOM_DIR=`dirname $GEOM_BIN_DIR`
- fi
-
fi
#
fi
-if test -f ${GEOM_DIR}/bin/salome/libGEOM_Swig.py ; then
+if test -f ${GEOM_DIR}/lib/salome/libGEOMClient.so ; then
Geom_ok=yes
AC_MSG_RESULT(Using Geom module distribution in ${GEOM_DIR})
# MED_ROOT_DIR environment variable defined
MED_DIR=$MED_ROOT_DIR
- else
-
- # search Med binaries in PATH variable
- AC_PATH_PROG(TEMP, libMEDMEM_Swig.py)
- if test "x$TEMP" != "x" ; then
- MED_BIN_DIR=`dirname $TEMP`
- MED_DIR=`dirname $MED_BIN_DIR`
- fi
-
fi
#
fi
-if test -f ${MED_DIR}/bin/salome/libMEDMEM_Swig.py ; then
+if test -f ${MED_DIR}/idl/salome/MED.idl ; then
Med_ok=yes
AC_MSG_RESULT(Using Med module distribution in ${MED_DIR})
+++ /dev/null
-AC_DEFUN([CHECK_NETGEN],[
-
-AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_PROG_CXXCPP])dnl
-
-AC_CHECKING(for Netgen Libraries)
-
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-
-AC_ARG_WITH(netgen,
- [ --with-netgen=DIR root directory path of NETGEN installation],
- WITHNETGEN="yes",WITHNETGEN="no")
-
-NETGEN_INCLUDES=""
-NETGEN_LIBS=""
-
-Netgen_ok=no
-
-if test "$WITHNETGEN" = yes; then
-
- echo
- echo
- echo -------------------------------------------------
- echo You are about to choose to use somehow the
- echo Netgen Library to generate Tetrahedric mesh.
- echo
- echo WARNING
- echo ----------------------------------------------------------
- echo ----------------------------------------------------------
- echo You are strongly advised to consult the file
- echo SMESH_SRC/src/NETGEN/ReadMeForNgUsers, particularly about
- echo assumptions made on the installation of the Netgen
- echo application and libraries.
- echo Ask your system administrator for those details.
- echo ----------------------------------------------------------
- echo ----------------------------------------------------------
- echo
- echo
-
- NETGEN_HOME=$withval
-
- if test "$NETGEN_HOME"; then
- NETGEN_INCLUDES="-I$NETGEN_HOME/include"
- NETGEN_LIBS_DIR="$NETGEN_HOME/lib/LINUX"
- NETGEN_LIBS="-L$NETGEN_LIBS_DIR"
- fi
-
- CPPFLAGS_old="$CPPFLAGS"
- CPPFLAGS="$NETGEN_INCLUDES $CPPFLAGS"
- CXXFLAGS_old="$CXXFLAGS"
- CXXFLAGS="$NETGEN_INCLUDES $CXXFLAGS"
-
- AC_MSG_CHECKING(for Netgen header file)
-
- AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no)
- CPPFLAGS="$CPPFLAGS_old"
- CXXFLAGS="$CXXFLAGS_old"
-
- if test "$WITHNETGEN" = "yes";then
- NETGEN_LIBS="-L. -lNETGEN"
-
- AC_MSG_CHECKING(for Netgen libraries)
-
- CPPFLAGS_old="$CPPFLAGS"
- CPPFLAGS="$NETGEN_INCLUDES $CPPFLAGS"
- CXXFLAGS_old="$CXXFLAGS"
- CXXFLAGS="$NETGEN_INCLUDES $CXXFLAGS"
-
- LDFLAGS_old="$LDFLAGS"
- LDFLAGS="$NETGEN_LIBS $LDFLAGS"
-
- AC_TRY_COMPILE(#include <iostream.h>
-#include <fstream.h>
-#include "nglib.h"
-,Ng_Init();
- Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a";
- ar x "$NETGEN_LIBS_DIR/libcsg.a";
- ar x "$NETGEN_LIBS_DIR/libgprim.a";
- ar x "$NETGEN_LIBS_DIR/libmesh.a";
- ar x "$NETGEN_LIBS_DIR/libopti.a";
- ar x "$NETGEN_LIBS_DIR/libgen.a";
- ar x "$NETGEN_LIBS_DIR/libla.a";
- ar x "$NETGEN_LIBS_DIR/libstlgeom.a";
- ar x "$NETGEN_LIBS_DIR/libgeom2d.a";
- $CXX -shared linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline2d.o splinegeometry2.o ngnewdelete.o nglib.o -o libNETGEN.so;
- rm -rf adfront2.o adfront3.o adtree.o algprim.o array.o basemat.o bfgs.o bisect.o bitarray.o boundarylayer.o brick.o bspline2d.o clusters.o csgeom.o csgparser.o curve2d.o curvedelems.o delaunay.o densemat.o dynamicmem.o edgeflw.o explicitcurve2d.o extrusion.o flags.o gencyl.o genmesh.o geom2dmesh.o geom2d.o geom3d.o geomfuncs.o geomsearch.o geomtest3d.o global.o hashtabl.o hprefinement.o identify.o importsolution.o improve2gen.o improve2.o improve3.o linopt.o linsearch.o localh.o manifold.o meshclass.o meshfunc2d.o meshfunc.o meshing2.o meshing3.o meshstlsurface.o meshsurf.o meshtool.o meshtype.o moveablemem.o msghandler.o mystring.o netrule2.o netrule3.o ngexception.o nglib.o ngnewdelete.o optmem.o parser2.o parser3.o parthreads.o polyhedra.o polynomial.o prism2rls.o pyramid2rls.o pyramidrls.o quadrls.o readuser.o refine.o revolution.o ruler2.o ruler3.o secondorder.o seti.o singularref.o smoothing2.o smoothing3.o solid.o sort.o sparsmat.o spbita2d.o specials.o specpoin.o spline2d.o spline3d.o splinegeometry2.o stlgeomchart.o stlgeommesh.o stlgeom.o stlline.o stltool.o stltopology.o surface.o symbolta.o table.o tetrarls.o topology.o transform3d.o triapprox.o triarls.o vector.o writeabaqus.o writediffpack.o writefeap.o writefluent.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o zrefine.o,
- Netgen_ok=no)
-
- AC_CACHE_VAL(salome_netgen_lib,[
- AC_TRY_LINK(
-#include <iostream.h>
-#include <fstream.h>
-#include "nglib.h"
-,Ng_Init();
- Ng_Exit();,
- eval "salome_netgen_lib=yes";rm -rf libNETGEN.so,eval "salome_netgen_lib=no";rm -rf libNETGEN.so)
- ])
- Netgen_ok="$salome_netgen_lib"
-
-
- LDFLAGS="$LDFLAGS_old"
- CPPFLAGS="$CPPFLAGS_old"
- CXXFLAGS="$CXXFLAGS_old"
- fi
-
-
-if test "x$Netgen_ok" = xno ; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN(Netgen libraries not found or not properly installed)
-else
- AC_MSG_RESULT(yes)
- NETGEN_LIBS="-lNETGEN"
- CPPFLAGS="${CPPFLAGS} -DHAVE_NETGEN"
- IDLCXXFLAGS="${IDLCXXFLAGS} -DHAVE_NETGEN"
- OMNIORB_IDLPYFLAGS="${OMNIORB_IDLPYFLAGS} -DHAVE_NETGEN"
-fi
-fi
-AC_SUBST(NETGEN_INCLUDES)
-AC_SUBST(NETGEN_LIBS)
-AC_SUBST(NETGEN_LIBS_DIR)
-AC_SUBST(WITHNETGEN)
-
-AC_LANG_RESTORE
-
-])dnl
LIBS=@LIBS@
+LIBSFORBIN=@LIBS@
LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
+LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
# add libstdc++ to link c++ library with libtool !
LDFLAGS+= -lstdc++
+LDFLAGSFORBIN+= -lstdc++
CP=@CP@
# C++
CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
# BOOST Library
--- /dev/null
+#=======================================================================
+# This section of this makefile comes from the file
+# 'adm/unix/make_conclude' which was generated with config.status
+# from file adm/unix/make_conclude.in
+#=======================================================================
+# -* Makefile *-
+#
+# Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
+# Date : 6/07/2001
+# $Header$
+#
+
+# ORB Specifics rules
+@CORBA@
+
+# transform idl reference in appropriate obj file
+LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
+LIB_SRC+=$(LIB_MOC_SRC)
+LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
+LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
+
+LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+
+
+# transform c file in appropriate libtool obj file (.c, .cc and .cxx)
+LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
+LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
+LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
+LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
+LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
+
+# all libtool obj file in library
+LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F)
+
+# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la)
+LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB)))
+LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB)))
+
+ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
+LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
+else
+LIB_SWIG =
+endif
+
+lib: $(LIB_BUILD) $(LIB_CLIENT_PY)
+# we don't build static library !
+
+$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la
+ -$(RM) $@
+ -$(RM) $(patsubst %.la, %.so, $@)
+ -$(RM) $(patsubst %.la, %.a, $@)
+ ln -sf $(CURDIR)/$< $@ || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
+ $(patsubst %.la, %.so, $@) || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
+ $(patsubst %.la, %.so, $@).0 || true
+
+ if ! test -z $(LIB_SWIG) ; then \
+ ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\
+ fi;
+
+$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@ || true
+
+$(LIB): $(LIB_OBJ)
+ @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
+
+# transform idl reference in appropriate obj file
+BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
+BIN_SRC+=$(BIN_MOC_SRC)
+BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+
+BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+# transform c file in appropriate libtool obj file (.c)
+BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
+# transform c++ file in appropriate libtool obj file (.cc and .cxx)
+BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
+BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
+# all obj file in bin target
+BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
+
+bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
+
+BIN_LIB=$(LIB:lib%.la=-l%)
+
+$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@
+
+$(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
+
+# copy python scripts in $(top_builddir)/bin/salome
+#
+DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS)
+$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
+# copy pyqt files in $(PYTHON_SHARED_SITE)
+#
+PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+
+$(PYTHON_SHARED_SITE):
+ $(INSTALL) -d $@
+
+DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
+sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
+$(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
+ cp -f $< $@
+
+check: test
+
+tests: test
+
+test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
+
+
+# copy header file in $(inc_builddir)
+#
+DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
+inc: $(DEST_HEADERS)
+$(DEST_HEADERS): $(inc_builddir)/%: %
+ cp -f $< $@
+
+# build resources file (icons and messages) : .qm file from .po file
+resources: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+
+# Make installation directories if they don't exist.
+$(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
+ $(INSTALL) -d $@ && chmod 755 $@
+
+# Install the library, the public header files, and programs.
+install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm
+ @for f in X $(LIB); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
+ fi; \
+ done
+ @if ! test -z $(LIB_SWIG) ; then \
+ (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
+ fi;
+ @for f in X $(BIN); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install tests programmes in bindir
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install exported includes in includedir
+ @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
+ if test $$f != X; then \
+ (cp -p -f $$f $(includedir) || exit 1); \
+ fi; \
+ done
+
+# Install python script in $(bindir)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+
+$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
+
+#install-python: $(bindir) $(EXPORT_PYSCRIPTS)
+# @for f in X $(EXPORT_PYSCRIPTS); do \
+# if test $$f != X; then \
+# ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
+# fi; \
+# done
+
+# Install pyqt script in $(install-sharedpyqt)
+install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
+
+$(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(sharedpydir)/.
+
+
+# generic rule to install .qm files :
+install-qm: resources
+ $(INSTALL) -d $(datadir)/resources
+ @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm); do \
+ if test $$f != X; then \
+ ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \
+ fi; \
+ done
+
+# Removes those things that `make install' (would have) installed.
+uninstall:
+ @if test "X$(LIB)" != X; then \
+ for f in $(LIB); do \
+ $(LT_UNINSTALL) $(libdir)/$$f; \
+ done; \
+ fi
+ @if test "X$(BIN)" != X; then \
+ for f in $(BIN); do \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ done; \
+ fi
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ fi; \
+ done
+# Uninstall exported includes in includedir
+ @for f in X $(EXPORT_HEADERS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(includedir)/$$f; \
+ fi; \
+ done
+# Uninstall python script in $(bindir)
+ @for f in X $(EXPORT_PYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall pyqt script in $(sharedpydir)
+ @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall qm files
+ @for f in X $(PO_FILES:%.po=%.qm); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(datadir)/resources/$$f ; \
+ fi; \
+ done
+
+# remove all dependencies files
+#
+cleandep:
+ -$(RM) .dep*
+
+# Removes temporary files without removing the final target files. That is,
+# remove things like object files but not libraries or executables.
+#
+mostlyclean: cleandep
+ -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
+ -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
+ -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
+ -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
+
+# Like `mostlyclean' except it also removes the final targets: things like
+# libraries and executables. This target doesn't remove any file that
+# is part of the SALOME distribution.
+#
+clean: mostlyclean
+ -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
+ -$(RM) TAGS *~ *# core *.core
+ -$(RM) -r .libs
+ -$(RM) $(top_builddir)/lib/salome/$(LIB)
+ -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
+ -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB))
+ -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB))
+# remove idl generated files (sources)
+ -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+# remove idl generated files (headers)
+ -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
+ -$(RM) $(LIB_SWIG_SRC)
+
+# Like `clean' except it also removes files that were created by running
+# configure. If you've unpacked the source and built without creating
+# any other files, then `make distclean' will leave only the files that were
+# in the distribution.
+#
+distclean: clean
+ #remove qm file !
+ -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+ #remove include files
+ -$(RM) $(DEST_HEADERS)
+ -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
+ @if test -f $(srcdir)/Makefile.in; then \
+ (@SETX@; $(RM) Makefile); \
+ fi
+
+
+#implicits rules
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cc.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.c.lo:
+ $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.f.o:
+ $(FC) $(FFLAGS) -c $< -o $@
+
+.f.lo:
+ $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
+
+.ui.h:
+ $(UIC) -o $@ $<
+
+.ui.cxx:
+ $(UIC) -o $@ -i $*.h $<
+
+#pattern rules
+%_moc.cxx : %.h
+ $(MOC) $< -o $@
+
+%_wrap.cxx : %.i
+ $(SWIG) $(SWIG_FLAGS) -o $@ $<
+
+$(top_builddir)/share/salome/resources/%.qm: %.po
+ if test -e ${KERNEL_ROOT_DIR}/bin/salome/msg2qm ; then \
+ ${KERNEL_ROOT_DIR}/bin/salome/msg2qm $< $@ ; \
+ else \
+ $(top_builddir)/bin/salome/msg2qm $< $@ ; \
+ fi
+
+#------------------------------------------------------------------------------
+# The following section of this makefile contains dependencies between the
+# source files and the header files. If GNU make and GCC are being used then
+# the dependencies are in the form of rules that cause the information to
+# be kept updated automatically. Otherwise the dependencies are listed
+# explicitly and come from the `.distdep' files in the various directories.
+# These files are part of the distribution and are generated automatically on
+# GNU/GCC systems.
+#------------------------------------------------------------------------------
+
+@DEPEND@
-THIS IS SALOME - SMESH VERSION: 2.0.0
+THIS IS SALOME - SMESH VERSION: 2.1.0
echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
-echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
+echo " ./adm_local/unix/make_conclude \\" >> configure.in_tmp1
echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
\rm -f configure.in_tmp2 configure.in_tmp3
dnl generals files which could be included in every makefile
AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence
-AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
+AC_SUBST_FILE(CONCLUDE) CONCLUDE=adm_local/unix/make_conclude
AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
dnl les dependences
|SourceProjectName:SMESH.hpr\r
-|DestinationProjectName:smesh.html\r
+|DestinationProjectName:smesh.htm\r
whhost.js\r
whmsg.js\r
whmozemu.js\r
files\about_quality_controls.htm\r
files\adding_nodes_and_elements.htm\r
files\area_of_elements.htm\r
+files\arithmetic_1d.htm\r
files\aspect_ratio.htm\r
files\changing_orientation_of_elements.htm\r
files\computing_meshes.htm\r
files\connectivity.htm\r
files\constructing_meshes.htm\r
files\constructing_submeshes.htm\r
+files\deflection_1d.htm\r
files\diagonal_iversion_of_elements.htm\r
files\displacing_nodes.htm\r
files\displaying_elements_numbers.htm\r
files\editing_hypotheses.htm\r
files\importing_and_exporting_meshes.htm\r
files\introduction_to_smesh.htm\r
+files\length_from_edges.htm\r
files\length_of_edges.htm\r
files\local_length_hypothesis.htm\r
files\max._element_area_hypothesis.htm\r
files\max._element_volume_hypothsis.htm\r
files\minimum_angle.htm\r
+files\non_conform_mesh_allowed_hypothesis.htm\r
files\number_of_segments_hypothesis.htm\r
+files\propagation_of_1d_hypothesis_on_opposite_edges.htm\r
files\reassigning_hypotheses_and_algorithms.htm\r
files\removing_nodes_and_elements.htm\r
files\running_smesh_module.htm\r
files\shading.htm\r
files\shrink.htm\r
files\skew.htm\r
+files\start_and_end_length_hypothesis.htm\r
files\taper.htm\r
files\tetrahedron_(netgen)_meshing_algorithm.htm\r
files\using_smesh_module.htm\r
files\visualization_properties.htm\r
files\warp.htm\r
files\wireframe.htm\r
-texture_horiz_ltbluebubbles.jpg\r
+tetrahedron_(ghs3d)_meshing_algorithm.htm\r
ehlpdhtm.js\r
+texture_horiz_ltbluebubbles.jpg\r
smesh.glo\r
default.css\r
-image3.jpg\r
-image55.gif\r
image44.gif\r
image33.gif\r
image22.gif\r
image25.jpg\r
-image4.jpg\r
-image56.gif\r
-image45.gif\r
+image12.gif\r
+image3.jpg\r
image34.gif\r
image26.jpg\r
-image2.gif\r
+image13.gif\r
+image16.jpg\r
+image4.jpg\r
image46.gif\r
image35.gif\r
image27.jpg\r
image24.gif\r
-image6.jpg\r
-image47.gif\r
+image14.gif\r
+image17.jpg\r
+image2.gif\r
image36.gif\r
image28.jpg\r
image25.gif\r
-image4.gif\r
-image7.jpg\r
+image15.gif\r
+image18.jpg\r
+image6.jpg\r
image48.gif\r
image37.gif\r
image29.jpg\r
image26.gif\r
-image8.jpg\r
+note1.gif\r
+image16.gif\r
+image4.gif\r
+image7.jpg\r
image49.gif\r
image38.gif\r
image27.gif\r
-note1.gif\r
-image6.gif\r
-image9.jpg\r
+image8.jpg\r
image39.gif\r
image28.gif\r
+image6.gif\r
+image9.jpg\r
+pics\exemple.gif\r
image29.gif\r
+image7.gif\r
i_blue.jpg\r
-image50.gif\r
+image8.gif\r
+image9.gif\r
pics\new.jpg\r
+image20.jpg\r
+image21.jpg\r
image10.jpg\r
-image51.gif\r
image40.gif\r
image11.jpg\r
-image52.gif\r
image41.gif\r
image12.jpg\r
-pics\exemple.gif\r
-image53.gif\r
-image42.gif\r
image31.gif\r
image43.gif\r
image32.gif\r
whgdata\whlstf1.htm\r
whgdata\whlstf2.htm\r
whgdata\whlstf3.htm\r
+whgdata\whlstf4.htm\r
whgdata\whlstg0.htm\r
-smesh.html\r
-smesh_csh.html\r
-smesh_rhc.html\r
+smesh.htm\r
+smesh_csh.htm\r
+smesh_rhc.htm\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=380>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=547>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 27px; height: 24px;}\r
+img_whs3 {border-style: none; border: none; width: 22px; height: 22px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Wire discretization \r
- </B></span>or click <img src="../image51.gif" width="27px" height="24px" border="0" class="img_whs3"> button in the toolbar.</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms \r
+ ></B></span> <img src="../image16.gif" width="22px" height="22px" border="0" class="img_whs3"> <span style="font-weight: bold;"><B>Wire discretization \r
+ </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=380>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=547>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 26px; height: 27px;}\r
+img_whs3 {border-style: none; border: none; width: 22px; height: 21px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Quadrangle (Mapping) \r
- </B></span>or click <img src="../image56.gif" width="26px" height="27px" border="0" class="img_whs3"> button in the toolbar.</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms \r
+ > <img src="../image14.gif" width="22px" height="21px" border="0" class="img_whs3"> Quadrangle (Mapping) </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=380>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=553>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 27px; height: 24px;}\r
+img_whs3 {border-style: none; border: none; width: 22px; height: 22px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Triangle (Mefisto) \r
- </B></span>or click <img src="../image55.gif" width="27px" height="24px" border="0" class="img_whs3"> button in the toolbar.</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms \r
+ ></B></span> <img src="../image15.gif" width="22px" height="22px" border="0" class="img_whs3"> <span style="font-weight: bold;"><B>Triangle \r
+ (Mefisto) </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=380>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=547>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 26px; height: 24px;}\r
+img_whs3 {border-style: none; border: none; width: 23px; height: 21px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Hexahedron (i,j,k) \r
- </B></span>or \r
- click <img src="../image53.gif" width="26px" height="24px" border="0" class="img_whs3"> button in the toolbar.</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms \r
+ ></B></span> <img src="../image13.gif" width="23px" height="21px" border="0" class="img_whs3"> <span style="font-weight: bold;"><B>Hexahedron \r
+ (i,j,k) </B></span>and \r
+ click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=479>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=1162>\r
+<meta name=layout-width content=473>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
ul.whs2 {list-style: disc;}\r
-ol.whs3 {list-style: disc;}\r
+p.whs3 {background-color: Transparent; color: #000000;}\r
+p.whs4 {font-style: italic; font-size: 12pt; font-family: 'Arial Black', sans-serif;}\r
+img_whs5 {border-style: none; border: none; width: 22px; height: 22px;}\r
+img_whs6 {border-style: none; border: none; width: 448px; height: 367px;}\r
-->\r
</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs3 {background-color:white; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
<!--\r
function reDo() {\r
<!--(Body)==========================================================-->\r
\r
\r
-<body>\r
+<body page-style ="x-size: Letter;">\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
<li style="list-style: circle;"\r
type=circle\r
- class=kadov-p><p>For meshing of <span style="font-weight: bold;"><B>edges</B></span>:</p></li>\r
+ class=kadov-p><p class="whs3">For \r
+ meshing of <span style="font-weight: bold;"><B>edges</B></span>:</p></li>\r
\r
<ul type="disc" class="whs2">\r
\r
- <li class=kadov-p><p><a href="local_length_hypothesis.htm">Local \r
- Length</a> </p></li>\r
+ <li class=kadov-p><p class="whs3"><a href="arithmetic_1d.htm">Arithmetic 1D</a></p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="local_length_hypothesis.htm">Average Length</a></p></li>\r
\r
- <li class=kadov-p><p><a href="number_of_segments_hypothesis.htm">Number \r
- of segments</a></p></li>\r
+ <li class=kadov-p><p class="whs3"><a href="deflection_1d.htm">Deflection 1D</a> </p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="number_of_segments_hypothesis.htm">Number of segments</a></p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="propagation_of_1d_hypothesis_on_opposite_edges.htm">Propagation \r
+ of 1D Hypothesis on opposite edges</a></p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="start_and_end_length_hypothesis.htm">Start and end length</a></p></li>\r
</ul>\r
\r
<li style="list-style: circle;"\r
type=circle\r
- class=kadov-p><p>For meshing of <span style="font-weight: bold;"><B>faces</B></span>: \r
- </p></li>\r
+ class=kadov-p><p class="whs3">For \r
+ meshing of <span style="font-weight: bold;"><B>faces</B></span>: </p></li>\r
</ul>\r
\r
-<ol type="disc" class="whs3">\r
+<ul type="disc" class="whs2">\r
\r
<ul type="disc" class="whs2">\r
\r
- <li class=kadov-p><p><a href="max._element_area_hypothesis.htm">Max \r
- Element Area</a></p></li>\r
+ <li class=kadov-p><p class="whs3"><a href="length_from_edges.htm">Length from edges</a></p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="max._element_area_hypothesis.htm">Max Element Area</a></p></li>\r
+ \r
+ <li class=kadov-p><p class="whs3"><a href="non_conform_mesh_allowed_hypothesis.htm">Non conform mesh allowed</a></p></li>\r
</ul>\r
-</ol>\r
+</ul>\r
\r
<ul type="disc" class="whs2">\r
\r
<li style="list-style: circle;"\r
type=circle\r
- class=kadov-p><p>For meshing of <span style="font-weight: bold;"><B>volumes</B></span>: \r
- </p></li>\r
+ class=kadov-p><p class="whs3">For \r
+ meshing of <span style="font-weight: bold;"><B>volumes</B></span>: </p></li>\r
\r
<ul type="disc" class="whs2">\r
\r
\r
<p> </p>\r
\r
+<p class="whs4">To create a hypothesis \r
+ </p>\r
+\r
+<p><span style="font-size: 12pt;"><font size=3 style="font-size:12pt;">In the main menu select</font></span><span style="font-style: italic;\r
+ font-size: 12pt;\r
+ font-family: 'Arial Black', sans-serif;"> <font size=3 style="font-size:12pt;"><I></I></font></span><span style="font-weight: bold;"><B>Hypotheses \r
+ > </B></span><img src="../image7.gif" width="22px" height="22px" border="0" class="img_whs5"> <span style="font-weight: bold;"><B>Create hypotheses</B></span></p>\r
+\r
+<p>The following menu will appear:</p>\r
+\r
+<p> </p>\r
+\r
+<p><img src="../image21.jpg" width="448px" height="367px" border="0" class="img_whs6"></p>\r
+\r
+<p> </p>\r
+\r
+<p>Select one of the menu items and click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
+\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.writeIntopicBar)\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=422>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=891>\r
+<meta name=layout-width content=486>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
ul.whs2 {list-style: disc;}\r
-ul.whs3 {list-style: circle;}\r
+ol.whs3 {list-style: disc;}\r
+ul.whs4 {list-style: circle;}\r
+p.whs5 {font-style: italic; font-size: 12pt; font-family: 'Arial Black', sans-serif;}\r
+img_whs6 {border-style: none; border: none; width: 23px; height: 22px;}\r
+img_whs7 {border-style: none; border: none; width: 464px; height: 324px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
<p> </p>\r
\r
-<ul type="disc" class="whs2">\r
+<ol type="disc" class="whs3">\r
\r
<ul type="disc" class="whs2">\r
\r
class=kadov-p><p><a href="1d_meshing_algorithm.htm">Wire discretization \r
meshing algorithm</a></p></li>\r
</ul>\r
-</ul>\r
+</ol>\r
\r
<p> </p>\r
\r
\r
<p> </p>\r
\r
-<ul type="disc" class="whs2">\r
+<ol type="disc" class="whs3">\r
\r
- <ul type="circle" class="whs3">\r
+ <ul type="circle" class="whs4">\r
\r
<li class=kadov-p><p><a href="2d_meshing_algorithm.htm">Triangle \r
meshing algorithm</a></p></li>\r
<li class=kadov-p><p><a href="2d_(quadrangle)_meshing_algorithm.htm">Quadrangle \r
meshing algorithm</a></p></li>\r
</ul>\r
-</ul>\r
+</ol>\r
\r
<p> </p>\r
\r
\r
<p> </p>\r
\r
-<ul type="disc" class="whs2">\r
+<ol type="disc" class="whs3">\r
\r
- <ul type="circle" class="whs3">\r
+ <ul type="circle" class="whs4">\r
\r
<li class=kadov-p><p><a href="3d_meshing_algorithm.htm">Hexahedron \r
meshing algorithm</a></p></li>\r
<li class=kadov-p><p><a href="tetrahedron_(netgen)_meshing_algorithm.htm">Tetrahedron \r
meshing algorithm</a></p></li>\r
</ul>\r
-</ul>\r
+</ol>\r
\r
<p> </p>\r
\r
+<p class="whs5"><span style="font-style: italic;\r
+ font-size: 12pt;\r
+ font-family: 'Arial Black', sans-serif;"><font size=3 style="font-size:12pt;"><I>To apply a meshing algorithm \r
+ </I></font></span></p>\r
+\r
+<p><span style="font-size: 12pt;"><font size=3 style="font-size:12pt;">In the main menu select</font></span><span style="font-style: italic;\r
+ font-size: 12pt;\r
+ font-family: 'Arial Black', sans-serif;"> <font size=3 style="font-size:12pt;"><I></I></font></span><span style="font-weight: bold;"><B>Hypotheses \r
+ > </B></span><img src="../image8.gif" width="23px" height="22px" border="0" class="img_whs6"> <span style="font-weight: bold;"><B>Create Algorithms</B></span></p>\r
+\r
+<p>The following menu will appear:</p>\r
+\r
+<p> </p>\r
+\r
+<p><img src="../image20.jpg" width="464px" height="324px" border="0" class="img_whs7"></p>\r
+\r
+<p> </p>\r
+\r
+<p>Select one of the menu items and click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
+\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.writeIntopicBar)\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Arithmetic 1D</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=690>\r
+<meta name=layout-width content=402>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 40px;}\r
+img_whs3 {border-style: none; border: none; width: 319px; height: 222px;}\r
+p.whs4 {margin-left: 0px;}\r
+ul.whs5 {list-style: disc;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs4 {margin-left:1; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nArithmetic 1D hypothesis");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Arithmetic 1D hypothesis</h1>\r
+\r
+<p><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> <span style="font-weight: bold;"><B>Arithmetic 1D</B></span> \r
+ - hypothesis for the Regular 1D algorithm. It allows to split edges into \r
+ segments with a length that changes in arithmetic progression (Lk = Lk-1 \r
+ + d) beginning from a given starting length and up to a given end length.</p>\r
+\r
+<p> </p>\r
+\r
+<p>Similar to Start and End Length.</p>\r
+\r
+<p> </p>\r
+\r
+<p class=TODO>To define the Arithmetic 1D hypothesis:</p>\r
+\r
+<p class=TODO> </p>\r
+\r
+<p class="whs2">From the <span style="font-weight: bold;"><B>Create \r
+ Hypotheses </B></span>menu select <span style="font-weight: bold;"><B>Arithmetic \r
+ 1D </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>. The \r
+ following dialog box will appear:</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"><img src="../image16.jpg" width="319px" height="222px" border="0" class="img_whs3"></p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<p class="whs4">In this dialog box you can set:</p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<ul type="disc" class="whs5">\r
+ \r
+ <li class=kadov-p><p class="whs4"><span style="font-weight: bold;"><B>Name \r
+ </B></span>of your Arithmetic 1D hypothesis;</p></li>\r
+ \r
+ <li class=kadov-p><p><span style="font-weight: bold;"><B>Start</B></span> \r
+ and <span style="font-weight: bold;"><B>End length</B></span> values</p></li>\r
+</ul>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Deflection 1D</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=663>\r
+<meta name=layout-width content=402>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 40px;}\r
+img_whs3 {border-style: none; border: none; width: 318px; height: 195px;}\r
+p.whs4 {margin-left: 0px;}\r
+ul.whs5 {list-style: disc;}\r
+p.whs6 {font-weight: bold;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs4 {margin-left:1; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nDeflection 1D hypothesis");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Deflection 1D hypothesis</h1>\r
+\r
+<p><span style="font-weight: bold;"><B><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> Deflection 1D</B></span> \r
+ hypothesis is used to build 1D mesh on geometrical edges.</p>\r
+\r
+<p>A geometrical edge is divided into equal segments so that the maximum \r
+ distance between the edge curve and the line connecting segment ends is \r
+ not more than the specified deflection value. Then mesh nodes are constructed \r
+ at segment ends location and 1D mesh elements are constructed on them.</p>\r
+\r
+<p> </p>\r
+\r
+<p class=TODO>To define the Deflection 1D hypothesis:</p>\r
+\r
+<p class=TODO> </p>\r
+\r
+<p class="whs2">From the <span style="font-weight: bold;"><B>Create \r
+ Hypotheses </B></span>menu select <span style="font-weight: bold;"><B>Deflection \r
+ 1D </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>. The \r
+ following dialog box will appear:</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"><img src="../image17.jpg" width="318px" height="195px" border="0" class="img_whs3"></p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<p class="whs4">In this dialog box you can set:</p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<ul type="disc" class="whs5">\r
+ \r
+ <li class=kadov-p><p class="whs4"><span style="font-weight: bold;"><B>Name \r
+ </B></span>of your Deflection 1D hypothesis;</p></li>\r
+ \r
+ <li class=kadov-p><p class="whs6">Deflection <span style="font-weight: normal;">value</span></p></li>\r
+</ul>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Length from edges</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=287>\r
+<meta name=layout-width content=557>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 40px;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nLength from edges hypothesis");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Length from edges (2D hypothesis for Triangulator) hypothesis</h1>\r
+\r
+<p><span style="font-weight: bold;"><B><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> Length from edges</B></span> \r
+ hypothesis builds 1D mesh segments having a length calculated as an average \r
+ edge length for a given wire. </p>\r
+\r
+<p> </p>\r
+\r
+<p>This hypothesis has no parameters.</p>\r
+\r
+<p> </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=896>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=963>\r
+<meta name=layout-width content=429>\r
\r
\r
<!--(Links)=========================================================-->\r
p.whs2 {font-weight: bold; margin-left: 40px;}\r
img_whs3 {border-style: none; border: none; width: 367px; height: 224px;}\r
p.whs4 {margin-left: 40px;}\r
-img_whs5 {border-style: none; border: none; width: 26px; height: 24px;}\r
-p.whs6 {margin-left: 80px;}\r
-img_whs7 {border-style: none; border: none; width: 304px; height: 233px;}\r
-p.whs8 {margin-left: 0px;}\r
-ul.whs9 {list-style: disc;}\r
+p.whs5 {margin-left: 80px;}\r
+img_whs6 {border-style: none; border: none; width: 304px; height: 233px;}\r
+p.whs7 {margin-left: 0px;}\r
+ul.whs8 {list-style: disc;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript">\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
{\r
var strNSS = "<style type='text/css'>";\r
- strNSS += "p.whs8 {margin-left:1; }";\r
+ strNSS += "p.whs7 {margin-left:1; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
{\r
if (window.addTocInfo)\r
{\r
- addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nLocal Length hypothesis");\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nAverage Length hypothesis");\r
addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
\r
}\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
document.location.reload();\r
//-->\r
</script>\r
-<h1>Local Length hypothesis</h1>\r
+<h1>Average Length hypothesis</h1>\r
\r
-<p><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> <span style="font-weight: bold;"><B>Local Length </B></span>hypothesis \r
+<p><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> <span style="font-weight: bold;"><B>Average Length </B></span>hypothesis \r
can be applied for meshing of edges composing your geometrical object. \r
Definition of this hypothesis consists of setting the <span style="font-weight: bold;"><B>length</B></span> \r
of segments, which will split these edges. The points on the edges generated \r
\r
<p class="whs2"> </p>\r
\r
-<p class=TODO>To define the Local Length hypothesis:</p>\r
+<p class=TODO>To define the Average Length hypothesis:</p>\r
\r
<p class=TODO> </p>\r
\r
-<p class="whs4">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Average Length </B></span>or \r
- <img src="../image42.gif" width="26px" height="24px" border="0" class="img_whs5"> click button. The following dialog box will appear:</p>\r
+<p class="whs4">From the <span style="font-weight: bold;"><B>Create \r
+ Hypotheses </B></span>menu select <span style="font-weight: bold;"><B>Average \r
+ Length </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>. \r
+ The following dialog box will appear:</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs6"><img src="../image43.gif" width="304px" height="233px" border="0" class="img_whs7"></p>\r
+<p class="whs5"><img src="../image43.gif" width="304px" height="233px" border="0" class="img_whs6"></p>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs8">In this dialog box you can set:</p>\r
+<p class="whs7">In this dialog box you can set:</p>\r
\r
-<p class="whs8"> </p>\r
+<p class="whs7"> </p>\r
\r
-<ul type="disc" class="whs9">\r
+<ul type="disc" class="whs8">\r
\r
- <li class=kadov-p><p class="whs8"><span style="font-weight: bold;"><B>Name \r
- </B></span>of your Local Length hypothesis</p></li>\r
+ <li class=kadov-p><p class="whs7"><span style="font-weight: bold;"><B>Name \r
+ </B></span>of your Average Length hypothesis</p></li>\r
\r
- <li class=kadov-p><p class="whs8"><span style="font-weight: bold;"><B>Length \r
+ <li class=kadov-p><p class="whs7"><span style="font-weight: bold;"><B>Length \r
</B></span>of segments which will split the edges of your geometrical object</p></li>\r
</ul>\r
\r
-<p class="whs8"> </p>\r
+<p class="whs7"> </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=634>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=644>\r
+<meta name=layout-width content=557>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 25px; height: 24px;}\r
-p.whs4 {margin-left: 80px;}\r
-img_whs5 {border-style: none; border: none; width: 304px; height: 233px;}\r
-p.whs6 {margin-left: 0px;}\r
-ul.whs7 {list-style: disc;}\r
+p.whs3 {margin-left: 80px;}\r
+img_whs4 {border-style: none; border: none; width: 304px; height: 233px;}\r
+p.whs5 {margin-left: 0px;}\r
+ul.whs6 {list-style: disc;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript">\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
{\r
var strNSS = "<style type='text/css'>";\r
- strNSS += "p.whs6 {margin-left:1; }";\r
+ strNSS += "p.whs5 {margin-left:1; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Max Element Area </B></span>or \r
- <img src="../image47.gif" width="25px" height="24px" border="0" class="img_whs3"> click button. The following dialog box will appear:</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Max Element Area </B></span>and<span \r
+ style="font-weight: bold;"> <B></B></span>click <span style="font-weight: bold;"><B>Create</B></span>. \r
+ The following dialog box will appear:</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs4"><img src="../image48.gif" width="304px" height="233px" border="0" class="img_whs5"></p>\r
+<p class="whs3"><img src="../image48.gif" width="304px" height="233px" border="0" class="img_whs4"></p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs6">In this dialog box you can set:</p>\r
+<p class="whs5">In this dialog box you can set:</p>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs5"> </p>\r
\r
-<ul type="disc" class="whs7">\r
+<ul type="disc" class="whs6">\r
\r
- <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Name \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Name \r
</B></span>of your Max Element Area hypothesis</p></li>\r
\r
- <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Max. \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Max. \r
Area</B></span>:<span style="font-weight: bold;"> <B></B></span>the maximum area<span \r
style="font-weight: bold;"> <B></B></span>of meshing elements</p></li>\r
</ul>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs5"> </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=653>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=663>\r
+<meta name=layout-width content=557>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 25px; height: 24px;}\r
-p.whs4 {margin-left: 80px;}\r
-img_whs5 {border-style: none; border: none; width: 304px; height: 233px;}\r
-p.whs6 {margin-left: 0px;}\r
-ul.whs7 {list-style: disc;}\r
+p.whs3 {margin-left: 80px;}\r
+img_whs4 {border-style: none; border: none; width: 304px; height: 233px;}\r
+p.whs5 {margin-left: 0px;}\r
+ul.whs6 {list-style: disc;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript">\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
{\r
var strNSS = "<style type='text/css'>";\r
- strNSS += "p.whs6 {margin-left:1; }";\r
+ strNSS += "p.whs5 {margin-left:1; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
</B></span>menu select <span style="font-weight: bold;"><B>Max Element Volume \r
- </B></span>or <img src="../image50.gif" width="25px" height="24px" border="0" class="img_whs3"> click button. The following dialog box will appear:</p>\r
+ </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>. The following \r
+ dialog box will appear:</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs4"><img src="../image49.gif" width="304px" height="233px" border="0" class="img_whs5"></p>\r
+<p class="whs3"><img src="../image49.gif" width="304px" height="233px" border="0" class="img_whs4"></p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs6">In this dialog box you can set:</p>\r
+<p class="whs5">In this dialog box you can set:</p>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs5"> </p>\r
\r
-<ul type="disc" class="whs7">\r
+<ul type="disc" class="whs6">\r
\r
- <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Name \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Name \r
</B></span>of your Max Element Volume hypothesis</p></li>\r
\r
- <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Max. \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Max. \r
Volume</B></span>:<span style="font-weight: bold;"> <B></B></span>the maximum volume \r
of 3D meshing elements</p></li>\r
</ul>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs5"> </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Non conform mesh allowed hypothesis</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=246>\r
+<meta name=layout-width content=560>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nNon conform mesh allowed hypothesis");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Non conform mesh allowed hypothesis</h1>\r
+\r
+<p><span style="font-weight: bold;"><B><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> Non Conform mesh allowed</B></span> \r
+ hypothesis allows to generate non-conform meshes (that is, meshes having \r
+ some edges ending on an edge or face of adjacent elements). </p>\r
+\r
+<p> </p>\r
+\r
+<p>This hypothesis has no parameters.</p>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=905>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=934>\r
+<meta name=layout-width content=557>\r
\r
\r
<!--(Links)=========================================================-->\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
img_whs3 {border-style: none; border: none; width: 431px; height: 233px;}\r
-img_whs4 {border-style: none; border: none; width: 25px; height: 24px;}\r
-p.whs5 {margin-left: 80px;}\r
-img_whs6 {border-style: none; border: none; width: 304px; height: 233px;}\r
-p.whs7 {margin-left: 0px;}\r
-ul.whs8 {list-style: disc;}\r
+p.whs4 {margin-left: 80px;}\r
+img_whs5 {border-style: none; border: none; width: 304px; height: 233px;}\r
+p.whs6 {margin-left: 0px;}\r
+ul.whs7 {list-style: disc;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript">\r
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
{\r
var strNSS = "<style type='text/css'>";\r
- strNSS += "p.whs7 {margin-left:1; }";\r
+ strNSS += "p.whs6 {margin-left:1; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Nb. Segments </B></span>or \r
- <img src="../image45.gif" width="25px" height="24px" border="0" class="img_whs4"> click button. The following dialog box will appear:</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Nb. Segments </B></span>and \r
+ click <span style="font-weight: bold;"><B>Create</B></span>. The following dialog \r
+ box will appear:</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs5"><img src="../image44.gif" width="304px" height="233px" border="0" class="img_whs6"></p>\r
+<p class="whs4"><img src="../image44.gif" width="304px" height="233px" border="0" class="img_whs5"></p>\r
\r
-<p class="whs5"> </p>\r
+<p class="whs4"> </p>\r
\r
-<p class="whs7">In this dialog box you can set:</p>\r
+<p class="whs6">In this dialog box you can set:</p>\r
\r
-<p class="whs7"> </p>\r
+<p class="whs6"> </p>\r
\r
-<ul type="disc" class="whs8">\r
+<ul type="disc" class="whs7">\r
\r
- <li class=kadov-p><p class="whs7"><span style="font-weight: bold;"><B>Name \r
+ <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Name \r
</B></span>of your Local Length hypothesis</p></li>\r
\r
- <li class=kadov-p><p class="whs7"><span style="font-weight: bold;"><B>Segments</B></span>:<span \r
+ <li class=kadov-p><p class="whs6"><span style="font-weight: bold;"><B>Segments</B></span>:<span \r
style="font-weight: bold;"> <B></B></span>the number<span style="font-weight: bold;"> \r
<B></B></span>of segments which will split the edges of your geometrical object</p></li>\r
</ul>\r
\r
-<p class="whs7"> </p>\r
+<p class="whs6"> </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Propagation of 1D Hypothesis on opposite edges</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=547>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 0px;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs2 {margin-left:1; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nPropagation of 1D Hypothesis on opposite edges");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Propagation of 1D Hypothesis on opposite edges</h1>\r
+\r
+<p><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> <span style="font-weight: bold;"><B>Propagation of 1D Hypothesis \r
+ on opposite edges </B></span>allows to propagate a set hypothesis onto an \r
+ opposite edge. If a local hypothesis and propagation are set on one of \r
+ edges of a quadrangular face, the opposite edge will have the same hypothesis, \r
+ unless another hypothesis has been locally set on such opposite edge.</p>\r
+\r
+<p> </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Start and End Length hypothesis</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=633>\r
+<meta name=layout-width content=557>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='../default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='../default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 40px;}\r
+p.whs3 {margin-left: 80px;}\r
+img_whs4 {border-style: none; border: none; width: 319px; height: 222px;}\r
+p.whs5 {margin-left: 0px;}\r
+ul.whs6 {list-style: disc;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs5 {margin-left:1; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="../whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining hypotheses\nStart and End Length hypothesis");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("../smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Start and End Length hypothesis</h1>\r
+\r
+<p><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> <span style="font-weight: bold;"><B>Start and End Length</B></span> \r
+ hypothesis is used to build 1D mesh on geometrical edges.</p>\r
+\r
+<p>A geometrical edge is divided into segments so that the first and the \r
+ last segments have a specified length. Length of each but the first segment \r
+ differs from length of the previous one by a constant factor. Then mesh \r
+ nodes are constructed at segment ends location and 1D mesh elements are \r
+ constructed on them.</p>\r
+\r
+<p> </p>\r
+\r
+<p class=TODO>To define the Average Length hypothesis:</p>\r
+\r
+<p class=TODO> </p>\r
+\r
+<p class="whs2">From the <span style="font-weight: bold;"><B>Create \r
+ Hypotheses </B></span>menu select <span style="font-weight: bold;"><B>Start and \r
+ End Length </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>. \r
+ The following dialog box will appear:</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs3"><img src="../image18.jpg" width="319px" height="222px" border="0" class="img_whs4"></p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs5">In this dialog box you can set:</p>\r
+\r
+<p class="whs5"> </p>\r
+\r
+<ul type="disc" class="whs6">\r
+ \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Name \r
+ </B></span>of your Start and End Length hypothesis</p></li>\r
+ \r
+ <li class=kadov-p><p class="whs5"><span style="font-weight: bold;"><B>Start \r
+ and End Length </B></span>of segments</p></li>\r
+</ul>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<meta name=filetype content=kadov>\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
-<meta name=layout-height content=380>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-height content=755>\r
+<meta name=layout-width content=473>\r
\r
\r
<!--(Links)=========================================================-->\r
<!--\r
img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
p.whs2 {margin-left: 40px;}\r
-img_whs3 {border-style: none; border: none; width: 26px; height: 24px;}\r
+img_whs3 {border-style: none; border: none; width: 23px; height: 23px;}\r
+p.whs4 {margin-left: 0px;}\r
+p.whs5 {margin-left: 0px; font-weight: bold;}\r
+img_whs6 {border-style: none; border: none; width: 386px; height: 414px;}\r
-->\r
</style>\r
+<script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs4 {margin-left:1; }";\r
+ strNSS += "p.whs5 {margin-left:1; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
<!--\r
function reDo() {\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<p class=TODO> </p>\r
\r
<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
- </B></span>menu select <span style="font-weight: bold;"><B>Tetrahedron (Netgen) \r
- </B></span>or click <img src="../image52.gif" width="26px" height="24px" border="0" class="img_whs3"> button in the toolbar.</p>\r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms \r
+ ></B></span> <img src="../image12.gif" width="23px" height="23px" border="0" class="img_whs3"><span style="font-weight: bold;"><B>Tetrahedron \r
+ (Netgen) </B></span>and click <span style="font-weight: bold;"><B>Create</B></span>..</p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<p class="whs5">Example:</p>\r
+\r
+<p class="whs2"><img src="../image9.gif" width="386px" height="414px" border="0" class="img_whs6"></p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
<meta name=filetype-version content=1>\r
<meta name=page-count content=1>\r
<meta name=layout-height content=588>\r
-<meta name=layout-width content=700>\r
+<meta name=layout-width content=547>\r
\r
\r
<!--(Links)=========================================================-->\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
img_whs1 {border-style: none; border: none; float: none; width: 30px; height: 30px;}\r
ul.whs2 {list-style: disc;}\r
p.whs3 {font-weight: bold;}\r
+p.whs4 {margin-left: 40px;}\r
-->\r
</style>\r
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
//--></script></p></li>\r
</ul>\r
\r
+<p class="whs3"> </p>\r
+\r
+<p class=TODO>To set the visualization mode for displaying of your mesh:</p>\r
+\r
+<p class=TODO> </p>\r
+\r
+<p class="whs4">1. Select your mesh in the <span style="font-weight: bold;"><B>Object \r
+ Browser</B></span>.</p>\r
+\r
+<p class="whs4"> </p>\r
+\r
+<p class="whs4">2. Right-click on the mesh in the viewer \r
+ and from the pop-up menu select <span style="font-weight: bold;"><B>Properties \r
+ > Display mode</B></span></p>\r
+\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.writeIntopicBar)\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
\r
if (window.setRelStartPage)\r
{\r
- setRelStartPage("../smesh.html");\r
+ setRelStartPage("../smesh.htm");\r
\r
autoSync(0);\r
sendSyncInfo();\r
--- /dev/null
+\r
+<html>\r
+<head><script language="javascript">\r
+<!--\r
+var sIcon="whstart.ico";\r
+var sPath=document.location.href;\r
+if (sPath.indexOf("http")!= -1)\r
+ document.write("<link REL=\"SHORTCUT ICON\" href=\""+ sIcon +"\">");\r
+//-->\r
+</script>\r
+ <title>SMESH reference manual</title>\r
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">\r
+ <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">\r
+ <meta name "description" content="WebHelp 2002">\r
+</head>\r
+<script type="text/javascript" language="javascript" src="whver.js"></script>\r
+<script type="text/javascript" language="javascript" src="whutils.js"></script>\r
+<script type="text/javascript" language="javascript" src="whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" >\r
+<!--\r
+if (!window.gbWhVer||!window.gbWhUtil||!window.gbWhMsg)\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+\r
+<script type="text/javascript" language="javascript" src="whstub.js"></script>\r
+<script language="javascript">\r
+<!--\r
+var nWebhelpNavPaneMode = 1; //1: DHTML 2:Applet 3:PureHTML 4:NoframeAt all\r
+var strPaneDHTML = "whskin_pdhtml.htm"; //whd_nvp10.htm if tab enabled, whnframe.htm if tab disabled.\r
+var strPaneApplet = "whskin_papplet.htm";\r
+var strPaneList = "whskin_plist.htm";\r
+var bNoApplet = false;\r
+\r
+var strPane = "";\r
+\r
+var nViewFrameType = nWebhelpNavPaneMode;\r
+\r
+if (!window.gAgent)\r
+{\r
+ // low end browser, we don't even try to determine it.\r
+ document.location = "whnjs.htm";\r
+}\r
+else\r
+{\r
+ if (!gbNav4 && !gbIE4) \r
+ document.location = "whnjs.htm";\r
+ if (gbNav4 && !gbNav6 && ((gnVerMinor <= 4.06)))\r
+ document.location = "whnjs.htm";\r
+ if (gbMac && gbIE4 && !gbIE5) \r
+ document.location = "whnjs.htm";\r
+ //figure out which mode is the best\r
+ if ((nWebhelpNavPaneMode == 1) ||\r
+ (nWebhelpNavPaneMode == 2))\r
+ {\r
+ var gbDHTML = (nWebhelpNavPaneMode == 1);\r
+ if (nWebhelpNavPaneMode == 2) nViewFrameType = 2;\r
+ if (gbNav4) nViewFrameType = 2;\r
+ if (gbNav4 && (gnVerMinor < 4.1)) nViewFrameType = 3;\r
+ if (gbNav4 && (gnVerMinor == 4.6)) nViewFrameType = 3;\r
+ if (gbIE4 && gbDHTML) nViewFrameType = 1;\r
+ if (gbIE4 && gbSunOS && nWebhelpNavPaneMode == 2) nViewFrameType = 3;\r
+ if (gbNav6 && gbDHTML) nViewFrameType = 1;\r
+ if (gbNav6 && !gbNav61 && nWebhelpNavPaneMode == 2) nViewFrameType = 3;\r
+ if (gbMac) nViewFrameType = 3;\r
+ if ((bNoApplet) && (nViewFrameType == 2)) nViewFrameType = 3;\r
+ if (gbOpera) nViewFrameType = 3;\r
+ }\r
+}\r
+\r
+var gbWindows = ((gAgent.indexOf("win") != -1) || (gAgent.indexOf("16bit") != -1));\r
+//The colordepth of the 16 color on Windows is 1. \r
+if ((gbWindows) && (gbNav4) && (window.screen) && (window.screen.colorDepth <= 4))\r
+{\r
+ alert("WebHelp has detected that your display is set to 16 colors. For full WebHelp support, please set your display to use 256 or more colors.");\r
+ nViewFrameType = 3;\r
+}\r
+\r
+//figure out which one is navpane\r
+// ReplaceMark:nViewFrameType = 1\r
+if (nViewFrameType == 1)\r
+{\r
+ if (gbNav4 && !gbNav6)\r
+ strPane = strPaneList;\r
+ else\r
+ strPane = strPaneDHTML;\r
+}\r
+else if (nViewFrameType == 2)\r
+ strPane = strPaneApplet;\r
+else\r
+ strPane = strPaneList;\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="javascript" src="whstart.js"></script>\r
+<script type="text/javascript" language="javascript">\r
+<!--\r
+if (!gbIE4 && !gbNav4)\r
+ document.location = "whnjs.htm";\r
+\r
+function CMRAgent( strID, strURL, strLabel, strFrameAttr )\r
+{\r
+ this.m_strID = strID;\r
+ this.m_strURL = strURL;\r
+ this.m_strLabel = strLabel;\r
+ this.m_strFrameAttr = strFrameAttr;\r
+}\r
+\r
+function CMRServer()\r
+{\r
+ this.m_strVersion;\r
+ this.m_strDefAgent;\r
+ this.m_strAgentList;\r
+ this.m_bTrial;\r
+ this.m_bExpired;\r
+ this.m_bSinglePane;\r
+ this.m_strProduct;\r
+ this.m_strWindow;\r
+ this.m_strProject;\r
+ this.m_strContextID;\r
+ this.m_strCaption; \r
+ this.m_strURLSkinFile;\r
+ this.m_strURLResource;\r
+ this.m_strURLLogoImg;\r
+ this.m_strURLTopic;\r
+ this.m_strURLBase;\r
+ this.m_bShowSync;\r
+ this.m_bShowBrowseSequences;\r
+ this.m_bShowSearchInput;\r
+ this.m_cAgents = new Array;\r
+}\r
+var cMRServer = new CMRServer;\r
+// GetServerInfo\r
+// Registry the agent array handled by webhelp\r
+// ReplaceMark:MRServer.strServerData\r
+//-->\r
+</script>\r
+\r
+<script type="text/javascript" language="javascript">\r
+<!--\r
+var strHTML = "<frameset rows=\"32,*\" hostof=\"parent:toolbar!startpage:yes\" frameborder=\"no\" border=\"0\"><frame src=\"whskin_tbars.htm\" id=\"toolbar\" frameborder=\"no\" border=\"0\" scrolling=\"no\" noresize marginheight=\"0\" marginwidth=\"0\" title=\"Toolbar\"></frame><frame src=\"whskin_frmset01.htm\" frameborder=\"yes\" border=\"1\" scrolling=\"auto\" marginheight=\"0\" marginwidth=\"0\"></frame></frameset>";\r
+document.write(strHTML);\r
+//-->\r
+</script>\r
+\r
+<frameset cols="100%,*" frameborder=no border=0>\r
+ <frame src="whnjs.htm">\r
+ <frame src="whskin_blank.htm" noresize>\r
+</frameset>\r
+\r
+</html>
\ No newline at end of file
--- /dev/null
+<html>\r
+<head>\r
+<title>SMESH reference manual</title>\r
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">\r
+<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">\r
+<meta name "description" content="WebHelp 2002">\r
+<script language="javascript" src="whutils.js"></script>\r
+<script language="javascript">\r
+<!--\r
+var gCSHFileName = "whc_data.htm";\r
+var gCSHSuffixName1 = "_csh.html";\r
+var gCSHSuffixName2 = "_csh.htm";\r
+//-->\r
+</script>\r
+<script language="javascript">\r
+<!--\r
+gCSHFileName="cshdat_webhelp.htm";\r
+//-->\r
+</script>\r
+<script language="javascript">\r
+<!--\r
+var gasProj = new Array();\r
+gasProj[0] = _getPath(document.location.href);\r
+var gCurrent = 0;\r
+\r
+function addProject(strProj)\r
+{\r
+ var len = gasProj.length;\r
+ var strPPath = _getFullPath(_getPath(document.location.href), strProj);\r
+ var bFound = false;\r
+ for (var i = 0; i < len; i ++)\r
+ {\r
+ if (isSamePath(gasProj[i], strPPath))\r
+ {\r
+ bFound = true;\r
+ break;\r
+ }\r
+ }\r
+ if (!bFound)\r
+ gasProj[len] = strPPath; \r
+}\r
+\r
+function isSamePath(strPath1, strPath2)\r
+{\r
+ return strPath1.toLowerCase() == strPath2.toLowerCase();\r
+}\r
+\r
+function goNext()\r
+{\r
+ gCurrent ++;\r
+ var len = gasProj.length;\r
+ if (gCurrent >= len)\r
+ return getHomePage()\r
+ else\r
+ frames["csh"].location = gasProj[gCurrent] + gCSHFileName;\r
+ return "";\r
+}\r
+\r
+function getRelHomePage(strLocation)\r
+{\r
+ var strCurPPath = _getPath(strLocation);\r
+ var strOriPPath = _getPath(getHomePage());\r
+ var strRelPath = _getRelativeFileName(strOriPPath, strCurPPath);\r
+ var strURL = getHomePage() + "#" + strRelPath;\r
+ return strURL;\r
+}\r
+\r
+function getHomePage()\r
+{\r
+ var strHomePage;\r
+ var strTmp = location.toString();\r
+ var nPos = strTmp.indexOf("#");\r
+ if (nPos != -1)\r
+ {\r
+ strHomePage = strTmp.substring(0, nPos);\r
+ }\r
+ else\r
+ {\r
+ strHomePage = strTmp;\r
+ }\r
+ var nPos1 = strHomePage.indexOf(gCSHSuffixName1);\r
+ var nPos = strHomePage.indexOf(gCSHSuffixName2);\r
+ if (nPos != -1)\r
+ {\r
+ strHomePage = strHomePage.substring(0,nPos);\r
+ if (nPos1 != -1)\r
+ strHomePage += ".html";\r
+ else\r
+ strHomePage += ".htm";\r
+ }\r
+ return strHomePage;\r
+}\r
+//-->\r
+</script>\r
+</head>\r
+<frameset rows="1,*">\r
+<frame name="dumb" src="about:blank"></frame>\r
+<frame name="csh" src="cshdat_webhelp.htm"></frame> \r
+</frameset>\r
+</html>
\ No newline at end of file
--- /dev/null
+<html>\r
+<head>\r
+<title>SMESH reference manual</title>\r
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">\r
+<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">\r
+<meta name "description" content="WebHelp 2002">\r
+<script language="javascript" src="whutils.js"></script>\r
+<script language="javascript">\r
+<!--\r
+var gCSHFileName = "whc_data.htm";\r
+var gCSHSuffixName1 = "_rhc.html";\r
+var gCSHSuffixName2 = "_rhc.htm";\r
+//-->\r
+</script>\r
+<script language="javascript">\r
+<!--\r
+gCSHFileName="cshdat_robohelp.htm";\r
+//-->\r
+</script>\r
+<script language="javascript">\r
+<!--\r
+var gasProj = new Array();\r
+gasProj[0] = _getPath(document.location.href);\r
+var gCurrent = 0;\r
+\r
+function addProject(strProj)\r
+{\r
+ var len = gasProj.length;\r
+ var strPPath = _getFullPath(_getPath(document.location.href), strProj);\r
+ var bFound = false;\r
+ for (var i = 0; i < len; i ++)\r
+ {\r
+ if (isSamePath(gasProj[i], strPPath))\r
+ {\r
+ bFound = true;\r
+ break;\r
+ }\r
+ }\r
+ if (!bFound)\r
+ gasProj[len] = strPPath; \r
+}\r
+\r
+function isSamePath(strPath1, strPath2)\r
+{\r
+ return strPath1.toLowerCase() == strPath2.toLowerCase();\r
+}\r
+\r
+function goNext()\r
+{\r
+ gCurrent ++;\r
+ var len = gasProj.length;\r
+ if (gCurrent >= len)\r
+ return getHomePage()\r
+ else\r
+ frames["csh"].location = gasProj[gCurrent] + gCSHFileName;\r
+ return "";\r
+}\r
+\r
+function getRelHomePage(strLocation)\r
+{\r
+ var strCurPPath = _getPath(strLocation);\r
+ var strOriPPath = _getPath(getHomePage());\r
+ var strRelPath = _getRelativeFileName(strOriPPath, strCurPPath);\r
+ var strURL = getHomePage() + "#" + strRelPath;\r
+ return strURL;\r
+}\r
+\r
+function getHomePage()\r
+{\r
+ var strHomePage;\r
+ var strTmp = location.toString();\r
+ var nPos = strTmp.indexOf("#");\r
+ if (nPos != -1)\r
+ {\r
+ strHomePage = strTmp.substring(0, nPos);\r
+ }\r
+ else\r
+ {\r
+ strHomePage = strTmp;\r
+ }\r
+ var nPos1 = strHomePage.indexOf(gCSHSuffixName1);\r
+ var nPos = strHomePage.indexOf(gCSHSuffixName2);\r
+ if (nPos != -1)\r
+ {\r
+ strHomePage = strHomePage.substring(0,nPos);\r
+ if (nPos1 != -1)\r
+ strHomePage += ".html";\r
+ else\r
+ strHomePage += ".htm";\r
+ }\r
+ return strHomePage;\r
+}\r
+//-->\r
+</script>\r
+</head>\r
+<frameset rows="1,*">\r
+<frame name="dumb" src="about:blank"></frame>\r
+<frame name="csh" src="cshdat_robohelp.htm"></frame> \r
+</frameset>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<!--(==============================================================)-->\r
+<!--(Document created with RoboEditor. )============================-->\r
+<!--(==============================================================)-->\r
+\r
+<head>\r
+\r
+<title>Tetrahedron (GHS3D) meshing algorithm</title>\r
+\r
+<!--(Meta)==========================================================-->\r
+\r
+<meta http-equiv=content-type content="text/html; charset=windows-1252">\r
+<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">\r
+<meta name=generator-major-version content=0.1>\r
+<meta name=generator-minor-version content=1>\r
+<meta name=filetype content=kadov>\r
+<meta name=filetype-version content=1>\r
+<meta name=page-count content=1>\r
+<meta name=layout-height content=397>\r
+<meta name=layout-width content=473>\r
+\r
+\r
+<!--(Links)=========================================================-->\r
+\r
+ <link rel='stylesheet' href='default_ns.css'>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
+<!--\r
+if (navigator.appName !="Netscape")\r
+{ document.write("<link rel='stylesheet' href='default.css'>");}\r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+img_whs1 {border-style: none; border: none; width: 30px; height: 30px; float: none;}\r
+p.whs2 {margin-left: 40px;}\r
+img_whs3 {border-style: none; border: none; width: 23px; height: 23px;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+ div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
+-->\r
+</style>\r
+<script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>\r
+</head>\r
+\r
+<!--(Body)==========================================================-->\r
+\r
+\r
+<body>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.addTocInfo)\r
+ {\r
+ addTocInfo("SMESH module\nCreating meshes\nDefining meshing algorithms\n3D meshing algorithms\nTetrahedron (GHS3D) meshing algorithm");\r
+addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
+\r
+ }\r
+ if (window.writeBtnStyle)\r
+ writeBtnStyle();\r
+\r
+ if (window.writeIntopicBar)\r
+ writeIntopicBar(1);\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("smesh.htm");\r
+\r
+ autoSync(0);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+}\r
+else\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+<h1>Tetrahedron (GHS3D) meshing algorithm</h1>\r
+\r
+<p><img src="i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs1"> This algorithm is used for meshing of 3D entities of \r
+ geometrical objects - <span style="font-weight: bold;"><B>volume objects</B></span>. \r
+ While <a href="files/tetrahedron_(netgen)_meshing_algorithm.htm">NETGEN</a> \r
+ generates 3D elements having a volume less than the one specified by hypothesis, \r
+ GHS3D does not need any hypotheses, all it needs is a surface mesh built \r
+ in advance</p>\r
+\r
+<p> </p>\r
+\r
+<p> </p>\r
+\r
+<p class=TODO>To apply the Tetrahedron GHS3D meshing algorithm:</p>\r
+\r
+<p class=TODO> </p>\r
+\r
+<p class="whs2">From the <span style="font-weight: bold;"><B>Hypotheses \r
+ </B></span>menu select <span style="font-weight: bold;"><B>Create Algorithms</B></span> \r
+ > <img src="image12.gif" width="23px" height="23px" border="0" class="img_whs3"><span style="font-weight: bold;"><B>Tetrahedron (GHS3D) </B></span>and \r
+ click <span style="font-weight: bold;"><B>Create</B></span>.</p>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+\r
+</html>\r
aTE("About quality controls","files/about_quality_controls.htm");\r
aTE("Adding nodes and elements","files/adding_nodes_and_elements.htm");\r
aTE("Area of elements","files/area_of_elements.htm");\r
+aTE("Arithmetic 1D","files/arithmetic_1d.htm");\r
aTE("Aspect Ratio","files/aspect_ratio.htm");\r
aTE("Changing orientation of elements","files/changing_orientation_of_elements.htm");\r
aTE("Computing meshes","files/computing_meshes.htm");\r
aTE("Connectivity","files/connectivity.htm");\r
aTE("Constructing meshes","files/constructing_meshes.htm");\r
aTE("Constructing submeshes","files/constructing_submeshes.htm");\r
+aTE("Deflection 1D","files/deflection_1d.htm");\r
aTE("Diagonal iversion of elements","files/diagonal_iversion_of_elements.htm");\r
aTE("Displacing nodes","files/displacing_nodes.htm");\r
aTE("Displaying elements numbers","files/displaying_elements_numbers.htm");\r
aTE("Editing hypotheses","files/editing_hypotheses.htm");\r
aTE("Importing and exporting meshes","files/importing_and_exporting_meshes.htm");\r
aTE("Introduction to SMESH","files/introduction_to_smesh.htm");\r
+aTE("Length from edges","files/length_from_edges.htm");\r
aTE("Length of edges","files/length_of_edges.htm");\r
aTE("Local Length hypothesis","files/local_length_hypothesis.htm");\r
aTE("Max. Element Area hypothesis","files/max._element_area_hypothesis.htm");\r
aTE("Max. Element volume hypothsis","files/max._element_volume_hypothsis.htm");\r
aTE("Minimum angle","files/minimum_angle.htm");\r
+aTE("Non conform mesh allowed hypothesis","files/non_conform_mesh_allowed_hypothesis.htm");\r
aTE("Number of segments hypothesis","files/number_of_segments_hypothesis.htm");\r
+aTE("Propagation of 1D Hypothesis on opposite edges","files/propagation_of_1d_hypothesis_on_opposite_edges.htm");\r
aTE("Reassigning hypotheses and algorithms","files/reassigning_hypotheses_and_algorithms.htm");\r
aTE("Removing nodes and elements","files/removing_nodes_and_elements.htm");\r
aTE("Running SMESH module","files/running_smesh_module.htm");\r
aTE("Scalar Bar properties","files/scalar_bar_properties.htm");\r
aTE("Skew","files/skew.htm");\r
+aTE("Start and End Length hypothesis","files/start_and_end_length_hypothesis.htm");\r
aTE("Taper","files/taper.htm");\r
aTE("Tetrahedron (Netgen) meshing algorithm","files/tetrahedron_(netgen)_meshing_algorithm.htm");\r
aTE("Using SMESH module","files/using_smesh_module.htm");\r
aTE("Visualization modes","files/visualization_modes.htm");\r
aTE("Visualization properties","files/visualization_properties.htm");\r
aTE("Warp","files/warp.htm");\r
+aTE("Tetrahedron (GHS3D) meshing algorithm","tetrahedron_(ghs3d)_meshing_algorithm.htm");\r
\r
//-->\r
</script>\r
<topic name="About quality controls" url="files/about_quality_controls.htm" />\r
<topic name="Adding nodes and elements" url="files/adding_nodes_and_elements.htm" />\r
<topic name="Area of elements" url="files/area_of_elements.htm" />\r
+<topic name="Arithmetic 1D" url="files/arithmetic_1d.htm" />\r
<topic name="Aspect Ratio" url="files/aspect_ratio.htm" />\r
<topic name="Changing orientation of elements" url="files/changing_orientation_of_elements.htm" />\r
<topic name="Computing meshes" url="files/computing_meshes.htm" />\r
<topic name="Connectivity" url="files/connectivity.htm" />\r
<topic name="Constructing meshes" url="files/constructing_meshes.htm" />\r
<topic name="Constructing submeshes" url="files/constructing_submeshes.htm" />\r
+<topic name="Deflection 1D" url="files/deflection_1d.htm" />\r
<topic name="Diagonal iversion of elements" url="files/diagonal_iversion_of_elements.htm" />\r
<topic name="Displacing nodes" url="files/displacing_nodes.htm" />\r
<topic name="Displaying elements numbers" url="files/displaying_elements_numbers.htm" />\r
<topic name="Editing hypotheses" url="files/editing_hypotheses.htm" />\r
<topic name="Importing and exporting meshes" url="files/importing_and_exporting_meshes.htm" />\r
<topic name="Introduction to SMESH" url="files/introduction_to_smesh.htm" />\r
+<topic name="Length from edges" url="files/length_from_edges.htm" />\r
<topic name="Length of edges" url="files/length_of_edges.htm" />\r
<topic name="Local Length hypothesis" url="files/local_length_hypothesis.htm" />\r
<topic name="Max. Element Area hypothesis" url="files/max._element_area_hypothesis.htm" />\r
<topic name="Max. Element volume hypothsis" url="files/max._element_volume_hypothsis.htm" />\r
<topic name="Minimum angle" url="files/minimum_angle.htm" />\r
+<topic name="Non conform mesh allowed hypothesis" url="files/non_conform_mesh_allowed_hypothesis.htm" />\r
<topic name="Number of segments hypothesis" url="files/number_of_segments_hypothesis.htm" />\r
+<topic name="Propagation of 1D Hypothesis on opposite edges" url="files/propagation_of_1d_hypothesis_on_opposite_edges.htm" />\r
<topic name="Reassigning hypotheses and algorithms" url="files/reassigning_hypotheses_and_algorithms.htm" />\r
<topic name="Removing nodes and elements" url="files/removing_nodes_and_elements.htm" />\r
<topic name="Running SMESH module" url="files/running_smesh_module.htm" />\r
<topic name="Scalar Bar properties" url="files/scalar_bar_properties.htm" />\r
<topic name="Skew" url="files/skew.htm" />\r
+<topic name="Start and End Length hypothesis" url="files/start_and_end_length_hypothesis.htm" />\r
<topic name="Taper" url="files/taper.htm" />\r
<topic name="Tetrahedron (Netgen) meshing algorithm" url="files/tetrahedron_(netgen)_meshing_algorithm.htm" />\r
<topic name="Using SMESH module" url="files/using_smesh_module.htm" />\r
<topic name="Visualization modes" url="files/visualization_modes.htm" />\r
<topic name="Visualization properties" url="files/visualization_properties.htm" />\r
<topic name="Warp" url="files/warp.htm" />\r
+<topic name="Tetrahedron (GHS3D) meshing algorithm" url="tetrahedron_(ghs3d)_meshing_algorithm.htm" />\r
\r
</ftstdata> \r
<!--\r
iWM("0","z","whfwdata0.htm");\r
\r
-iTM(0,42,"whftdata0.htm");\r
+iTM(0,49,"whftdata0.htm");\r
\r
-->\r
</script>\r
<fts>\r
<chunkinfo url="whfwdata0.xml" first="0" last="z"/>\r
\r
-<tchunkinfo first="0" last="42" url="whftdata0.xml" />\r
+<tchunkinfo first="0" last="49" url="whftdata0.xml" />\r
\r
</fts>\r
<!--\r
aWE("0",5);\r
aWE("0d",5);\r
-aWE("1",10,11,13,19,20,22,24,28,34,35,39,42);\r
-aWE("1d",0,5,6,23);\r
-aWE("2",10,11,13,19,20,22,24,28,34,35,39,42);\r
-aWE("2d",1,2,5,6,10,11,23,26,28,42);\r
-aWE("3",5,10,11,22,32,34,42);\r
-aWE("3d",3,5,6,23,27,36);\r
+aWE("1",10,11,12,14,21,22,24,27,31,39,41,45,46,48);\r
+aWE("1d",0,4,5,6,11,18,25,26,34,40);\r
+aWE("2",10,12,14,21,22,24,27,31,39,41,45,46,48);\r
+aWE("2d",1,2,5,6,10,12,25,26,29,31,48);\r
+aWE("3",5,10,12,24,37,39,48);\r
+aWE("3d",3,5,6,25,30,49,42);\r
aWE("3rd",5);\r
-aWE("4",5,10,11,34,35,42);\r
+aWE("4",5,10,12,39,41,48);\r
aWE("5th",5);\r
-aWE("abut",25,29);\r
-aWE("accord",8,10,11,24,28,34,35,42);\r
+aWE("abut",28,33);\r
+aWE("accord",8,10,12,27,31,39,41,48);\r
aWE("account",4);\r
aWE("ad",9);\r
-aWE("addition",23);\r
-aWE("additional",5,32);\r
-aWE("adjacent",28);\r
-aWE("algorithm",0,1,2,3,4,5,6,8,10,15,16,23,26,27,30,36);\r
-aWE("allow",4,22,23);\r
-aWE("angl",8,23,28,34,42);\r
-aWE("any",5);\r
-aWE("ap",0,1,2,3,10,11,23,24,28,34,35,36,42);\r
-aWE("appear",15,16,25,26,27,29,32);\r
-aWE("appli",10,11,24,25,26,27,28,29,34,35,42);\r
+aWE("addition",25);\r
+aWE("additional",5,37);\r
+aWE("adjacent",31,32);\r
+aWE("advanc",49);\r
+aWE("algorithm",0,1,2,3,4,5,6,8,10,11,16,17,25,29,30,35,49,42);\r
+aWE("allow",4,11,24,25,32,34);\r
+aWE("angl",8,25,31,39,48);\r
+aWE("anoth",34);\r
+aWE("any",5,49);\r
+aWE("ap",0,1,2,3,6,10,12,25,27,31,39,41,49,42,48);\r
+aWE("appear",4,6,11,16,17,18,28,29,30,33,37,40);\r
+aWE("appli",10,12,27,28,29,30,31,33,39,41,48);\r
aWE("application",8);\r
-aWE("apply",4,15,16);\r
-aWE("approximate",29);\r
-aWE("arcsin",42);\r
-aWE("area",4,8,10,23,26,27,35);\r
-aWE("aspect",8,11,23);\r
-aWE("assign",42);\r
-aWE("averag",25,42);\r
-aWE("axi",42);\r
-aWE("bar",8,33);\r
-aWE("bas",4,10,23,42);\r
+aWE("apply",4,16,17);\r
+aWE("approximate",33);\r
+aWE("arcsin",48);\r
+aWE("area",4,8,10,25,29,30,41);\r
+aWE("arithmetic",4,11);\r
+aWE("aspect",8,12,25);\r
+aWE("assign",48);\r
+aWE("averag",4,26,28,40,48);\r
+aWE("axi",48);\r
+aWE("bar",8,38);\r
+aWE("bas",4,10,25,48);\r
aWE("basi",5);\r
aWE("basic",4);\r
-aWE("befor",32);\r
-aWE("bisect",42);\r
-aWE("bisector",42);\r
-aWE("border",23);\r
-aWE("bottom",32);\r
+aWE("befor",37);\r
+aWE("begin",11);\r
+aWE("bisect",48);\r
+aWE("bisector",48);\r
+aWE("border",25);\r
+aWE("bottom",37);\r
aWE("bound",5);\r
aWE("boundary",4);\r
-aWE("box",15,16,22,25,26,27,29,32);\r
-aWE("brows",13,39);\r
-aWE("button",0,1,2,3,10,11,13,15,16,22,24,25,26,27,28,29,34,35,36,39,42);\r
+aWE("box",11,16,17,18,24,28,29,30,33,37,40);\r
+aWE("brows",14,45,46);\r
+aWE("build",18,26,40);\r
+aWE("built",49);\r
+aWE("button",10,12,14,16,17,24,27,31,39,41,45,48);\r
aWE("cad",5);\r
-aWE("calculat",8,11,35);\r
-aWE("calculation",4,10,24,28);\r
-aWE("chang",12);\r
+aWE("calculat",8,12,26,41);\r
+aWE("calculation",4,10,27,31);\r
+aWE("chang",11,13);\r
aWE("characteristic",8);\r
aWE("characteriz",5);\r
aWE("choic",4);\r
-aWE("choos",10,11,22,24,28,32,34,35,42);\r
-aWE("chosen",26,27);\r
-aWE("click",0,1,2,3,10,11,13,15,16,22,24,25,26,27,28,29,32,34,35,36,39,42);\r
+aWE("choos",10,12,24,27,31,37,39,41,48);\r
+aWE("chosen",29,30);\r
+aWE("click",0,1,2,3,4,6,10,11,12,14,16,17,18,24,27,28,29,30,31,33,37,39,40,41,49,42,45,46,48);\r
aWE("clos",5);\r
-aWE("color",8,10,11,24,28,34,35,42);\r
-aWE("combin",24);\r
-aWE("component",23,32);\r
-aWE("compos",4,5,6,8,19,25,26,27,29,34);\r
-aWE("comput",13);\r
-aWE("computation",13,15,16);\r
+aWE("color",8,10,12,27,31,39,41,48);\r
+aWE("combin",27);\r
+aWE("component",25,37);\r
+aWE("compos",4,5,6,8,21,28,29,30,33,39);\r
+aWE("comput",14);\r
+aWE("computation",14,16,17);\r
aWE("condition",4);\r
-aWE("connection",5,23);\r
-aWE("connectivity",14);\r
+aWE("conform",4,32);\r
+aWE("connect",18);\r
+aWE("connection",5,25);\r
+aWE("connectivity",15);\r
aWE("consider",5);\r
-aWE("consist",8,10,11,15,16,24,25,26,27,28,29,35);\r
-aWE("construct",15,16);\r
-aWE("construction",15,16);\r
-aWE("contain",5,6,22);\r
+aWE("consist",8,10,12,16,17,27,28,29,30,31,33,41);\r
+aWE("constant",40);\r
+aWE("construct",16,17,18,40);\r
+aWE("construction",16,17);\r
+aWE("contain",5,6,24);\r
aWE("contour",5);\r
-aWE("control",8,10,11,23,24,28,34,35,42);\r
+aWE("control",8,10,12,25,27,31,39,41,48);\r
aWE("coordinat",5);\r
-aWE("corn",42);\r
-aWE("corner",42);\r
-aWE("correspond",5,8,22);\r
+aWE("corn",48);\r
+aWE("corner",48);\r
+aWE("correspond",5,8,24);\r
aWE("could",5);\r
-aWE("creat",5,23,32,42);\r
-aWE("creation",5,32);\r
-aWE("criteria",23);\r
-aWE("criterion",10,11,24,28,34,35,42);\r
-aWE("cros",42);\r
-aWE("curv",5);\r
+aWE("creat",0,1,2,3,4,5,6,11,18,25,28,29,30,33,37,40,49,42,48);\r
+aWE("creation",5,37);\r
+aWE("criteria",25);\r
+aWE("criterion",10,12,27,31,39,41,48);\r
+aWE("cros",48);\r
+aWE("curv",5,18);\r
+aWE("d",11);\r
aWE("deal",5);\r
-aWE("default",32);\r
-aWE("defin",5,11,25,26,27,29);\r
-aWE("definit",5,8,23,29);\r
-aWE("definition",25,26,27,29);\r
-aWE("deletion",23);\r
-aWE("depend",4,5,26,27);\r
+aWE("default",37);\r
+aWE("defin",5,11,12,18,28,29,30,33,40);\r
+aWE("definit",5,8,25,33);\r
+aWE("definition",28,29,30,33);\r
+aWE("deflection",4,18);\r
+aWE("deletion",25);\r
+aWE("depend",4,5,29,30);\r
aWE("describ",5);\r
-aWE("desktop",32);\r
-aWE("destin",5,8,23);\r
+aWE("desktop",37);\r
+aWE("destin",5,8,25);\r
aWE("detail",4);\r
-aWE("diagonal",17,35);\r
-aWE("dialog",15,16,22,25,26,27,29);\r
+aWE("diagonal",19,41);\r
+aWE("dialog",11,16,17,18,24,28,29,30,33,40);\r
+aWE("differ",40);\r
aWE("different",4);\r
aWE("dimension",5);\r
aWE("direct",5);\r
-aWE("direction",42);\r
+aWE("direction",48);\r
aWE("discretization",0,5,6);\r
-aWE("displac",18);\r
-aWE("display",8,10,11,19,20,24,28,34,35,39,40,42);\r
+aWE("displac",20);\r
+aWE("display",8,10,12,21,22,27,31,39,41,45,46,48);\r
aWE("disposal",8);\r
-aWE("distanc",42);\r
+aWE("distanc",18,48);\r
+aWE("divid",18,40);\r
+aWE("do",49);\r
aWE("don",5);\r
-aWE("edg",0,4,5,6,8,11,23,24,25,29,42);\r
-aWE("edit",21);\r
-aWE("element",4,5,8,9,10,11,12,17,19,23,24,26,27,28,31,34,35,42);\r
-aWE("encapsulat",16);\r
-aWE("ent",22);\r
-aWE("entiti",0,1,2,3,5,6,36);\r
+aWE("edg",0,4,5,6,8,11,12,18,25,26,27,28,32,33,34,40,48);\r
+aWE("edit",23);\r
+aWE("element",4,5,8,9,10,12,13,18,19,21,25,27,29,30,31,32,36,39,40,41,49,48);\r
+aWE("encapsulat",17);\r
+aWE("end",4,11,18,32,40);\r
+aWE("ent",24);\r
+aWE("entiti",0,1,2,3,5,6,49,42);\r
aWE("entity",5);\r
-aWE("equal",11);\r
-aWE("equilateral",11);\r
+aWE("equal",12,18);\r
+aWE("equilateral",12);\r
aWE("etc",8);\r
-aWE("every",42);\r
-aWE("exampl",5);\r
-aWE("export",22,23);\r
-aWE("exportation",22);\r
-aWE("extend",42);\r
-aWE("fac",1,2,4,5,6,23,25,26,29,42);\r
-aWE("fil",22);\r
-aWE("final",13);\r
-aWE("find",22);\r
+aWE("every",48);\r
+aWE("exampl",5,42);\r
+aWE("export",24,25);\r
+aWE("exportation",24);\r
+aWE("extend",48);\r
+aWE("fac",1,2,4,5,6,25,28,29,32,33,34,48);\r
+aWE("factor",40);\r
+aWE("fil",24);\r
+aWE("final",14);\r
+aWE("find",24);\r
+aWE("first",40);\r
aWE("fix",5);\r
-aWE("follow",4,5,6,8,11,15,16,19,20,25,26,27,29,32,39);\r
-aWE("format",22,23);\r
-aWE("four",5,42);\r
-aWE("fre",5,23);\r
+aWE("follow",4,5,6,8,11,12,16,17,18,21,22,28,29,30,33,37,40,45);\r
+aWE("format",24,25);\r
+aWE("four",5,48);\r
+aWE("fre",5,25);\r
aWE("function",5);\r
-aWE("functionality",5,22);\r
-aWE("generat",4,5,8,23,25,29,32);\r
-aWE("generation",13);\r
-aWE("geom",5,23);\r
+aWE("functionality",5,24);\r
+aWE("generat",4,5,8,25,28,32,33,37,49);\r
+aWE("generation",14);\r
+aWE("geom",5,25);\r
aWE("geometric",5,8);\r
-aWE("geometrical",0,1,2,3,4,5,6,15,16,23,25,26,27,29,36);\r
-aWE("global",15);\r
-aWE("group",23);\r
-aWE("h",42);\r
-aWE("h1",11);\r
-aWE("h2",11);\r
-aWE("half",42);\r
-aWE("height",11,42);\r
+aWE("geometrical",0,1,2,3,4,5,6,16,17,18,25,28,29,30,33,40,49,42);\r
+aWE("ghs3d",49);\r
+aWE("given",11,26);\r
+aWE("global",16);\r
+aWE("group",25);\r
+aWE("h",48);\r
+aWE("h1",12);\r
+aWE("h2",12);\r
+aWE("half",48);\r
+aWE("hav",26,32,49);\r
+aWE("height",12,48);\r
aWE("help",8);\r
-aWE("her",5,7,9,12,14,17,18,31,33,41);\r
-aWE("hexahedron",3,5,6,27);\r
+aWE("her",5,7,9,13,15,19,20,36,38,47);\r
+aWE("hexahedron",3,5,6,30);\r
aWE("high",5);\r
-aWE("hyp",15,16);\r
-aWE("hypothes",0,1,2,3,4,15,16,21,23,25,26,27,29,30,36);\r
-aWE("hypothesi",4,25,26,27,29);\r
+aWE("hyp",16,17);\r
+aWE("hypothes",0,1,2,3,4,6,11,16,17,18,23,25,28,29,30,33,35,40,49,42);\r
+aWE("hypothesi",4,11,18,26,28,29,30,32,33,34,40,49);\r
aWE("i",3);\r
-aWE("icon",32);\r
-aWE("id",19,20);\r
-aWE("if",5);\r
+aWE("icon",37);\r
+aWE("id",21,22);\r
+aWE("if",5,34);\r
aWE("imp",5);\r
-aWE("import",22,23);\r
-aWE("importation",22);\r
+aWE("import",24,25);\r
+aWE("importation",24);\r
aWE("includ",5);\r
-aWE("indicat",42);\r
-aWE("info",39);\r
-aWE("information",5,39);\r
-aWE("initial",32);\r
+aWE("indicat",48);\r
+aWE("info",45);\r
+aWE("information",5,45);\r
+aWE("initial",37);\r
aWE("interest",5);\r
-aWE("introduction",23);\r
+aWE("introduction",25);\r
aWE("invers",5);\r
-aWE("inversion",17);\r
-aWE("item",22);\r
+aWE("inversion",19);\r
+aWE("item",4,6,24);\r
aWE("j",3);\r
-aWE("join",34);\r
+aWE("join",39);\r
aWE("k",3);\r
aWE("kind",6);\r
-aWE("l",42);\r
-aWE("largest",11);\r
-aWE("launch",32);\r
-aWE("length",4,8,11,23,24,25,29,42);\r
+aWE("l",48);\r
+aWE("largest",12);\r
+aWE("last",40);\r
+aWE("launch",37);\r
+aWE("length",4,8,11,12,25,26,27,28,33,40,48);\r
+aWE("les",49);\r
aWE("level",4);\r
-aWE("lik",19,20,32);\r
-aWE("lin",5,34);\r
-aWE("local",4,16,23,25,29);\r
-aWE("location",22);\r
-aWE("longest",11);\r
-aWE("look",19,20,32);\r
+aWE("lik",21,22,37);\r
+aWE("lin",5,18,39);\r
+aWE("lk",11);\r
+aWE("local",17,25,33,34);\r
+aWE("location",18,24,40);\r
+aWE("longest",12);\r
+aWE("look",21,22,37);\r
aWE("low",5);\r
-aWE("main",32);\r
+aWE("main",4,6,37);\r
aWE("manag",4);\r
aWE("map",1);\r
-aWE("max",4,23,26,27);\r
-aWE("maximum",26,27,34);\r
+aWE("max",4,25,29,30);\r
+aWE("maximum",18,29,30,39);\r
aWE("mean",5);\r
aWE("meaningful",5);\r
-aWE("measur",42);\r
+aWE("measur",48);\r
aWE("mefisto",2);\r
-aWE("menu",0,1,2,3,13,15,16,19,20,22,25,26,27,29,32,36,39);\r
-aWE("mesh",0,1,2,3,4,5,6,7,8,10,11,13,15,16,19,20,22,23,24,25,26,27,28,29,32,34,35,36,39,40,42);\r
-aWE("minimum",8,23,28);\r
-aWE("mod",40);\r
-aWE("model",5,23);\r
-aWE("modification",5,7,23);\r
-aWE("modul",5,6,23,32);\r
-aWE("mov",23);\r
-aWE("multi",23);\r
-aWE("multipli",11);\r
-aWE("nam",22,25,26,27,29);\r
-aWE("nb",29);\r
-aWE("netgen",36);\r
-aWE("new",32);\r
-aWE("nod",5,9,10,11,18,20,23,25,29,31,34,35,42);\r
-aWE("normal",42);\r
+aWE("menu",0,1,2,3,4,6,11,14,16,17,18,21,22,24,28,29,30,33,37,40,49,42,45,46);\r
+aWE("mesh",0,1,2,3,4,5,6,7,8,10,12,14,16,17,18,21,22,24,25,26,27,28,29,30,31,32,33,37,39,40,41,49,42,45,46,48);\r
+aWE("minimum",8,25,31);\r
+aWE("mod",46);\r
+aWE("model",5,25);\r
+aWE("modification",5,7,25);\r
+aWE("modul",5,6,25,37);\r
+aWE("mov",25);\r
+aWE("multi",25);\r
+aWE("multipli",12);\r
+aWE("nam",11,18,24,28,29,30,33,40);\r
+aWE("nb",33);\r
+aWE("ne",49);\r
+aWE("need",49);\r
+aWE("netgen",49,42);\r
+aWE("new",37);\r
+aWE("nod",5,9,10,12,18,20,22,25,28,33,36,39,40,41,48);\r
+aWE("normal",48);\r
aWE("notic",5);\r
-aWE("numb",4,5,23,29);\r
-aWE("number",19,20);\r
-aWE("object",0,1,2,3,4,6,13,15,16,25,26,27,29,36,39);\r
-aWE("ok",22);\r
-aWE("on",5,15,16);\r
-aWE("operation",23);\r
-aWE("opposit",34);\r
+aWE("numb",4,5,25,33);\r
+aWE("number",21,22);\r
+aWE("object",0,1,2,3,4,6,14,16,17,28,29,30,33,49,42,45,46);\r
+aWE("ok",24);\r
+aWE("on",4,5,6,16,17,34,40,49);\r
+aWE("onto",34);\r
+aWE("operation",25);\r
+aWE("opposit",4,34,39);\r
aWE("option",5);\r
aWE("ord",5);\r
-aWE("orientation",12);\r
-aWE("origin",42);\r
+aWE("orientation",13);\r
+aWE("origin",48);\r
aWE("own",5);\r
aWE("paramet",5);\r
-aWE("parameter",4);\r
+aWE("parameter",4,26,32);\r
aWE("parametric",5);\r
aWE("particularity",5);\r
-aWE("perfect",11);\r
-aWE("perform",23);\r
-aWE("plan",42);\r
-aWE("planar",42);\r
-aWE("platform",32);\r
-aWE("point",5,25,29,42);\r
+aWE("perfect",12);\r
+aWE("perform",25);\r
+aWE("plan",48);\r
+aWE("planar",48);\r
+aWE("platform",37);\r
+aWE("point",5,28,33,48);\r
+aWE("pop",46);\r
aWE("position",5);\r
aWE("possibl",4);\r
aWE("present",5);\r
aWE("presentation",8);\r
aWE("preset",4);\r
-aWE("previous",15,16,23);\r
-aWE("procedur",11);\r
+aWE("previou",40);\r
+aWE("previous",16,17,25);\r
+aWE("procedur",12);\r
aWE("produc",5);\r
-aWE("product",42);\r
-aWE("projection",42);\r
-aWE("properti",33,41);\r
-aWE("quad",42);\r
-aWE("quadrangl",1,5,6,10,11,24,26,28,34);\r
-aWE("quality",8,10,11,23,24,28,34,35,42);\r
+aWE("product",48);\r
+aWE("progression",11);\r
+aWE("projection",48);\r
+aWE("propagat",34);\r
+aWE("propagation",4,34);\r
+aWE("properti",38,46,47);\r
+aWE("quad",48);\r
+aWE("quadrangl",1,5,6,10,12,27,29,31,39);\r
+aWE("quadrangular",34);\r
+aWE("quality",8,10,12,25,27,31,39,41,48);\r
aWE("quantity",4);\r
-aWE("ratio",8,11,23,35,42);\r
-aWE("reassign",30);\r
+aWE("ratio",8,12,25,41,48);\r
+aWE("reassign",35);\r
aWE("referenc",5,8);\r
aWE("refin",4);\r
-aWE("reflect",34);\r
-aWE("relat",32);\r
+aWE("reflect",39);\r
+aWE("regular",11);\r
+aWE("relat",37);\r
aWE("relation",5);\r
aWE("relationship",5);\r
-aWE("remain",11);\r
-aWE("remov",31);\r
-aWE("repeat",11);\r
-aWE("represent",4,5,25,29,35);\r
+aWE("remain",12);\r
+aWE("remov",36);\r
+aWE("repeat",12);\r
+aWE("represent",4,5,28,33,41);\r
aWE("representation",5);\r
aWE("restrict",5);\r
aWE("result",4);\r
-aWE("retain",11);\r
+aWE("retain",12);\r
aWE("retriev",5);\r
+aWE("right",46);\r
aWE("rough",4);\r
-aWE("run",32);\r
-aWE("s",11);\r
-aWE("salom",23,32);\r
-aWE("sam",5,29);\r
-aWE("scalar",8,33);\r
+aWE("run",37);\r
+aWE("s",12);\r
+aWE("salom",25,37);\r
+aWE("sam",5,33,34);\r
+aWE("scalar",8,38);\r
aWE("se",5);\r
-aWE("search",22);\r
-aWE("segment",4,23,25,29);\r
-aWE("select",0,1,2,3,4,13,15,16,19,20,22,25,26,27,29,32,36,39);\r
+aWE("search",24);\r
+aWE("segment",4,11,18,25,26,28,33,40);\r
+aWE("select",0,1,2,3,4,6,11,14,16,17,18,21,22,24,28,29,30,33,37,40,49,42,45,46);\r
aWE("sens",5);\r
-aWE("separat",35);\r
-aWE("set",5,6,23,25,26,27,29,32);\r
-aWE("shad",40);\r
-aWE("shap",4,5,11);\r
-aWE("shortest",11,42);\r
-aWE("should",32);\r
+aWE("separat",41);\r
+aWE("set",5,6,11,18,25,28,29,30,33,34,37,40,46);\r
+aWE("shad",46);\r
+aWE("shap",4,5,12);\r
+aWE("shortest",12,48);\r
+aWE("should",37);\r
aWE("shown",8);\r
-aWE("shrink",40);\r
-aWE("sid",11,28,34);\r
+aWE("shrink",46);\r
+aWE("sid",12,31,39);\r
+aWE("similar",11);\r
aWE("simpl",5);\r
-aWE("skew",8,23,34);\r
-aWE("smesh",4,5,6,8,19,20,22,23,32,37,40);\r
-aWE("so",4,11,35);\r
+aWE("skew",8,25,39);\r
+aWE("smesh",4,5,6,8,21,22,24,25,37,43,46);\r
+aWE("so",4,12,18,40,41);\r
aWE("spac",5);\r
-aWE("split",25,29);\r
-aWE("standard",22,32);\r
-aWE("start",32);\r
-aWE("step",13);\r
-aWE("study",32);\r
-aWE("sub",22);\r
-aWE("submesh",4,16);\r
-aWE("surfac",5);\r
+aWE("specifi",18,40,49);\r
+aWE("split",11,28,33);\r
+aWE("standard",24,37);\r
+aWE("start",4,11,37,40);\r
+aWE("step",14);\r
+aWE("study",37);\r
+aWE("sub",24);\r
+aWE("submesh",4,17);\r
+aWE("surfac",5,49);\r
aWE("surround",5);\r
aWE("t",5);\r
aWE("taken",4);\r
-aWE("tap",8,23,35);\r
-aWE("tetrahedron",5,6,27,36);\r
-aWE("text",7,9,12,14,17,18,31,33,41);\r
-aWE("thre",5,40);\r
-aWE("toolbar",0,1,2,3,11,13,15,16,24,32,34,35,36,39,42);\r
-aWE("topic",7,9,12,14,17,18,31,33,41);\r
+aWE("tap",8,25,41);\r
+aWE("tetrahedron",5,6,30,49,42);\r
+aWE("text",7,9,13,15,19,20,36,38,47);\r
+aWE("them",18,40);\r
+aWE("thre",5,46);\r
+aWE("toolbar",12,14,16,17,27,37,39,41,45,48);\r
+aWE("topic",7,9,13,15,19,20,36,38,47);\r
aWE("topological",5);\r
aWE("topology",5);\r
-aWE("triangl",2,5,6,10,11,24,26,28,34,35);\r
-aWE("two",5,11,28,35);\r
-aWE("typ",5,7,9,12,14,17,18,31,33,41);\r
+aWE("triangl",2,5,6,10,12,27,29,31,39,41);\r
+aWE("triangulator",26);\r
+aWE("two",5,12,31,41);\r
+aWE("typ",5,7,9,13,15,19,20,36,38,47);\r
aWE("u",5);\r
-aWE("unv",22);\r
-aWE("updat",32,38);\r
-aWE("us",0,1,2,3,5,6,15,16,25,29,36,37);\r
+aWE("unles",34);\r
+aWE("unv",24);\r
+aWE("up",11,46);\r
+aWE("updat",37,44);\r
+aWE("us",0,1,2,3,5,6,16,17,18,28,33,40,49,42,43);\r
aWE("usag",8);\r
aWE("v",5);\r
-aWE("valu",8,11,28,34);\r
-aWE("vector",42);\r
+aWE("valu",8,11,12,18,31,39);\r
+aWE("vector",48);\r
aWE("vertex",5);\r
-aWE("view",10,11,19,20,24,28,32,34,35,38,39,40,42);\r
+aWE("view",10,12,21,22,27,31,37,39,41,44,45,46,48);\r
aWE("visual",8);\r
-aWE("visualization",40,41);\r
-aWE("volum",3,4,5,6,23,27,36);\r
-aWE("vtk",32);\r
-aWE("warp",8,23,42);\r
+aWE("visualization",46,47);\r
+aWE("volum",3,4,5,6,25,30,49,42);\r
+aWE("vtk",37);\r
+aWE("warp",8,25,48);\r
aWE("way",5);\r
-aWE("will",4,5,10,11,15,16,19,20,22,24,25,26,27,28,29,32,34,35,39,42);\r
-aWE("window",32);\r
-aWE("wir",0,6);\r
-aWE("wirefram",40);\r
-aWE("word",29);\r
-aWE("work",32);\r
-aWE("x",5,42);\r
+aWE("whil",49);\r
+aWE("will",4,5,6,10,11,12,16,17,18,21,22,24,27,28,29,30,31,33,34,37,39,40,41,45,48);\r
+aWE("window",37);\r
+aWE("wir",0,6,26);\r
+aWE("wirefram",46);\r
+aWE("word",33);\r
+aWE("work",37);\r
+aWE("x",5,48);\r
aWE("y",5);\r
-aWE("your",4,5,8,10,11,13,16,19,20,22,24,25,26,27,28,29,34,35,39,42);\r
+aWE("your",4,5,8,10,11,12,14,17,18,21,22,24,27,28,29,30,31,33,39,40,41,45,46,48);\r
aWE("z",5);\r
\r
//-->\r
<ftswdata>\r
<key name="0"> 5, </key>\r
<key name="0d"> 5, </key>\r
-<key name="1"> 10,11,13,19,20,22,24,28,34,35,39,42, </key>\r
-<key name="1d"> 0,5,6,23, </key>\r
-<key name="2"> 10,11,13,19,20,22,24,28,34,35,39,42, </key>\r
-<key name="2d"> 1,2,5,6,10,11,23,26,28,42, </key>\r
-<key name="3"> 5,10,11,22,32,34,42, </key>\r
-<key name="3d"> 3,5,6,23,27,36, </key>\r
+<key name="1"> 10,11,12,14,21,22,24,27,31,39,41,45,46,48, </key>\r
+<key name="1d"> 0,4,5,6,11,18,25,26,34,40, </key>\r
+<key name="2"> 10,12,14,21,22,24,27,31,39,41,45,46,48, </key>\r
+<key name="2d"> 1,2,5,6,10,12,25,26,29,31,48, </key>\r
+<key name="3"> 5,10,12,24,37,39,48, </key>\r
+<key name="3d"> 3,5,6,25,30,49,42, </key>\r
<key name="3rd"> 5, </key>\r
-<key name="4"> 5,10,11,34,35,42, </key>\r
+<key name="4"> 5,10,12,39,41,48, </key>\r
<key name="5th"> 5, </key>\r
-<key name="abut"> 25,29, </key>\r
-<key name="accord"> 8,10,11,24,28,34,35,42, </key>\r
+<key name="abut"> 28,33, </key>\r
+<key name="accord"> 8,10,12,27,31,39,41,48, </key>\r
<key name="account"> 4, </key>\r
<key name="ad"> 9, </key>\r
-<key name="addition"> 23, </key>\r
-<key name="additional"> 5,32, </key>\r
-<key name="adjacent"> 28, </key>\r
-<key name="algorithm"> 0,1,2,3,4,5,6,8,10,15,16,23,26,27,30,36, </key>\r
-<key name="allow"> 4,22,23, </key>\r
-<key name="angl"> 8,23,28,34,42, </key>\r
-<key name="any"> 5, </key>\r
-<key name="ap"> 0,1,2,3,10,11,23,24,28,34,35,36,42, </key>\r
-<key name="appear"> 15,16,25,26,27,29,32, </key>\r
-<key name="appli"> 10,11,24,25,26,27,28,29,34,35,42, </key>\r
+<key name="addition"> 25, </key>\r
+<key name="additional"> 5,37, </key>\r
+<key name="adjacent"> 31,32, </key>\r
+<key name="advanc"> 49, </key>\r
+<key name="algorithm"> 0,1,2,3,4,5,6,8,10,11,16,17,25,29,30,35,49,42, </key>\r
+<key name="allow"> 4,11,24,25,32,34, </key>\r
+<key name="angl"> 8,25,31,39,48, </key>\r
+<key name="anoth"> 34, </key>\r
+<key name="any"> 5,49, </key>\r
+<key name="ap"> 0,1,2,3,6,10,12,25,27,31,39,41,49,42,48, </key>\r
+<key name="appear"> 4,6,11,16,17,18,28,29,30,33,37,40, </key>\r
+<key name="appli"> 10,12,27,28,29,30,31,33,39,41,48, </key>\r
<key name="application"> 8, </key>\r
-<key name="apply"> 4,15,16, </key>\r
-<key name="approximate"> 29, </key>\r
-<key name="arcsin"> 42, </key>\r
-<key name="area"> 4,8,10,23,26,27,35, </key>\r
-<key name="aspect"> 8,11,23, </key>\r
-<key name="assign"> 42, </key>\r
-<key name="averag"> 25,42, </key>\r
-<key name="axi"> 42, </key>\r
-<key name="bar"> 8,33, </key>\r
-<key name="bas"> 4,10,23,42, </key>\r
+<key name="apply"> 4,16,17, </key>\r
+<key name="approximate"> 33, </key>\r
+<key name="arcsin"> 48, </key>\r
+<key name="area"> 4,8,10,25,29,30,41, </key>\r
+<key name="arithmetic"> 4,11, </key>\r
+<key name="aspect"> 8,12,25, </key>\r
+<key name="assign"> 48, </key>\r
+<key name="averag"> 4,26,28,40,48, </key>\r
+<key name="axi"> 48, </key>\r
+<key name="bar"> 8,38, </key>\r
+<key name="bas"> 4,10,25,48, </key>\r
<key name="basi"> 5, </key>\r
<key name="basic"> 4, </key>\r
-<key name="befor"> 32, </key>\r
-<key name="bisect"> 42, </key>\r
-<key name="bisector"> 42, </key>\r
-<key name="border"> 23, </key>\r
-<key name="bottom"> 32, </key>\r
+<key name="befor"> 37, </key>\r
+<key name="begin"> 11, </key>\r
+<key name="bisect"> 48, </key>\r
+<key name="bisector"> 48, </key>\r
+<key name="border"> 25, </key>\r
+<key name="bottom"> 37, </key>\r
<key name="bound"> 5, </key>\r
<key name="boundary"> 4, </key>\r
-<key name="box"> 15,16,22,25,26,27,29,32, </key>\r
-<key name="brows"> 13,39, </key>\r
-<key name="button"> 0,1,2,3,10,11,13,15,16,22,24,25,26,27,28,29,34,35,36,39,42, </key>\r
+<key name="box"> 11,16,17,18,24,28,29,30,33,37,40, </key>\r
+<key name="brows"> 14,45,46, </key>\r
+<key name="build"> 18,26,40, </key>\r
+<key name="built"> 49, </key>\r
+<key name="button"> 10,12,14,16,17,24,27,31,39,41,45,48, </key>\r
<key name="cad"> 5, </key>\r
-<key name="calculat"> 8,11,35, </key>\r
-<key name="calculation"> 4,10,24,28, </key>\r
-<key name="chang"> 12, </key>\r
+<key name="calculat"> 8,12,26,41, </key>\r
+<key name="calculation"> 4,10,27,31, </key>\r
+<key name="chang"> 11,13, </key>\r
<key name="characteristic"> 8, </key>\r
<key name="characteriz"> 5, </key>\r
<key name="choic"> 4, </key>\r
-<key name="choos"> 10,11,22,24,28,32,34,35,42, </key>\r
-<key name="chosen"> 26,27, </key>\r
-<key name="click"> 0,1,2,3,10,11,13,15,16,22,24,25,26,27,28,29,32,34,35,36,39,42, </key>\r
+<key name="choos"> 10,12,24,27,31,37,39,41,48, </key>\r
+<key name="chosen"> 29,30, </key>\r
+<key name="click"> 0,1,2,3,4,6,10,11,12,14,16,17,18,24,27,28,29,30,31,33,37,39,40,41,49,42,45,46,48, </key>\r
<key name="clos"> 5, </key>\r
-<key name="color"> 8,10,11,24,28,34,35,42, </key>\r
-<key name="combin"> 24, </key>\r
-<key name="component"> 23,32, </key>\r
-<key name="compos"> 4,5,6,8,19,25,26,27,29,34, </key>\r
-<key name="comput"> 13, </key>\r
-<key name="computation"> 13,15,16, </key>\r
+<key name="color"> 8,10,12,27,31,39,41,48, </key>\r
+<key name="combin"> 27, </key>\r
+<key name="component"> 25,37, </key>\r
+<key name="compos"> 4,5,6,8,21,28,29,30,33,39, </key>\r
+<key name="comput"> 14, </key>\r
+<key name="computation"> 14,16,17, </key>\r
<key name="condition"> 4, </key>\r
-<key name="connection"> 5,23, </key>\r
-<key name="connectivity"> 14, </key>\r
+<key name="conform"> 4,32, </key>\r
+<key name="connect"> 18, </key>\r
+<key name="connection"> 5,25, </key>\r
+<key name="connectivity"> 15, </key>\r
<key name="consider"> 5, </key>\r
-<key name="consist"> 8,10,11,15,16,24,25,26,27,28,29,35, </key>\r
-<key name="construct"> 15,16, </key>\r
-<key name="construction"> 15,16, </key>\r
-<key name="contain"> 5,6,22, </key>\r
+<key name="consist"> 8,10,12,16,17,27,28,29,30,31,33,41, </key>\r
+<key name="constant"> 40, </key>\r
+<key name="construct"> 16,17,18,40, </key>\r
+<key name="construction"> 16,17, </key>\r
+<key name="contain"> 5,6,24, </key>\r
<key name="contour"> 5, </key>\r
-<key name="control"> 8,10,11,23,24,28,34,35,42, </key>\r
+<key name="control"> 8,10,12,25,27,31,39,41,48, </key>\r
<key name="coordinat"> 5, </key>\r
-<key name="corn"> 42, </key>\r
-<key name="corner"> 42, </key>\r
-<key name="correspond"> 5,8,22, </key>\r
+<key name="corn"> 48, </key>\r
+<key name="corner"> 48, </key>\r
+<key name="correspond"> 5,8,24, </key>\r
<key name="could"> 5, </key>\r
-<key name="creat"> 5,23,32,42, </key>\r
-<key name="creation"> 5,32, </key>\r
-<key name="criteria"> 23, </key>\r
-<key name="criterion"> 10,11,24,28,34,35,42, </key>\r
-<key name="cros"> 42, </key>\r
-<key name="curv"> 5, </key>\r
+<key name="creat"> 0,1,2,3,4,5,6,11,18,25,28,29,30,33,37,40,49,42,48, </key>\r
+<key name="creation"> 5,37, </key>\r
+<key name="criteria"> 25, </key>\r
+<key name="criterion"> 10,12,27,31,39,41,48, </key>\r
+<key name="cros"> 48, </key>\r
+<key name="curv"> 5,18, </key>\r
+<key name="d"> 11, </key>\r
<key name="deal"> 5, </key>\r
-<key name="default"> 32, </key>\r
-<key name="defin"> 5,11,25,26,27,29, </key>\r
-<key name="definit"> 5,8,23,29, </key>\r
-<key name="definition"> 25,26,27,29, </key>\r
-<key name="deletion"> 23, </key>\r
-<key name="depend"> 4,5,26,27, </key>\r
+<key name="default"> 37, </key>\r
+<key name="defin"> 5,11,12,18,28,29,30,33,40, </key>\r
+<key name="definit"> 5,8,25,33, </key>\r
+<key name="definition"> 28,29,30,33, </key>\r
+<key name="deflection"> 4,18, </key>\r
+<key name="deletion"> 25, </key>\r
+<key name="depend"> 4,5,29,30, </key>\r
<key name="describ"> 5, </key>\r
-<key name="desktop"> 32, </key>\r
-<key name="destin"> 5,8,23, </key>\r
+<key name="desktop"> 37, </key>\r
+<key name="destin"> 5,8,25, </key>\r
<key name="detail"> 4, </key>\r
-<key name="diagonal"> 17,35, </key>\r
-<key name="dialog"> 15,16,22,25,26,27,29, </key>\r
+<key name="diagonal"> 19,41, </key>\r
+<key name="dialog"> 11,16,17,18,24,28,29,30,33,40, </key>\r
+<key name="differ"> 40, </key>\r
<key name="different"> 4, </key>\r
<key name="dimension"> 5, </key>\r
<key name="direct"> 5, </key>\r
-<key name="direction"> 42, </key>\r
+<key name="direction"> 48, </key>\r
<key name="discretization"> 0,5,6, </key>\r
-<key name="displac"> 18, </key>\r
-<key name="display"> 8,10,11,19,20,24,28,34,35,39,40,42, </key>\r
+<key name="displac"> 20, </key>\r
+<key name="display"> 8,10,12,21,22,27,31,39,41,45,46,48, </key>\r
<key name="disposal"> 8, </key>\r
-<key name="distanc"> 42, </key>\r
+<key name="distanc"> 18,48, </key>\r
+<key name="divid"> 18,40, </key>\r
+<key name="do"> 49, </key>\r
<key name="don"> 5, </key>\r
-<key name="edg"> 0,4,5,6,8,11,23,24,25,29,42, </key>\r
-<key name="edit"> 21, </key>\r
-<key name="element"> 4,5,8,9,10,11,12,17,19,23,24,26,27,28,31,34,35,42, </key>\r
-<key name="encapsulat"> 16, </key>\r
-<key name="ent"> 22, </key>\r
-<key name="entiti"> 0,1,2,3,5,6,36, </key>\r
+<key name="edg"> 0,4,5,6,8,11,12,18,25,26,27,28,32,33,34,40,48, </key>\r
+<key name="edit"> 23, </key>\r
+<key name="element"> 4,5,8,9,10,12,13,18,19,21,25,27,29,30,31,32,36,39,40,41,49,48, </key>\r
+<key name="encapsulat"> 17, </key>\r
+<key name="end"> 4,11,18,32,40, </key>\r
+<key name="ent"> 24, </key>\r
+<key name="entiti"> 0,1,2,3,5,6,49,42, </key>\r
<key name="entity"> 5, </key>\r
-<key name="equal"> 11, </key>\r
-<key name="equilateral"> 11, </key>\r
+<key name="equal"> 12,18, </key>\r
+<key name="equilateral"> 12, </key>\r
<key name="etc"> 8, </key>\r
-<key name="every"> 42, </key>\r
-<key name="exampl"> 5, </key>\r
-<key name="export"> 22,23, </key>\r
-<key name="exportation"> 22, </key>\r
-<key name="extend"> 42, </key>\r
-<key name="fac"> 1,2,4,5,6,23,25,26,29,42, </key>\r
-<key name="fil"> 22, </key>\r
-<key name="final"> 13, </key>\r
-<key name="find"> 22, </key>\r
+<key name="every"> 48, </key>\r
+<key name="exampl"> 5,42, </key>\r
+<key name="export"> 24,25, </key>\r
+<key name="exportation"> 24, </key>\r
+<key name="extend"> 48, </key>\r
+<key name="fac"> 1,2,4,5,6,25,28,29,32,33,34,48, </key>\r
+<key name="factor"> 40, </key>\r
+<key name="fil"> 24, </key>\r
+<key name="final"> 14, </key>\r
+<key name="find"> 24, </key>\r
+<key name="first"> 40, </key>\r
<key name="fix"> 5, </key>\r
-<key name="follow"> 4,5,6,8,11,15,16,19,20,25,26,27,29,32,39, </key>\r
-<key name="format"> 22,23, </key>\r
-<key name="four"> 5,42, </key>\r
-<key name="fre"> 5,23, </key>\r
+<key name="follow"> 4,5,6,8,11,12,16,17,18,21,22,28,29,30,33,37,40,45, </key>\r
+<key name="format"> 24,25, </key>\r
+<key name="four"> 5,48, </key>\r
+<key name="fre"> 5,25, </key>\r
<key name="function"> 5, </key>\r
-<key name="functionality"> 5,22, </key>\r
-<key name="generat"> 4,5,8,23,25,29,32, </key>\r
-<key name="generation"> 13, </key>\r
-<key name="geom"> 5,23, </key>\r
+<key name="functionality"> 5,24, </key>\r
+<key name="generat"> 4,5,8,25,28,32,33,37,49, </key>\r
+<key name="generation"> 14, </key>\r
+<key name="geom"> 5,25, </key>\r
<key name="geometric"> 5,8, </key>\r
-<key name="geometrical"> 0,1,2,3,4,5,6,15,16,23,25,26,27,29,36, </key>\r
-<key name="global"> 15, </key>\r
-<key name="group"> 23, </key>\r
-<key name="h"> 42, </key>\r
-<key name="h1"> 11, </key>\r
-<key name="h2"> 11, </key>\r
-<key name="half"> 42, </key>\r
-<key name="height"> 11,42, </key>\r
+<key name="geometrical"> 0,1,2,3,4,5,6,16,17,18,25,28,29,30,33,40,49,42, </key>\r
+<key name="ghs3d"> 49, </key>\r
+<key name="given"> 11,26, </key>\r
+<key name="global"> 16, </key>\r
+<key name="group"> 25, </key>\r
+<key name="h"> 48, </key>\r
+<key name="h1"> 12, </key>\r
+<key name="h2"> 12, </key>\r
+<key name="half"> 48, </key>\r
+<key name="hav"> 26,32,49, </key>\r
+<key name="height"> 12,48, </key>\r
<key name="help"> 8, </key>\r
-<key name="her"> 5,7,9,12,14,17,18,31,33,41, </key>\r
-<key name="hexahedron"> 3,5,6,27, </key>\r
+<key name="her"> 5,7,9,13,15,19,20,36,38,47, </key>\r
+<key name="hexahedron"> 3,5,6,30, </key>\r
<key name="high"> 5, </key>\r
-<key name="hyp"> 15,16, </key>\r
-<key name="hypothes"> 0,1,2,3,4,15,16,21,23,25,26,27,29,30,36, </key>\r
-<key name="hypothesi"> 4,25,26,27,29, </key>\r
+<key name="hyp"> 16,17, </key>\r
+<key name="hypothes"> 0,1,2,3,4,6,11,16,17,18,23,25,28,29,30,33,35,40,49,42, </key>\r
+<key name="hypothesi"> 4,11,18,26,28,29,30,32,33,34,40,49, </key>\r
<key name="i"> 3, </key>\r
-<key name="icon"> 32, </key>\r
-<key name="id"> 19,20, </key>\r
-<key name="if"> 5, </key>\r
+<key name="icon"> 37, </key>\r
+<key name="id"> 21,22, </key>\r
+<key name="if"> 5,34, </key>\r
<key name="imp"> 5, </key>\r
-<key name="import"> 22,23, </key>\r
-<key name="importation"> 22, </key>\r
+<key name="import"> 24,25, </key>\r
+<key name="importation"> 24, </key>\r
<key name="includ"> 5, </key>\r
-<key name="indicat"> 42, </key>\r
-<key name="info"> 39, </key>\r
-<key name="information"> 5,39, </key>\r
-<key name="initial"> 32, </key>\r
+<key name="indicat"> 48, </key>\r
+<key name="info"> 45, </key>\r
+<key name="information"> 5,45, </key>\r
+<key name="initial"> 37, </key>\r
<key name="interest"> 5, </key>\r
-<key name="introduction"> 23, </key>\r
+<key name="introduction"> 25, </key>\r
<key name="invers"> 5, </key>\r
-<key name="inversion"> 17, </key>\r
-<key name="item"> 22, </key>\r
+<key name="inversion"> 19, </key>\r
+<key name="item"> 4,6,24, </key>\r
<key name="j"> 3, </key>\r
-<key name="join"> 34, </key>\r
+<key name="join"> 39, </key>\r
<key name="k"> 3, </key>\r
<key name="kind"> 6, </key>\r
-<key name="l"> 42, </key>\r
-<key name="largest"> 11, </key>\r
-<key name="launch"> 32, </key>\r
-<key name="length"> 4,8,11,23,24,25,29,42, </key>\r
+<key name="l"> 48, </key>\r
+<key name="largest"> 12, </key>\r
+<key name="last"> 40, </key>\r
+<key name="launch"> 37, </key>\r
+<key name="length"> 4,8,11,12,25,26,27,28,33,40,48, </key>\r
+<key name="les"> 49, </key>\r
<key name="level"> 4, </key>\r
-<key name="lik"> 19,20,32, </key>\r
-<key name="lin"> 5,34, </key>\r
-<key name="local"> 4,16,23,25,29, </key>\r
-<key name="location"> 22, </key>\r
-<key name="longest"> 11, </key>\r
-<key name="look"> 19,20,32, </key>\r
+<key name="lik"> 21,22,37, </key>\r
+<key name="lin"> 5,18,39, </key>\r
+<key name="lk"> 11, </key>\r
+<key name="local"> 17,25,33,34, </key>\r
+<key name="location"> 18,24,40, </key>\r
+<key name="longest"> 12, </key>\r
+<key name="look"> 21,22,37, </key>\r
<key name="low"> 5, </key>\r
-<key name="main"> 32, </key>\r
+<key name="main"> 4,6,37, </key>\r
<key name="manag"> 4, </key>\r
<key name="map"> 1, </key>\r
-<key name="max"> 4,23,26,27, </key>\r
-<key name="maximum"> 26,27,34, </key>\r
+<key name="max"> 4,25,29,30, </key>\r
+<key name="maximum"> 18,29,30,39, </key>\r
<key name="mean"> 5, </key>\r
<key name="meaningful"> 5, </key>\r
-<key name="measur"> 42, </key>\r
+<key name="measur"> 48, </key>\r
<key name="mefisto"> 2, </key>\r
-<key name="menu"> 0,1,2,3,13,15,16,19,20,22,25,26,27,29,32,36,39, </key>\r
-<key name="mesh"> 0,1,2,3,4,5,6,7,8,10,11,13,15,16,19,20,22,23,24,25,26,27,28,29,32,34,35,36,39,40,42, </key>\r
-<key name="minimum"> 8,23,28, </key>\r
-<key name="mod"> 40, </key>\r
-<key name="model"> 5,23, </key>\r
-<key name="modification"> 5,7,23, </key>\r
-<key name="modul"> 5,6,23,32, </key>\r
-<key name="mov"> 23, </key>\r
-<key name="multi"> 23, </key>\r
-<key name="multipli"> 11, </key>\r
-<key name="nam"> 22,25,26,27,29, </key>\r
-<key name="nb"> 29, </key>\r
-<key name="netgen"> 36, </key>\r
-<key name="new"> 32, </key>\r
-<key name="nod"> 5,9,10,11,18,20,23,25,29,31,34,35,42, </key>\r
-<key name="normal"> 42, </key>\r
+<key name="menu"> 0,1,2,3,4,6,11,14,16,17,18,21,22,24,28,29,30,33,37,40,49,42,45,46, </key>\r
+<key name="mesh"> 0,1,2,3,4,5,6,7,8,10,12,14,16,17,18,21,22,24,25,26,27,28,29,30,31,32,33,37,39,40,41,49,42,45,46,48, </key>\r
+<key name="minimum"> 8,25,31, </key>\r
+<key name="mod"> 46, </key>\r
+<key name="model"> 5,25, </key>\r
+<key name="modification"> 5,7,25, </key>\r
+<key name="modul"> 5,6,25,37, </key>\r
+<key name="mov"> 25, </key>\r
+<key name="multi"> 25, </key>\r
+<key name="multipli"> 12, </key>\r
+<key name="nam"> 11,18,24,28,29,30,33,40, </key>\r
+<key name="nb"> 33, </key>\r
+<key name="ne"> 49, </key>\r
+<key name="need"> 49, </key>\r
+<key name="netgen"> 49,42, </key>\r
+<key name="new"> 37, </key>\r
+<key name="nod"> 5,9,10,12,18,20,22,25,28,33,36,39,40,41,48, </key>\r
+<key name="normal"> 48, </key>\r
<key name="notic"> 5, </key>\r
-<key name="numb"> 4,5,23,29, </key>\r
-<key name="number"> 19,20, </key>\r
-<key name="object"> 0,1,2,3,4,6,13,15,16,25,26,27,29,36,39, </key>\r
-<key name="ok"> 22, </key>\r
-<key name="on"> 5,15,16, </key>\r
-<key name="operation"> 23, </key>\r
-<key name="opposit"> 34, </key>\r
+<key name="numb"> 4,5,25,33, </key>\r
+<key name="number"> 21,22, </key>\r
+<key name="object"> 0,1,2,3,4,6,14,16,17,28,29,30,33,49,42,45,46, </key>\r
+<key name="ok"> 24, </key>\r
+<key name="on"> 4,5,6,16,17,34,40,49, </key>\r
+<key name="onto"> 34, </key>\r
+<key name="operation"> 25, </key>\r
+<key name="opposit"> 4,34,39, </key>\r
<key name="option"> 5, </key>\r
<key name="ord"> 5, </key>\r
-<key name="orientation"> 12, </key>\r
-<key name="origin"> 42, </key>\r
+<key name="orientation"> 13, </key>\r
+<key name="origin"> 48, </key>\r
<key name="own"> 5, </key>\r
<key name="paramet"> 5, </key>\r
-<key name="parameter"> 4, </key>\r
+<key name="parameter"> 4,26,32, </key>\r
<key name="parametric"> 5, </key>\r
<key name="particularity"> 5, </key>\r
-<key name="perfect"> 11, </key>\r
-<key name="perform"> 23, </key>\r
-<key name="plan"> 42, </key>\r
-<key name="planar"> 42, </key>\r
-<key name="platform"> 32, </key>\r
-<key name="point"> 5,25,29,42, </key>\r
+<key name="perfect"> 12, </key>\r
+<key name="perform"> 25, </key>\r
+<key name="plan"> 48, </key>\r
+<key name="planar"> 48, </key>\r
+<key name="platform"> 37, </key>\r
+<key name="point"> 5,28,33,48, </key>\r
+<key name="pop"> 46, </key>\r
<key name="position"> 5, </key>\r
<key name="possibl"> 4, </key>\r
<key name="present"> 5, </key>\r
<key name="presentation"> 8, </key>\r
<key name="preset"> 4, </key>\r
-<key name="previous"> 15,16,23, </key>\r
-<key name="procedur"> 11, </key>\r
+<key name="previou"> 40, </key>\r
+<key name="previous"> 16,17,25, </key>\r
+<key name="procedur"> 12, </key>\r
<key name="produc"> 5, </key>\r
-<key name="product"> 42, </key>\r
-<key name="projection"> 42, </key>\r
-<key name="properti"> 33,41, </key>\r
-<key name="quad"> 42, </key>\r
-<key name="quadrangl"> 1,5,6,10,11,24,26,28,34, </key>\r
-<key name="quality"> 8,10,11,23,24,28,34,35,42, </key>\r
+<key name="product"> 48, </key>\r
+<key name="progression"> 11, </key>\r
+<key name="projection"> 48, </key>\r
+<key name="propagat"> 34, </key>\r
+<key name="propagation"> 4,34, </key>\r
+<key name="properti"> 38,46,47, </key>\r
+<key name="quad"> 48, </key>\r
+<key name="quadrangl"> 1,5,6,10,12,27,29,31,39, </key>\r
+<key name="quadrangular"> 34, </key>\r
+<key name="quality"> 8,10,12,25,27,31,39,41,48, </key>\r
<key name="quantity"> 4, </key>\r
-<key name="ratio"> 8,11,23,35,42, </key>\r
-<key name="reassign"> 30, </key>\r
+<key name="ratio"> 8,12,25,41,48, </key>\r
+<key name="reassign"> 35, </key>\r
<key name="referenc"> 5,8, </key>\r
<key name="refin"> 4, </key>\r
-<key name="reflect"> 34, </key>\r
-<key name="relat"> 32, </key>\r
+<key name="reflect"> 39, </key>\r
+<key name="regular"> 11, </key>\r
+<key name="relat"> 37, </key>\r
<key name="relation"> 5, </key>\r
<key name="relationship"> 5, </key>\r
-<key name="remain"> 11, </key>\r
-<key name="remov"> 31, </key>\r
-<key name="repeat"> 11, </key>\r
-<key name="represent"> 4,5,25,29,35, </key>\r
+<key name="remain"> 12, </key>\r
+<key name="remov"> 36, </key>\r
+<key name="repeat"> 12, </key>\r
+<key name="represent"> 4,5,28,33,41, </key>\r
<key name="representation"> 5, </key>\r
<key name="restrict"> 5, </key>\r
<key name="result"> 4, </key>\r
-<key name="retain"> 11, </key>\r
+<key name="retain"> 12, </key>\r
<key name="retriev"> 5, </key>\r
+<key name="right"> 46, </key>\r
<key name="rough"> 4, </key>\r
-<key name="run"> 32, </key>\r
-<key name="s"> 11, </key>\r
-<key name="salom"> 23,32, </key>\r
-<key name="sam"> 5,29, </key>\r
-<key name="scalar"> 8,33, </key>\r
+<key name="run"> 37, </key>\r
+<key name="s"> 12, </key>\r
+<key name="salom"> 25,37, </key>\r
+<key name="sam"> 5,33,34, </key>\r
+<key name="scalar"> 8,38, </key>\r
<key name="se"> 5, </key>\r
-<key name="search"> 22, </key>\r
-<key name="segment"> 4,23,25,29, </key>\r
-<key name="select"> 0,1,2,3,4,13,15,16,19,20,22,25,26,27,29,32,36,39, </key>\r
+<key name="search"> 24, </key>\r
+<key name="segment"> 4,11,18,25,26,28,33,40, </key>\r
+<key name="select"> 0,1,2,3,4,6,11,14,16,17,18,21,22,24,28,29,30,33,37,40,49,42,45,46, </key>\r
<key name="sens"> 5, </key>\r
-<key name="separat"> 35, </key>\r
-<key name="set"> 5,6,23,25,26,27,29,32, </key>\r
-<key name="shad"> 40, </key>\r
-<key name="shap"> 4,5,11, </key>\r
-<key name="shortest"> 11,42, </key>\r
-<key name="should"> 32, </key>\r
+<key name="separat"> 41, </key>\r
+<key name="set"> 5,6,11,18,25,28,29,30,33,34,37,40,46, </key>\r
+<key name="shad"> 46, </key>\r
+<key name="shap"> 4,5,12, </key>\r
+<key name="shortest"> 12,48, </key>\r
+<key name="should"> 37, </key>\r
<key name="shown"> 8, </key>\r
-<key name="shrink"> 40, </key>\r
-<key name="sid"> 11,28,34, </key>\r
+<key name="shrink"> 46, </key>\r
+<key name="sid"> 12,31,39, </key>\r
+<key name="similar"> 11, </key>\r
<key name="simpl"> 5, </key>\r
-<key name="skew"> 8,23,34, </key>\r
-<key name="smesh"> 4,5,6,8,19,20,22,23,32,37,40, </key>\r
-<key name="so"> 4,11,35, </key>\r
+<key name="skew"> 8,25,39, </key>\r
+<key name="smesh"> 4,5,6,8,21,22,24,25,37,43,46, </key>\r
+<key name="so"> 4,12,18,40,41, </key>\r
<key name="spac"> 5, </key>\r
-<key name="split"> 25,29, </key>\r
-<key name="standard"> 22,32, </key>\r
-<key name="start"> 32, </key>\r
-<key name="step"> 13, </key>\r
-<key name="study"> 32, </key>\r
-<key name="sub"> 22, </key>\r
-<key name="submesh"> 4,16, </key>\r
-<key name="surfac"> 5, </key>\r
+<key name="specifi"> 18,40,49, </key>\r
+<key name="split"> 11,28,33, </key>\r
+<key name="standard"> 24,37, </key>\r
+<key name="start"> 4,11,37,40, </key>\r
+<key name="step"> 14, </key>\r
+<key name="study"> 37, </key>\r
+<key name="sub"> 24, </key>\r
+<key name="submesh"> 4,17, </key>\r
+<key name="surfac"> 5,49, </key>\r
<key name="surround"> 5, </key>\r
<key name="t"> 5, </key>\r
<key name="taken"> 4, </key>\r
-<key name="tap"> 8,23,35, </key>\r
-<key name="tetrahedron"> 5,6,27,36, </key>\r
-<key name="text"> 7,9,12,14,17,18,31,33,41, </key>\r
-<key name="thre"> 5,40, </key>\r
-<key name="toolbar"> 0,1,2,3,11,13,15,16,24,32,34,35,36,39,42, </key>\r
-<key name="topic"> 7,9,12,14,17,18,31,33,41, </key>\r
+<key name="tap"> 8,25,41, </key>\r
+<key name="tetrahedron"> 5,6,30,49,42, </key>\r
+<key name="text"> 7,9,13,15,19,20,36,38,47, </key>\r
+<key name="them"> 18,40, </key>\r
+<key name="thre"> 5,46, </key>\r
+<key name="toolbar"> 12,14,16,17,27,37,39,41,45,48, </key>\r
+<key name="topic"> 7,9,13,15,19,20,36,38,47, </key>\r
<key name="topological"> 5, </key>\r
<key name="topology"> 5, </key>\r
-<key name="triangl"> 2,5,6,10,11,24,26,28,34,35, </key>\r
-<key name="two"> 5,11,28,35, </key>\r
-<key name="typ"> 5,7,9,12,14,17,18,31,33,41, </key>\r
+<key name="triangl"> 2,5,6,10,12,27,29,31,39,41, </key>\r
+<key name="triangulator"> 26, </key>\r
+<key name="two"> 5,12,31,41, </key>\r
+<key name="typ"> 5,7,9,13,15,19,20,36,38,47, </key>\r
<key name="u"> 5, </key>\r
-<key name="unv"> 22, </key>\r
-<key name="updat"> 32,38, </key>\r
-<key name="us"> 0,1,2,3,5,6,15,16,25,29,36,37, </key>\r
+<key name="unles"> 34, </key>\r
+<key name="unv"> 24, </key>\r
+<key name="up"> 11,46, </key>\r
+<key name="updat"> 37,44, </key>\r
+<key name="us"> 0,1,2,3,5,6,16,17,18,28,33,40,49,42,43, </key>\r
<key name="usag"> 8, </key>\r
<key name="v"> 5, </key>\r
-<key name="valu"> 8,11,28,34, </key>\r
-<key name="vector"> 42, </key>\r
+<key name="valu"> 8,11,12,18,31,39, </key>\r
+<key name="vector"> 48, </key>\r
<key name="vertex"> 5, </key>\r
-<key name="view"> 10,11,19,20,24,28,32,34,35,38,39,40,42, </key>\r
+<key name="view"> 10,12,21,22,27,31,37,39,41,44,45,46,48, </key>\r
<key name="visual"> 8, </key>\r
-<key name="visualization"> 40,41, </key>\r
-<key name="volum"> 3,4,5,6,23,27,36, </key>\r
-<key name="vtk"> 32, </key>\r
-<key name="warp"> 8,23,42, </key>\r
+<key name="visualization"> 46,47, </key>\r
+<key name="volum"> 3,4,5,6,25,30,49,42, </key>\r
+<key name="vtk"> 37, </key>\r
+<key name="warp"> 8,25,48, </key>\r
<key name="way"> 5, </key>\r
-<key name="will"> 4,5,10,11,15,16,19,20,22,24,25,26,27,28,29,32,34,35,39,42, </key>\r
-<key name="window"> 32, </key>\r
-<key name="wir"> 0,6, </key>\r
-<key name="wirefram"> 40, </key>\r
-<key name="word"> 29, </key>\r
-<key name="work"> 32, </key>\r
-<key name="x"> 5,42, </key>\r
+<key name="whil"> 49, </key>\r
+<key name="will"> 4,5,6,10,11,12,16,17,18,21,22,24,27,28,29,30,31,33,34,37,39,40,41,45,48, </key>\r
+<key name="window"> 37, </key>\r
+<key name="wir"> 0,6,26, </key>\r
+<key name="wirefram"> 46, </key>\r
+<key name="word"> 33, </key>\r
+<key name="work"> 37, </key>\r
+<key name="x"> 5,48, </key>\r
<key name="y"> 5, </key>\r
-<key name="your"> 4,5,8,10,11,13,16,19,20,22,24,25,26,27,28,29,34,35,39,42, </key>\r
+<key name="your"> 4,5,8,10,11,12,14,17,18,21,22,24,27,28,29,30,31,33,39,40,41,45,46,48, </key>\r
<key name="z"> 5, </key>\r
\r
</ftswdata> \r
<script LANGUAGE="JavaScript" SRC="whtdata.js"></script>\r
<script language="javascript">\r
<!--\r
- aTE(1,52,"SMESH module");\r
+ aTE(1,59,"SMESH module");\r
aTE(2,0,"Introduction to SMESH","files/introduction_to_smesh.htm");\r
aTE(2,0,"Running SMESH module","files/running_smesh_module.htm");\r
- aTE(1,21,"Creating meshes");\r
+ aTE(1,28,"Creating meshes");\r
aTE(2,0,"About meshes","files/about_meshes.htm");\r
aTE(2,0,"Importing and exporting meshes","files/importing_and_exporting_meshes.htm");\r
- aTE(1,5,"Defining hypotheses");\r
+ aTE(1,11,"Defining hypotheses");\r
aTE(2,0,"About hypotheses","files/about_hypotheses.htm");\r
- aTE(2,0,"Local Length hypothesis","files/local_length_hypothesis.htm");\r
- aTE(2,0,"Number of segments hypothesis","files/number_of_segments_hypothesis.htm");\r
+ aTE(2,0,"Arithmetic 1D hypothesis","files/arithmetic_1d.htm");\r
+ aTE(2,0,"Average Length hypothesis","files/local_length_hypothesis.htm");\r
+ aTE(2,0,"Deflection 1D hypothesis","files/deflection_1d.htm");\r
+ aTE(2,0,"Length from edges hypothesis","files/length_from_edges.htm");\r
aTE(2,0,"Max Element Area hypothesis","files/max._element_area_hypothesis.htm");\r
aTE(2,0,"Max Element Volume hypothesis","files/max._element_volume_hypothsis.htm");\r
- aTE(1,9,"Defining meshing algorithms");\r
+ aTE(2,0,"Number of segments hypothesis","files/number_of_segments_hypothesis.htm");\r
+ aTE(2,0,"Non conform mesh allowed hypothesis","files/non_conform_mesh_allowed_hypothesis.htm");\r
+ aTE(2,0,"Propagation of 1D Hypothesis on opposite edges","files/propagation_of_1d_hypothesis_on_opposite_edges.htm");\r
+ aTE(2,0,"Start and End Length hypothesis","files/start_and_end_length_hypothesis.htm");\r
+ aTE(1,10,"Defining meshing algorithms");\r
aTE(2,0,"About meshing algorithms","files/about_meshing_algorithms.htm");\r
aTE(1,1,"1D meshing algorithms");\r
aTE(2,0,"Wire discretization","files/1d_meshing_algorithm.htm");\r
aTE(1,2,"2D meshing algorithms");\r
aTE(2,0,"Triangle meshing algorithm","files/2d_meshing_algorithm.htm");\r
aTE(2,0,"Quadrangle meshing algorithm","files/2d_(quadrangle)_meshing_algorithm.htm");\r
- aTE(1,2,"3D meshing algorithms");\r
+ aTE(1,3,"3D meshing algorithms");\r
aTE(2,0,"Hexahedron meshing algorithm","files/3d_meshing_algorithm.htm");\r
aTE(2,0,"Tetrahedron (Netgen) meshing algorithm","files/tetrahedron_(netgen)_meshing_algorithm.htm");\r
+ aTE(2,0,"Tetrahedron (GHS3D) meshing algorithm","tetrahedron_(ghs3d)_meshing_algorithm.htm");\r
aTE(2,0,"Constructing meshes","files/constructing_meshes.htm");\r
aTE(2,0,"Constructing submeshes","files/constructing_submeshes.htm");\r
aTE(2,0,"Computing meshes","files/computing_meshes.htm");\r
<item name="Importing and exporting meshes" url="files/importing_and_exporting_meshes.htm" />\r
<book name="Defining hypotheses" >\r
<item name="About hypotheses" url="files/about_hypotheses.htm" />\r
- <item name="Local Length hypothesis" url="files/local_length_hypothesis.htm" />\r
- <item name="Number of segments hypothesis" url="files/number_of_segments_hypothesis.htm" />\r
+ <item name="Arithmetic 1D hypothesis" url="files/arithmetic_1d.htm" />\r
+ <item name="Average Length hypothesis" url="files/local_length_hypothesis.htm" />\r
+ <item name="Deflection 1D hypothesis" url="files/deflection_1d.htm" />\r
+ <item name="Length from edges hypothesis" url="files/length_from_edges.htm" />\r
<item name="Max Element Area hypothesis" url="files/max._element_area_hypothesis.htm" />\r
<item name="Max Element Volume hypothesis" url="files/max._element_volume_hypothsis.htm" />\r
+ <item name="Number of segments hypothesis" url="files/number_of_segments_hypothesis.htm" />\r
+ <item name="Non conform mesh allowed hypothesis" url="files/non_conform_mesh_allowed_hypothesis.htm" />\r
+ <item name="Propagation of 1D Hypothesis on opposite edges" url="files/propagation_of_1d_hypothesis_on_opposite_edges.htm" />\r
+ <item name="Start and End Length hypothesis" url="files/start_and_end_length_hypothesis.htm" />\r
</book>\r
<book name="Defining meshing algorithms" >\r
<item name="About meshing algorithms" url="files/about_meshing_algorithms.htm" />\r
<book name="3D meshing algorithms" >\r
<item name="Hexahedron meshing algorithm" url="files/3d_meshing_algorithm.htm" />\r
<item name="Tetrahedron (Netgen) meshing algorithm" url="files/tetrahedron_(netgen)_meshing_algorithm.htm" />\r
+ <item name="Tetrahedron (GHS3D) meshing algorithm" url="tetrahedron_(ghs3d)_meshing_algorithm.htm" />\r
</book>\r
</book>\r
<item name="Constructing meshes" url="files/constructing_meshes.htm" />\r
<p class="ftsbody">\r
\r
\r
-<a name="bm_{"></a><a name="subkey_{D"></a><a href="../files/about_meshes.htm"><b>0d</b></a> <br><nobr>1d <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>2d <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>8</b></a> <a href="../files/introduction_to_smesh.htm"><b>9</b></a> <a href="../files/warp.htm"><b>10</b></a> </nobr><br><nobr>3d <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>6</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>3rd</b></a> <br><a href="../files/about_meshes.htm"><b>5th</b></a> <br>\r
+<a name="bm_{"></a><a name="subkey_{D"></a><a href="../files/about_meshes.htm"><b>0d</b></a> <br><nobr>1d <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/length_from_edges.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/deflection_1d.htm"><b>8</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>9</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>10</b></a> </nobr><br><nobr>2d <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>8</b></a> <a href="../files/length_from_edges.htm"><b>9</b></a> <a href="../files/introduction_to_smesh.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> </nobr><br><nobr>3d <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>6</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>7</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>3rd</b></a> <br><a href="../files/about_meshes.htm"><b>5th</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_A"></a><a name="subkey_AB"></a>abutting <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_AC"></a><a name="subkey_AC"></a>according <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/warp.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>account</b></a> <br><a name="bms_AD"></a><a name="subkey_AD"></a><a href="../files/adding_nodes_and_elements.htm"><b>adding</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>addition</b></a> <br><nobr>additional <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><a href="../files/minimum_angle.htm"><b>adjacent</b></a> <br><nobr><a name="bms_AL"></a><a name="subkey_AL"></a>algorithm <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>11</b></a> </nobr><br><nobr>algorithms <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/constructing_submeshes.htm"><b>6</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>allow</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>allowing</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>allows</b></a> <br><nobr><a name="bms_AN"></a><a name="subkey_AN"></a>angle <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/warp.htm"><b>4</b></a> <a href="../files/skew.htm"><b>5</b></a> </nobr><br><a href="../files/skew.htm"><b>angles</b></a> <br><a href="../files/about_meshes.htm"><b>any</b></a> <br><nobr><a name="bms_AP"></a><a name="subkey_AP"></a>appear <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/constructing_submeshes.htm"><b>6</b></a> <a href="../files/running_smesh_module.htm"><b>7</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>application</b></a> <br><nobr>applied <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/local_length_hypothesis.htm"><b>7</b></a> <a href="../files/length_of_edges.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> <a href="../files/taper.htm"><b>10</b></a> <a href="../files/skew.htm"><b>11</b></a> </nobr><br><nobr>apply <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/length_of_edges.htm"><b>8</b></a> <a href="../files/introduction_to_smesh.htm"><b>9</b></a> <a href="../files/warp.htm"><b>10</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>11</b></a> <a href="../files/taper.htm"><b>12</b></a> <a href="../files/skew.htm"><b>13</b></a> </nobr><br><nobr>applying <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/constructing_submeshes.htm"><b>3</b></a> </nobr><br><a href="../files/number_of_segments_hypothesis.htm"><b>approximately</b></a> <br><a name="bms_AR"></a><a name="subkey_AR"></a><a href="../files/warp.htm"><b>arcsine</b></a> <br><nobr>area <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> </nobr><br><a href="../files/taper.htm"><b>areas</b></a> <br><nobr><a name="bms_AS"></a><a name="subkey_AS"></a>aspect <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a href="../files/warp.htm"><b>assigned</b></a> <br><nobr><a name="bms_AV"></a><a name="subkey_AV"></a>average <a href="../files/local_length_hypothesis.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a name="bms_AX"></a><a name="subkey_AX"></a><a href="../files/warp.htm"><b>axis</b></a> <br>\r
+<nobr><a name="bm_A"></a><a name="subkey_AB"></a>abutting <a href="../files/local_length_hypothesis.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_AC"></a><a name="subkey_AC"></a>according <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/taper.htm"><b>6</b></a> <a href="../files/skew.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>account</b></a> <br><a name="bms_AD"></a><a name="subkey_AD"></a><a href="../files/adding_nodes_and_elements.htm"><b>adding</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>addition</b></a> <br><nobr>additional <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>adjacent <a href="../files/minimum_angle.htm"><b>1</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>2</b></a> </nobr><br><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>advance</b></a> <br><nobr><a name="bms_AL"></a><a name="subkey_AL"></a>algorithm <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/about_meshing_algorithms.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>8</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>9</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>10</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>11</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>12</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>13</b></a> </nobr><br><nobr>algorithms <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/constructing_submeshes.htm"><b>8</b></a> <a href="../files/constructing_meshes.htm"><b>9</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>10</b></a> <a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>11</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>12</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>allow</b></a> <br><nobr>allowed <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>allowing</b></a> <br><nobr>allows <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>3</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>4</b></a> </nobr><br><nobr><a name="bms_AN"></a><a name="subkey_AN"></a>angle <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/skew.htm"><b>4</b></a> <a href="../files/warp.htm"><b>5</b></a> </nobr><br><a href="../files/skew.htm"><b>angles</b></a> <br><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>another</b></a> <br><nobr>any <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_AP"></a><a name="subkey_AP"></a>appear <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/deflection_1d.htm"><b>7</b></a> <a href="../files/constructing_submeshes.htm"><b>8</b></a> <a href="../files/constructing_meshes.htm"><b>9</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>12</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>application</b></a> <br><nobr>applied <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/length_of_edges.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> </nobr><br><nobr>apply <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/minimum_angle.htm"><b>8</b></a> <a href="../files/length_of_edges.htm"><b>9</b></a> <a href="../files/introduction_to_smesh.htm"><b>10</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>11</b></a> <a href="../files/taper.htm"><b>12</b></a> <a href="../files/skew.htm"><b>13</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>14</b></a> <a href="../files/warp.htm"><b>15</b></a> </nobr><br><nobr>applying <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> <a href="../files/constructing_meshes.htm"><b>3</b></a> </nobr><br><a href="../files/number_of_segments_hypothesis.htm"><b>approximately</b></a> <br><a name="bms_AR"></a><a name="subkey_AR"></a><a href="../files/warp.htm"><b>arcsine</b></a> <br><nobr>area <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> </nobr><br><a href="../files/taper.htm"><b>areas</b></a> <br><nobr>arithmetic <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_AS"></a><a name="subkey_AS"></a>aspect <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a href="../files/warp.htm"><b>assigned</b></a> <br><nobr><a name="bms_AV"></a><a name="subkey_AV"></a>average <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> <a href="../files/length_from_edges.htm"><b>3</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>4</b></a> <a href="../files/warp.htm"><b>5</b></a> </nobr><br><a name="bms_AX"></a><a name="subkey_AX"></a><a href="../files/warp.htm"><b>axis</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_B"></a><a name="subkey_BA"></a>bar <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/scalar_bar_properties.htm"><b>2</b></a> </nobr><br><nobr>based <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>basic</b></a> <br><nobr>basing <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>basis</b></a> <br><a name="bms_BE"></a><a name="subkey_BE"></a><a href="../files/running_smesh_module.htm"><b>before</b></a> <br><a name="bms_BI"></a><a name="subkey_BI"></a><a href="../files/warp.htm"><b>bisecting</b></a> <br><a href="../files/warp.htm"><b>bisector</b></a> <br><a name="bms_BO"></a><a name="subkey_BO"></a><a href="../files/introduction_to_smesh.htm"><b>borders</b></a> <br><a href="../files/running_smesh_module.htm"><b>bottom</b></a> <br><a href="../files/about_hypotheses.htm"><b>boundary</b></a> <br><a href="../files/about_meshes.htm"><b>bounded</b></a> <br><a href="../files/about_meshes.htm"><b>bounding</b></a> <br><a href="../files/about_meshes.htm"><b>bounds</b></a> <br><nobr>box <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> <a href="../files/running_smesh_module.htm"><b>8</b></a> </nobr><br><nobr><a name="bms_BR"></a><a name="subkey_BR"></a>browser <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/viewing_mesh_info.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_BU"></a><a name="subkey_BU"></a>button <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/aspect_ratio.htm"><b>3</b></a> <a href="../files/area_of_elements.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>9</b></a> <a href="../files/minimum_angle.htm"><b>10</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>11</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>12</b></a> <a href="../files/local_length_hypothesis.htm"><b>13</b></a> <a href="../files/length_of_edges.htm"><b>14</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/warp.htm"><b>17</b></a> <a href="../files/viewing_mesh_info.htm"><b>18</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>19</b></a> <a href="../files/taper.htm"><b>20</b></a> <a href="../files/skew.htm"><b>21</b></a> </nobr><br>\r
+<nobr><a name="bm_B"></a><a name="subkey_BA"></a>bar <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/scalar_bar_properties.htm"><b>2</b></a> </nobr><br><nobr>based <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>basic</b></a> <br><nobr>basing <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>basis</b></a> <br><a name="bms_BE"></a><a name="subkey_BE"></a><a href="../files/running_smesh_module.htm"><b>before</b></a> <br><a href="../files/arithmetic_1d.htm"><b>beginning</b></a> <br><a name="bms_BI"></a><a name="subkey_BI"></a><a href="../files/warp.htm"><b>bisecting</b></a> <br><a href="../files/warp.htm"><b>bisector</b></a> <br><a name="bms_BO"></a><a name="subkey_BO"></a><a href="../files/introduction_to_smesh.htm"><b>borders</b></a> <br><a href="../files/running_smesh_module.htm"><b>bottom</b></a> <br><a href="../files/about_hypotheses.htm"><b>boundary</b></a> <br><a href="../files/about_meshes.htm"><b>bounded</b></a> <br><a href="../files/about_meshes.htm"><b>bounding</b></a> <br><a href="../files/about_meshes.htm"><b>bounds</b></a> <br><nobr>box <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> <a href="../files/deflection_1d.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> <a href="../files/constructing_meshes.htm"><b>8</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>9</b></a> <a href="../files/running_smesh_module.htm"><b>10</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>11</b></a> </nobr><br><nobr><a name="bms_BR"></a><a name="subkey_BR"></a>browser <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> <a href="../files/viewing_mesh_info.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_BU"></a><a name="subkey_BU"></a>build <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><a href="../files/length_from_edges.htm"><b>builds</b></a> <br><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>built</b></a> <br><nobr>button <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> <a href="../files/constructing_meshes.htm"><b>8</b></a> <a href="../files/viewing_mesh_info.htm"><b>9</b></a> <a href="../files/taper.htm"><b>10</b></a> <a href="../files/skew.htm"><b>11</b></a> <a href="../files/warp.htm"><b>12</b></a> </nobr><br>\r
<br><br>\r
-<a name="bm_C"></a><a name="subkey_CA"></a><a href="../files/about_meshes.htm"><b>cad</b></a> <br><nobr>calculated <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>calculates</b></a> <br><nobr>calculation <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/length_of_edges.htm"><b>3</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>calculations</b></a> <br><a name="bms_CH"></a><a name="subkey_CH"></a><a href="../files/changing_orientation_of_elements.htm"><b>changing</b></a> <br><a href="../files/about_quality_controls.htm"><b>characteristic</b></a> <br><a href="../files/about_meshes.htm"><b>characterizes</b></a> <br><a href="../files/about_hypotheses.htm"><b>choice</b></a> <br><nobr>choose <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> <a href="../files/warp.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/running_smesh_module.htm"><b>9</b></a> </nobr><br><nobr>chosen <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_CL"></a><a name="subkey_CL"></a>click <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/aspect_ratio.htm"><b>3</b></a> <a href="../files/area_of_elements.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>9</b></a> <a href="../files/minimum_angle.htm"><b>10</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>11</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>12</b></a> <a href="../files/local_length_hypothesis.htm"><b>13</b></a> <a href="../files/length_of_edges.htm"><b>14</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/warp.htm"><b>17</b></a> <a href="../files/viewing_mesh_info.htm"><b>18</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>19</b></a> <a href="../files/taper.htm"><b>20</b></a> <a href="../files/skew.htm"><b>21</b></a> <a href="../files/running_smesh_module.htm"><b>22</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>clicking</b></a> <br><a href="../files/about_meshes.htm"><b>closed</b></a> <br><nobr><a name="bms_CO"></a><a name="subkey_CO"></a>colored <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/warp.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>coloring</b></a> <br><a href="../files/length_of_edges.htm"><b>combining</b></a> <br><nobr>component <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>compose <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> </nobr><br><nobr>composed <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/skew.htm"><b>2</b></a> </nobr><br><nobr>composing <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/displaying_elements_numbers.htm"><b>7</b></a> </nobr><br><nobr>computation <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/constructing_submeshes.htm"><b>3</b></a> </nobr><br><a href="../files/computing_meshes.htm"><b>compute</b></a> <br><a href="../files/computing_meshes.htm"><b>computing</b></a> <br><a href="../files/about_hypotheses.htm"><b>conditions</b></a> <br><nobr>connections <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><a href="../files/connectivity.htm"><b>connectivity</b></a> <br><a href="../files/about_meshes.htm"><b>considered</b></a> <br><nobr>consisting <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><nobr>consists <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/local_length_hypothesis.htm"><b>7</b></a> <a href="../files/length_of_edges.htm"><b>8</b></a> <a href="../files/constructing_submeshes.htm"><b>9</b></a> </nobr><br><nobr>construct <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>constructing <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>construction <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>contain <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>containing</b></a> <br><a href="../files/about_meshing_algorithms.htm"><b>contains</b></a> <br><a href="../files/about_meshes.htm"><b>contour</b></a> <br><nobr>control <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/warp.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> </nobr><br><nobr>controls <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/warp.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>coordinates</b></a> <br><a href="../files/warp.htm"><b>corner</b></a> <br><a href="../files/warp.htm"><b>corners</b></a> <br><nobr>corresponding <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>could</b></a> <br><nobr><a name="bms_CR"></a><a name="subkey_CR"></a>create <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>created <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/warp.htm"><b>creating</b></a> <br><nobr>creation <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>criteria</b></a> <br><nobr>criterion <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/warp.htm"><b>5</b></a> <a href="../files/taper.htm"><b>6</b></a> <a href="../files/skew.htm"><b>7</b></a> </nobr><br><a href="../files/warp.htm"><b>cross</b></a> <br><a name="bms_CU"></a><a name="subkey_CU"></a><a href="../files/about_meshes.htm"><b>curve</b></a> <br>\r
-<br><br>\r
-<a name="bm_D"></a><a name="subkey_DE"></a><a href="../files/about_meshes.htm"><b>dealing</b></a> <br><a href="../files/running_smesh_module.htm"><b>default</b></a> <br><nobr>define <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>defined <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><nobr>definite <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>definition <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>deletion</b></a> <br><nobr>depending <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> </nobr><br><nobr>depends <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>described</b></a> <br><a href="../files/running_smesh_module.htm"><b>desktop</b></a> <br><nobr>destined <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>detail</b></a> <br><br><br></p><p class="ftsbody" align="center"><a href="whlstf1.htm" target="_self" title="previous search group"><b>>></b></a>\r
+<a name="bm_C"></a><a name="subkey_CA"></a><a href="../files/about_meshes.htm"><b>cad</b></a> <br><nobr>calculated <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/length_from_edges.htm"><b>3</b></a> <a href="../files/taper.htm"><b>4</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>calculates</b></a> <br><nobr>calculation <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/length_of_edges.htm"><b>3</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>calculations</b></a> <br><a name="bms_CH"></a><a name="subkey_CH"></a><a href="../files/arithmetic_1d.htm"><b>changes</b></a> <br><a href="../files/changing_orientation_of_elements.htm"><b>changing</b></a> <br><a href="../files/about_quality_controls.htm"><b>characteristic</b></a> <br><a href="../files/about_meshes.htm"><b>characterizes</b></a> <br><a href="../files/about_hypotheses.htm"><b>choice</b></a> <br><nobr>choose <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> <a href="../files/taper.htm"><b>6</b></a> <a href="../files/skew.htm"><b>7</b></a> <a href="../files/running_smesh_module.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> </nobr><br><nobr>chosen <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_CL"></a><a name="subkey_CL"></a>click <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/arithmetic_1d.htm"><b>3</b></a> <a href="../files/area_of_elements.htm"><b>4</b></a> <a href="../files/about_meshing_algorithms.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>9</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>10</b></a> <a href="../files/minimum_angle.htm"><b>11</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>12</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>13</b></a> <a href="../files/local_length_hypothesis.htm"><b>14</b></a> <a href="../files/length_of_edges.htm"><b>15</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>16</b></a> <a href="../files/deflection_1d.htm"><b>17</b></a> <a href="../files/constructing_submeshes.htm"><b>18</b></a> <a href="../files/constructing_meshes.htm"><b>19</b></a> <a href="../files/visualization_modes.htm"><b>20</b></a> <a href="../files/viewing_mesh_info.htm"><b>21</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>22</b></a> <a href="../files/taper.htm"><b>23</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>24</b></a> <a href="../files/skew.htm"><b>25</b></a> <a href="../files/running_smesh_module.htm"><b>26</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>27</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>28</b></a> <a href="../files/warp.htm"><b>29</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>clicking</b></a> <br><a href="../files/about_meshes.htm"><b>closed</b></a> <br><nobr><a name="bms_CO"></a><a name="subkey_CO"></a>colored <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/taper.htm"><b>6</b></a> <a href="../files/skew.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>coloring</b></a> <br><a href="../files/length_of_edges.htm"><b>combining</b></a> <br><nobr>component <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>compose <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> </nobr><br><nobr>composed <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/skew.htm"><b>2</b></a> </nobr><br><nobr>composing <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/displaying_elements_numbers.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> </nobr><br><nobr>computation <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> <a href="../files/constructing_meshes.htm"><b>3</b></a> </nobr><br><a href="../files/computing_meshes.htm"><b>compute</b></a> <br><a href="../files/computing_meshes.htm"><b>computing</b></a> <br><a href="../files/about_hypotheses.htm"><b>conditions</b></a> <br><nobr>conform <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>2</b></a> </nobr><br><a href="../files/deflection_1d.htm"><b>connecting</b></a> <br><nobr>connections <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><a href="../files/connectivity.htm"><b>connectivity</b></a> <br><a href="../files/about_meshes.htm"><b>considered</b></a> <br><nobr>consisting <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><nobr>consists <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/length_of_edges.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> <a href="../files/constructing_meshes.htm"><b>8</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>9</b></a> </nobr><br><a href="../files/start_and_end_length_hypothesis.htm"><b>constant</b></a> <br><nobr>construct <a href="../files/constructing_submeshes.htm"><b>1</b></a> <a href="../files/constructing_meshes.htm"><b>2</b></a> </nobr><br><nobr>constructed <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><nobr>constructing <a href="../files/constructing_submeshes.htm"><b>1</b></a> <a href="../files/constructing_meshes.htm"><b>2</b></a> </nobr><br><nobr>construction <a href="../files/constructing_submeshes.htm"><b>1</b></a> <a href="../files/constructing_meshes.htm"><b>2</b></a> </nobr><br><nobr>contain <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>containing</b></a> <br><a href="../files/about_meshing_algorithms.htm"><b>contains</b></a> <br><a href="../files/about_meshes.htm"><b>contour</b></a> <br><nobr>control <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> </nobr><br><nobr>controls <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/taper.htm"><b>6</b></a> <a href="../files/skew.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>coordinates</b></a> <br><a href="../files/warp.htm"><b>corner</b></a> <br><a href="../files/warp.htm"><b>corners</b></a> <br><nobr>corresponding <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>could</b></a> <br><br><br></p><p class="ftsbody" align="center"><a href="whlstf1.htm" target="_self" title="previous search group"><b>>></b></a>\r
\r
</body>\r
\r
<body marginheight="0" marginwidth="0">\r
<p class="ftsbody" align="center"><a href="whlstf0.htm" target="_self" title="previous search group"><b><<</b></a><br><br></p>\r
<p class="ftsbody">\r
-<nobr><a name="bms_DI"></a><a name="subkey_DI"></a>diagonal <a href="../files/diagonal_iversion_of_elements.htm"><b>1</b></a> <a href="../files/taper.htm"><b>2</b></a> </nobr><br><nobr>dialog <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>different</b></a> <br><a href="../files/about_meshes.htm"><b>dimension</b></a> <br><a href="../files/about_meshes.htm"><b>direct</b></a> <br><a href="../files/warp.htm"><b>direction</b></a> <br><nobr>discretization <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>3</b></a> </nobr><br><a href="../files/displacing_nodes.htm"><b>displacing</b></a> <br><nobr>display <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>5</b></a> <a href="../files/displaying_elements_numbers.htm"><b>6</b></a> <a href="../files/warp.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> </nobr><br><nobr>displayed <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/warp.htm"><b>6</b></a> <a href="../files/viewing_mesh_info.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> </nobr><br><nobr>displaying <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/visualization_modes.htm"><b>3</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>disposal</b></a> <br><a href="../files/warp.htm"><b>distance</b></a> <br><a name="bms_DO"></a><a name="subkey_DO"></a><a href="../files/about_meshes.htm"><b>don</b></a> <br>\r
+<nobr><a name="bms_CR"></a><a name="subkey_CR"></a>create <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/deflection_1d.htm"><b>12</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>13</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>14</b></a> <a href="../files/running_smesh_module.htm"><b>15</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>16</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>17</b></a> </nobr><br><nobr>created <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/warp.htm"><b>creating</b></a> <br><nobr>creation <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>criteria</b></a> <br><nobr>criterion <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/taper.htm"><b>5</b></a> <a href="../files/skew.htm"><b>6</b></a> <a href="../files/warp.htm"><b>7</b></a> </nobr><br><a href="../files/warp.htm"><b>cross</b></a> <br><nobr><a name="bms_CU"></a><a name="subkey_CU"></a>curve <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/deflection_1d.htm"><b>2</b></a> </nobr><br>\r
<br><br>\r
-<nobr><a name="bm_E"></a><a name="subkey_ED"></a>edge <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/warp.htm"><b>3</b></a> </nobr><br><nobr>edges <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/length_of_edges.htm"><b>9</b></a> <a href="../files/introduction_to_smesh.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> </nobr><br><a href="../files/editing_hypotheses.htm"><b>editing</b></a> <br><nobr><a name="bms_EL"></a><a name="subkey_EL"></a>element <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> </nobr><br><nobr>elements <a href="../files/changing_orientation_of_elements.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>4</b></a> <a href="../files/about_quality_controls.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>7</b></a> <a href="../files/minimum_angle.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/length_of_edges.htm"><b>11</b></a> <a href="../files/introduction_to_smesh.htm"><b>12</b></a> <a href="../files/displaying_elements_numbers.htm"><b>13</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>14</b></a> <a href="../files/warp.htm"><b>15</b></a> <a href="../files/taper.htm"><b>16</b></a> <a href="../files/skew.htm"><b>17</b></a> </nobr><br><a name="bms_EN"></a><a name="subkey_EN"></a><a href="../files/constructing_submeshes.htm"><b>encapsulate</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>enter</b></a> <br><nobr>entities <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>7</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>entity</b></a> <br><a name="bms_EQ"></a><a name="subkey_EQ"></a><a href="../files/aspect_ratio.htm"><b>equal</b></a> <br><a href="../files/aspect_ratio.htm"><b>equilateral</b></a> <br><a name="bms_ET"></a><a name="subkey_ET"></a><a href="../files/about_quality_controls.htm"><b>etc</b></a> <br><a name="bms_EV"></a><a name="subkey_EV"></a><a href="../files/warp.htm"><b>every</b></a> <br><a name="bms_EX"></a><a name="subkey_EX"></a><a href="../files/about_meshes.htm"><b>example</b></a> <br><nobr>export <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>exportation</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>exported</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>exporting</b></a> <br><a href="../files/warp.htm"><b>extends</b></a> <br>\r
+<a name="bm_D"></a><a name="subkey_D{"></a><a href="../files/arithmetic_1d.htm"><b>d</b></a> <br><a name="bms_DE"></a><a name="subkey_DE"></a><a href="../files/about_meshes.htm"><b>dealing</b></a> <br><a href="../files/running_smesh_module.htm"><b>default</b></a> <br><nobr>define <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/deflection_1d.htm"><b>5</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> </nobr><br><nobr>defined <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><nobr>definite <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>definition <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>deflection <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/deflection_1d.htm"><b>2</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>deletion</b></a> <br><nobr>depending <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> </nobr><br><nobr>depends <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>described</b></a> <br><a href="../files/running_smesh_module.htm"><b>desktop</b></a> <br><nobr>destined <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>detail</b></a> <br><nobr><a name="bms_DI"></a><a name="subkey_DI"></a>diagonal <a href="../files/diagonal_iversion_of_elements.htm"><b>1</b></a> <a href="../files/taper.htm"><b>2</b></a> </nobr><br><nobr>dialog <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> <a href="../files/deflection_1d.htm"><b>6</b></a> <a href="../files/constructing_submeshes.htm"><b>7</b></a> <a href="../files/constructing_meshes.htm"><b>8</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>different</b></a> <br><a href="../files/start_and_end_length_hypothesis.htm"><b>differs</b></a> <br><a href="../files/about_meshes.htm"><b>dimension</b></a> <br><a href="../files/about_meshes.htm"><b>direct</b></a> <br><a href="../files/warp.htm"><b>direction</b></a> <br><nobr>discretization <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>3</b></a> </nobr><br><a href="../files/displacing_nodes.htm"><b>displacing</b></a> <br><nobr>display <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>5</b></a> <a href="../files/displaying_elements_numbers.htm"><b>6</b></a> <a href="../files/visualization_modes.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> <a href="../files/warp.htm"><b>10</b></a> </nobr><br><nobr>displayed <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/viewing_mesh_info.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> </nobr><br><nobr>displaying <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/visualization_modes.htm"><b>3</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>disposal</b></a> <br><nobr>distance <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr>divided <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><a name="bms_DO"></a><a name="subkey_DO"></a><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>does</b></a> <br><a href="../files/about_meshes.htm"><b>don</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_F"></a><a name="subkey_FA"></a>face <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr>faces <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>6</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/introduction_to_smesh.htm"><b>9</b></a> </nobr><br><a name="bms_FI"></a><a name="subkey_FI"></a><a href="../files/importing_and_exporting_meshes.htm"><b>file</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>files</b></a> <br><a href="../files/computing_meshes.htm"><b>final</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>find</b></a> <br><a href="../files/about_meshes.htm"><b>fixed</b></a> <br><nobr><a name="bms_FO"></a><a name="subkey_FO"></a>following <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>5</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>6</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/constructing_submeshes.htm"><b>9</b></a> <a href="../files/viewing_mesh_info.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> </nobr><br><nobr>follows <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>3</b></a> <a href="../files/displaying_elements_numbers.htm"><b>4</b></a> <a href="../files/running_smesh_module.htm"><b>5</b></a> </nobr><br><nobr>format <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><nobr>four <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_FR"></a><a name="subkey_FR"></a>free <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_FU"></a><a name="subkey_FU"></a>functionality <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>functions</b></a> <br>\r
+<nobr><a name="bm_E"></a><a name="subkey_ED"></a>edge <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/length_from_edges.htm"><b>3</b></a> <a href="../files/deflection_1d.htm"><b>4</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>5</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>6</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> </nobr><br><nobr>edges <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/arithmetic_1d.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/about_meshing_algorithms.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/length_of_edges.htm"><b>9</b></a> <a href="../files/length_from_edges.htm"><b>10</b></a> <a href="../files/introduction_to_smesh.htm"><b>11</b></a> <a href="../files/deflection_1d.htm"><b>12</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>13</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>14</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>15</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>16</b></a> <a href="../files/warp.htm"><b>17</b></a> </nobr><br><a href="../files/editing_hypotheses.htm"><b>editing</b></a> <br><nobr><a name="bms_EL"></a><a name="subkey_EL"></a>element <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> </nobr><br><nobr>elements <a href="../files/changing_orientation_of_elements.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>4</b></a> <a href="../files/about_quality_controls.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/length_of_edges.htm"><b>10</b></a> <a href="../files/introduction_to_smesh.htm"><b>11</b></a> <a href="../files/displaying_elements_numbers.htm"><b>12</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>13</b></a> <a href="../files/deflection_1d.htm"><b>14</b></a> <a href="../files/taper.htm"><b>15</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>16</b></a> <a href="../files/skew.htm"><b>17</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>18</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>19</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>20</b></a> <a href="../files/warp.htm"><b>21</b></a> </nobr><br><a name="bms_EN"></a><a name="subkey_EN"></a><a href="../files/constructing_submeshes.htm"><b>encapsulate</b></a> <br><nobr>end <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>ending</b></a> <br><nobr>ends <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>enter</b></a> <br><nobr>entities <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>7</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>8</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>entity</b></a> <br><nobr><a name="bms_EQ"></a><a name="subkey_EQ"></a>equal <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/deflection_1d.htm"><b>2</b></a> </nobr><br><a href="../files/aspect_ratio.htm"><b>equilateral</b></a> <br><a name="bms_ET"></a><a name="subkey_ET"></a><a href="../files/about_quality_controls.htm"><b>etc</b></a> <br><a name="bms_EV"></a><a name="subkey_EV"></a><a href="../files/warp.htm"><b>every</b></a> <br><nobr><a name="bms_EX"></a><a name="subkey_EX"></a>example <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>2</b></a> </nobr><br><nobr>export <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>exportation</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>exported</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>exporting</b></a> <br><a href="../files/warp.htm"><b>extends</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_G"></a><a name="subkey_GE"></a>generate <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><nobr>generated <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> </nobr><br><a href="../files/computing_meshes.htm"><b>generation</b></a> <br><nobr>geom <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><nobr>geometric <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><nobr>geometrical <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>9</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>10</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>11</b></a> <a href="../files/local_length_hypothesis.htm"><b>12</b></a> <a href="../files/introduction_to_smesh.htm"><b>13</b></a> <a href="../files/constructing_submeshes.htm"><b>14</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>15</b></a> </nobr><br><a name="bms_GL"></a><a name="subkey_GL"></a><a href="../files/constructing_meshes.htm"><b>global</b></a> <br><a name="bms_GR"></a><a name="subkey_GR"></a><a href="../files/introduction_to_smesh.htm"><b>grouping</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>groups</b></a> <br>\r
+<nobr><a name="bm_F"></a><a name="subkey_FA"></a>face <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>2</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>3</b></a> <a href="../files/warp.htm"><b>4</b></a> </nobr><br><nobr>faces <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/local_length_hypothesis.htm"><b>7</b></a> <a href="../files/introduction_to_smesh.htm"><b>8</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>9</b></a> </nobr><br><a href="../files/start_and_end_length_hypothesis.htm"><b>factor</b></a> <br><a name="bms_FI"></a><a name="subkey_FI"></a><a href="../files/importing_and_exporting_meshes.htm"><b>file</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>files</b></a> <br><a href="../files/computing_meshes.htm"><b>final</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>find</b></a> <br><a href="../files/start_and_end_length_hypothesis.htm"><b>first</b></a> <br><a href="../files/about_meshes.htm"><b>fixed</b></a> <br><nobr><a name="bms_FO"></a><a name="subkey_FO"></a>following <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>6</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/deflection_1d.htm"><b>9</b></a> <a href="../files/constructing_submeshes.htm"><b>10</b></a> <a href="../files/constructing_meshes.htm"><b>11</b></a> <a href="../files/viewing_mesh_info.htm"><b>12</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>13</b></a> <a href="../files/running_smesh_module.htm"><b>14</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>15</b></a> </nobr><br><nobr>follows <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>3</b></a> <a href="../files/displaying_elements_numbers.htm"><b>4</b></a> <a href="../files/running_smesh_module.htm"><b>5</b></a> </nobr><br><nobr>format <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><nobr>four <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_FR"></a><a name="subkey_FR"></a>free <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_FU"></a><a name="subkey_FU"></a>functionality <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>functions</b></a> <br>\r
<br><br>\r
-<a name="bm_H"></a><a name="subkey_H{"></a><a href="../files/warp.htm"><b>h</b></a> <br><a href="../files/aspect_ratio.htm"><b>h1</b></a> <br><a href="../files/aspect_ratio.htm"><b>h2</b></a> <br><a name="bms_HA"></a><a name="subkey_HA"></a><a href="../files/warp.htm"><b>half</b></a> <br><nobr><a name="bms_HE"></a><a name="subkey_HE"></a>height <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>help</b></a> <br><nobr>here <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>6</b></a> <a href="../files/displacing_nodes.htm"><b>7</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>8</b></a> <a href="../files/visualization_properties.htm"><b>9</b></a> <a href="../files/scalar_bar_properties.htm"><b>10</b></a> </nobr><br><nobr>hexahedron <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> </nobr><br><a href="../files/max._element_volume_hypothsis.htm"><b>hexahedrons</b></a> <br><a name="bms_HI"></a><a name="subkey_HI"></a><a href="../files/about_meshes.htm"><b>higher</b></a> <br><nobr><a name="bms_HY"></a><a name="subkey_HY"></a>hyp <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>hypotheses <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>7</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/introduction_to_smesh.htm"><b>12</b></a> <a href="../files/editing_hypotheses.htm"><b>13</b></a> <a href="../files/constructing_submeshes.htm"><b>14</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>15</b></a> </nobr><br><nobr>hypothesis <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> </nobr><br>\r
+<nobr><a name="bm_G"></a><a name="subkey_GE"></a>generate <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>generated <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>5</b></a> </nobr><br><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>generates</b></a> <br><a href="../files/computing_meshes.htm"><b>generation</b></a> <br><nobr>geom <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> </nobr><br><nobr>geometric <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><nobr>geometrical <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/introduction_to_smesh.htm"><b>11</b></a> <a href="../files/deflection_1d.htm"><b>12</b></a> <a href="../files/constructing_submeshes.htm"><b>13</b></a> <a href="../files/constructing_meshes.htm"><b>14</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>15</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>16</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>17</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>18</b></a> </nobr><br><a name="bms_GH"></a><a name="subkey_GH"></a><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>ghs3d</b></a> <br><nobr><a name="bms_GI"></a><a name="subkey_GI"></a>given <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/length_from_edges.htm"><b>2</b></a> </nobr><br><a name="bms_GL"></a><a name="subkey_GL"></a><a href="../files/constructing_meshes.htm"><b>global</b></a> <br><a name="bms_GR"></a><a name="subkey_GR"></a><a href="../files/introduction_to_smesh.htm"><b>grouping</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>groups</b></a> <br>\r
<br><br>\r
-<a name="bm_I"></a><a name="subkey_I{"></a><a href="../files/3d_meshing_algorithm.htm"><b>i</b></a> <br><a name="bms_IC"></a><a name="subkey_IC"></a><a href="../files/running_smesh_module.htm"><b>icon</b></a> <br><nobr><a name="bms_ID"></a><a name="subkey_ID"></a>id <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br><a name="bms_IF"></a><a name="subkey_IF"></a><a href="../files/about_meshes.htm"><b>if</b></a> <br><a name="bms_IM"></a><a name="subkey_IM"></a><a href="../files/about_meshes.htm"><b>imply</b></a> <br><nobr>import <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>importation</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>imported</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>importing</b></a> <br><a name="bms_IN"></a><a name="subkey_IN"></a><a href="../files/about_meshes.htm"><b>including</b></a> <br><a href="../files/warp.htm"><b>indicates</b></a> <br><a href="../files/viewing_mesh_info.htm"><b>info</b></a> <br><nobr>information <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/viewing_mesh_info.htm"><b>2</b></a> </nobr><br><a href="../files/viewing_mesh_info.htm"><b>infos</b></a> <br><a href="../files/running_smesh_module.htm"><b>initial</b></a> <br><a href="../files/about_meshes.htm"><b>interested</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>introduction</b></a> <br><a href="../files/about_meshes.htm"><b>inverse</b></a> <br><a href="../files/diagonal_iversion_of_elements.htm"><b>inversion</b></a> <br><a name="bms_IT"></a><a name="subkey_IT"></a><a href="../files/importing_and_exporting_meshes.htm"><b>item</b></a> <br>\r
-<br><br>\r
-<a name="bm_J"></a><a name="subkey_J{"></a><a href="../files/3d_meshing_algorithm.htm"><b>j</b></a> <br><a name="bms_JO"></a><a name="subkey_JO"></a><a href="../files/skew.htm"><b>join</b></a> <br>\r
-<br><br>\r
-<a name="bm_K"></a><a name="subkey_K{"></a><a href="../files/3d_meshing_algorithm.htm"><b>k</b></a> <br><a name="bms_KI"></a><a name="subkey_KI"></a><a href="../files/about_meshing_algorithms.htm"><b>kinds</b></a> <br>\r
-<br><br>\r
-<a name="bm_L"></a><a name="subkey_L{"></a><a href="../files/warp.htm"><b>l</b></a> <br><a name="bms_LA"></a><a name="subkey_LA"></a><a href="../files/aspect_ratio.htm"><b>largest</b></a> <br><a href="../files/running_smesh_module.htm"><b>launching</b></a> <br><nobr><a name="bms_LE"></a><a name="subkey_LE"></a>length <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/length_of_edges.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/warp.htm"><b>8</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>level</b></a> <br><nobr><a name="bms_LI"></a><a name="subkey_LI"></a>like <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>line</b></a> <br><a href="../files/skew.htm"><b>lines</b></a> <br><nobr><a name="bms_LO"></a><a name="subkey_LO"></a>local <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> <a href="../files/constructing_submeshes.htm"><b>5</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>locally</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>location</b></a> <br><a href="../files/aspect_ratio.htm"><b>longest</b></a> <br><nobr>look <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>lower</b></a> <br>\r
-<br><br>\r
-<a name="bm_M"></a><a name="subkey_MA"></a><a href="../files/running_smesh_module.htm"><b>main</b></a> <br><a href="../files/about_hypotheses.htm"><b>manage</b></a> <br><a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>mapping</b></a> <br><nobr>max <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>maximum <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> <a href="../files/skew.htm"><b>3</b></a> </nobr><br><a name="bms_ME"></a><a name="subkey_ME"></a><a href="../files/about_meshes.htm"><b>meaning</b></a> <br><a href="../files/about_meshes.htm"><b>meaningful</b></a> <br><a href="../files/warp.htm"><b>measured</b></a> <br><a href="../files/2d_meshing_algorithm.htm"><b>mefisto</b></a> <br><nobr>menu <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>11</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>12</b></a> <a href="../files/displaying_elements_numbers.htm"><b>13</b></a> <a href="../files/constructing_submeshes.htm"><b>14</b></a> <a href="../files/viewing_mesh_info.htm"><b>15</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>16</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>menus</b></a> <br><nobr>mesh <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/aspect_ratio.htm"><b>3</b></a> <a href="../files/area_of_elements.htm"><b>4</b></a> <a href="../files/about_quality_controls.htm"><b>5</b></a> <a href="../files/about_meshes.htm"><b>6</b></a> <a href="../files/about_hypotheses.htm"><b>7</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>8</b></a> <a href="../files/minimum_angle.htm"><b>9</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>10</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>11</b></a> <a href="../files/local_length_hypothesis.htm"><b>12</b></a> <a href="../files/length_of_edges.htm"><b>13</b></a> <a href="../files/introduction_to_smesh.htm"><b>14</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>15</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>16</b></a> <a href="../files/displaying_elements_numbers.htm"><b>17</b></a> <a href="../files/constructing_submeshes.htm"><b>18</b></a> <a href="../files/warp.htm"><b>19</b></a> <a href="../files/viewing_mesh_info.htm"><b>20</b></a> <a href="../files/taper.htm"><b>21</b></a> <a href="../files/skew.htm"><b>22</b></a> </nobr><br><nobr>meshed <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><nobr>meshes <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>8</b></a> <a href="../files/visualization_modes.htm"><b>9</b></a> <a href="../files/viewing_mesh_info.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> </nobr><br><nobr>meshing <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/about_meshing_algorithms.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>8</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> <a href="../files/minimum_angle.htm"><b>11</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>12</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>13</b></a> <a href="../files/local_length_hypothesis.htm"><b>14</b></a> <a href="../files/length_of_edges.htm"><b>15</b></a> <a href="../files/introduction_to_smesh.htm"><b>16</b></a> <a href="../files/displaying_elements_numbers.htm"><b>17</b></a> <a href="../files/constructing_submeshes.htm"><b>18</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>19</b></a> </nobr><br><br><br></p><p class="ftsbody" align="center"><a href="whlstf2.htm" target="_self" title="previous search group"><b>>></b></a>\r
+<a name="bm_H"></a><a name="subkey_H{"></a><a href="../files/warp.htm"><b>h</b></a> <br><a href="../files/aspect_ratio.htm"><b>h1</b></a> <br><a href="../files/aspect_ratio.htm"><b>h2</b></a> <br><a name="bms_HA"></a><a name="subkey_HA"></a><a href="../files/warp.htm"><b>half</b></a> <br><nobr>having <a href="../files/length_from_edges.htm"><b>1</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>2</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_HE"></a><a name="subkey_HE"></a>height <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>help</b></a> <br><nobr>here <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/displacing_nodes.htm"><b>6</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>7</b></a> <a href="../files/visualization_properties.htm"><b>8</b></a> <a href="../files/scalar_bar_properties.htm"><b>9</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>10</b></a> </nobr><br><nobr>hexahedron <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> </nobr><br><a href="../files/max._element_volume_hypothsis.htm"><b>hexahedrons</b></a> <br><a name="bms_HI"></a><a name="subkey_HI"></a><a href="../files/about_meshes.htm"><b>higher</b></a> <br><nobr><a name="bms_HY"></a><a name="subkey_HY"></a>hyp <a href="../files/constructing_submeshes.htm"><b>1</b></a> <a href="../files/constructing_meshes.htm"><b>2</b></a> </nobr><br><nobr>hypotheses <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/introduction_to_smesh.htm"><b>11</b></a> <a href="../files/editing_hypotheses.htm"><b>12</b></a> <a href="../files/deflection_1d.htm"><b>13</b></a> <a href="../files/constructing_submeshes.htm"><b>14</b></a> <a href="../files/constructing_meshes.htm"><b>15</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>16</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>17</b></a> <a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>18</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>19</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>20</b></a> </nobr><br><nobr>hypothesis <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/length_from_edges.htm"><b>6</b></a> <a href="../files/deflection_1d.htm"><b>7</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>8</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>11</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>12</b></a> </nobr><br><br><br></p><p class="ftsbody" align="center"><a href="whlstf2.htm" target="_self" title="previous search group"><b>>></b></a>\r
\r
</body>\r
\r
<body marginheight="0" marginwidth="0">\r
<p class="ftsbody" align="center"><a href="whlstf1.htm" target="_self" title="previous search group"><b><<</b></a><br><br></p>\r
<p class="ftsbody">\r
-<nobr><a name="bms_MI"></a><a name="subkey_MI"></a>minimum <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a name="bms_MO"></a><a name="subkey_MO"></a><a href="../files/about_meshes.htm"><b>model</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>models</b></a> <br><a href="../files/visualization_modes.htm"><b>modes</b></a> <br><nobr>modification <a href="../files/about_modification_of_meshes.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><nobr>module <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/running_smesh_module.htm"><b>4</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>moving</b></a> <br><a name="bms_MU"></a><a name="subkey_MU"></a><a href="../files/introduction_to_smesh.htm"><b>multi</b></a> <br><a href="../files/aspect_ratio.htm"><b>multiplied</b></a> <br>\r
+\r
+\r
+<a name="bm_I"></a><a name="subkey_I{"></a><a href="../files/3d_meshing_algorithm.htm"><b>i</b></a> <br><a name="bms_IC"></a><a name="subkey_IC"></a><a href="../files/running_smesh_module.htm"><b>icon</b></a> <br><nobr><a name="bms_ID"></a><a name="subkey_ID"></a>id <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_IF"></a><a name="subkey_IF"></a>if <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>2</b></a> </nobr><br><a name="bms_IM"></a><a name="subkey_IM"></a><a href="../files/about_meshes.htm"><b>imply</b></a> <br><nobr>import <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/importing_and_exporting_meshes.htm"><b>importation</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>imported</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>importing</b></a> <br><a name="bms_IN"></a><a name="subkey_IN"></a><a href="../files/about_meshes.htm"><b>including</b></a> <br><a href="../files/warp.htm"><b>indicates</b></a> <br><a href="../files/viewing_mesh_info.htm"><b>info</b></a> <br><nobr>information <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/viewing_mesh_info.htm"><b>2</b></a> </nobr><br><a href="../files/viewing_mesh_info.htm"><b>infos</b></a> <br><a href="../files/running_smesh_module.htm"><b>initial</b></a> <br><a href="../files/about_meshes.htm"><b>interested</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>introduction</b></a> <br><a href="../files/about_meshes.htm"><b>inverse</b></a> <br><a href="../files/diagonal_iversion_of_elements.htm"><b>inversion</b></a> <br><a name="bms_IT"></a><a name="subkey_IT"></a><a href="../files/importing_and_exporting_meshes.htm"><b>item</b></a> <br><nobr>items <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br>\r
+<br><br>\r
+<a name="bm_J"></a><a name="subkey_J{"></a><a href="../files/3d_meshing_algorithm.htm"><b>j</b></a> <br><a name="bms_JO"></a><a name="subkey_JO"></a><a href="../files/skew.htm"><b>join</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_N"></a><a name="subkey_NA"></a>name <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> </nobr><br><a name="bms_NB"></a><a name="subkey_NB"></a><a href="../files/number_of_segments_hypothesis.htm"><b>nb</b></a> <br><a name="bms_NE"></a><a name="subkey_NE"></a><a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>netgen</b></a> <br><a href="../files/running_smesh_module.htm"><b>new</b></a> <br><a name="bms_NO"></a><a name="subkey_NO"></a><a href="../files/about_meshes.htm"><b>node</b></a> <br><nobr>nodes <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>5</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>6</b></a> <a href="../files/local_length_hypothesis.htm"><b>7</b></a> <a href="../files/introduction_to_smesh.htm"><b>8</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>9</b></a> <a href="../files/displacing_nodes.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> <a href="../files/taper.htm"><b>12</b></a> <a href="../files/skew.htm"><b>13</b></a> </nobr><br><a href="../files/warp.htm"><b>normal</b></a> <br><a href="../files/about_meshes.htm"><b>notice</b></a> <br><nobr><a name="bms_NU"></a><a name="subkey_NU"></a>number <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>numbering <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br><nobr>numbers <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br>\r
+<a name="bm_K"></a><a name="subkey_K{"></a><a href="../files/3d_meshing_algorithm.htm"><b>k</b></a> <br><a name="bms_KI"></a><a name="subkey_KI"></a><a href="../files/about_meshing_algorithms.htm"><b>kinds</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_O"></a><a name="subkey_OB"></a>object <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>6</b></a> <a href="../files/local_length_hypothesis.htm"><b>7</b></a> <a href="../files/constructing_submeshes.htm"><b>8</b></a> <a href="../files/viewing_mesh_info.htm"><b>9</b></a> </nobr><br><nobr>objects <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>7</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>8</b></a> </nobr><br><a name="bms_OK"></a><a name="subkey_OK"></a><a href="../files/importing_and_exporting_meshes.htm"><b>ok</b></a> <br><nobr><a name="bms_ON"></a><a name="subkey_ON"></a>one <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/constructing_submeshes.htm"><b>3</b></a> </nobr><br><a name="bms_OP"></a><a name="subkey_OP"></a><a href="../files/introduction_to_smesh.htm"><b>operations</b></a> <br><a href="../files/skew.htm"><b>opposite</b></a> <br><a href="../files/about_meshes.htm"><b>options</b></a> <br><a name="bms_OR"></a><a name="subkey_OR"></a><a href="../files/about_meshes.htm"><b>order</b></a> <br><a href="../files/changing_orientation_of_elements.htm"><b>orientation</b></a> <br><a href="../files/warp.htm"><b>origin</b></a> <br><a name="bms_OW"></a><a name="subkey_OW"></a><a href="../files/about_meshes.htm"><b>own</b></a> <br>\r
+<a name="bm_L"></a><a name="subkey_L{"></a><a href="../files/warp.htm"><b>l</b></a> <br><a name="bms_LA"></a><a name="subkey_LA"></a><a href="../files/aspect_ratio.htm"><b>largest</b></a> <br><a href="../files/start_and_end_length_hypothesis.htm"><b>last</b></a> <br><a href="../files/running_smesh_module.htm"><b>launching</b></a> <br><nobr><a name="bms_LE"></a><a name="subkey_LE"></a>length <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/arithmetic_1d.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/length_of_edges.htm"><b>6</b></a> <a href="../files/length_from_edges.htm"><b>7</b></a> <a href="../files/introduction_to_smesh.htm"><b>8</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> </nobr><br><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>less</b></a> <br><a href="../files/about_hypotheses.htm"><b>level</b></a> <br><nobr><a name="bms_LI"></a><a name="subkey_LI"></a>like <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><nobr>line <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/deflection_1d.htm"><b>2</b></a> </nobr><br><a href="../files/skew.htm"><b>lines</b></a> <br><a name="bms_LK"></a><a name="subkey_LK"></a><a href="../files/arithmetic_1d.htm"><b>lk</b></a> <br><nobr><a name="bms_LO"></a><a name="subkey_LO"></a>local <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>locally <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>2</b></a> </nobr><br><nobr>location <a href="../files/importing_and_exporting_meshes.htm"><b>1</b></a> <a href="../files/deflection_1d.htm"><b>2</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/aspect_ratio.htm"><b>longest</b></a> <br><nobr>look <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>lower</b></a> <br>\r
<br><br>\r
-<a name="bm_P"></a><a name="subkey_PA"></a><a href="../files/about_meshes.htm"><b>parameter</b></a> <br><a href="../files/about_hypotheses.htm"><b>parameters</b></a> <br><a href="../files/about_meshes.htm"><b>parametric</b></a> <br><a href="../files/about_meshes.htm"><b>particularity</b></a> <br><a name="bms_PE"></a><a name="subkey_PE"></a><a href="../files/aspect_ratio.htm"><b>perfect</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>performing</b></a> <br><a name="bms_PL"></a><a name="subkey_PL"></a><a href="../files/warp.htm"><b>planar</b></a> <br><a href="../files/warp.htm"><b>plane</b></a> <br><a href="../files/running_smesh_module.htm"><b>platform</b></a> <br><nobr><a name="bms_PO"></a><a name="subkey_PO"></a>point <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr>points <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>position</b></a> <br><a href="../files/about_hypotheses.htm"><b>possible</b></a> <br><a name="bms_PR"></a><a name="subkey_PR"></a><a href="../files/about_quality_controls.htm"><b>presentation</b></a> <br><a href="../files/about_meshes.htm"><b>presented</b></a> <br><a href="../files/about_hypotheses.htm"><b>preset</b></a> <br><nobr>previously <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/constructing_submeshes.htm"><b>3</b></a> </nobr><br><a href="../files/aspect_ratio.htm"><b>procedure</b></a> <br><a href="../files/about_meshes.htm"><b>produced</b></a> <br><a href="../files/warp.htm"><b>product</b></a> <br><a href="../files/warp.htm"><b>projection</b></a> <br><nobr>properties <a href="../files/visualization_properties.htm"><b>1</b></a> <a href="../files/scalar_bar_properties.htm"><b>2</b></a> </nobr><br>\r
+<nobr><a name="bm_M"></a><a name="subkey_MA"></a>main <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/running_smesh_module.htm"><b>3</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>manage</b></a> <br><a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>mapping</b></a> <br><nobr>max <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>maximum <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> <a href="../files/deflection_1d.htm"><b>3</b></a> <a href="../files/skew.htm"><b>4</b></a> </nobr><br><a name="bms_ME"></a><a name="subkey_ME"></a><a href="../files/about_meshes.htm"><b>meaning</b></a> <br><a href="../files/about_meshes.htm"><b>meaningful</b></a> <br><a href="../files/warp.htm"><b>measured</b></a> <br><a href="../files/2d_meshing_algorithm.htm"><b>mefisto</b></a> <br><nobr>menu <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/arithmetic_1d.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>12</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>13</b></a> <a href="../files/displaying_elements_numbers.htm"><b>14</b></a> <a href="../files/deflection_1d.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/constructing_meshes.htm"><b>17</b></a> <a href="../files/visualization_modes.htm"><b>18</b></a> <a href="../files/viewing_mesh_info.htm"><b>19</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>20</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>21</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>22</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>23</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>menus</b></a> <br><nobr>mesh <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/about_quality_controls.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/length_of_edges.htm"><b>11</b></a> <a href="../files/length_from_edges.htm"><b>12</b></a> <a href="../files/introduction_to_smesh.htm"><b>13</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>14</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>15</b></a> <a href="../files/displaying_elements_numbers.htm"><b>16</b></a> <a href="../files/deflection_1d.htm"><b>17</b></a> <a href="../files/constructing_submeshes.htm"><b>18</b></a> <a href="../files/constructing_meshes.htm"><b>19</b></a> <a href="../files/visualization_modes.htm"><b>20</b></a> <a href="../files/viewing_mesh_info.htm"><b>21</b></a> <a href="../files/taper.htm"><b>22</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>23</b></a> <a href="../files/skew.htm"><b>24</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>25</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>26</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>27</b></a> <a href="../files/warp.htm"><b>28</b></a> </nobr><br><nobr>meshed <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><nobr>meshes <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_modification_of_meshes.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>7</b></a> <a href="../files/constructing_meshes.htm"><b>8</b></a> <a href="../files/visualization_modes.htm"><b>9</b></a> <a href="../files/viewing_mesh_info.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>12</b></a> </nobr><br><nobr>meshing <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/minimum_angle.htm"><b>9</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>10</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>11</b></a> <a href="../files/local_length_hypothesis.htm"><b>12</b></a> <a href="../files/length_of_edges.htm"><b>13</b></a> <a href="../files/introduction_to_smesh.htm"><b>14</b></a> <a href="../files/displaying_elements_numbers.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/constructing_meshes.htm"><b>17</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>18</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>19</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>20</b></a> </nobr><br><nobr><a name="bms_MI"></a><a name="subkey_MI"></a>minimum <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/minimum_angle.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><a name="bms_MO"></a><a name="subkey_MO"></a><a href="../files/visualization_modes.htm"><b>mode</b></a> <br><a href="../files/about_meshes.htm"><b>model</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>models</b></a> <br><a href="../files/visualization_modes.htm"><b>modes</b></a> <br><nobr>modification <a href="../files/about_modification_of_meshes.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> </nobr><br><nobr>module <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/running_smesh_module.htm"><b>4</b></a> </nobr><br><a href="../files/introduction_to_smesh.htm"><b>moving</b></a> <br><a name="bms_MU"></a><a name="subkey_MU"></a><a href="../files/introduction_to_smesh.htm"><b>multi</b></a> <br><a href="../files/aspect_ratio.htm"><b>multiplied</b></a> <br>\r
<br><br>\r
-<a name="bm_Q"></a><a name="subkey_QU"></a><a href="../files/warp.htm"><b>quad</b></a> <br><nobr>quadrangle <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> </nobr><br><nobr>quadrangles <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/skew.htm"><b>5</b></a> </nobr><br><nobr>quality <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/warp.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>quantity</b></a> <br>\r
+<nobr><a name="bm_N"></a><a name="subkey_NA"></a>name <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>5</b></a> <a href="../files/deflection_1d.htm"><b>6</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>7</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>8</b></a> </nobr><br><a name="bms_NB"></a><a name="subkey_NB"></a><a href="../files/number_of_segments_hypothesis.htm"><b>nb</b></a> <br><a name="bms_NE"></a><a name="subkey_NE"></a><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>need</b></a> <br><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>needs</b></a> <br><nobr>netgen <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>1</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>2</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>new</b></a> <br><a name="bms_NO"></a><a name="subkey_NO"></a><a href="../files/about_meshes.htm"><b>node</b></a> <br><nobr>nodes <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>7</b></a> <a href="../files/displacing_nodes.htm"><b>8</b></a> <a href="../files/deflection_1d.htm"><b>9</b></a> <a href="../files/taper.htm"><b>10</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>11</b></a> <a href="../files/skew.htm"><b>12</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>13</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>14</b></a> <a href="../files/warp.htm"><b>15</b></a> </nobr><br><a href="../files/warp.htm"><b>normal</b></a> <br><a href="../files/about_meshes.htm"><b>notice</b></a> <br><nobr><a name="bms_NU"></a><a name="subkey_NU"></a>number <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> </nobr><br><nobr>numbering <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br><nobr>numbers <a href="../files/displaying_nodes_numbers.htm"><b>1</b></a> <a href="../files/displaying_elements_numbers.htm"><b>2</b></a> </nobr><br>\r
<br><br>\r
-<nobr><a name="bm_R"></a><a name="subkey_RA"></a>ratio <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/warp.htm"><b>4</b></a> <a href="../files/taper.htm"><b>5</b></a> </nobr><br><a name="bms_RE"></a><a name="subkey_RE"></a><a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>reassigning</b></a> <br><nobr>reference <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>refined</b></a> <br><a href="../files/skew.htm"><b>reflects</b></a> <br><a href="../files/running_smesh_module.htm"><b>related</b></a> <br><a href="../files/about_meshes.htm"><b>relations</b></a> <br><a href="../files/about_meshes.htm"><b>relationship</b></a> <br><a href="../files/about_meshes.htm"><b>relationships</b></a> <br><a href="../files/aspect_ratio.htm"><b>remaining</b></a> <br><a href="../files/removing_nodes_and_elements.htm"><b>removing</b></a> <br><a href="../files/aspect_ratio.htm"><b>repeated</b></a> <br><nobr>represent <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>representation</b></a> <br><a href="../files/about_meshes.htm"><b>representations</b></a> <br><nobr>represents <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/taper.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>restricted</b></a> <br><a href="../files/about_hypotheses.htm"><b>resulting</b></a> <br><a href="../files/aspect_ratio.htm"><b>retained</b></a> <br><a href="../files/about_meshes.htm"><b>retrieve</b></a> <br><a name="bms_RO"></a><a name="subkey_RO"></a><a href="../files/about_hypotheses.htm"><b>rough</b></a> <br><a name="bms_RU"></a><a name="subkey_RU"></a><a href="../files/running_smesh_module.htm"><b>run</b></a> <br><a href="../files/running_smesh_module.htm"><b>running</b></a> <br>\r
+<nobr><a name="bm_O"></a><a name="subkey_OB"></a>object <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>3</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>4</b></a> <a href="../files/local_length_hypothesis.htm"><b>5</b></a> <a href="../files/constructing_submeshes.htm"><b>6</b></a> <a href="../files/constructing_meshes.htm"><b>7</b></a> <a href="../files/visualization_modes.htm"><b>8</b></a> <a href="../files/viewing_mesh_info.htm"><b>9</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>10</b></a> </nobr><br><nobr>objects <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>7</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>8</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>9</b></a> </nobr><br><a name="bms_OK"></a><a name="subkey_OK"></a><a href="../files/importing_and_exporting_meshes.htm"><b>ok</b></a> <br><nobr><a name="bms_ON"></a><a name="subkey_ON"></a>one <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/constructing_submeshes.htm"><b>4</b></a> <a href="../files/constructing_meshes.htm"><b>5</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>6</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>7</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>8</b></a> </nobr><br><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>onto</b></a> <br><a name="bms_OP"></a><a name="subkey_OP"></a><a href="../files/introduction_to_smesh.htm"><b>operations</b></a> <br><nobr>opposite <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/skew.htm"><b>2</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>options</b></a> <br><a name="bms_OR"></a><a name="subkey_OR"></a><a href="../files/about_meshes.htm"><b>order</b></a> <br><a href="../files/changing_orientation_of_elements.htm"><b>orientation</b></a> <br><a href="../files/warp.htm"><b>origin</b></a> <br><a name="bms_OW"></a><a name="subkey_OW"></a><a href="../files/about_meshes.htm"><b>own</b></a> <br>\r
<br><br>\r
-<a name="bm_S"></a><a name="subkey_S{"></a><a href="../files/aspect_ratio.htm"><b>s</b></a> <br><nobr><a name="bms_SA"></a><a name="subkey_SA"></a>salome <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>same <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_SC"></a><a name="subkey_SC"></a>scalar <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/scalar_bar_properties.htm"><b>2</b></a> </nobr><br><a name="bms_SE"></a><a name="subkey_SE"></a><a href="../files/importing_and_exporting_meshes.htm"><b>search</b></a> <br><a href="../files/about_meshes.htm"><b>see</b></a> <br><nobr>segments <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/introduction_to_smesh.htm"><b>4</b></a> </nobr><br><nobr>select <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>11</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>12</b></a> <a href="../files/displaying_elements_numbers.htm"><b>13</b></a> <a href="../files/constructing_submeshes.htm"><b>14</b></a> <a href="../files/viewing_mesh_info.htm"><b>15</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>16</b></a> <a href="../files/running_smesh_module.htm"><b>17</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>selected</b></a> <br><nobr>selecting <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>sense</b></a> <br><a href="../files/taper.htm"><b>separated</b></a> <br><nobr>set <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/running_smesh_module.htm"><b>8</b></a> </nobr><br><nobr>setting <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/local_length_hypothesis.htm"><b>4</b></a> </nobr><br><a name="bms_SH"></a><a name="subkey_SH"></a><a href="../files/visualization_modes.htm"><b>shading</b></a> <br><nobr>shape <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>shapes</b></a> <br><nobr>shortest <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>should</b></a> <br><a href="../files/about_quality_controls.htm"><b>shown</b></a> <br><a href="../files/visualization_modes.htm"><b>shrink</b></a> <br><a name="bms_SI"></a><a name="subkey_SI"></a><a href="../files/aspect_ratio.htm"><b>side</b></a> <br><nobr>sides <a href="../files/minimum_angle.htm"><b>1</b></a> <a href="../files/skew.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>simple</b></a> <br><nobr><a name="bms_SK"></a><a name="subkey_SK"></a>skew <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/skew.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_SM"></a><a name="subkey_SM"></a>smesh <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>6</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>7</b></a> <a href="../files/displaying_elements_numbers.htm"><b>8</b></a> <a href="../files/visualization_modes.htm"><b>9</b></a> <a href="../files/using_smesh_module.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> </nobr><br><nobr><a name="bms_SO"></a><a name="subkey_SO"></a>so <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><a name="bms_SP"></a><a name="subkey_SP"></a><a href="../files/about_meshes.htm"><b>space</b></a> <br><nobr>split <a href="../files/number_of_segments_hypothesis.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_ST"></a><a name="subkey_ST"></a>standard <a href="../files/importing_and_exporting_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>start</b></a> <br><a href="../files/computing_meshes.htm"><b>step</b></a> <br><a href="../files/running_smesh_module.htm"><b>study</b></a> <br><a name="bms_SU"></a><a name="subkey_SU"></a><a href="../files/importing_and_exporting_meshes.htm"><b>sub</b></a> <br><nobr>submesh <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>submeshes <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>surface</b></a> <br><a href="../files/about_meshes.htm"><b>surrounding</b></a> <br>\r
+<a name="bm_P"></a><a name="subkey_PA"></a><a href="../files/about_meshes.htm"><b>parameter</b></a> <br><nobr>parameters <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/length_from_edges.htm"><b>2</b></a> <a href="../files/non_conform_mesh_allowed_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>parametric</b></a> <br><a href="../files/about_meshes.htm"><b>particularity</b></a> <br><a name="bms_PE"></a><a name="subkey_PE"></a><a href="../files/aspect_ratio.htm"><b>perfect</b></a> <br><a href="../files/introduction_to_smesh.htm"><b>performing</b></a> <br><a name="bms_PL"></a><a name="subkey_PL"></a><a href="../files/warp.htm"><b>planar</b></a> <br><a href="../files/warp.htm"><b>plane</b></a> <br><a href="../files/running_smesh_module.htm"><b>platform</b></a> <br><nobr><a name="bms_PO"></a><a name="subkey_PO"></a>point <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><nobr>points <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/visualization_modes.htm"><b>pop</b></a> <br><a href="../files/about_meshes.htm"><b>position</b></a> <br><a href="../files/about_hypotheses.htm"><b>possible</b></a> <br><a name="bms_PR"></a><a name="subkey_PR"></a><a href="../files/about_quality_controls.htm"><b>presentation</b></a> <br><a href="../files/about_meshes.htm"><b>presented</b></a> <br><a href="../files/about_hypotheses.htm"><b>preset</b></a> <br><a href="../files/start_and_end_length_hypothesis.htm"><b>previous</b></a> <br><nobr>previously <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> <a href="../files/constructing_meshes.htm"><b>3</b></a> </nobr><br><a href="../files/aspect_ratio.htm"><b>procedure</b></a> <br><a href="../files/about_meshes.htm"><b>produced</b></a> <br><a href="../files/warp.htm"><b>product</b></a> <br><a href="../files/arithmetic_1d.htm"><b>progression</b></a> <br><a href="../files/warp.htm"><b>projection</b></a> <br><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>propagate</b></a> <br><nobr>propagation <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>2</b></a> </nobr><br><nobr>properties <a href="../files/visualization_properties.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> <a href="../files/scalar_bar_properties.htm"><b>3</b></a> </nobr><br>\r
<br><br>\r
-<a name="bm_T"></a><a name="subkey_T{"></a><a href="../files/about_meshes.htm"><b>t</b></a> <br><a name="bms_TA"></a><a name="subkey_TA"></a><a href="../files/about_hypotheses.htm"><b>taken</b></a> <br><nobr>taper <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_TE"></a><a name="subkey_TE"></a>tetrahedron <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>3</b></a> </nobr><br><a href="../files/max._element_volume_hypothsis.htm"><b>tetrahedrons</b></a> <br><nobr>text <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>5</b></a> <a href="../files/displacing_nodes.htm"><b>6</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>7</b></a> <a href="../files/visualization_properties.htm"><b>8</b></a> <a href="../files/scalar_bar_properties.htm"><b>9</b></a> </nobr><br><nobr><a name="bms_TH"></a><a name="subkey_TH"></a>three <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_TO"></a><a name="subkey_TO"></a>toolbar <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/computing_meshes.htm"><b>2</b></a> <a href="../files/aspect_ratio.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>6</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>7</b></a> <a href="../files/length_of_edges.htm"><b>8</b></a> <a href="../files/constructing_submeshes.htm"><b>9</b></a> <a href="../files/warp.htm"><b>10</b></a> <a href="../files/viewing_mesh_info.htm"><b>11</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>12</b></a> <a href="../files/taper.htm"><b>13</b></a> <a href="../files/skew.htm"><b>14</b></a> <a href="../files/running_smesh_module.htm"><b>15</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>toolbars</b></a> <br><nobr>topic <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>5</b></a> <a href="../files/displacing_nodes.htm"><b>6</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>7</b></a> <a href="../files/visualization_properties.htm"><b>8</b></a> <a href="../files/scalar_bar_properties.htm"><b>9</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>topological</b></a> <br><a href="../files/about_meshes.htm"><b>topology</b></a> <br><br><br></p><p class="ftsbody" align="center"><a href="whlstf3.htm" target="_self" title="previous search group"><b>>></b></a>\r
+<a name="bm_Q"></a><a name="subkey_QU"></a><a href="../files/warp.htm"><b>quad</b></a> <br><nobr>quadrangle <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> </nobr><br><nobr>quadrangles <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/skew.htm"><b>5</b></a> </nobr><br><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>quadrangular</b></a> <br><nobr>quality <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/about_quality_controls.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> <a href="../files/length_of_edges.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/warp.htm"><b>9</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>quantity</b></a> <br><br><br></p><p class="ftsbody" align="center"><a href="whlstf3.htm" target="_self" title="previous search group"><b>>></b></a>\r
\r
</body>\r
\r
<body marginheight="0" marginwidth="0">\r
<p class="ftsbody" align="center"><a href="whlstf2.htm" target="_self" title="previous search group"><b><<</b></a><br><br></p>\r
<p class="ftsbody">\r
-<nobr><a name="bms_TR"></a><a name="subkey_TR"></a>triangle <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> </nobr><br><nobr>triangles <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/taper.htm"><b>5</b></a> <a href="../files/skew.htm"><b>6</b></a> </nobr><br><nobr><a name="bms_TW"></a><a name="subkey_TW"></a>two <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/taper.htm"><b>4</b></a> </nobr><br><nobr><a name="bms_TY"></a><a name="subkey_TY"></a>type <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>6</b></a> <a href="../files/displacing_nodes.htm"><b>7</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>8</b></a> <a href="../files/visualization_properties.htm"><b>9</b></a> <a href="../files/scalar_bar_properties.htm"><b>10</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>types</b></a> <br>\r
-<br><br>\r
-<a name="bm_U"></a><a name="subkey_U{"></a><a href="../files/about_meshes.htm"><b>u</b></a> <br><a name="bms_UN"></a><a name="subkey_UN"></a><a href="../files/importing_and_exporting_meshes.htm"><b>unv</b></a> <br><a name="bms_UP"></a><a name="subkey_UP"></a><a href="../files/view_update.htm"><b>update</b></a> <br><a href="../files/running_smesh_module.htm"><b>updated</b></a> <br><a name="bms_US"></a><a name="subkey_US"></a><a href="../files/about_quality_controls.htm"><b>usage</b></a> <br><nobr>used <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>5</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> <a href="../files/local_length_hypothesis.htm"><b>8</b></a> <a href="../files/constructing_submeshes.htm"><b>9</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>10</b></a> </nobr><br><nobr>using <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/using_smesh_module.htm"><b>2</b></a> </nobr><br>\r
+\r
+\r
+<nobr><a name="bm_R"></a><a name="subkey_RA"></a>ratio <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/introduction_to_smesh.htm"><b>3</b></a> <a href="../files/taper.htm"><b>4</b></a> <a href="../files/warp.htm"><b>5</b></a> </nobr><br><a name="bms_RE"></a><a name="subkey_RE"></a><a href="../files/reassigning_hypotheses_and_algorithms.htm"><b>reassigning</b></a> <br><nobr>reference <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>refined</b></a> <br><a href="../files/skew.htm"><b>reflects</b></a> <br><a href="../files/arithmetic_1d.htm"><b>regular</b></a> <br><a href="../files/running_smesh_module.htm"><b>related</b></a> <br><a href="../files/about_meshes.htm"><b>relations</b></a> <br><a href="../files/about_meshes.htm"><b>relationship</b></a> <br><a href="../files/about_meshes.htm"><b>relationships</b></a> <br><a href="../files/aspect_ratio.htm"><b>remaining</b></a> <br><a href="../files/removing_nodes_and_elements.htm"><b>removing</b></a> <br><a href="../files/aspect_ratio.htm"><b>repeated</b></a> <br><nobr>represent <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>representation</b></a> <br><a href="../files/about_meshes.htm"><b>representations</b></a> <br><nobr>represents <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/taper.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>restricted</b></a> <br><a href="../files/about_hypotheses.htm"><b>resulting</b></a> <br><a href="../files/aspect_ratio.htm"><b>retained</b></a> <br><a href="../files/about_meshes.htm"><b>retrieve</b></a> <br><a name="bms_RI"></a><a name="subkey_RI"></a><a href="../files/visualization_modes.htm"><b>right</b></a> <br><a name="bms_RO"></a><a name="subkey_RO"></a><a href="../files/about_hypotheses.htm"><b>rough</b></a> <br><a name="bms_RU"></a><a name="subkey_RU"></a><a href="../files/running_smesh_module.htm"><b>run</b></a> <br><a href="../files/running_smesh_module.htm"><b>running</b></a> <br>\r
<br><br>\r
-<a name="bm_V"></a><a name="subkey_V{"></a><a href="../files/about_meshes.htm"><b>v</b></a> <br><nobr><a name="bms_VA"></a><a name="subkey_VA"></a>value <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/skew.htm"><b>4</b></a> </nobr><br><a href="../files/about_quality_controls.htm"><b>values</b></a> <br><a name="bms_VE"></a><a name="subkey_VE"></a><a href="../files/warp.htm"><b>vector</b></a> <br><a href="../files/about_meshes.htm"><b>vertex</b></a> <br><nobr><a name="bms_VI"></a><a name="subkey_VI"></a>view <a href="../files/viewing_mesh_info.htm"><b>1</b></a> <a href="../files/view_update.htm"><b>2</b></a> </nobr><br><nobr>viewer <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>5</b></a> <a href="../files/displaying_elements_numbers.htm"><b>6</b></a> <a href="../files/warp.htm"><b>7</b></a> <a href="../files/visualization_modes.htm"><b>8</b></a> <a href="../files/taper.htm"><b>9</b></a> <a href="../files/skew.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> </nobr><br><a href="../files/viewing_mesh_info.htm"><b>viewing</b></a> <br><a href="../files/about_quality_controls.htm"><b>visual</b></a> <br><nobr>visualization <a href="../files/visualization_properties.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_VO"></a><a name="subkey_VO"></a>volume <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>7</b></a> </nobr><br><nobr>volumes <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a name="bms_VT"></a><a name="subkey_VT"></a><a href="../files/running_smesh_module.htm"><b>vtk</b></a> <br>\r
+<a name="bm_S"></a><a name="subkey_S{"></a><a href="../files/aspect_ratio.htm"><b>s</b></a> <br><nobr><a name="bms_SA"></a><a name="subkey_SA"></a>salome <a href="../files/introduction_to_smesh.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>same <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_SC"></a><a name="subkey_SC"></a>scalar <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/scalar_bar_properties.htm"><b>2</b></a> </nobr><br><a name="bms_SE"></a><a name="subkey_SE"></a><a href="../files/importing_and_exporting_meshes.htm"><b>search</b></a> <br><a href="../files/about_meshes.htm"><b>see</b></a> <br><nobr>segment <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><nobr>segments <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/length_from_edges.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/deflection_1d.htm"><b>6</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>7</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>8</b></a> </nobr><br><nobr>select <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/arithmetic_1d.htm"><b>2</b></a> <a href="../files/about_meshing_algorithms.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>6</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>7</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>12</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>13</b></a> <a href="../files/displaying_elements_numbers.htm"><b>14</b></a> <a href="../files/deflection_1d.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/constructing_meshes.htm"><b>17</b></a> <a href="../files/visualization_modes.htm"><b>18</b></a> <a href="../files/viewing_mesh_info.htm"><b>19</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>20</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>21</b></a> <a href="../files/running_smesh_module.htm"><b>22</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>23</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>24</b></a> </nobr><br><a href="../files/about_hypotheses.htm"><b>selected</b></a> <br><nobr>selecting <a href="../files/constructing_submeshes.htm"><b>1</b></a> <a href="../files/constructing_meshes.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>sense</b></a> <br><a href="../files/taper.htm"><b>separated</b></a> <br><nobr>set <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>4</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/introduction_to_smesh.htm"><b>7</b></a> <a href="../files/deflection_1d.htm"><b>8</b></a> <a href="../files/visualization_modes.htm"><b>9</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>12</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>13</b></a> </nobr><br><nobr>setting <a href="../files/max._element_volume_hypothsis.htm"><b>1</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>2</b></a> <a href="../files/local_length_hypothesis.htm"><b>3</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>4</b></a> </nobr><br><a name="bms_SH"></a><a name="subkey_SH"></a><a href="../files/visualization_modes.htm"><b>shading</b></a> <br><nobr>shape <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>shapes</b></a> <br><nobr>shortest <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>should</b></a> <br><a href="../files/about_quality_controls.htm"><b>shown</b></a> <br><a href="../files/visualization_modes.htm"><b>shrink</b></a> <br><a name="bms_SI"></a><a name="subkey_SI"></a><a href="../files/aspect_ratio.htm"><b>side</b></a> <br><nobr>sides <a href="../files/minimum_angle.htm"><b>1</b></a> <a href="../files/skew.htm"><b>2</b></a> </nobr><br><a href="../files/arithmetic_1d.htm"><b>similar</b></a> <br><a href="../files/about_meshes.htm"><b>simple</b></a> <br><nobr><a name="bms_SK"></a><a name="subkey_SK"></a>skew <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/skew.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_SM"></a><a name="subkey_SM"></a>smesh <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/about_meshes.htm"><b>3</b></a> <a href="../files/about_hypotheses.htm"><b>4</b></a> <a href="../files/introduction_to_smesh.htm"><b>5</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>6</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>7</b></a> <a href="../files/displaying_elements_numbers.htm"><b>8</b></a> <a href="../files/visualization_modes.htm"><b>9</b></a> <a href="../files/using_smesh_module.htm"><b>10</b></a> <a href="../files/running_smesh_module.htm"><b>11</b></a> </nobr><br><nobr><a name="bms_SO"></a><a name="subkey_SO"></a>so <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/deflection_1d.htm"><b>3</b></a> <a href="../files/taper.htm"><b>4</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>5</b></a> </nobr><br><a name="bms_SP"></a><a name="subkey_SP"></a><a href="../files/about_meshes.htm"><b>space</b></a> <br><nobr>specified <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>3</b></a> </nobr><br><nobr>split <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/local_length_hypothesis.htm"><b>2</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_ST"></a><a name="subkey_ST"></a>standard <a href="../files/importing_and_exporting_meshes.htm"><b>1</b></a> <a href="../files/running_smesh_module.htm"><b>2</b></a> </nobr><br><nobr>start <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>3</b></a> <a href="../files/running_smesh_module.htm"><b>4</b></a> </nobr><br><a href="../files/arithmetic_1d.htm"><b>starting</b></a> <br><a href="../files/computing_meshes.htm"><b>step</b></a> <br><a href="../files/running_smesh_module.htm"><b>study</b></a> <br><a name="bms_SU"></a><a name="subkey_SU"></a><a href="../files/importing_and_exporting_meshes.htm"><b>sub</b></a> <br><nobr>submesh <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>submeshes <a href="../files/about_hypotheses.htm"><b>1</b></a> <a href="../files/constructing_submeshes.htm"><b>2</b></a> </nobr><br><nobr>surface <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>2</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>surrounding</b></a> <br>\r
<br><br>\r
-<a name="bm_W"></a><a name="subkey_WA"></a><a href="../files/warp.htm"><b>warp</b></a> <br><nobr>warping <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/warp.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>way</b></a> <br><nobr><a name="bms_WI"></a><a name="subkey_WI"></a>will <a href="../files/constructing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/about_meshes.htm"><b>4</b></a> <a href="../files/about_hypotheses.htm"><b>5</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/length_of_edges.htm"><b>11</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>12</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>13</b></a> <a href="../files/displaying_elements_numbers.htm"><b>14</b></a> <a href="../files/constructing_submeshes.htm"><b>15</b></a> <a href="../files/warp.htm"><b>16</b></a> <a href="../files/viewing_mesh_info.htm"><b>17</b></a> <a href="../files/taper.htm"><b>18</b></a> <a href="../files/skew.htm"><b>19</b></a> <a href="../files/running_smesh_module.htm"><b>20</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>window</b></a> <br><nobr>wire <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>2</b></a> </nobr><br><a href="../files/visualization_modes.htm"><b>wireframe</b></a> <br><a name="bms_WO"></a><a name="subkey_WO"></a><a href="../files/number_of_segments_hypothesis.htm"><b>words</b></a> <br><a href="../files/running_smesh_module.htm"><b>work</b></a> <br>\r
+<a name="bm_T"></a><a name="subkey_T{"></a><a href="../files/about_meshes.htm"><b>t</b></a> <br><a name="bms_TA"></a><a name="subkey_TA"></a><a href="../files/about_hypotheses.htm"><b>taken</b></a> <br><nobr>taper <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/taper.htm"><b>3</b></a> </nobr><br><nobr><a name="bms_TE"></a><a name="subkey_TE"></a>tetrahedron <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>3</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>4</b></a> </nobr><br><a href="../files/max._element_volume_hypothsis.htm"><b>tetrahedrons</b></a> <br><nobr>text <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/displacing_nodes.htm"><b>5</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>6</b></a> <a href="../files/visualization_properties.htm"><b>7</b></a> <a href="../files/scalar_bar_properties.htm"><b>8</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>9</b></a> </nobr><br><nobr><a name="bms_TH"></a><a name="subkey_TH"></a>them <a href="../files/deflection_1d.htm"><b>1</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>2</b></a> </nobr><br><nobr>three <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_TO"></a><a name="subkey_TO"></a>toolbar <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/length_of_edges.htm"><b>3</b></a> <a href="../files/constructing_submeshes.htm"><b>4</b></a> <a href="../files/constructing_meshes.htm"><b>5</b></a> <a href="../files/viewing_mesh_info.htm"><b>6</b></a> <a href="../files/taper.htm"><b>7</b></a> <a href="../files/skew.htm"><b>8</b></a> <a href="../files/running_smesh_module.htm"><b>9</b></a> <a href="../files/warp.htm"><b>10</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>toolbars</b></a> <br><nobr>topic <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/displacing_nodes.htm"><b>5</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>6</b></a> <a href="../files/visualization_properties.htm"><b>7</b></a> <a href="../files/scalar_bar_properties.htm"><b>8</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>9</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>topological</b></a> <br><a href="../files/about_meshes.htm"><b>topology</b></a> <br><nobr><a name="bms_TR"></a><a name="subkey_TR"></a>triangle <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshing_algorithms.htm"><b>2</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/minimum_angle.htm"><b>4</b></a> </nobr><br><nobr>triangles <a href="../files/area_of_elements.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/taper.htm"><b>5</b></a> <a href="../files/skew.htm"><b>6</b></a> </nobr><br><a href="../files/length_from_edges.htm"><b>triangulator</b></a> <br><nobr><a name="bms_TW"></a><a name="subkey_TW"></a>two <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/taper.htm"><b>4</b></a> </nobr><br><nobr><a name="bms_TY"></a><a name="subkey_TY"></a>type <a href="../files/connectivity.htm"><b>1</b></a> <a href="../files/changing_orientation_of_elements.htm"><b>2</b></a> <a href="../files/adding_nodes_and_elements.htm"><b>3</b></a> <a href="../files/about_modification_of_meshes.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/displacing_nodes.htm"><b>6</b></a> <a href="../files/diagonal_iversion_of_elements.htm"><b>7</b></a> <a href="../files/visualization_properties.htm"><b>8</b></a> <a href="../files/scalar_bar_properties.htm"><b>9</b></a> <a href="../files/removing_nodes_and_elements.htm"><b>10</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>types</b></a> <br>\r
<br><br>\r
-<nobr><a name="bm_X"></a><a name="subkey_X{"></a>x <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br>\r
+<a name="bm_U"></a><a name="subkey_U{"></a><a href="../files/about_meshes.htm"><b>u</b></a> <br><a name="bms_UN"></a><a name="subkey_UN"></a><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>unless</b></a> <br><a href="../files/importing_and_exporting_meshes.htm"><b>unv</b></a> <br><nobr><a name="bms_UP"></a><a name="subkey_UP"></a>up <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> </nobr><br><a href="../files/view_update.htm"><b>update</b></a> <br><a href="../files/running_smesh_module.htm"><b>updated</b></a> <br><a name="bms_US"></a><a name="subkey_US"></a><a href="../files/about_quality_controls.htm"><b>usage</b></a> <br><nobr>used <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>2</b></a> <a href="../files/2d_meshing_algorithm.htm"><b>3</b></a> <a href="../files/2d_(quadrangle)_meshing_algorithm.htm"><b>4</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>5</b></a> <a href="../files/local_length_hypothesis.htm"><b>6</b></a> <a href="../files/deflection_1d.htm"><b>7</b></a> <a href="../files/constructing_submeshes.htm"><b>8</b></a> <a href="../files/constructing_meshes.htm"><b>9</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>10</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>11</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>12</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>13</b></a> </nobr><br><nobr>using <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/using_smesh_module.htm"><b>2</b></a> </nobr><br>\r
<br><br>\r
-<a name="bm_Y"></a><a name="subkey_Y{"></a><a href="../files/about_meshes.htm"><b>y</b></a> <br><nobr><a name="bms_YO"></a><a name="subkey_YO"></a>your <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/about_quality_controls.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>7</b></a> <a href="../files/minimum_angle.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/length_of_edges.htm"><b>12</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>13</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>14</b></a> <a href="../files/displaying_elements_numbers.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/warp.htm"><b>17</b></a> <a href="../files/viewing_mesh_info.htm"><b>18</b></a> <a href="../files/taper.htm"><b>19</b></a> <a href="../files/skew.htm"><b>20</b></a> </nobr><br>\r
+<a name="bm_V"></a><a name="subkey_V{"></a><a href="../files/about_meshes.htm"><b>v</b></a> <br><nobr><a name="bms_VA"></a><a name="subkey_VA"></a>value <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/deflection_1d.htm"><b>4</b></a> <a href="../files/skew.htm"><b>5</b></a> </nobr><br><nobr>values <a href="../files/arithmetic_1d.htm"><b>1</b></a> <a href="../files/about_quality_controls.htm"><b>2</b></a> </nobr><br><a name="bms_VE"></a><a name="subkey_VE"></a><a href="../files/warp.htm"><b>vector</b></a> <br><a href="../files/about_meshes.htm"><b>vertex</b></a> <br><nobr><a name="bms_VI"></a><a name="subkey_VI"></a>view <a href="../files/viewing_mesh_info.htm"><b>1</b></a> <a href="../files/view_update.htm"><b>2</b></a> </nobr><br><nobr>viewer <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/area_of_elements.htm"><b>2</b></a> <a href="../files/minimum_angle.htm"><b>3</b></a> <a href="../files/length_of_edges.htm"><b>4</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>5</b></a> <a href="../files/displaying_elements_numbers.htm"><b>6</b></a> <a href="../files/visualization_modes.htm"><b>7</b></a> <a href="../files/taper.htm"><b>8</b></a> <a href="../files/skew.htm"><b>9</b></a> <a href="../files/running_smesh_module.htm"><b>10</b></a> <a href="../files/warp.htm"><b>11</b></a> </nobr><br><a href="../files/viewing_mesh_info.htm"><b>viewing</b></a> <br><a href="../files/about_quality_controls.htm"><b>visual</b></a> <br><nobr>visualization <a href="../files/visualization_properties.htm"><b>1</b></a> <a href="../files/visualization_modes.htm"><b>2</b></a> </nobr><br><nobr><a name="bms_VO"></a><a name="subkey_VO"></a>volume <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/about_meshes.htm"><b>2</b></a> <a href="../files/about_hypotheses.htm"><b>3</b></a> <a href="../files/3d_meshing_algorithm.htm"><b>4</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>5</b></a> <a href="../files/introduction_to_smesh.htm"><b>6</b></a> <a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><b>7</b></a> <a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>8</b></a> </nobr><br><nobr>volumes <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/about_hypotheses.htm"><b>2</b></a> </nobr><br><a name="bms_VT"></a><a name="subkey_VT"></a><a href="../files/running_smesh_module.htm"><b>vtk</b></a> <br>\r
<br><br>\r
-<a name="bm_Z"></a><a name="subkey_Z{"></a><a href="../files/about_meshes.htm"><b>z</b></a> <br><br><br></p>\r
+<a name="bm_W"></a><a name="subkey_WA"></a><a href="../files/warp.htm"><b>warp</b></a> <br><nobr>warping <a href="../files/about_quality_controls.htm"><b>1</b></a> <a href="../files/introduction_to_smesh.htm"><b>2</b></a> <a href="../files/warp.htm"><b>3</b></a> </nobr><br><a href="../files/about_meshes.htm"><b>way</b></a> <br><a name="bms_WH"></a><a name="subkey_WH"></a><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><b>while</b></a> <br><br><br></p><p class="ftsbody" align="center"><a href="whlstf4.htm" target="_self" title="previous search group"><b>>></b></a>\r
+\r
</body>\r
\r
</html>\r
--- /dev/null
+<html>\r
+<head>\r
+<title>Search Words List</title>\r
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">\r
+<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">\r
+<meta name "description" content="WebHelp 2002">\r
+<base target="bsscright">\r
+<style>\r
+<!--\r
+body {margin-left:1pt; margin-top:1pt; margin-right:1pt;font-family:Arial; font-size:9pt;}\r
+\r
+A:link {font-family:Arial; font-size:9pt; color:#000000; font-style:normal; text-decoration:none; }\r
+A:visited {font-family:Arial; font-size:9pt; color:#000000; font-style:normal; text-decoration:none; }\r
+A:active {background-color:#cccccc;}\r
+A:hover {font-family:Arial; font-size:9pt; color:#007f00; font-style:normal; text-decoration:underline; }\r
+\r
+.tabs {background-color:#c0c0c0;}\r
+.ftsheader {margin-left:10pt; margin-top:0pt;}\r
+.ftsbody {margin-left:10pt; margin-top:0pt;}\r
+.inactive {color:#666666;}\r
+.ftsheader {background-color:White; } \r
+\r
+body {background-color:White; } \r
+p {color:Black; } p {font-family:Tahoma; } p {font-size:8pt; } p {font-style:Normal; } p {text-decoration:none; } \r
+A:link {color:Black; } A:link {font-family:Tahoma; } A:link {font-size:8pt; } A:link {font-style:Normal; } A:link {text-decoration:none; } \r
+A:visited {color:Black; } A:visited {font-family:Tahoma; } A:visited {font-size:8pt; } A:visited {font-style:Normal; } A:visited {text-decoration:none; } \r
+A:active {background-color:Silver; } \r
+A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; } A:hover {font-style:Normal; } A:hover {text-decoration:underline; } \r
+\r
+-->\r
+</style>\r
+</head>\r
+<body marginheight="0" marginwidth="0">\r
+<p class="ftsbody" align="center"><a href="whlstf3.htm" target="_self" title="previous search group"><b><<</b></a><br><br></p>\r
+<p class="ftsbody">\r
+<nobr><a name="bms_WI"></a><a name="subkey_WI"></a>will <a href="../files/aspect_ratio.htm"><b>1</b></a> <a href="../files/arithmetic_1d.htm"><b>2</b></a> <a href="../files/area_of_elements.htm"><b>3</b></a> <a href="../files/about_meshing_algorithms.htm"><b>4</b></a> <a href="../files/about_meshes.htm"><b>5</b></a> <a href="../files/about_hypotheses.htm"><b>6</b></a> <a href="../files/minimum_angle.htm"><b>7</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>8</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>9</b></a> <a href="../files/local_length_hypothesis.htm"><b>10</b></a> <a href="../files/length_of_edges.htm"><b>11</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>12</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>13</b></a> <a href="../files/displaying_elements_numbers.htm"><b>14</b></a> <a href="../files/deflection_1d.htm"><b>15</b></a> <a href="../files/constructing_submeshes.htm"><b>16</b></a> <a href="../files/constructing_meshes.htm"><b>17</b></a> <a href="../files/viewing_mesh_info.htm"><b>18</b></a> <a href="../files/taper.htm"><b>19</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>20</b></a> <a href="../files/skew.htm"><b>21</b></a> <a href="../files/running_smesh_module.htm"><b>22</b></a> <a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><b>23</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>24</b></a> <a href="../files/warp.htm"><b>25</b></a> </nobr><br><a href="../files/running_smesh_module.htm"><b>window</b></a> <br><nobr>wire <a href="../files/about_meshing_algorithms.htm"><b>1</b></a> <a href="../files/1d_meshing_algorithm.htm"><b>2</b></a> <a href="../files/length_from_edges.htm"><b>3</b></a> </nobr><br><a href="../files/visualization_modes.htm"><b>wireframe</b></a> <br><a name="bms_WO"></a><a name="subkey_WO"></a><a href="../files/number_of_segments_hypothesis.htm"><b>words</b></a> <br><a href="../files/running_smesh_module.htm"><b>work</b></a> <br>\r
+<br><br>\r
+<nobr><a name="bm_X"></a><a name="subkey_X{"></a>x <a href="../files/about_meshes.htm"><b>1</b></a> <a href="../files/warp.htm"><b>2</b></a> </nobr><br>\r
+<br><br>\r
+<a name="bm_Y"></a><a name="subkey_Y{"></a><a href="../files/about_meshes.htm"><b>y</b></a> <br><nobr><a name="bms_YO"></a><a name="subkey_YO"></a>your <a href="../files/computing_meshes.htm"><b>1</b></a> <a href="../files/aspect_ratio.htm"><b>2</b></a> <a href="../files/arithmetic_1d.htm"><b>3</b></a> <a href="../files/area_of_elements.htm"><b>4</b></a> <a href="../files/about_quality_controls.htm"><b>5</b></a> <a href="../files/about_meshes.htm"><b>6</b></a> <a href="../files/about_hypotheses.htm"><b>7</b></a> <a href="../files/minimum_angle.htm"><b>8</b></a> <a href="../files/max._element_volume_hypothsis.htm"><b>9</b></a> <a href="../files/max._element_area_hypothesis.htm"><b>10</b></a> <a href="../files/local_length_hypothesis.htm"><b>11</b></a> <a href="../files/length_of_edges.htm"><b>12</b></a> <a href="../files/importing_and_exporting_meshes.htm"><b>13</b></a> <a href="../files/displaying_nodes_numbers.htm"><b>14</b></a> <a href="../files/displaying_elements_numbers.htm"><b>15</b></a> <a href="../files/deflection_1d.htm"><b>16</b></a> <a href="../files/constructing_submeshes.htm"><b>17</b></a> <a href="../files/visualization_modes.htm"><b>18</b></a> <a href="../files/viewing_mesh_info.htm"><b>19</b></a> <a href="../files/taper.htm"><b>20</b></a> <a href="../files/start_and_end_length_hypothesis.htm"><b>21</b></a> <a href="../files/skew.htm"><b>22</b></a> <a href="../files/number_of_segments_hypothesis.htm"><b>23</b></a> <a href="../files/warp.htm"><b>24</b></a> </nobr><br>\r
+<br><br>\r
+<a name="bm_Z"></a><a name="subkey_Z{"></a><a href="../files/about_meshes.htm"><b>z</b></a> <br><br><br></p>\r
+</body>\r
+\r
+</html>\r
+\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_K"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_K" target="ftslist" title="search letter K "><b>K </b></a> <a href="whlstf1.htm#bms_KI" target="ftslist" title="search letter KI"><b>KI</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_K"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_K" target="ftslist" title="search letter K "><b>K </b></a> <a href="whlstf2.htm#bms_KI" target="ftslist" title="search letter KI"><b>KI</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_L"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_L" target="ftslist" title="search letter L "><b>L </b></a> <a href="whlstf1.htm#bms_LA" target="ftslist" title="search letter LA"><b>LA</b></a> <a href="whlstf1.htm#bms_LE" target="ftslist" title="search letter LE"><b>LE</b></a> <a href="whlstf1.htm#bms_LI" target="ftslist" title="search letter LI"><b>LI</b></a> <a href="whlstf1.htm#bms_LO" target="ftslist" title="search letter LO"><b>LO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_L"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_L" target="ftslist" title="search letter L "><b>L </b></a> <a href="whlstf2.htm#bms_LA" target="ftslist" title="search letter LA"><b>LA</b></a> <a href="whlstf2.htm#bms_LE" target="ftslist" title="search letter LE"><b>LE</b></a> <a href="whlstf2.htm#bms_LI" target="ftslist" title="search letter LI"><b>LI</b></a> <a href="whlstf2.htm#bms_LK" target="ftslist" title="search letter LK"><b>LK</b></a> <a href="whlstf2.htm#bms_LO" target="ftslist" title="search letter LO"><b>LO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_M"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_M" target="ftslist" title="search letter MA"><b>MA</b></a> <a href="whlstf1.htm#bms_ME" target="ftslist" title="search letter ME"><b>ME</b></a> <a href="whlstf2.htm#bms_MI" target="ftslist" title="search letter MI"><b>MI</b></a> <a href="whlstf2.htm#bms_MO" target="ftslist" title="search letter MO"><b>MO</b></a> <a href="whlstf2.htm#bms_MU" target="ftslist" title="search letter MU"><b>MU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_M"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_M" target="ftslist" title="search letter MA"><b>MA</b></a> <a href="whlstf2.htm#bms_ME" target="ftslist" title="search letter ME"><b>ME</b></a> <a href="whlstf2.htm#bms_MI" target="ftslist" title="search letter MI"><b>MI</b></a> <a href="whlstf2.htm#bms_MO" target="ftslist" title="search letter MO"><b>MO</b></a> <a href="whlstf2.htm#bms_MU" target="ftslist" title="search letter MU"><b>MU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_R"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_R" target="ftslist" title="search letter RA"><b>RA</b></a> <a href="whlstf2.htm#bms_RE" target="ftslist" title="search letter RE"><b>RE</b></a> <a href="whlstf2.htm#bms_RO" target="ftslist" title="search letter RO"><b>RO</b></a> <a href="whlstf2.htm#bms_RU" target="ftslist" title="search letter RU"><b>RU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_R"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_R" target="ftslist" title="search letter RA"><b>RA</b></a> <a href="whlstf3.htm#bms_RE" target="ftslist" title="search letter RE"><b>RE</b></a> <a href="whlstf3.htm#bms_RI" target="ftslist" title="search letter RI"><b>RI</b></a> <a href="whlstf3.htm#bms_RO" target="ftslist" title="search letter RO"><b>RO</b></a> <a href="whlstf3.htm#bms_RU" target="ftslist" title="search letter RU"><b>RU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_S"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_S" target="ftslist" title="search letter S "><b>S </b></a> <a href="whlstf2.htm#bms_SA" target="ftslist" title="search letter SA"><b>SA</b></a> <a href="whlstf2.htm#bms_SC" target="ftslist" title="search letter SC"><b>SC</b></a> <a href="whlstf2.htm#bms_SE" target="ftslist" title="search letter SE"><b>SE</b></a> <a href="whlstf2.htm#bms_SH" target="ftslist" title="search letter SH"><b>SH</b></a> <a href="whlstf2.htm#bms_SI" target="ftslist" title="search letter SI"><b>SI</b></a> <a href="whlstf2.htm#bms_SK" target="ftslist" title="search letter SK"><b>SK</b></a> <a href="whlstf2.htm#bms_SM" target="ftslist" title="search letter SM"><b>SM</b></a> <a href="whlstf2.htm#bms_SO" target="ftslist" title="search letter SO"><b>SO</b></a> <a href="whlstf2.htm#bms_SP" target="ftslist" title="search letter SP"><b>SP</b></a> <a href="whlstf2.htm#bms_ST" target="ftslist" title="search letter ST"><b>ST</b></a> <a href="whlstf2.htm#bms_SU" target="ftslist" title="search letter SU"><b>SU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_S"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_S" target="ftslist" title="search letter S "><b>S </b></a> <a href="whlstf3.htm#bms_SA" target="ftslist" title="search letter SA"><b>SA</b></a> <a href="whlstf3.htm#bms_SC" target="ftslist" title="search letter SC"><b>SC</b></a> <a href="whlstf3.htm#bms_SE" target="ftslist" title="search letter SE"><b>SE</b></a> <a href="whlstf3.htm#bms_SH" target="ftslist" title="search letter SH"><b>SH</b></a> <a href="whlstf3.htm#bms_SI" target="ftslist" title="search letter SI"><b>SI</b></a> <a href="whlstf3.htm#bms_SK" target="ftslist" title="search letter SK"><b>SK</b></a> <a href="whlstf3.htm#bms_SM" target="ftslist" title="search letter SM"><b>SM</b></a> <a href="whlstf3.htm#bms_SO" target="ftslist" title="search letter SO"><b>SO</b></a> <a href="whlstf3.htm#bms_SP" target="ftslist" title="search letter SP"><b>SP</b></a> <a href="whlstf3.htm#bms_ST" target="ftslist" title="search letter ST"><b>ST</b></a> <a href="whlstf3.htm#bms_SU" target="ftslist" title="search letter SU"><b>SU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_T"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_T" target="ftslist" title="search letter T "><b>T </b></a> <a href="whlstf2.htm#bms_TA" target="ftslist" title="search letter TA"><b>TA</b></a> <a href="whlstf2.htm#bms_TE" target="ftslist" title="search letter TE"><b>TE</b></a> <a href="whlstf2.htm#bms_TH" target="ftslist" title="search letter TH"><b>TH</b></a> <a href="whlstf2.htm#bms_TO" target="ftslist" title="search letter TO"><b>TO</b></a> <a href="whlstf3.htm#bms_TR" target="ftslist" title="search letter TR"><b>TR</b></a> <a href="whlstf3.htm#bms_TW" target="ftslist" title="search letter TW"><b>TW</b></a> <a href="whlstf3.htm#bms_TY" target="ftslist" title="search letter TY"><b>TY</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_T"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_T" target="ftslist" title="search letter T "><b>T </b></a> <a href="whlstf3.htm#bms_TA" target="ftslist" title="search letter TA"><b>TA</b></a> <a href="whlstf3.htm#bms_TE" target="ftslist" title="search letter TE"><b>TE</b></a> <a href="whlstf3.htm#bms_TH" target="ftslist" title="search letter TH"><b>TH</b></a> <a href="whlstf3.htm#bms_TO" target="ftslist" title="search letter TO"><b>TO</b></a> <a href="whlstf3.htm#bms_TR" target="ftslist" title="search letter TR"><b>TR</b></a> <a href="whlstf3.htm#bms_TW" target="ftslist" title="search letter TW"><b>TW</b></a> <a href="whlstf3.htm#bms_TY" target="ftslist" title="search letter TY"><b>TY</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_C"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf0.htm#bm_C" target="ftslist" title="search letter CA"><b>CA</b></a> <a href="whlstf0.htm#bms_CH" target="ftslist" title="search letter CH"><b>CH</b></a> <a href="whlstf0.htm#bms_CL" target="ftslist" title="search letter CL"><b>CL</b></a> <a href="whlstf0.htm#bms_CO" target="ftslist" title="search letter CO"><b>CO</b></a> <a href="whlstf0.htm#bms_CR" target="ftslist" title="search letter CR"><b>CR</b></a> <a href="whlstf0.htm#bms_CU" target="ftslist" title="search letter CU"><b>CU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_C"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf0.htm#bm_C" target="ftslist" title="search letter CA"><b>CA</b></a> <a href="whlstf0.htm#bms_CH" target="ftslist" title="search letter CH"><b>CH</b></a> <a href="whlstf0.htm#bms_CL" target="ftslist" title="search letter CL"><b>CL</b></a> <a href="whlstf0.htm#bms_CO" target="ftslist" title="search letter CO"><b>CO</b></a> <a href="whlstf1.htm#bms_CR" target="ftslist" title="search letter CR"><b>CR</b></a> <a href="whlstf1.htm#bms_CU" target="ftslist" title="search letter CU"><b>CU</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_W"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_W" target="ftslist" title="search letter WA"><b>WA</b></a> <a href="whlstf3.htm#bms_WI" target="ftslist" title="search letter WI"><b>WI</b></a> <a href="whlstf3.htm#bms_WO" target="ftslist" title="search letter WO"><b>WO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_W"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_W" target="ftslist" title="search letter WA"><b>WA</b></a> <a href="whlstf3.htm#bms_WH" target="ftslist" title="search letter WH"><b>WH</b></a> <a href="whlstf4.htm#bms_WI" target="ftslist" title="search letter WI"><b>WI</b></a> <a href="whlstf4.htm#bms_WO" target="ftslist" title="search letter WO"><b>WO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_Y"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf3.htm#bm_Y" target="ftslist" title="search letter Y "><b>Y </b></a> <a href="whlstf3.htm#bms_YO" target="ftslist" title="search letter YO"><b>YO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_Y"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf4.htm#bm_Y" target="ftslist" title="search letter Y "><b>Y </b></a> <a href="whlstf4.htm#bms_YO" target="ftslist" title="search letter YO"><b>YO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_D"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf0.htm#bm_D" target="ftslist" title="search letter DE"><b>DE</b></a> <a href="whlstf1.htm#bms_DI" target="ftslist" title="search letter DI"><b>DI</b></a> <a href="whlstf1.htm#bms_DO" target="ftslist" title="search letter DO"><b>DO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_D"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_D" target="ftslist" title="search letter D "><b>D </b></a> <a href="whlstf1.htm#bms_DE" target="ftslist" title="search letter DE"><b>DE</b></a> <a href="whlstf1.htm#bms_DI" target="ftslist" title="search letter DI"><b>DI</b></a> <a href="whlstf1.htm#bms_DO" target="ftslist" title="search letter DO"><b>DO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_G"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_G" target="ftslist" title="search letter GE"><b>GE</b></a> <a href="whlstf1.htm#bms_GL" target="ftslist" title="search letter GL"><b>GL</b></a> <a href="whlstf1.htm#bms_GR" target="ftslist" title="search letter GR"><b>GR</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_G"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_G" target="ftslist" title="search letter GE"><b>GE</b></a> <a href="whlstf1.htm#bms_GH" target="ftslist" title="search letter GH"><b>GH</b></a> <a href="whlstf1.htm#bms_GI" target="ftslist" title="search letter GI"><b>GI</b></a> <a href="whlstf1.htm#bms_GL" target="ftslist" title="search letter GL"><b>GL</b></a> <a href="whlstf1.htm#bms_GR" target="ftslist" title="search letter GR"><b>GR</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_I"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_I" target="ftslist" title="search letter I "><b>I </b></a> <a href="whlstf1.htm#bms_IC" target="ftslist" title="search letter IC"><b>IC</b></a> <a href="whlstf1.htm#bms_ID" target="ftslist" title="search letter ID"><b>ID</b></a> <a href="whlstf1.htm#bms_IF" target="ftslist" title="search letter IF"><b>IF</b></a> <a href="whlstf1.htm#bms_IM" target="ftslist" title="search letter IM"><b>IM</b></a> <a href="whlstf1.htm#bms_IN" target="ftslist" title="search letter IN"><b>IN</b></a> <a href="whlstf1.htm#bms_IT" target="ftslist" title="search letter IT"><b>IT</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_I"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_I" target="ftslist" title="search letter I "><b>I </b></a> <a href="whlstf2.htm#bms_IC" target="ftslist" title="search letter IC"><b>IC</b></a> <a href="whlstf2.htm#bms_ID" target="ftslist" title="search letter ID"><b>ID</b></a> <a href="whlstf2.htm#bms_IF" target="ftslist" title="search letter IF"><b>IF</b></a> <a href="whlstf2.htm#bms_IM" target="ftslist" title="search letter IM"><b>IM</b></a> <a href="whlstf2.htm#bms_IN" target="ftslist" title="search letter IN"><b>IN</b></a> <a href="whlstf2.htm#bms_IT" target="ftslist" title="search letter IT"><b>IT</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
</head>\r
<body marginheight="0" marginwidth="0">\r
\r
-<p class="ftsheader"><a name="subkey_J"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf1.htm#bm_J" target="ftslist" title="search letter J "><b>J </b></a> <a href="whlstf1.htm#bms_JO" target="ftslist" title="search letter JO"><b>JO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
+<p class="ftsheader"><a name="subkey_J"></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a> <a href="whlstf2.htm#bm_J" target="ftslist" title="search letter J "><b>J </b></a> <a href="whlstf2.htm#bms_JO" target="ftslist" title="search letter JO"><b>JO</b></a> <a href="whnvl32.htm#home" target="_self" title="back to top level"><b>^</b></a></p>\r
\r
</body>\r
\r
<nobr><a href="../files/importing_and_exporting_meshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Importing and exporting meshes</a></nobr><br>\r
<nobr><a name="3"></a><a href="whlstt2.htm#3" target="_self"><img src="../wht_toc2.gif" border="0" align="absmiddle"> Defining hypotheses</a></nobr><br>\r
<nobr><a href="../files/about_hypotheses.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> About hypotheses</a></nobr><br>\r
- <nobr><a href="../files/local_length_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Local Length hypothesis</a></nobr><br>\r
- <nobr><a href="../files/number_of_segments_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Number of segments hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/arithmetic_1d.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Arithmetic 1D hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/local_length_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Average Length hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/deflection_1d.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Deflection 1D hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/length_from_edges.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Length from edges hypothesis</a></nobr><br>\r
<nobr><a href="../files/max._element_area_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Max Element Area hypothesis</a></nobr><br>\r
<nobr><a href="../files/max._element_volume_hypothsis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Max Element Volume hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/number_of_segments_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Number of segments hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/non_conform_mesh_allowed_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Non conform mesh allowed hypothesis</a></nobr><br>\r
+ <nobr><a href="../files/propagation_of_1d_hypothesis_on_opposite_edges.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Propagation of 1D Hypothesis on opposite edges</a></nobr><br>\r
+ <nobr><a href="../files/start_and_end_length_hypothesis.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Start and End Length hypothesis</a></nobr><br>\r
<nobr><a name="4"></a><a href="whlstt4.htm#4" target="_self" title="closed book"><img src="../wht_toc1.gif" border="0" align="absmiddle"> Defining meshing algorithms</a></nobr><br>\r
<nobr><a href="../files/constructing_meshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Constructing meshes</a></nobr><br>\r
<nobr><a href="../files/constructing_submeshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Constructing submeshes</a></nobr><br>\r
<nobr><a name="7"></a><a href="whlstt4.htm#7" target="_self"><img src="../wht_toc2.gif" border="0" align="absmiddle"> 3D meshing algorithms</a></nobr><br>\r
<nobr><a href="../files/3d_meshing_algorithm.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Hexahedron meshing algorithm</a></nobr><br>\r
<nobr><a href="../files/tetrahedron_(netgen)_meshing_algorithm.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Tetrahedron (Netgen) meshing algorithm</a></nobr><br>\r
+ <nobr><a href="../tetrahedron_(ghs3d)_meshing_algorithm.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Tetrahedron (GHS3D) meshing algorithm</a></nobr><br>\r
<nobr><a href="../files/constructing_meshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Constructing meshes</a></nobr><br>\r
<nobr><a href="../files/constructing_submeshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Constructing submeshes</a></nobr><br>\r
<nobr><a href="../files/computing_meshes.htm"><img src="../wht_toc3.gif" border="0" align="absmiddle"> Computing meshes</a></nobr><br>\r
<a href="whlstfl19.htm#subkey_U" target="_self"title="search letter U"><b>U</b></a> \r
<a href="whlstfl20.htm#subkey_V" target="_self"title="search letter V"><b>V</b></a> \r
<a href="whlstfl21.htm#subkey_W" target="_self"title="search letter W"><b>W</b></a> \r
- <a href="whlstf3.htm#bm_X" target="ftslist"title="search letter X" ><b>X</b></a> \r
+ <a href="whlstf4.htm#bm_X" target="ftslist"title="search letter X" ><b>X</b></a> \r
<a href="whlstfl22.htm#subkey_Y" target="_self"title="search letter Y"><b>Y</b></a> \r
- <a href="whlstf3.htm#bm_Z" target="ftslist"title="search letter Z" ><b>Z</b></a> \r
+ <a href="whlstf4.htm#bm_Z" target="ftslist"title="search letter Z" ><b>Z</b></a> \r
</p>\r
\r
<body>\r
<body>\r
<h1> WebHelp 5.00 System Info </h1>\r
<table>\r
-<tr><td> Start Page </td><td>smesh.html</td></tr>\r
+<tr><td> Start Page </td><td>smesh.htm</td></tr>\r
<tr><td> Skin Name </td><td>Default</td></tr>\r
-<tr><td> Generating Time </td><td>17:39 02/24/2004</td></tr>\r
+<tr><td> Generating Time </td><td>16:04 09/24/2004</td></tr>\r
<tr><td> Language ID </td><td>1033</td></tr>\r
<tr><td> Compile Script </td><td>webhelp5_compile_script.xml</td></tr>\r
<tr><td> Compile Build Version </td><td>10.00.949</td></tr>\r
<HTML><b>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_LocalLength</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_LocalLength</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_NumberOfSegments</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_NumberOfSegments</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
<td bgcolor= "lightgreen"><div align="center"><b>long GetNumberOfSegments ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetNumberOfSegments ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetScaleFactor ( in double scaleFactor )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetScaleFactor ( scaleFactor )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>double GetScaleFactor ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetScaleFactor ( )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Arithmetic1D</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetLength ( in double length, in boolean isStartLength )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetLength ( length, isStartLength )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>double GetLength ( in boolean isStartLength )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetLength ( isStartLength )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_MaxElementArea</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_MaxElementArea</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_MaxElementVolume</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_LengthFromEdges</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetMode ( in long mode )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetMode ( mode )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long GetMode ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetMode ( )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_StartEndLength</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetLength ( in double length, in boolean isStartLength )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetLength ( length, isStartLength )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>double GetLength ( in boolean isStartLength )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetLength ( isStartLength )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Deflection1D</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetDeflection ( in double deflection )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetDeflection ( deflection )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>double GetDeflection ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetDeflection ( )</b></div></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_MaxElementVolume</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_Regular_1D</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_NotConformAllowed</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Propagation</i></div></b></font></td>
+</tr>
+<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
+<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
+</tr>
+</table><br>
+<table width="100%" BORDER>
+<tr bgcolor="#FFFFCC">
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Regular_1D</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_MEFISTO_2D</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_MEFISTO_2D</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_Quadrangle_2D</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Quadrangle_2D</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
-<td colspan="11"><font size="+3"><b><div align="center"><i>interface SMESH_Hexa_3D</i></div></b></font></td>
+<td colspan="11"><font size="+3"><b><div align="center"><i>interface StdMeshers_Hexa_3D</i></div></b></font></td>
</tr>
<td width="50%" bgcolor= "lightgreen" ><font size="+2"><div align="center"><b><i>IDL file</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Hypothesis CreateHypothesis ( in string anHyp, in long studyId )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateHypothesis ( anHyp, studyId )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>FilterManager CreateFilterManager ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateFilterManager ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Mesh Init ( in GEOM_Gen geomEngine, in long studyId, in GEOM_Shape aShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = Init ( geomEngine, studyId, aShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Pattern GetPattern ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetPattern ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>boolean Compute ( in SMESH_Mesh aMesh, in GEOM_Shape aSubShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = Compute ( aMesh, aSubShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>void SetCurrentStudy ( in Study theStudy )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SetCurrentStudy ( theStudy )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>boolean IsReadyToCompute ( in SMESH_Mesh aMesh, in GEOM_Shape aSubShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = IsReadyToCompute ( aMesh, aSubShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Study GetCurrentStudy ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetCurrentStudy ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>long_array GetSubShapesId ( in GEOM_Gen geomEngine, in long studyId, in GEOM_Shape mainShape, in shape_array listOfSubShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetSubShapesId ( geomEngine, studyId, mainShape, listOfSubShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Hypothesis CreateHypothesis ( in string theHypName, in string theLibName )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateHypothesis ( theHypName, theLibName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Mesh CreateMesh ( in GEOM_Object theObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateMesh ( theObject )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Mesh CreateMeshesFromUNV ( in string theFileName )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateMeshesFromUNV ( theFileName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>mesh_array CreateMeshesFromMED ( in string theFileName, out DriverMED_ReadStatus theStatus )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>[ return_value, theStatus ] = CreateMeshesFromMED ( theFileName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Mesh CreateMeshesFromSTL ( in string theFileName )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateMeshesFromSTL ( theFileName )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean Compute ( in SMESH_Mesh theMesh, in GEOM_Object theSubObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Compute ( theMesh, theSubObject )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean IsReadyToCompute ( in SMESH_Mesh theMesh, in GEOM_Object theSubObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = IsReadyToCompute ( theMesh, theSubObject )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long_array GetSubShapesId ( in GEOM_Object theMainObject, in object_array theListOfSubObjects )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetSubShapesId ( theMainObject, theListOfSubObjects )</b></div></td>
</tr>
</table><br>
</b></HTML>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetName ( )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string GetLibName ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetLibName ( )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>long GetId ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetId ( )</b></div></td>
</tr>
<td width="50%" bgcolor= "lightgreen"><font size="+2"><div align="center"><b><i>Python</i></b></div></font></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>SMESH_subMesh GetElementsOnShape ( in GEOM_Shape aSubShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetElementsOnShape ( aSubShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_subMesh GetSubMesh ( in GEOM_Object aSubObject, in string name )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetSubMesh ( aSubObject, name )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>boolean AddHypothesis ( in GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = AddHypothesis ( aSubShape, anHyp )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemoveSubMesh ( in SMESH_subMesh aSubMesh )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemoveSubMesh ( aSubMesh )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>boolean RemoveHypothesis ( in GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = RemoveHypothesis ( aSubShape, anHyp )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Group CreateGroup ( in ElementType elem_type, in string name )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateGroup ( elem_type, name )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>ListOfHypothesis GetHypothesisList ( in GEOM_Shape aSubShape )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetHypothesisList ( aSubShape )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Group CreateGroupFromGEOM ( in ElementType elem_type, in string name, in GEOM_Object theGEOMGroup )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CreateGroupFromGEOM ( elem_type, name, theGEOMGroup )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemoveGroup ( in SMESH_Group aGroup )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemoveGroup ( aGroup )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RemoveGroupWithContents ( in SMESH_Group aGroup )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RemoveGroupWithContents ( aGroup )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Group UnionGroups ( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = UnionGroups ( aGroup1, aGroup2, name )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Group IntersectGroups ( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = IntersectGroups ( aGroup1, aGroup2, name )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>SMESH_Group CutGroups ( in SMESH_Group aMainGroup, in SMESH_Group aToolGroup, in string name )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CutGroups ( aMainGroup, aToolGroup, name )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Hypothesis_Status AddHypothesis ( in GEOM_Object aSubObject, in SMESH_Hypothesis anHyp )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = AddHypothesis ( aSubObject, anHyp )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>Hypothesis_Status RemoveHypothesis ( in GEOM_Object aSubObject, in SMESH_Hypothesis anHyp )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = RemoveHypothesis ( aSubObject, anHyp )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>ListOfHypothesis GetHypothesisList ( in GEOM_Object aSubObject )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetHypothesisList ( aSubObject )</b></div></td>
</tr>
<tr>
<td bgcolor= "lightgreen"><div align="center"><b>log_array GetLog ( in boolean clearAfterGet )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>ExportDAT ( file )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>void ExportMED ( in string file )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>ExportMED ( file )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>void ExportMED ( in string file, in boolean auto_groups )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ExportMED ( file, auto_groups )</b></div></td>
</tr>
<tr>
<td bgcolor= "lightgreen"><div align="center"><b>void ExportUNV ( in string file )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>ExportUNV ( file )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void ExportSTL ( in string file, in boolean isascii )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ExportSTL ( file, isascii )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>MESH GetMEDMesh ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetMEDMesh ( )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = NbHexas ( )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long NbPyramids ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = NbPyramids ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long NbPrisms ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = NbPrisms ( )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>long NbSubMesh ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = NbSubMesh ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>string Dump ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Dump ( )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetNumberOfElements ( )</b></div></td>
</tr>
<tr>
-<td bgcolor= "lightgreen"><div align="center"><b>long GetNumberOfNodes ( )</b></div></td>
-<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetNumberOfNodes ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>long GetNumberOfNodes ( in boolean all )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetNumberOfNodes ( all )</b></div></td>
</tr>
<tr>
<td bgcolor= "lightgreen"><div align="center"><b>long_array GetElementsId ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetElementsId ( )</b></div></td>
</tr>
<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long_array GetElementsByType ( in ElementType theType )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetElementsByType ( theType )</b></div></td>
+</tr>
+<tr>
<td bgcolor= "lightgreen"><div align="center"><b>long_array GetNodesId ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = GetNodesId ( )</b></div></td>
</tr>
<td bgcolor= "lightgreen"><div align="center"><b>boolean AddVolume ( in long_array IDsOfNodes )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = AddVolume ( IDsOfNodes )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean MoveNode ( in long NodeID, in double x, in double y, in double z )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = MoveNode ( NodeID, x, y, z )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean InverseDiag ( in long NodeID1, in long NodeID2 )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = InverseDiag ( NodeID1, NodeID2 )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean DeleteDiag ( in long NodeID1, in long NodeID2 )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = DeleteDiag ( NodeID1, NodeID2 )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean Reorient ( in long_array IDsOfElements )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Reorient ( IDsOfElements )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean TriToQuad ( in long_array IDsOfElements, in NumericalFunctor Criterion, in double MaxAngle )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = TriToQuad ( IDsOfElements, Criterion, MaxAngle )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean QuadToTri ( in long_array IDsOfElements, in NumericalFunctor Criterion )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = QuadToTri ( IDsOfElements, Criterion )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean SplitQuad ( in long_array IDsOfElements, in boolean Diag13 )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SplitQuad ( IDsOfElements, Diag13 )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean Smooth ( in long_array IDsOfElements, in long_array IDsOfFixedNodes, in long MaxNbOfIterations, in double MaxAspectRatio, in Smooth_Method Method )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = Smooth ( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RenumberNodes ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RenumberNodes ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RenumberElements ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RenumberElements ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void RotationSweep ( in long_array IDsOfElements, in AxisStruct Axix, in double AngleInRadians, in long NbOfSteps, in double Tolerance )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>RotationSweep ( IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void ExtrusionSweep ( in long_array IDsOfElements, in DirStruct StepVector, in long NbOfSteps )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>ExtrusionSweep ( IDsOfElements, StepVector, NbOfSteps )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Mirror ( in long_array IDsOfElements, in AxisStruct Mirror, in MirrorType theMirrorType, in boolean Copy )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Mirror ( IDsOfElements, Mirror, theMirrorType, Copy )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Translate ( in long_array IDsOfElements, in DirStruct Vector, in boolean Copy )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Translate ( IDsOfElements, Vector, Copy )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void Rotate ( in long_array IDsOfElements, in AxisStruct Axis, in double AngleInRadians, in boolean Copy )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>Rotate ( IDsOfElements, Axis, AngleInRadians, Copy )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void FindCoincidentNodes ( in double Tolerance, out array_of_long_array GroupsOfNodes )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>GroupsOfNodes = FindCoincidentNodes ( Tolerance )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void MergeNodes ( in array_of_long_array GroupsOfNodes )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>MergeNodes ( GroupsOfNodes )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>void MergeEqualElements ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>MergeEqualElements ( )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean SewFreeBorders ( in long FirstNodeID1, in long SecondNodeID1, in long LastNodeID1, in long FirstNodeID2, in long SecondNodeID2, in long LastNodeID2 )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SewFreeBorders ( FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2, LastNodeID2 )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean SewConformFreeBorders ( in long FirstNodeID1, in long SecondNodeID1, in long LastNodeID1, in long FirstNodeID2, in long SecondNodeID2 )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SewConformFreeBorders ( FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2 )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean SewBorderToSide ( in long FirstNodeIDOnFreeBorder, in long SecondNodeIDOnFreeBorder, in long LastNodeIDOnFreeBorder, in long FirstNodeIDOnSide, in long LastNodeIDOnSide )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SewBorderToSide ( FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, FirstNodeIDOnSide, LastNodeIDOnSide )</b></div></td>
+</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>boolean SewSideElements ( in long_array IDsOfSide1Elements, in long_array IDsOfSide2Elements, in long NodeID1OfSide1ToMerge, in long NodeID1OfSide2ToMerge, in long NodeID2OfSide1ToMerge, in long NodeID2OfSide2ToMerge )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = SewSideElements ( IDsOfSide1Elements, IDsOfSide2Elements, NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge )</b></div></td>
+</tr>
</table><br>
</b></HTML>
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME - SMESH - v.2.0.0"
+PROJECT_NAME = "SALOME - SMESH - v.2.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
<li><a href="HTML/SMESH_BasicHypothesis.html">Mapping of SMESH_BasicHypothesis functions</a></li>
<li><a href="HTML/SMESH_Hypothesis.html">Mapping of SMESH_Hypothesis functions</a></li>
<li><a href="HTML/SMESH_Mesh.html">Mapping of SMESH_Mesh functions</a></li>
+ <li><a href="HTML/SMESH_Filter.html">Mapping of SMESH_Filter functions</a></li>
+ <li><a href="HTML/SMESH_Gen.html">Mapping of SMESH_Gen functions</a></li>
+ <li><a href="HTML/SMESH_Group.html">Mapping of SMESH_Group functions</a></li>
+ <li><a href="HTML/SMESH_Pattern.html">Mapping of SMESH_Pattern functions</a></li>
</ul>
</li>
</ul>
-foldersTree = gFld("<b>SALOME v.2.0.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.2.1.0 </b>", "", "")
insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
SMESH_Hypothesis.idl \
SMESH_BasicHypothesis.idl \
SMESH_Filter.idl \
- SMESH_Group.idl
+ SMESH_Group.idl \
+ SMESH_Pattern.idl
PY_CLIENT_IDL = $(IDL_FILES)
double GetScaleFactor();
};
+ /*!
+ * StdMeshers_Arithmetic1D: interface of "Arithmetic 1D" hypothesis
+ */
+ interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis
+ {
+ /*!
+ * Sets <start segment length> or <end segment length> parameter value
+ */
+ void SetLength(in double length, in boolean isStartLength)
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Returns <start segment length> or <end segment length> parameter value
+ */
+ double GetLength(in boolean isStartLength);
+ };
+
/*!
* StdMeshers_MaxElementArea: interface of "Max. Triangle Area" hypothesis
*/
long GetMode();
};
+ /*!
+ * StdMeshers_StartEndLength: interface of "Start and End Length" hypothesis
+ */
+ interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis
+ {
+ /*!
+ * Sets <start segment length> or <end segment length> parameter value
+ */
+ void SetLength(in double length, in boolean isStartLength)
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Returns <start segment length> or <end segment length> parameter value
+ */
+ double GetLength(in boolean isStartLength);
+ };
+
+
+ /*!
+ * StdMeshers_Deflection1D: interface of "Deflection 1D" hypothesis
+ */
+ interface StdMeshers_Deflection1D : SMESH::SMESH_Hypothesis
+ {
+ /*!
+ * Sets <deflection> parameter value
+ */
+ void SetDeflection(in double deflection)
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Returns <deflection> parameter value
+ */
+ double GetDeflection();
+ };
+
+
/*!
* StdMeshers_MaxElementVolume: interface of "Max. Hexahedron or Tetrahedron Volume" hypothesis
*/
{
};
+ /*!
+ * StdMeshers_Propagation: interface of "Propagation" hypothesis.
+ * Presence of this hypothesis on any edge propagates any other 1D
+ * hypothesis from this edge on all edges, opposite to it.
+ * It concerns only edges of quadrangle faces.
+ */
+ interface StdMeshers_Propagation : SMESH::SMESH_Hypothesis
+ {
+ };
+
/*!
* StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
*/
#include "SALOME_GenericObj.idl"\r
#include "SMESH_Mesh.idl"\r
\r
-module SMESH{\r
\r
- interface Functor: SALOME::GenericObj{\r
- void SetMesh(in SMESH_Mesh theMesh);\r
+module GEOM\r
+{\r
+ interface GEOM_Object;\r
+};\r
+\r
+\r
+module SMESH\r
+{\r
+\r
+ /*!\r
+ * Enumeration of functor types\r
+ */\r
+ enum FunctorType\r
+ {\r
+ FT_AspectRatio,\r
+ FT_Warping, \r
+ FT_MinimumAngle,\r
+ FT_Taper, \r
+ FT_Skew, \r
+ FT_Area, \r
+ FT_FreeBorders,\r
+ FT_FreeEdges,\r
+ FT_MultiConnection,\r
+ FT_Length,\r
+ FT_BelongToGeom,\r
+ FT_BelongToPlane,\r
+ FT_BelongToCylinder,\r
+ FT_RangeOfIds,\r
+ FT_LessThan,\r
+ FT_MoreThan,\r
+ FT_EqualTo,\r
+ FT_LogicalNOT,\r
+ FT_LogicalAND,\r
+ FT_LogicalOR,\r
+ FT_Undefined\r
};\r
\r
- interface NumericalFunctor: Functor{\r
- double GetValue(in long theElementId);\r
+ /*!\r
+ * Base interface for all functors ( i.e. numerical functors and predicates )\r
+ */\r
+ interface Functor: SALOME::GenericObj\r
+ {\r
+ void SetMesh( in SMESH_Mesh theMesh );\r
+ FunctorType GetFunctorType();\r
+ ElementType GetElementType();\r
};\r
\r
- interface MinimumAngle: NumericalFunctor{};\r
- interface AspectRatio: NumericalFunctor{};\r
- interface Warping: NumericalFunctor{};\r
- interface Taper: NumericalFunctor{};\r
- interface Skew: NumericalFunctor{};\r
- interface Area: NumericalFunctor{};\r
- interface Length: NumericalFunctor{};\r
- interface MultiConnection: NumericalFunctor{};\r
\r
- interface Predicate: Functor{\r
- boolean IsSatisfy(in long thEntityId);\r
+\r
+ /*!\r
+ * Numerical functors are intended for calculating value by Id of mesh entity\r
+ */\r
+ interface NumericalFunctor: Functor\r
+ {\r
+ double GetValue( in long theElementId );\r
+\r
+ /*!\r
+ * Set precision for calculation. It is a position after point which is\r
+ * used to functor value after calculation.\r
+ */\r
+ void SetPrecision( in long thePrecision );\r
+ long GetPrecision();\r
+ };\r
+ interface MinimumAngle : NumericalFunctor{};\r
+ interface AspectRatio : NumericalFunctor{};\r
+ interface Warping : NumericalFunctor{};\r
+ interface Taper : NumericalFunctor{};\r
+ interface Skew : NumericalFunctor{};\r
+ interface Area : NumericalFunctor{};\r
+ interface Length : NumericalFunctor{};\r
+ interface MultiConnection : NumericalFunctor{};\r
+\r
+ /*!\r
+ * Predicates are intended for verification of criteria,\r
+ * must return bool value by mesh id\r
+ */\r
+ interface Predicate: Functor\r
+ {\r
+ boolean IsSatisfy( in long thEntityId );\r
+ };\r
+\r
+ /*!\r
+ * Logical functor (predicate) "Belong To Geometry".\r
+ * Verify whether mesh element or node belong to pointed Geom Object\r
+ */\r
+ interface BelongToGeom: Predicate\r
+ {\r
+ void SetGeom( in GEOM::GEOM_Object theGeom );\r
+ void SetElementType( in ElementType theType );\r
+\r
+ void SetShapeName( in string theName );\r
+ string GetShapeName(); \r
+ };\r
+\r
+ /*!\r
+ * Logical functor (predicate) "Belong To Surface".\r
+ * Base interface for "belong to plane" and "belong to cylinder interfaces"\r
+ */\r
+ interface BelongToSurface: Predicate\r
+ {\r
+ void SetTolerance( in double theToler );\r
+ double GetTolerance();\r
+ void SetShapeName( in string theName, in ElementType theType );\r
+ string GetShapeName();\r
};\r
\r
+\r
+ /*!\r
+ * Logical functor (predicate) "Belong To Plane".\r
+ * Verify whether mesh element lie in pointed Geom planar object\r
+ */\r
+ interface BelongToPlane: BelongToSurface\r
+ {\r
+ void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
+ };\r
+\r
+ /*!\r
+ * Logical functor (predicate) "Belong To Culinder".\r
+ * Verify whether mesh element lie in pointed Geom cylindrical object\r
+ */\r
+ interface BelongToCylinder: BelongToSurface\r
+ {\r
+ void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
+ };\r
+\r
+ /*!\r
+ * Logical functor (predicate) "Free borders".\r
+ * Verify whether 1D mesh element is free ( i.e. connected to one face only )\r
+ */\r
interface FreeBorders: Predicate{};\r
\r
- interface Comparator: Predicate{\r
- void SetMargin(in double theValue);\r
- void SetNumFunctor(in NumericalFunctor theFunct);\r
+ /*!\r
+ * Logical functor (predicate) "Free edges".\r
+ * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )\r
+ */\r
+ interface FreeEdges: Predicate\r
+\r
+ {\r
+ struct Border\r
+ {\r
+ long myElemId;\r
+ long myPnt1, myPnt2;\r
+ };\r
+ typedef sequence<Border> Borders;\r
+ Borders GetBorders();\r
};\r
\r
+\r
+ /*!\r
+ * Abstract logical functor (predicate) "RangeOfIds".\r
+ * Verify whether an Entity Id belongs to defined sequence of id's\r
+ */\r
+ interface RangeOfIds: Predicate\r
+ {\r
+ void SetRange( in long_array theIds );\r
+ boolean SetRangeStr( in string theRange );\r
+ string GetRangeStr();\r
+\r
+ void SetElementType( in ElementType theType );\r
+ };\r
+\r
+ /*!\r
+ * Comparator. Predicate for compare value calculated\r
+ * by numerical functor with threshold value\r
+ */\r
+ interface Comparator: Predicate\r
+ {\r
+ void SetMargin( in double theValue );\r
+ void SetNumFunctor( in NumericalFunctor theFunct );\r
+ double GetMargin();\r
+ };\r
interface LessThan: Comparator{};\r
interface MoreThan: Comparator{};\r
- interface EqualTo: Comparator{\r
- void SetTolerance(in double theTolerance );\r
+ interface EqualTo : Comparator\r
+ {\r
+ void SetTolerance( in double theToler );\r
+ double GetTolerance();\r
};\r
\r
+ /*!\r
+ * Logical predicates are intended for compose predicates using boolean operations\r
+ */\r
interface Logical: Predicate{};\r
\r
- interface LogicalNOT: Logical{\r
+ interface LogicalNOT: Logical\r
+ {\r
void SetPredicate(in Predicate thePredicate);\r
};\r
\r
- interface LogicalBinary: Logical{\r
- void SetPredicate1(in Predicate thePredicate);\r
- void SetPredicate2(in Predicate thePredicate);\r
+ interface LogicalBinary: Logical\r
+{\r
+ void SetPredicate1( in Predicate thePredicate );\r
+ void SetPredicate2( in Predicate thePredicate );\r
};\r
- \r
+\r
interface LogicalAND: LogicalBinary{};\r
- interface LogicalOR: LogicalBinary{};\r
- interface Filter: SALOME::GenericObj{\r
- void SetPredicate( in Predicate thePredicate );\r
- long_array GetElementsId( in SMESH_Mesh theMesh );\r
- };\r
-\r
- interface FilterManager: SALOME::GenericObj{\r
- MinimumAngle CreateMinimumAngle();\r
- AspectRatio CreateAspectRatio();\r
- Warping CreateWarping();\r
- Taper CreateTaper();\r
- Skew CreateSkew();\r
- Area CreateArea();\r
- Length CreateLength();\r
- MultiConnection CreateMultiConnection();\r
-\r
- FreeBorders CreateFreeBorders();\r
-\r
- LessThan CreateLessThan();\r
- MoreThan CreateMoreThan();\r
- EqualTo CreateEqualTo();\r
- \r
- LogicalNOT CreateLogicalNOT();\r
- LogicalAND CreateLogicalAND();\r
- LogicalOR CreateLogicalOR();\r
- Filter CreateFilter();\r
- };\r
- \r
+ interface LogicalOR : LogicalBinary{};\r
+\r
+ /*!\r
+ * Filter\r
+ */\r
+ interface Filter: SALOME::GenericObj\r
+ {\r
+ /*!\r
+ * Structure containing information about one criterion\r
+ * Type - FT_Taper, FT_Skew ...\r
+ * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo\r
+ * Threshold - threshold value\r
+ * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined\r
+ * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or\r
+ * (FT_Undefined must be for the last criterion)\r
+ * ThresholdStr - Threshold value defined as string. Used for:\r
+ * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"\r
+ * 2. BelongToGeom predicate for storing name of shape\r
+ * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for\r
+ * "Belong to plane" and "Belong to cylinder" predicates\r
+ * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)\r
+ * Precision - Precision of numerical functors\r
+ */\r
+ struct Criterion\r
+ {\r
+ long Type;\r
+ long Compare;\r
+ double Threshold;\r
+ string ThresholdStr;\r
+ long UnaryOp;\r
+ long BinaryOp;\r
+ double Tolerance;\r
+ ElementType TypeOfElement;\r
+ long Precision;\r
+ };\r
+\r
+ typedef sequence<Criterion> Criteria;\r
+\r
+ void SetPredicate( in Predicate thePredicate );\r
+ long_array GetElementsId( in SMESH_Mesh theMesh );\r
+ ElementType GetElementType();\r
+ Predicate GetPredicate();\r
+\r
+ boolean GetCriteria( out Criteria theCriteria );\r
+ boolean SetCriteria( in Criteria theCriteria );\r
+ };\r
+\r
+\r
+ /*!\r
+ * Interface for working with library of filters\r
+ */\r
+ interface FilterLibrary : SALOME::GenericObj\r
+ {\r
+ /*!\r
+ * Copy filter from library by name (new filter is created)\r
+ */\r
+ Filter Copy( in string theFilterName );\r
+\r
+ /*!\r
+ * Methods for editing library\r
+ */\r
+ boolean Add ( in string theFilterName, in Filter theFilter );\r
+ boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter\r
+ boolean Delete ( in string theFilterName );\r
+ boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );\r
+\r
+ /*!\r
+ * Save library on disk\r
+ */\r
+ boolean Save();\r
+ boolean SaveAs( in string aFileName );\r
+\r
+ /*!\r
+ * Query methods\r
+ */\r
+ boolean IsPresent( in string aFilterName );\r
+ long NbFilters( in ElementType aType );\r
+ string_array GetNames( in ElementType aType );\r
+ string_array GetAllNames();\r
+ void SetFileName( in string aFilterName );\r
+ string GetFileName();\r
+ };\r
+\r
+\r
+ /*!\r
+ * Interface of Filter manager\r
+ */\r
+ interface FilterManager: SALOME::GenericObj\r
+ {\r
+ /*!\r
+ * Create numerical functors\r
+ */\r
+ MinimumAngle CreateMinimumAngle();\r
+ AspectRatio CreateAspectRatio();\r
+ Warping CreateWarping();\r
+ Taper CreateTaper();\r
+ Skew CreateSkew();\r
+ Area CreateArea();\r
+ Length CreateLength();\r
+ MultiConnection CreateMultiConnection();\r
+\r
+ /*!\r
+ * Create logical functors ( predicates )\r
+ */\r
+ BelongToGeom CreateBelongToGeom();\r
+ BelongToPlane CreateBelongToPlane();\r
+ BelongToCylinder CreateBelongToCylinder();\r
+\r
+ FreeBorders CreateFreeBorders();\r
+ FreeEdges CreateFreeEdges();\r
+\r
+ RangeOfIds CreateRangeOfIds();\r
+\r
+ /*!\r
+ * Create comparators ( predicates )\r
+ */\r
+ LessThan CreateLessThan();\r
+ MoreThan CreateMoreThan();\r
+ EqualTo CreateEqualTo();\r
+\r
+ /*!\r
+ * Create boolean operations ( predicates )\r
+ */\r
+ LogicalNOT CreateLogicalNOT();\r
+ LogicalAND CreateLogicalAND();\r
+ LogicalOR CreateLogicalOR();\r
+\r
+ /*!\r
+ * Create filter\r
+ */\r
+ Filter CreateFilter();\r
+\r
+ /*!\r
+ * Load filter library. If libary does not exist it is created\r
+ */\r
+ FilterLibrary LoadLibrary( in string aFileName );\r
+\r
+ /*!\r
+ * Create new library\r
+ */\r
+ FilterLibrary CreateLibrary();\r
+\r
+ /*!\r
+ * Delete library\r
+ */\r
+ boolean DeleteLibrary( in string aFileName );\r
+ };\r
};\r
\r
+\r
#endif\r
#include "SALOMEDS.idl"
#include "GEOM_Gen.idl"
-#include "GEOM_Shape.idl"
#include "SMESH_Mesh.idl"
#include "SMESH_Hypothesis.idl"
module SMESH
{
- typedef sequence<GEOM::GEOM_Shape> shape_array;
+ typedef sequence<GEOM::GEOM_Object> object_array;
typedef sequence<SMESH_Mesh> mesh_array;
interface FilterManager;
+ interface SMESH_Pattern;
interface SMESH_Gen : Engines::Component, SALOMEDS::Driver
{
FilterManager CreateFilterManager();
+ SMESH_Pattern GetPattern();
+
/*!
Set the current study
*/
* of TopoDS_Shapes and bind CORBA references of shape & subshapes
* with TopoDS_Shapes
*/
- SMESH_Mesh CreateMesh( in GEOM::GEOM_Shape theShape )
+ SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject )
raises ( SALOME::SALOME_Exception );
+ /*!
+ * Create Mesh object importing data from given UNV file
+ */
+ SMESH_Mesh CreateMeshesFromUNV( in string theFileName )
+ raises ( SALOME::SALOME_Exception );
+
/*!
* Create Mesh object(s) importing data from given MED file
*/
out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
+ /*!
+ * Create Mesh object importing data from given STL file
+ */
+ SMESH_Mesh CreateMeshesFromSTL( in string theFileName )
+ raises ( SALOME::SALOME_Exception );
+
/*!
* Create a Mesh object, without a geometry shape reference
*/
* return NOK if hypothesis are not sufficient
*/
boolean Compute( in SMESH_Mesh theMesh,
- in GEOM::GEOM_Shape theSubShape )
+ in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
/*!
*/
boolean IsReadyToCompute( in SMESH_Mesh theMesh,
- in GEOM::GEOM_Shape theSubShape )
+ in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
/*!
*
*/
- long_array GetSubShapesId( in GEOM::GEOM_Shape theMainShape,
- in shape_array theListOfSubShape )
+ long_array GetSubShapesId( in GEOM::GEOM_Object theMainObject,
+ in object_array theListOfSubObjects )
raises ( SALOME::SALOME_Exception );
/*!
*
*/
- // long_array GetSubMeshesState( in shape_array theListOfSubShape )
+ // long_array GetSubMeshesState( in object_array theListOfSubShape )
// raises ( SALOME::SALOME_Exception );
-
};
};
#define _SMESH_MESH_IDL_
#include "SALOME_Exception.idl"
-//#include "SMESH_Hypothesis.idl"
-
#include "SALOME_GenericObj.idl"
-//#include "GEOM_Shape.idl"
-//#include "MED.idl"
module GEOM
{
- interface GEOM_Shape;
+ interface GEOM_Object;
};
typedef sequence<double> double_array ;
typedef sequence<long> long_array ;
typedef sequence<string> string_array ;
+ typedef sequence<long_array> array_of_long_array ;
enum log_command
{
ADD_PRISM,
ADD_HEXAHEDRON,
REMOVE_NODE,
- REMOVE_ELEMENT
+ REMOVE_ELEMENT,
+ MOVE_NODE,
+ CHANGE_ELEMENT_NODES,
+ RENUMBER
};
struct log_block
long_array indexes;
};
+ struct PointStruct { double x;
+ double y;
+ double z; } ;
+ struct DirStruct { PointStruct PS ; } ; // analog to Occ Direction
+
+ struct AxisStruct { double x;
+ double y;
+ double z;
+ double vx;
+ double vy;
+ double vz; } ;
+
/*!
* Enumeration for element type, like in SMDS
* Associate a Shape to a Mesh created with NewEmpty
*/
-// boolean SetMesh(in GEOM::GEOM_Shape aShape)
+// boolean SetMesh(in GEOM::GEOM_Object anObject)
// raises (SALOME::SALOME_Exception);
/*!
* SubMesh will be used instead of SubShape in a next idl version to
* adress a specific subMesh...
*/
- SMESH_subMesh GetSubMesh(in GEOM::GEOM_Shape aSubShape, in string name)
+ SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
raises (SALOME::SALOME_Exception);
/*!
in string name )
raises (SALOME::SALOME_Exception);
+ /*!
+ * Create a group from geometry group
+ */
+ SMESH_Group CreateGroupFromGEOM( in ElementType elem_type,
+ in string name,
+ in GEOM::GEOM_Object theGEOMGroup )
+ raises (SALOME::SALOME_Exception);
+
/*!
* Remove a group
*/
void RemoveGroup(in SMESH_Group aGroup)
raises (SALOME::SALOME_Exception);
+ /*!
+ * Remove group with its contents
+ */
+ void RemoveGroupWithContents( in SMESH_Group aGroup )
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Union of two groups
+ * New group is created. All mesh elements that are
+ * present in initial groups are added to the new one
+ */
+ SMESH_Group UnionGroups( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Intersection of two groups
+ * New group is created. All mesh elements that are
+ * present in both initial groups are added to the new one.
+ */
+ SMESH_Group IntersectGroups( in SMESH_Group aGroup1, in SMESH_Group aGroup2, in string name )
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Cut of two groups
+ * New group is created. All mesh elements that are present in
+ * main group but do not present in tool group are added to the new one
+ */
+ SMESH_Group CutGroups( in SMESH_Group aMainGroup, in SMESH_Group aToolGroup, in string name )
+ raises (SALOME::SALOME_Exception);
+
/*!
* Add hypothesis to the mesh, under a particular subShape
* (or the main shape itself)
* (or one previous hypothesis on the subShape)
* raises exception if hypothesis has not been created
*/
- Hypothesis_Status AddHypothesis(in GEOM::GEOM_Shape aSubShape,
+ Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
in SMESH_Hypothesis anHyp)
raises (SALOME::SALOME_Exception);
// boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
/*!
* Remove an hypothesis previouly added with AddHypothesis.
*/
- Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Shape aSubShape,
+ Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
in SMESH_Hypothesis anHyp)
raises (SALOME::SALOME_Exception);
// boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
/*!
* Get the list of hypothesis added on a subShape
*/
- ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Shape aSubShape)
+ ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
raises (SALOME::SALOME_Exception);
// ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
// raises (SALOME::SALOME_Exception);
raises (SALOME::SALOME_Exception);
void ExportUNV( in string file )
raises (SALOME::SALOME_Exception);
+ void ExportSTL( in string file, in boolean isascii )
+ raises (SALOME::SALOME_Exception);
/*!
* Get MED Mesh
/*!
*
*/
- long GetNumberOfNodes()
+ long GetNumberOfNodes( in boolean all )
raises (SALOME::SALOME_Exception);
/*!
};
/*
- * This interface makes modifications on the Mesh - removing elements and nodes
- */
+ * This interface makes modifications on the Mesh - removing elements and nodes etc.
+ */
+ interface NumericalFunctor;
interface SMESH_MeshEditor {
- boolean RemoveElements(in long_array IDsOfElements)
- raises (SALOME::SALOME_Exception);
+ boolean RemoveElements(in long_array IDsOfElements);
- boolean RemoveNodes(in long_array IDsOfNodes)
- raises (SALOME::SALOME_Exception);
+ boolean RemoveNodes(in long_array IDsOfNodes);
- boolean AddNode(in double x, in double y, in double z)
- raises (SALOME::SALOME_Exception);
+ boolean AddNode(in double x, in double y, in double z);
- boolean AddEdge(in long_array IDsOfNodes)
- raises (SALOME::SALOME_Exception);
+ boolean AddEdge(in long_array IDsOfNodes);
- boolean AddFace(in long_array IDsOfNodes)
- raises (SALOME::SALOME_Exception);
+ boolean AddFace(in long_array IDsOfNodes);
+
+ boolean AddVolume(in long_array IDsOfNodes);
+
+ boolean MoveNode(in long NodeID, in double x, in double y, in double z);
+
+ boolean InverseDiag(in long NodeID1, in long NodeID2);
+
+ boolean DeleteDiag(in long NodeID1, in long NodeID2);
+
+ boolean Reorient(in long_array IDsOfElements);
+
+ boolean TriToQuad(in long_array IDsOfElements,
+ in NumericalFunctor Criterion,
+ in double MaxAngle);
+
+ boolean QuadToTri(in long_array IDsOfElements,
+ in NumericalFunctor Criterion);
+
+ boolean SplitQuad(in long_array IDsOfElements,
+ in boolean Diag13);
+
+ enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
+
+ boolean Smooth(in long_array IDsOfElements,
+ in long_array IDsOfFixedNodes,
+ in long MaxNbOfIterations,
+ in double MaxAspectRatio,
+ in Smooth_Method Method);
+
+ void RenumberNodes();
+
+ void RenumberElements();
+
+ void RotationSweep(in long_array IDsOfElements,
+ in AxisStruct Axix,
+ in double AngleInRadians,
+ in long NbOfSteps,
+ in double Tolerance);
+
+ void ExtrusionSweep(in long_array IDsOfElements,
+ in DirStruct StepVector,
+ in long NbOfSteps);
+
+ enum MirrorType { POINT, AXIS, PLANE };
+
+ void Mirror (in long_array IDsOfElements,
+ in AxisStruct Mirror,
+ in MirrorType theMirrorType,
+ in boolean Copy);
+
+ void Translate (in long_array IDsOfElements,
+ in DirStruct Vector,
+ in boolean Copy);
+
+ void Rotate (in long_array IDsOfElements,
+ in AxisStruct Axis,
+ in double AngleInRadians,
+ in boolean Copy);
+
+ void FindCoincidentNodes (in double Tolerance,
+ out array_of_long_array GroupsOfNodes);
+
+ void MergeNodes (in array_of_long_array GroupsOfNodes);
+
+ void MergeEqualElements();
+
+ boolean SewFreeBorders (in long FirstNodeID1,
+ in long SecondNodeID1,
+ in long LastNodeID1,
+ in long FirstNodeID2,
+ in long SecondNodeID2,
+ in long LastNodeID2);
+
+ boolean SewConformFreeBorders (in long FirstNodeID1,
+ in long SecondNodeID1,
+ in long LastNodeID1,
+ in long FirstNodeID2,
+ in long SecondNodeID2);
+
+ boolean SewBorderToSide (in long FirstNodeIDOnFreeBorder,
+ in long SecondNodeIDOnFreeBorder,
+ in long LastNodeIDOnFreeBorder,
+ in long FirstNodeIDOnSide,
+ in long LastNodeIDOnSide);
+
+ boolean SewSideElements (in long_array IDsOfSide1Elements,
+ in long_array IDsOfSide2Elements,
+ in long NodeID1OfSide1ToMerge,
+ in long NodeID1OfSide2ToMerge,
+ in long NodeID2OfSide1ToMerge,
+ in long NodeID2OfSide2ToMerge);
- boolean AddVolume(in long_array IDsOfNodes)
- raises (SALOME::SALOME_Exception);
};
};
+++ /dev/null
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESH_NetgenAlgorithm.idl
-// Author : Julia DOROVSKIKH
-// $Header$
-
-#ifndef _SMESH_NETGENALGORITHM_IDL_
-#define _SMESH_NETGENALGORITHM_IDL_
-
-#include "SMESH_Hypothesis.idl"
-
-/*!
- * NETGENPlugin: interfaces to NETGEN related hypotheses and algorithms
- */
-module NETGENPlugin
-{
- /*!
- * NETGENPlugin_NETGEN_3D: interface of "Tetrahedron (Netgen)" algorithm
- */
- interface NETGENPlugin_NETGEN_3D : SMESH::SMESH_3D_Algo
- {
- };
-
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_Pattern.idl
+// Created : Mon Aug 2 10:48:36 2004
+// Author : Edward AGAPOV (eap)
+// $Header:
+
+#ifndef _SMESH_PATTERN_IDL_
+#define _SMESH_PATTERN_IDL_
+
+#include "SMESH_Mesh.idl"
+
+module SMESH
+{
+
+ typedef sequence<SMESH::PointStruct> point_array;
+
+ /*!
+ * SMESH_Pattern: interface of mesh pattern
+ */
+ interface SMESH_Pattern {
+
+ /*!
+ * Load a pattern from the string <theFileContents>
+ */
+ boolean LoadFromFile(in string theFileContents);
+
+ /*!
+ * Create a pattern from the mesh built on <theFace>.
+ * <theProject>==true makes override nodes positions
+ * on <theFace> computed by mesher
+ */
+ boolean LoadFromFace(in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theFace,
+ in boolean theProject);
+
+ /*!
+ * Create a pattern from the mesh built on <theBlock>
+ */
+ boolean LoadFrom3DBlock(in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theBlock);
+
+ /*!
+ * Compute nodes coordinates applying
+ * the loaded pattern to <theFace>. The first key-point
+ * will be mapped into <theVertexOnKeyPoint1>, which must
+ * be in the outer wire of theFace
+ */
+ point_array ApplyToFace(in GEOM::GEOM_Object theFace,
+ in GEOM::GEOM_Object theVertexOnKeyPoint1,
+ in boolean theReverse);
+
+ /*!
+ * Compute nodes coordinates applying
+ * the loaded pattern to <theBlock>. The (0,0,0) key-point
+ * will be mapped into <theVertex000>. The (0,0,1)
+ * key-point will be mapped into <theVertex001>.
+ */
+ point_array ApplyTo3DBlock(in GEOM::GEOM_Object theBlock,
+ in GEOM::GEOM_Object theVertex000,
+ in GEOM::GEOM_Object theVertex001);
+
+ /*!
+ * Create nodes and elements in <theMesh> using nodes
+ * coordinates computed by either of Apply...() methods
+ */
+ boolean MakeMesh(in SMESH_Mesh theMesh);
+
+ /*!
+ * Return the loaded pattern in the string form to be saved in file
+ */
+ string GetString();
+
+ /*!
+ * error code of the last of one of above operations
+ */
+ enum ErrorCode {
+ ERR_OK,
+ // Load(file)
+ ERR_READ_NB_POINTS, // couldn't read nb of points
+ ERR_READ_POINT_COORDS, // invalid nb of point coordinates
+ ERR_READ_TOO_FEW_POINTS, // too few points in a pattern
+ ERR_READ_3D_COORD, // coordinate of 3D point out of [0,1] range
+ ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
+ ERR_READ_BAD_INDEX, // invalid point index
+ ERR_READ_ELEM_POINTS, // invalid nb of points in element
+ ERR_READ_NO_ELEMS, // no elements in a pattern
+ ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
+ // Save(file)
+ ERR_SAVE_NOT_LOADED, // pattern was not loaded
+ // Load(shape)
+ ERR_LOAD_EMPTY_SUBMESH, // no elements to load
+ // Load(face)
+ ERR_LOADF_NARROW_FACE, // too narrow face
+ ERR_LOADF_CLOSED_FACE, // closed face
+ // Load(volume)
+ ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
+ ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
+ // Apply(shape)
+ ERR_APPL_NOT_LOADED, // pattern was not loaded
+ ERR_APPL_BAD_DIMENTION, // wrong shape dimention
+ ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
+ // Apply(face)
+ ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
+ ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
+ ERR_APPLF_INTERNAL_EEROR, // program error
+ // Apply(volume)
+ ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
+ // MakeMesh
+ ERR_MAKEM_NOT_COMPUTED // mapping failed
+ };
+
+ /*!
+ * Return error code of the last operation
+ */
+ ErrorCode GetErrorCode();
+
+ /*!
+ * Return true if the loaded pattern is a 2D one
+ */
+ boolean Is2D();
+
+ /*!
+ * Return coordinates of pattern points
+ */
+ point_array GetPoints();
+
+ /*!
+ * Return indices of key-points within the arrays returned by
+ * GetPoints()
+ */
+ long_array GetKeyPoints();
+
+ /*!
+ * Return nodal connectivity of the elements of the pattern
+ */
+ array_of_long_array GetElementPoints();
+ };
+};
+
+#endif
+++ /dev/null
-<?xml version='1.0' encoding='us-ascii'?>
-<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
-
-<!-- GUI customization for MESH component -->
-
-<meshers>
-
-<meshers-group name="Standard Meshers"
- resources="StdMeshers"
- server-lib="libStdMeshersEngine.so"
- gui-lib="libStdMeshersGUI.so">
- <hypotheses>
-
- <hypothesis type="LocalLength"
- label-id="Average length"
- icon-id="mesh_hypo_length.png"/>
-
- <hypothesis type="LengthFromEdges"
- label-id="Length From Edges (2D Hyp. for Triangulator)"
- icon-id="mesh_hypo_length.png"/>
-
- <hypothesis type="NumberOfSegments"
- label-id="Nb. Segments"
- icon-id="mesh_hypo_segment.png"/>
-
- <hypothesis type="MaxElementArea"
- label-id="Max. Triangle Area"
- icon-id="mesh_hypo_area.png"/>
-
- <hypothesis type="MaxElementVolume"
- label-id="Max. Hexahedron or Tetrahedron Volume"
- icon-id="mesh_hypo_volume.png"/>
-
- <hypothesis type="NotConformAllowed"
- label-id="Not Conform Mesh Allowed"
- icon-id="mesh_hypo_length.png"/>
- </hypotheses>
-
- <algorithms>
-
- <algorithm type="Regular_1D"
- label-id="Wire discretisation"
- icon-id="mesh_algo_regular.png"/>
-
- <algorithm type="MEFISTO_2D"
- label-id="Triangle (Mefisto)"
- icon-id="mesh_algo_mefisto.png"/>
-
- <algorithm type="Quadrangle_2D"
- label-id="Quadrangle (Mapping)"
- icon-id="mesh_algo_quad.png"/>
-
- <algorithm type="Hexa_3D"
- label-id="Hexahedron (i,j,k)"
- icon-id="mesh_algo_hexa.png"/>
- </algorithms>
-</meshers-group>
-
-<meshers-group name="Your Meshers Group"
- resources=""
- server-lib=""
- gui-lib="">
- <hypotheses>
-
- <hypothesis type=""
- label-id=""
- icon-id=""/>
- </hypotheses>
-
- <algorithms>
-
- <algorithm type=""
- label-id=""
- icon-id=""/>
- </algorithms>
-</meshers-group>
-
-</meshers>
+++ /dev/null
-<?xml version='1.0' encoding='us-ascii'?>
-<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
-
-<!-- GUI customization for MESH component -->
-
-<meshers>
-
-<meshers-group name="Standard Meshers"
- resources="StdMeshers"
- server-lib="libStdMeshersEngine.so"
- gui-lib="libStdMeshersGUI.so">
- <hypotheses>
-
- <hypothesis type="LocalLength"
- label-id="Average length"
- icon-id="mesh_hypo_length.png"/>
-
- <hypothesis type="LengthFromEdges"
- label-id="Length From Edges (2D Hyp. for Triangulator)"
- icon-id="mesh_hypo_length.png"/>
-
- <hypothesis type="NumberOfSegments"
- label-id="Nb. Segments"
- icon-id="mesh_hypo_segment.png"/>
-
- <hypothesis type="MaxElementArea"
- label-id="Max. Triangle Area"
- icon-id="mesh_hypo_area.png"/>
-
- <hypothesis type="MaxElementVolume"
- label-id="Max. Hexahedron or Tetrahedron Volume"
- icon-id="mesh_hypo_volume.png"/>
-
- <hypothesis type="NotConformAllowed"
- label-id="Not Conform Mesh Allowed"
- icon-id="mesh_hypo_length.png"/>
- </hypotheses>
-
- <algorithms>
-
- <algorithm type="Regular_1D"
- label-id="Wire discretisation"
- icon-id="mesh_algo_regular.png"/>
-
- <algorithm type="MEFISTO_2D"
- label-id="Triangle (Mefisto)"
- icon-id="mesh_algo_mefisto.png"/>
-
- <algorithm type="Quadrangle_2D"
- label-id="Quadrangle (Mapping)"
- icon-id="mesh_algo_quad.png"/>
-
- <algorithm type="Hexa_3D"
- label-id="Hexahedron (i,j,k)"
- icon-id="mesh_algo_hexa.png"/>
- </algorithms>
-</meshers-group>
-
-<meshers-group name="NETGEN"
- resources="NETGENPlugin"
- server-lib="libNETGENEngine.so"
- gui-lib="">
- <algorithms>
- <algorithm type="NETGEN_3D"
- label-id="Tetrahedron (Netgen)"
- icon-id="mesh_algo_tetra.png"/>
- </algorithms>
-</meshers-group>
-
-<meshers-group name="Your Meshers Group"
- resources=""
- server-lib=""
- gui-lib="">
- <hypotheses>
-
- <hypothesis type=""
- label-id=""
- icon-id=""/>
- </hypotheses>
-
- <algorithms>
-
- <algorithm type=""
- label-id=""
- icon-id=""/>
- </algorithms>
-</meshers-group>
-
-</meshers>
<menu-item label-id="File" item-id="1" pos-id="">
<submenu label-id="Import" item-id="11" pos-id="8">
<popup-item item-id="111" pos-id="" label-id="DAT file" icon-id="" tooltip-id="" accel-id="Ctrl+B" toggle-id="" execute-action=""/>
- <popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/>
+ <popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+U" toggle-id="" execute-action=""/>
<popup-item item-id="113" pos-id="" label-id="MED File" icon-id="" tooltip-id="" accel-id="Ctrl+M" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
</menu-item>
<!-- ************************* Edit (menubar) ************************************** -->
+
<menu-item label-id="Edit" item-id="3" pos-id="2">
<separator pos-id=""/>
<popup-item item-id="33" pos-id="" label-id="Delete" icon-id="delete.png" tooltip-id="" accel-id="" toggle-id="" execute-action="" />
</menu-item>
+<!-- ************************* Tools (menubar) ************************************** -->
+
+<menu-item label-id="Tools" item-id="5" pos-id="">
+ <separator pos-id=""/>
+ <popup-item item-id="5105" pos-id="" label-id="Selection filters library" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+</menu-item>
+
<!-- ************************** Hypothesis (menubar) ************************************ -->
<menu-item label-id="Hypotheses" item-id="50" pos-id="3">
<popup-item item-id="5000" pos-id="" label-id="Create Hypotheses" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="mesh_make_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="803" pos-id="" label-id="Edit Group" icon-id="mesh_edit_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
+ <popup-item item-id="810" pos-id="" label-id="Union Groups" icon-id="mesh_unionGroups.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="811" pos-id="" label-id="Intersect Groups" icon-id="mesh_intersectGroups.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="812" pos-id="" label-id="Cut Groups" icon-id="mesh_cutGroups.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <separator pos-id=""/>
+ <popup-item item-id="813" pos-id="" label-id="Delete Groups" icon-id="mesh_deleteGroups.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <separator pos-id=""/>
<popup-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************** Control (menubar) ************************************ -->
<menu-item label-id="Controls" item-id="60" pos-id="5">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<menu-item label-id="Modification" item-id="40" pos-id="6">
<submenu label-id="Add" item-id="402" pos-id="">
<popup-item item-id="400" pos-id="" label-id="Node" icon-id="mesh_vertex.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="401" pos-id="" label-id="Beam" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="401" pos-id="" label-id="Edge" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4021" pos-id="" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4022" pos-id="" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4031" pos-id="" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4042" pos-id="" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
- <popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="406" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <submenu label-id="Renumbering" item-id="404" pos-id="">
+ <popup-item item-id="4051" pos-id="" label-id="Nodes" icon-id="mesh_renumbering_nodes.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4052" pos-id="" label-id="Elements" icon-id="mesh_renumbering_elements.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ </submenu>
+ <endsubmenu />
+ <submenu label-id="Transformation" item-id="405" pos-id="">
+ <popup-item item-id="4061" pos-id="" label-id="Translation" icon-id="mesh_translation_vector.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4062" pos-id="" label-id="Rotation" icon-id="mesh_rotation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4063" pos-id="" label-id="Symmetry" icon-id="mesh_symmetry_plane.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4064" pos-id="" label-id="Sewing" icon-id="mesh_sew_freeborders.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4065" pos-id="" label-id="Merge nodes" icon-id="mesh_merge_nodes.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ </submenu>
+ <endsubmenu />
+ <popup-item item-id="406" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="407" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="408" pos-id="" label-id="Union of two triangles" icon-id="mesh_union2tri.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="409" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="410" pos-id="" label-id="Union of triangles" icon-id="mesh_uniontri.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="412" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="413" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="414" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Settings (menubar) ********************************* -->
<submenu label-id="Mesh" item-id="100" pos-id="-1">
<submenu label-id="Display Mode" item-id="1000" pos-id="">
<popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
- <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="true" execute-action=""/>
+ <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
<popup-item item-id="10004" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="10003" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<popup-item item-id="1005" pos-id="" label-id="Scalar Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <separator pos-id=""/>
+ <popup-item item-id="1007" pos-id="" label-id="Quality controls" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id="-1"/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="122" pos-id="" label-id="Export to MED" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="123" pos-id="" label-id="Export to UNV" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="SubMesh">
<separator pos-id=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="mesh_make_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
+ <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <separator pos-id=""/>
<popup-item item-id="33" pos-id="" label-id="Delete" icon-id="delete.png" tooltip-id="" accel-id="" toggle-id="" execute-action="" />
</popupmenu>
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="6015" pos-id="" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<toolbar label-id="Controls toolbar">
<toolbutton-item item-id="6001" label-id="Length" icon-id="mesh_length.png" tooltip-id="Length" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="6002" label-id="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="Free edges" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6003" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="Free borders" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="6004" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="Borders at multi-connection" accel-id="" toggle-id="" execute-action=""/>
-<!--<toolbutton-item item-id="6002" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="Connectivity" accel-id="" toggle-id="" execute-action=""/>-->
+ <toolbutton-item item-id="6004" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="Borders at multi-connection" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6014" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="Minimum angle" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="6015" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="Warp" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="6015" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="Warping angle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6016" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="Skew" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Add/Remove toolbar">
<toolbutton-item item-id="400" label-id="Node" icon-id="mesh_vertex.png" tooltip-id="Add Node" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="401" label-id="Beam" icon-id="mesh_line.png" tooltip-id="Add Beam" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="401" label-id="Edge" icon-id="mesh_line.png" tooltip-id="Add Edge" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4021" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="Add Triangle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4022" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="Add Quadrangle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4031" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="Add Tetrahedron" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="4041" label-id="Nodes" icon-id="mesh_rem_node.png" tooltip-id="Remove Nodes" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4042" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="Remove Elements" accel-id="" toggle-id="" execute-action=""/>
+ <separatorTB/>
+ <toolbutton-item item-id="4051" label-id="Nodes" icon-id="mesh_renumbering_nodes.png" tooltip-id="Renumbering Nodes" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4052" label-id="Elements" icon-id="mesh_renumbering_elements.png" tooltip-id="Renumbering Elements" accel-id="" toggle-id="" execute-action=""/>
+ <separatorTB/>
+ <toolbutton-item item-id="4061" label-id="Translation" icon-id="mesh_translation_vector.png" tooltip-id="Displacement of a mesh by Translation" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4062" label-id="Rotation" icon-id="mesh_rotation.png" tooltip-id="Displacement of a mesh by Rotation" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4063" label-id="Symmetry" icon-id="mesh_symmetry_plane.png" tooltip-id="Displacement of a mesh by Symmetry" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4064" label-id="Sewing" icon-id="mesh_sew_freeborders.png" tooltip-id="Sewing of meshes" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4065" label-id="Merge nodes" icon-id="mesh_merge_nodes.png" tooltip-id="Merge nodes" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Modification toolbar">
- <toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="406" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="406" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="407" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="408" label-id="Union of two triangles" icon-id="mesh_union2tri.png" tooltip-id="Union of two triangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="409" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="410" label-id="Union of triangles" icon-id="mesh_uniontri.png" tooltip-id="Union of triangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="412" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="413" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="414" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Display Mode Toolbar">
<menu-item label-id="Modification" item-id="40" pos-id="6">
<submenu label-id="Add" item-id="402" pos-id="">
<popup-item item-id="400" pos-id="" label-id="Node" icon-id="mesh_vertex.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="401" pos-id="" label-id="Beam" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="401" pos-id="" label-id="Edge" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4021" pos-id="" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4022" pos-id="" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4031" pos-id="" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4042" pos-id="" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
+ <submenu label-id="Renumbering" item-id="404" pos-id="">
+ <popup-item item-id="4051" pos-id="" label-id="Nodes" icon-id="mesh_renumbering_nodes.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="4052" pos-id="" label-id="Elements" icon-id="mesh_renumbering_elements.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ </submenu>
+ <endsubmenu />
<popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="406" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="407" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="408" pos-id="" label-id="Union of two triangles" icon-id="mesh_union2tri.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="406" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="409" pos-id="" label-id="Union of triangles" icon-id="mesh_uniontri.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="410" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="411" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="412" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="413" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************** Numbering (menubar) ************************************ -->
<submenu label-id="Mesh" item-id="100" pos-id="-1">
<submenu label-id="Display Mode" item-id="1000" pos-id="">
<popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
- <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="" tooltip-id=""accel-id="" toggle-id="true" execute-action=""/>
+ <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
<popup-item item-id="10003" pos-id="" label-id="Shrink" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
</submenu>
<endsubmenu />
<menu-item label-id="View" item-id="2" pos-id="">
<submenu label-id="Display Mode" item-id="21" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<popup-item item-id="706" pos-id="" label-id="Edit Local Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <separator pos-id=""/>
+ <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Hypothesis">
<submenu label-id="Properties" item-id="113" pos-id="">
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="212" pos-id="" label-id="Shading" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<toolbar label-id="Add/Remove toolbar">
<toolbutton-item item-id="400" label-id="Node" icon-id="mesh_vertex.png" tooltip-id="Add Node" accel-id="" toggle-id="" execute-action=""/>
- <toolbutton-item item-id="401" label-id="Beam" icon-id="mesh_line.png" tooltip-id="Add Beam" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="401" label-id="Edge" icon-id="mesh_line.png" tooltip-id="Add Edge" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4021" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="Add Triangle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4022" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="Add Quadrangle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4031" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="Add Tetrahedron" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="4041" label-id="Nodes" icon-id="mesh_rem_node.png" tooltip-id="Remove Nodes" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="4042" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="Remove Elements" accel-id="" toggle-id="" execute-action=""/>
+ <separatorTB/>
+ <toolbutton-item item-id="4051" label-id="Nodes" icon-id="mesh_renumbering_nodes.png" tooltip-id="Renumbering Nodes" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="4052" label-id="Elements" icon-id="mesh_renumbering_elements.png" tooltip-id="Renumbering Elements" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Modification toolbar">
<toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="406" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="407" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="408" label-id="Union of two triangles" icon-id="mesh_union2tri.png" tooltip-id="Union of two triangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="406" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="409" label-id="Union of triangles" icon-id="mesh_uniontri.png" tooltip-id="Union of triangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="410" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="411" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="412" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/>
+ <toolbutton-item item-id="413" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Display Mode Toolbar">
label-id="Average length"
icon-id="mesh_hypo_length.png"/>
- <hypothesis type="LengthFromEdges"
- label-id="Length From Edges (2D Hyp. for Triangulator)"
+ <hypothesis type="Arithmetic1D"
+ label-id="Arithmetic 1D"
+ icon-id="mesh_hypo_length.png"/>
+
+ <hypothesis type="StartEndLength"
+ label-id="Start and End Length"
icon-id="mesh_hypo_length.png"/>
<hypothesis type="NumberOfSegments"
label-id="Nb. Segments"
icon-id="mesh_hypo_segment.png"/>
+ <hypothesis type="Deflection1D"
+ label-id="Deflection 1D"
+ icon-id="mesh_hypo_length.png"/>
+
+ <hypothesis type="Propagation"
+ label-id="Propagation of 1D Hyp. on opposite edges"
+ icon-id="mesh_hypo_length.png"/>
+
+ <hypothesis type="LengthFromEdges"
+ label-id="Length From Edges (2D Hyp. for Triangulator)"
+ icon-id="mesh_hypo_length.png"/>
+
<hypothesis type="MaxElementArea"
- label-id="Max. Triangle Area"
+ label-id="Max. Element Area"
icon-id="mesh_hypo_area.png"/>
<hypothesis type="MaxElementVolume"
- label-id="Max. Hexahedron or Tetrahedron Volume"
+ label-id="Max. Element Volume"
icon-id="mesh_hypo_volume.png"/>
<hypothesis type="NotConformAllowed"
--- /dev/null
+# SMESH OBJECT : interactive object for SMESH visualization
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Module : SMESH
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
+
+@COMMENCE@
+
+EXPORT_HEADERS = SMESH_Controls.hxx
+
+
+# Libraries targets
+
+LIB = libSMESHControls.la
+LIB_SRC = SMESH_Controls.cxx
+
+# Executables targets
+BIN = SMESHControls
+BIN_SRC =
+
+CPPFLAGS+=$(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS+=$(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSMDS -lTKBRep -lTKG3d
+
+LDFLAGSFORBIN += -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace $(OCC_KERNEL_LIBS) -lTKBRep -lTKG3d
+
+@CONCLUDE@
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "SMESH_Controls.hxx"
+
+int main(int argc, char** argv)
+{
+ using namespace SMESH::Controls;
+ new MinimumAngle();
+ new AspectRatio();
+ new Warping();
+ new Taper();
+ new Skew();
+ new Area();
+ new Length();
+ new MultiConnection();
+ new FreeBorders();
+ new LessThan();
+ new MoreThan();
+ new EqualTo();
+ new LogicalNOT();
+ new LogicalAND();
+ new LogicalOR();
+ new ManifoldPart();
+
+ return 1;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "SMESH_Controls.hxx"
+
+#include <set>
+
+#include <BRep_Tool.hxx>
+#include <gp_Ax3.hxx>
+#include <gp_Cylinder.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Vec.hxx>
+#include <gp_XYZ.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Precision.hxx>
+#include <TColgp_Array1OfXYZ.hxx>
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TopAbs.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_Iterator.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+
+
+
+/*
+ AUXILIARY METHODS
+*/
+
+static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+ gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
+
+ return v1.Magnitude() < gp::Resolution() ||
+ v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
+}
+
+static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+ gp_Vec aVec1( P2 - P1 );
+ gp_Vec aVec2( P3 - P1 );
+ return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+}
+
+static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+{
+ return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+}
+
+static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
+{
+ double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+ return aDist;
+}
+
+static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
+{
+ if ( theMesh == 0 )
+ return 0;
+
+ const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
+ if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+ return 0;
+
+ TColStd_MapOfInteger aMap;
+
+ int aResult = 0;
+ SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+ if ( anIter != 0 )
+ {
+ while( anIter->more() )
+ {
+ const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+ if ( aNode == 0 )
+ return 0;
+ SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+ while( anElemIter->more() )
+ {
+ const SMDS_MeshElement* anElem = anElemIter->next();
+ if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge )
+ {
+ int anId = anElem->GetID();
+
+ if ( anIter->more() ) // i.e. first node
+ aMap.Add( anId );
+ else if ( aMap.Contains( anId ) )
+ aResult++;
+ }
+ }
+ }
+ }
+
+ return aResult;
+}
+
+
+using namespace SMESH::Controls;
+
+/*
+ FUNCTORS
+*/
+
+/*
+ Class : NumericalFunctor
+ Description : Base class for numerical functors
+*/
+NumericalFunctor::NumericalFunctor():
+ myMesh(NULL)
+{
+ myPrecision = -1;
+}
+
+void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool NumericalFunctor::GetPoints(const int theId,
+ TColgp_SequenceOfXYZ& theRes ) const
+{
+ theRes.Clear();
+
+ if ( myMesh == 0 )
+ return false;
+
+ return GetPoints( myMesh->FindElement( theId ), theRes );
+}
+
+bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
+ TColgp_SequenceOfXYZ& theRes )
+{
+ theRes.Clear();
+
+ if ( anElem == 0)
+ return false;
+
+ // Get nodes of the element
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ if ( anIter != 0 )
+ {
+ while( anIter->more() )
+ {
+ const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+ if ( aNode != 0 )
+ theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+ }
+ }
+
+ return true;
+}
+
+long NumericalFunctor::GetPrecision() const
+{
+ return myPrecision;
+}
+
+void NumericalFunctor::SetPrecision( const long thePrecision )
+{
+ myPrecision = thePrecision;
+}
+
+double NumericalFunctor::GetValue( long theId )
+{
+ TColgp_SequenceOfXYZ P;
+ if ( GetPoints( theId, P ))
+ {
+ double aVal = GetValue( P );
+ if ( myPrecision >= 0 )
+ {
+ double prec = pow( 10., (double)( myPrecision ) );
+ aVal = floor( aVal * prec + 0.5 ) / prec;
+ }
+
+ return aVal;
+ }
+
+ return 0.;
+}
+
+/*
+ Class : MinimumAngle
+ Description : Functor for calculation of minimum angle
+*/
+
+double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ double aMin;
+
+ if ( P.Length() == 3 )
+ {
+ double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
+ double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+ double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
+
+ aMin = Min( A0, Min( A1, A2 ) );
+ }
+ else if ( P.Length() == 4 )
+ {
+ double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
+ double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+ double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
+ double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
+
+ aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
+ }
+ else
+ return 0.;
+
+ return aMin * 180 / PI;
+}
+
+double MinimumAngle::GetBadRate( double Value, int nbNodes ) const
+{
+ const double aBestAngle = PI / nbNodes;
+ return ( fabs( aBestAngle - Value ));
+}
+
+SMDSAbs_ElementType MinimumAngle::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : AspectRatio
+ Description : Functor for calculating aspect ratio
+*/
+double AspectRatio::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ int nbNodes = P.Length();
+
+ if ( nbNodes != 3 && nbNodes != 4 )
+ return 0;
+
+ // Compute lengths of the sides
+
+ double aLen[ nbNodes ];
+ for ( int i = 0; i < nbNodes - 1; i++ )
+ aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
+ aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) );
+
+ // Compute aspect ratio
+
+ if ( nbNodes == 3 )
+ {
+ double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
+ if ( anArea <= Precision::Confusion() )
+ return 0.;
+ double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
+ static double aCoef = sqrt( 3. ) / 4;
+
+ return aCoef * aMaxLen * aMaxLen / anArea;
+ }
+ else
+ {
+ double aMinLen = Min( Min( aLen[ 0 ], aLen[ 1 ] ), Min( aLen[ 2 ], aLen[ 3 ] ) );
+ if ( aMinLen <= Precision::Confusion() )
+ return 0.;
+ double aMaxLen = Max( Max( aLen[ 0 ], aLen[ 1 ] ), Max( aLen[ 2 ], aLen[ 3 ] ) );
+
+ return aMaxLen / aMinLen;
+ }
+}
+
+double AspectRatio::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // the aspect ratio is in the range [1.0,infinity]
+ // 1.0 = good
+ // infinity = bad
+ return Value / 1000.;
+}
+
+SMDSAbs_ElementType AspectRatio::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : AspectRatio3D
+ Description : Functor for calculating aspect ratio
+*/
+
+static inline double getHalfPerimeter(double theTria[3]){
+ return (theTria[0] + theTria[1] + theTria[2])/2.0;
+}
+
+static inline double getArea(double theHalfPerim, double theTria[3]){
+ return sqrt(theHalfPerim*
+ (theHalfPerim-theTria[0])*
+ (theHalfPerim-theTria[1])*
+ (theHalfPerim-theTria[2]));
+}
+
+static inline double getVolume(double theLen[6]){
+ double a2 = theLen[0]*theLen[0];
+ double b2 = theLen[1]*theLen[1];
+ double c2 = theLen[2]*theLen[2];
+ double d2 = theLen[3]*theLen[3];
+ double e2 = theLen[4]*theLen[4];
+ double f2 = theLen[5]*theLen[5];
+ double P = 4.0*a2*b2*d2;
+ double Q = a2*(b2+d2-e2)-b2*(a2+d2-f2)-d2*(a2+b2-c2);
+ double R = (b2+d2-e2)*(a2+d2-f2)*(a2+d2-f2);
+ return sqrt(P-Q+R)/12.0;
+}
+
+static inline double getHeight( const gp_Pnt& P1, const gp_Pnt& P2,
+ const gp_Pnt& P3, const gp_Pnt& P4)
+{
+ gp_Vec aVec1( P2.XYZ() - P1.XYZ() );
+ gp_Vec aVec2( P3.XYZ() - P1.XYZ() );
+ gp_Vec aNorm = aVec1 ^ aVec2;
+ aNorm /= aNorm.Magnitude();
+ gp_Vec aVec3( P4.XYZ() - P1.XYZ() );
+ double aDist = aVec1 * aVec2;
+ return fabs( aDist );
+}
+
+static inline double getMaxHeight( const TColgp_SequenceOfXYZ& P )
+{
+ double aHeight = getHeight(P(1),P(2),P(3),P(4));
+ aHeight = max(aHeight,getHeight(P(1),P(2),P(4),P(3)));
+ aHeight = max(aHeight,getHeight(P(1),P(3),P(4),P(2)));
+ aHeight = max(aHeight,getHeight(P(2),P(3),P(4),P(1)));
+ return aHeight;
+}
+
+double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ double aQuality = 0.0;
+ int nbNodes = P.Length();
+ switch(nbNodes){
+ case 4:{
+ double aLen[6] = {
+ getDistance(P(1),P(2)), // a
+ getDistance(P(2),P(3)), // b
+ getDistance(P(3),P(1)), // c
+ getDistance(P(2),P(4)), // d
+ getDistance(P(3),P(4)), // e
+ getDistance(P(1),P(4)) // f
+ };
+ double aTria[4][3] = {
+ {aLen[0],aLen[1],aLen[2]}, // abc
+ {aLen[0],aLen[3],aLen[5]}, // adf
+ {aLen[1],aLen[3],aLen[4]}, // bde
+ {aLen[2],aLen[4],aLen[5]} // cef
+ };
+ double aHalfPerim = getHalfPerimeter(aTria[0]);
+ double anArea = getArea(aHalfPerim,aTria[0]);
+ aHalfPerim = getHalfPerimeter(aTria[1]);
+ anArea += getArea(aHalfPerim,aTria[1]);
+ aHalfPerim = getHalfPerimeter(aTria[2]);
+ anArea += getArea(aHalfPerim,aTria[2]);
+ double aVolume = getVolume(aLen);
+ double aHeight = getMaxHeight(P);
+ aQuality = 1.0/3.0*aHeight*anArea/aVolume;
+ break;
+ }
+ }
+ return aQuality;
+}
+
+double AspectRatio3D::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // the aspect ratio is in the range [1.0,infinity]
+ // 1.0 = good
+ // infinity = bad
+ return Value / 1000.;
+}
+
+SMDSAbs_ElementType AspectRatio3D::GetType() const
+{
+ return SMDSAbs_Volume;
+}
+
+
+/*
+ Class : Warping
+ Description : Functor for calculating warping
+*/
+double Warping::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ if ( P.Length() != 4 )
+ return 0;
+
+ gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
+
+ double A1 = ComputeA( P( 1 ), P( 2 ), P( 3 ), G );
+ double A2 = ComputeA( P( 2 ), P( 3 ), P( 4 ), G );
+ double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
+ double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
+
+ return Max( Max( A1, A2 ), Max( A3, A4 ) );
+}
+
+double Warping::ComputeA( const gp_XYZ& thePnt1,
+ const gp_XYZ& thePnt2,
+ const gp_XYZ& thePnt3,
+ const gp_XYZ& theG ) const
+{
+ double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
+ double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
+ double L = Min( aLen1, aLen2 ) * 0.5;
+ if ( L < Precision::Confusion())
+ return 0.;
+
+ gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
+ gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
+ gp_XYZ N = GI.Crossed( GJ );
+
+ if ( N.Modulus() < gp::Resolution() )
+ return PI / 2;
+
+ N.Normalize();
+
+ double H = ( thePnt2 - theG ).Dot( N );
+ return asin( fabs( H / L ) ) * 180 / PI;
+}
+
+double Warping::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // the warp is in the range [0.0,PI/2]
+ // 0.0 = good (no warp)
+ // PI/2 = bad (face pliee)
+ return Value;
+}
+
+SMDSAbs_ElementType Warping::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : Taper
+ Description : Functor for calculating taper
+*/
+double Taper::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ if ( P.Length() != 4 )
+ return 0;
+
+ // Compute taper
+ double J1 = getArea( P( 4 ), P( 1 ), P( 2 ) ) / 2;
+ double J2 = getArea( P( 3 ), P( 1 ), P( 2 ) ) / 2;
+ double J3 = getArea( P( 2 ), P( 3 ), P( 4 ) ) / 2;
+ double J4 = getArea( P( 3 ), P( 4 ), P( 1 ) ) / 2;
+
+ double JA = 0.25 * ( J1 + J2 + J3 + J4 );
+ if ( JA <= Precision::Confusion() )
+ return 0.;
+
+ double T1 = fabs( ( J1 - JA ) / JA );
+ double T2 = fabs( ( J2 - JA ) / JA );
+ double T3 = fabs( ( J3 - JA ) / JA );
+ double T4 = fabs( ( J4 - JA ) / JA );
+
+ return Max( Max( T1, T2 ), Max( T3, T4 ) );
+}
+
+double Taper::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // the taper is in the range [0.0,1.0]
+ // 0.0 = good (no taper)
+ // 1.0 = bad (les cotes opposes sont allignes)
+ return Value;
+}
+
+SMDSAbs_ElementType Taper::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : Skew
+ Description : Functor for calculating skew in degrees
+*/
+static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ& p3 )
+{
+ gp_XYZ p12 = ( p2 + p1 ) / 2;
+ gp_XYZ p23 = ( p3 + p2 ) / 2;
+ gp_XYZ p31 = ( p3 + p1 ) / 2;
+
+ gp_Vec v1( p31 - p2 ), v2( p12 - p23 );
+
+ return v1.Magnitude() < gp::Resolution() || v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
+}
+
+double Skew::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ if ( P.Length() != 3 && P.Length() != 4 )
+ return 0;
+
+ // Compute skew
+ static double PI2 = PI / 2;
+ if ( P.Length() == 3 )
+ {
+ double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
+ double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
+ double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
+
+ return Max( A0, Max( A1, A2 ) ) * 180 / PI;
+ }
+ else
+ {
+ gp_XYZ p12 = ( P( 1 ) + P( 2 ) ) / 2;
+ gp_XYZ p23 = ( P( 2 ) + P( 3 ) ) / 2;
+ gp_XYZ p34 = ( P( 3 ) + P( 4 ) ) / 2;
+ gp_XYZ p41 = ( P( 4 ) + P( 1 ) ) / 2;
+
+ gp_Vec v1( p34 - p12 ), v2( p23 - p41 );
+ double A = v1.Magnitude() <= gp::Resolution() || v2.Magnitude() <= gp::Resolution()
+ ? 0 : fabs( PI2 - v1.Angle( v2 ) );
+
+ return A * 180 / PI;
+ }
+}
+
+double Skew::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // the skew is in the range [0.0,PI/2].
+ // 0.0 = good
+ // PI/2 = bad
+ return Value;
+}
+
+SMDSAbs_ElementType Skew::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : Area
+ Description : Functor for calculating area
+*/
+double Area::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ if ( P.Length() == 3 )
+ return getArea( P( 1 ), P( 2 ), P( 3 ) );
+ else if ( P.Length() == 4 )
+ return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
+ else
+ return 0;
+}
+
+double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ return Value;
+}
+
+SMDSAbs_ElementType Area::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+
+/*
+ Class : Length
+ Description : Functor for calculating length off edge
+*/
+double Length::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ return ( P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 );
+}
+
+double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ return Value;
+}
+
+SMDSAbs_ElementType Length::GetType() const
+{
+ return SMDSAbs_Edge;
+}
+
+
+/*
+ Class : MultiConnection
+ Description : Functor for calculating number of faces conneted to the edge
+*/
+double MultiConnection::GetValue( const TColgp_SequenceOfXYZ& P )
+{
+ return 0;
+}
+double MultiConnection::GetValue( long theId )
+{
+ return getNbMultiConnection( myMesh, theId );
+}
+
+double MultiConnection::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ return Value;
+}
+
+SMDSAbs_ElementType MultiConnection::GetType() const
+{
+ return SMDSAbs_Edge;
+}
+
+
+/*
+ PREDICATES
+*/
+
+/*
+ Class : FreeBorders
+ Description : Predicate for free borders
+*/
+
+FreeBorders::FreeBorders()
+{
+ myMesh = 0;
+}
+
+void FreeBorders::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool FreeBorders::IsSatisfy( long theId )
+{
+ return getNbMultiConnection( myMesh, theId ) == 1;
+}
+
+SMDSAbs_ElementType FreeBorders::GetType() const
+{
+ return SMDSAbs_Edge;
+}
+
+
+/*
+ Class : FreeEdges
+ Description : Predicate for free Edges
+*/
+FreeEdges::FreeEdges()
+{
+ myMesh = 0;
+}
+
+void FreeEdges::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool FreeEdges::IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId )
+{
+ TColStd_MapOfInteger aMap;
+ for ( int i = 0; i < 2; i++ )
+ {
+ SMDS_ElemIteratorPtr anElemIter = theNodes[ i ]->GetInverseElementIterator();
+ while( anElemIter->more() )
+ {
+ const SMDS_MeshElement* anElem = anElemIter->next();
+ if ( anElem != 0 && anElem->GetType() == SMDSAbs_Face )
+ {
+ int anId = anElem->GetID();
+
+ if ( i == 0 )
+ aMap.Add( anId );
+ else if ( aMap.Contains( anId ) && anId != theFaceId )
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool FreeEdges::IsSatisfy( long theId )
+{
+ if ( myMesh == 0 )
+ return false;
+
+ const SMDS_MeshElement* aFace = myMesh->FindElement( theId );
+ if ( aFace == 0 || aFace->GetType() != SMDSAbs_Face || aFace->NbNodes() < 3 )
+ return false;
+
+ int nbNodes = aFace->NbNodes();
+ const SMDS_MeshNode* aNodes[ nbNodes ];
+ int i = 0;
+ SMDS_ElemIteratorPtr anIter = aFace->nodesIterator();
+ if ( anIter != 0 )
+ {
+ while( anIter->more() )
+ {
+ const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+ if ( aNode == 0 )
+ return false;
+ aNodes[ i++ ] = aNode;
+ }
+ }
+
+ for ( int i = 0; i < nbNodes - 1; i++ )
+ if ( IsFreeEdge( &aNodes[ i ], theId ) )
+ return true;
+
+ aNodes[ 1 ] = aNodes[ nbNodes - 1 ];
+
+ return IsFreeEdge( &aNodes[ 0 ], theId );
+
+}
+
+SMDSAbs_ElementType FreeEdges::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+FreeEdges::Border::Border(long theElemId, long thePntId1, long thePntId2):
+ myElemId(theElemId)
+{
+ myPntId[0] = thePntId1; myPntId[1] = thePntId2;
+ if(thePntId1 > thePntId2){
+ myPntId[1] = thePntId1; myPntId[0] = thePntId2;
+ }
+}
+
+bool FreeEdges::Border::operator<(const FreeEdges::Border& x) const{
+ if(myPntId[0] < x.myPntId[0]) return true;
+ if(myPntId[0] == x.myPntId[0])
+ if(myPntId[1] < x.myPntId[1]) return true;
+ return false;
+}
+
+inline void UpdateBorders(const FreeEdges::Border& theBorder,
+ FreeEdges::TBorders& theRegistry,
+ FreeEdges::TBorders& theContainer)
+{
+ if(theRegistry.find(theBorder) == theRegistry.end()){
+ theRegistry.insert(theBorder);
+ theContainer.insert(theBorder);
+ }else{
+ theContainer.erase(theBorder);
+ }
+}
+
+void FreeEdges::GetBoreders(TBorders& theBorders)
+{
+ TBorders aRegistry;
+ SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+ for(; anIter->more(); ){
+ const SMDS_MeshFace* anElem = anIter->next();
+ long anElemId = anElem->GetID();
+ SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+ long aNodeId[2];
+ const SMDS_MeshElement* aNode;
+ if(aNodesIter->more()){
+ aNode = aNodesIter->next();
+ aNodeId[0] = aNodeId[1] = aNode->GetID();
+ }
+ for(; aNodesIter->more(); ){
+ aNode = aNodesIter->next();
+ long anId = aNode->GetID();
+ Border aBorder(anElemId,aNodeId[1],anId);
+ aNodeId[1] = anId;
+ //std::cout<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<"; "<<aBorder.myElemId<<endl;
+ UpdateBorders(aBorder,aRegistry,theBorders);
+ }
+ Border aBorder(anElemId,aNodeId[0],aNodeId[1]);
+ //std::cout<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<"; "<<aBorder.myElemId<<endl;
+ UpdateBorders(aBorder,aRegistry,theBorders);
+ }
+ //std::cout<<"theBorders.size() = "<<theBorders.size()<<endl;
+}
+
+/*
+ Class : RangeOfIds
+ Description : Predicate for Range of Ids.
+ Range may be specified with two ways.
+ 1. Using AddToRange method
+ 2. With SetRangeStr method. Parameter of this method is a string
+ like as "1,2,3,50-60,63,67,70-"
+*/
+
+//=======================================================================
+// name : RangeOfIds
+// Purpose : Constructor
+//=======================================================================
+RangeOfIds::RangeOfIds()
+{
+ myMesh = 0;
+ myType = SMDSAbs_All;
+}
+
+//=======================================================================
+// name : SetMesh
+// Purpose : Set mesh
+//=======================================================================
+void RangeOfIds::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+//=======================================================================
+// name : AddToRange
+// Purpose : Add ID to the range
+//=======================================================================
+bool RangeOfIds::AddToRange( long theEntityId )
+{
+ myIds.Add( theEntityId );
+ return true;
+}
+
+//=======================================================================
+// name : GetRangeStr
+// Purpose : Get range as a string.
+// Example: "1,2,3,50-60,63,67,70-"
+//=======================================================================
+void RangeOfIds::GetRangeStr( TCollection_AsciiString& theResStr )
+{
+ theResStr.Clear();
+
+ TColStd_SequenceOfInteger anIntSeq;
+ TColStd_SequenceOfAsciiString aStrSeq;
+
+ TColStd_MapIteratorOfMapOfInteger anIter( myIds );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ int anId = anIter.Key();
+ TCollection_AsciiString aStr( anId );
+ anIntSeq.Append( anId );
+ aStrSeq.Append( aStr );
+ }
+
+ for ( int i = 1, n = myMin.Length(); i <= n; i++ )
+ {
+ int aMinId = myMin( i );
+ int aMaxId = myMax( i );
+
+ TCollection_AsciiString aStr;
+ if ( aMinId != IntegerFirst() )
+ aStr += aMinId;
+
+ aStr += "-";
+
+ if ( aMaxId != IntegerLast() )
+ aStr += aMaxId;
+
+ // find position of the string in result sequence and insert string in it
+ if ( anIntSeq.Length() == 0 )
+ {
+ anIntSeq.Append( aMinId );
+ aStrSeq.Append( aStr );
+ }
+ else
+ {
+ if ( aMinId < anIntSeq.First() )
+ {
+ anIntSeq.Prepend( aMinId );
+ aStrSeq.Prepend( aStr );
+ }
+ else if ( aMinId > anIntSeq.Last() )
+ {
+ anIntSeq.Append( aMinId );
+ aStrSeq.Append( aStr );
+ }
+ else
+ for ( int j = 1, k = anIntSeq.Length(); j <= k; j++ )
+ if ( aMinId < anIntSeq( j ) )
+ {
+ anIntSeq.InsertBefore( j, aMinId );
+ aStrSeq.InsertBefore( j, aStr );
+ break;
+ }
+ }
+ }
+
+ if ( aStrSeq.Length() == 0 )
+ return;
+
+ theResStr = aStrSeq( 1 );
+ for ( int j = 2, k = aStrSeq.Length(); j <= k; j++ )
+ {
+ theResStr += ",";
+ theResStr += aStrSeq( j );
+ }
+}
+
+//=======================================================================
+// name : SetRangeStr
+// Purpose : Define range with string
+// Example of entry string: "1,2,3,50-60,63,67,70-"
+//=======================================================================
+bool RangeOfIds::SetRangeStr( const TCollection_AsciiString& theStr )
+{
+ myMin.Clear();
+ myMax.Clear();
+ myIds.Clear();
+
+ TCollection_AsciiString aStr = theStr;
+ aStr.RemoveAll( ' ' );
+ aStr.RemoveAll( '\t' );
+
+ for ( int aPos = aStr.Search( ",," ); aPos != -1; aPos = aStr.Search( ",," ) )
+ aStr.Remove( aPos, 2 );
+
+ TCollection_AsciiString tmpStr = aStr.Token( ",", 1 );
+ int i = 1;
+ while ( tmpStr != "" )
+ {
+ tmpStr = aStr.Token( ",", i++ );
+ int aPos = tmpStr.Search( '-' );
+
+ if ( aPos == -1 )
+ {
+ if ( tmpStr.IsIntegerValue() )
+ myIds.Add( tmpStr.IntegerValue() );
+ else
+ return false;
+ }
+ else
+ {
+ TCollection_AsciiString aMaxStr = tmpStr.Split( aPos );
+ TCollection_AsciiString aMinStr = tmpStr;
+
+ while ( aMinStr.Search( "-" ) != -1 ) aMinStr.RemoveAll( '-' );
+ while ( aMaxStr.Search( "-" ) != -1 ) aMaxStr.RemoveAll( '-' );
+
+ if ( !aMinStr.IsEmpty() && !aMinStr.IsIntegerValue() ||
+ !aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue() )
+ return false;
+
+ myMin.Append( aMinStr.IsEmpty() ? IntegerFirst() : aMinStr.IntegerValue() );
+ myMax.Append( aMaxStr.IsEmpty() ? IntegerLast() : aMaxStr.IntegerValue() );
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+// name : GetType
+// Purpose : Get type of supported entities
+//=======================================================================
+SMDSAbs_ElementType RangeOfIds::GetType() const
+{
+ return myType;
+}
+
+//=======================================================================
+// name : SetType
+// Purpose : Set type of supported entities
+//=======================================================================
+void RangeOfIds::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
+}
+
+//=======================================================================
+// name : IsSatisfy
+// Purpose : Verify whether entity satisfies to this rpedicate
+//=======================================================================
+bool RangeOfIds::IsSatisfy( long theId )
+{
+ if ( !myMesh )
+ return false;
+
+ if ( myType == SMDSAbs_Node )
+ {
+ if ( myMesh->FindNode( theId ) == 0 )
+ return false;
+ }
+ else
+ {
+ const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+ if ( anElem == 0 || myType != anElem->GetType() && myType != SMDSAbs_All )
+ return false;
+ }
+
+ if ( myIds.Contains( theId ) )
+ return true;
+
+ for ( int i = 1, n = myMin.Length(); i <= n; i++ )
+ if ( theId >= myMin( i ) && theId <= myMax( i ) )
+ return true;
+
+ return false;
+}
+
+/*
+ Class : Comparator
+ Description : Base class for comparators
+*/
+Comparator::Comparator():
+ myMargin(0)
+{}
+
+Comparator::~Comparator()
+{}
+
+void Comparator::SetMesh( SMDS_Mesh* theMesh )
+{
+ if ( myFunctor )
+ myFunctor->SetMesh( theMesh );
+}
+
+void Comparator::SetMargin( double theValue )
+{
+ myMargin = theValue;
+}
+
+void Comparator::SetNumFunctor( NumericalFunctorPtr theFunct )
+{
+ myFunctor = theFunct;
+}
+
+SMDSAbs_ElementType Comparator::GetType() const
+{
+ return myFunctor ? myFunctor->GetType() : SMDSAbs_All;
+}
+
+double Comparator::GetMargin()
+{
+ return myMargin;
+}
+
+
+/*
+ Class : LessThan
+ Description : Comparator "<"
+*/
+bool LessThan::IsSatisfy( long theId )
+{
+ return myFunctor && myFunctor->GetValue( theId ) < myMargin;
+}
+
+
+/*
+ Class : MoreThan
+ Description : Comparator ">"
+*/
+bool MoreThan::IsSatisfy( long theId )
+{
+ return myFunctor && myFunctor->GetValue( theId ) > myMargin;
+}
+
+
+/*
+ Class : EqualTo
+ Description : Comparator "="
+*/
+EqualTo::EqualTo():
+ myToler(Precision::Confusion())
+{}
+
+bool EqualTo::IsSatisfy( long theId )
+{
+ return myFunctor && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
+}
+
+void EqualTo::SetTolerance( double theToler )
+{
+ myToler = theToler;
+}
+
+double EqualTo::GetTolerance()
+{
+ return myToler;
+}
+
+/*
+ Class : LogicalNOT
+ Description : Logical NOT predicate
+*/
+LogicalNOT::LogicalNOT()
+{}
+
+LogicalNOT::~LogicalNOT()
+{}
+
+bool LogicalNOT::IsSatisfy( long theId )
+{
+ return myPredicate && !myPredicate->IsSatisfy( theId );
+}
+
+void LogicalNOT::SetMesh( SMDS_Mesh* theMesh )
+{
+ if ( myPredicate )
+ myPredicate->SetMesh( theMesh );
+}
+
+void LogicalNOT::SetPredicate( PredicatePtr thePred )
+{
+ myPredicate = thePred;
+}
+
+SMDSAbs_ElementType LogicalNOT::GetType() const
+{
+ return myPredicate ? myPredicate->GetType() : SMDSAbs_All;
+}
+
+
+/*
+ Class : LogicalBinary
+ Description : Base class for binary logical predicate
+*/
+LogicalBinary::LogicalBinary()
+{}
+
+LogicalBinary::~LogicalBinary()
+{}
+
+void LogicalBinary::SetMesh( SMDS_Mesh* theMesh )
+{
+ if ( myPredicate1 )
+ myPredicate1->SetMesh( theMesh );
+
+ if ( myPredicate2 )
+ myPredicate2->SetMesh( theMesh );
+}
+
+void LogicalBinary::SetPredicate1( PredicatePtr thePredicate )
+{
+ myPredicate1 = thePredicate;
+}
+
+void LogicalBinary::SetPredicate2( PredicatePtr thePredicate )
+{
+ myPredicate2 = thePredicate;
+}
+
+SMDSAbs_ElementType LogicalBinary::GetType() const
+{
+ if ( !myPredicate1 || !myPredicate2 )
+ return SMDSAbs_All;
+
+ SMDSAbs_ElementType aType1 = myPredicate1->GetType();
+ SMDSAbs_ElementType aType2 = myPredicate2->GetType();
+
+ return aType1 == aType2 ? aType1 : SMDSAbs_All;
+}
+
+
+/*
+ Class : LogicalAND
+ Description : Logical AND
+*/
+bool LogicalAND::IsSatisfy( long theId )
+{
+ return
+ myPredicate1 &&
+ myPredicate2 &&
+ myPredicate1->IsSatisfy( theId ) &&
+ myPredicate2->IsSatisfy( theId );
+}
+
+
+/*
+ Class : LogicalOR
+ Description : Logical OR
+*/
+bool LogicalOR::IsSatisfy( long theId )
+{
+ return
+ myPredicate1 &&
+ myPredicate2 &&
+ myPredicate1->IsSatisfy( theId ) ||
+ myPredicate2->IsSatisfy( theId );
+}
+
+
+/*
+ FILTER
+*/
+
+Filter::Filter()
+{}
+
+Filter::~Filter()
+{}
+
+void Filter::SetPredicate( PredicatePtr thePredicate )
+{
+ myPredicate = thePredicate;
+}
+
+
+template<class TElement, class TIterator, class TPredicate>
+void FillSequence(const TIterator& theIterator,
+ TPredicate& thePredicate,
+ Filter::TIdSequence& theSequence)
+{
+ if ( theIterator ) {
+ while( theIterator->more() ) {
+ TElement anElem = theIterator->next();
+ long anId = anElem->GetID();
+ if ( thePredicate->IsSatisfy( anId ) )
+ theSequence.push_back( anId );
+ }
+ }
+}
+
+Filter::TIdSequence
+Filter::GetElementsId( SMDS_Mesh* theMesh )
+{
+ TIdSequence aSequence;
+ if ( !theMesh || !myPredicate ) return aSequence;
+
+ myPredicate->SetMesh( theMesh );
+
+ SMDSAbs_ElementType aType = myPredicate->GetType();
+ switch(aType){
+ case SMDSAbs_Node:{
+ FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),myPredicate,aSequence);
+ break;
+ }
+ case SMDSAbs_Edge:{
+ FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
+ break;
+ }
+ case SMDSAbs_Face:{
+ FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
+ break;
+ }
+ case SMDSAbs_Volume:{
+ FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
+ break;
+ }
+ case SMDSAbs_All:{
+ FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
+ FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
+ FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
+ break;
+ }
+ }
+ return aSequence;
+}
+
+/*
+ ManifoldPart
+*/
+
+typedef std::set<SMDS_MeshFace*> TMapOfFacePtr;
+
+/*
+ Internal class Link
+*/
+
+ManifoldPart::Link::Link( SMDS_MeshNode* theNode1,
+ SMDS_MeshNode* theNode2 )
+{
+ myNode1 = theNode1;
+ myNode2 = theNode2;
+}
+
+ManifoldPart::Link::~Link()
+{
+ myNode1 = 0;
+ myNode2 = 0;
+}
+
+bool ManifoldPart::Link::IsEqual( const ManifoldPart::Link& theLink ) const
+{
+ if ( myNode1 == theLink.myNode1 &&
+ myNode2 == theLink.myNode2 )
+ return true;
+ else if ( myNode1 == theLink.myNode2 &&
+ myNode2 == theLink.myNode1 )
+ return true;
+ else
+ return false;
+}
+
+bool ManifoldPart::Link::operator<( const ManifoldPart::Link& x ) const
+{
+ if(myNode1 < x.myNode1) return true;
+ if(myNode1 == x.myNode1)
+ if(myNode2 < x.myNode2) return true;
+ return false;
+}
+
+bool ManifoldPart::IsEqual( const ManifoldPart::Link& theLink1,
+ const ManifoldPart::Link& theLink2 )
+{
+ return theLink1.IsEqual( theLink2 );
+}
+
+ManifoldPart::ManifoldPart()
+{
+ myMesh = 0;
+ myAngToler = Precision::Angular();
+ myIsOnlyManifold = true;
+}
+
+ManifoldPart::~ManifoldPart()
+{
+ myMesh = 0;
+}
+
+void ManifoldPart::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+ process();
+}
+
+SMDSAbs_ElementType ManifoldPart::GetType() const
+{ return SMDSAbs_Face; }
+
+bool ManifoldPart::IsSatisfy( long theElementId )
+{
+ return myMapIds.Contains( theElementId );
+}
+
+void ManifoldPart::SetAngleTolerance( const double theAngToler )
+{ myAngToler = theAngToler; }
+
+double ManifoldPart::GetAngleTolerance() const
+{ return myAngToler; }
+
+void ManifoldPart::SetIsOnlyManifold( const bool theIsOnly )
+{ myIsOnlyManifold = theIsOnly; }
+
+void ManifoldPart::SetStartElem( const long theStartId )
+{ myStartElemId = theStartId; }
+
+bool ManifoldPart::process()
+{
+ myMapIds.Clear();
+ myMapBadGeomIds.Clear();
+
+ myAllFacePtr.clear();
+ myAllFacePtrIntDMap.clear();
+ if ( !myMesh )
+ return false;
+
+ // collect all faces into own map
+ SMDS_FaceIteratorPtr anFaceItr = myMesh->facesIterator();
+ for (; anFaceItr->more(); )
+ {
+ SMDS_MeshFace* aFacePtr = (SMDS_MeshFace*)anFaceItr->next();
+ myAllFacePtr.push_back( aFacePtr );
+ myAllFacePtrIntDMap[aFacePtr] = myAllFacePtr.size()-1;
+ }
+
+ SMDS_MeshFace* aStartFace = (SMDS_MeshFace*)myMesh->FindElement( myStartElemId );
+ if ( !aStartFace )
+ return false;
+
+ // the map of non manifold links and bad geometry
+ TMapOfLink aMapOfNonManifold;
+ TColStd_MapOfInteger aMapOfTreated;
+
+ // begin cycle on faces from start index and run on vector till the end
+ // and from begin to start index to cover whole vector
+ const int aStartIndx = myAllFacePtrIntDMap[aStartFace];
+ bool isStartTreat = false;
+ for ( int fi = aStartIndx; !isStartTreat || fi != aStartIndx ; fi++ )
+ {
+ if ( fi == aStartIndx )
+ isStartTreat = true;
+ // as result next time when fi will be equal to aStartIndx
+
+ SMDS_MeshFace* aFacePtr = myAllFacePtr[ fi ];
+ if ( aMapOfTreated.Contains( aFacePtr->GetID() ) )
+ continue;
+
+ aMapOfTreated.Add( aFacePtr->GetID() );
+ TColStd_MapOfInteger aResFaces;
+ if ( !findConnected( myAllFacePtrIntDMap, aFacePtr,
+ aMapOfNonManifold, aResFaces ) )
+ continue;
+ TColStd_MapIteratorOfMapOfInteger anItr( aResFaces );
+ for ( ; anItr.More(); anItr.Next() )
+ {
+ int aFaceId = anItr.Key();
+ aMapOfTreated.Add( aFaceId );
+ myMapIds.Add( aFaceId );
+ }
+
+ if ( fi == ( myAllFacePtr.size() - 1 ) )
+ fi = 0;
+ } // end run on vector of faces
+ return !myMapIds.IsEmpty();
+}
+
+static void getLinks( const SMDS_MeshFace* theFace,
+ ManifoldPart::TVectorOfLink& theLinks )
+{
+ int aNbNode = theFace->NbNodes();
+ SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
+ int i = 1;
+ SMDS_MeshNode* aNode = 0;
+ for ( ; aNodeItr->more() && i <= aNbNode; )
+ {
+
+ SMDS_MeshNode* aN1 = (SMDS_MeshNode*)aNodeItr->next();
+ if ( i == 1 )
+ aNode = aN1;
+ i++;
+ SMDS_MeshNode* aN2 = ( i >= aNbNode ) ? aNode : (SMDS_MeshNode*)aNodeItr->next();
+ i++;
+ ManifoldPart::Link aLink( aN1, aN2 );
+ theLinks.push_back( aLink );
+ }
+}
+
+static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
+{
+ gp_XYZ n;
+ int aNbNode = theFace->NbNodes();
+ TColgp_Array1OfXYZ anArrOfXYZ(1,4);
+ gp_XYZ p1, p2, p3, p4;
+ SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
+ int i = 1;
+ for ( ; aNodeItr->more() && i <= 4; i++ )
+ {
+ SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
+ anArrOfXYZ.SetValue(i, gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+ }
+
+ gp_XYZ q1 = anArrOfXYZ.Value(2) - anArrOfXYZ.Value(1);
+ gp_XYZ q2 = anArrOfXYZ.Value(3) - anArrOfXYZ.Value(1);
+ n = q1 ^ q2;
+ if ( aNbNode > 3 )
+ {
+ gp_XYZ q3 = anArrOfXYZ.Value(4) - anArrOfXYZ.Value(1);
+ n += q2 ^ q3;
+ }
+ double len = n.Modulus();
+ if ( len > 0 )
+ n /= len;
+
+ return n;
+}
+
+bool ManifoldPart::findConnected
+ ( const ManifoldPart::TDataMapFacePtrInt& theAllFacePtrInt,
+ SMDS_MeshFace* theStartFace,
+ ManifoldPart::TMapOfLink& theNonManifold,
+ TColStd_MapOfInteger& theResFaces )
+{
+ theResFaces.Clear();
+ if ( !theAllFacePtrInt.size() )
+ return false;
+
+ if ( getNormale( theStartFace ).SquareModulus() <= gp::Resolution() )
+ {
+ myMapBadGeomIds.Add( theStartFace->GetID() );
+ return false;
+ }
+
+ ManifoldPart::TMapOfLink aMapOfBoundary, aMapToSkip;
+ ManifoldPart::TVectorOfLink aSeqOfBoundary;
+ theResFaces.Add( theStartFace->GetID() );
+ ManifoldPart::TDataMapOfLinkFacePtr aDMapLinkFace;
+
+ expandBoundary( aMapOfBoundary, aSeqOfBoundary,
+ aDMapLinkFace, theNonManifold, theStartFace );
+
+ bool isDone = false;
+ while ( !isDone && aMapOfBoundary.size() != 0 )
+ {
+ bool isToReset = false;
+ ManifoldPart::TVectorOfLink::iterator pLink = aSeqOfBoundary.begin();
+ for ( ; !isToReset && pLink != aSeqOfBoundary.end(); ++pLink )
+ {
+ ManifoldPart::Link aLink = *pLink;
+ if ( aMapToSkip.find( aLink ) != aMapToSkip.end() )
+ continue;
+ // each link could be treated only once
+ aMapToSkip.insert( aLink );
+
+ ManifoldPart::TVectorOfFacePtr aFaces;
+ // find next
+ if ( myIsOnlyManifold &&
+ (theNonManifold.find( aLink ) != theNonManifold.end()) )
+ continue;
+ else
+ {
+ getFacesByLink( aLink, aFaces );
+ // filter the element to keep only indicated elements
+ ManifoldPart::TVectorOfFacePtr aFiltered;
+ ManifoldPart::TVectorOfFacePtr::iterator pFace = aFaces.begin();
+ for ( ; pFace != aFaces.end(); ++pFace )
+ {
+ SMDS_MeshFace* aFace = *pFace;
+ if ( myAllFacePtrIntDMap.find( aFace ) != myAllFacePtrIntDMap.end() )
+ aFiltered.push_back( aFace );
+ }
+ aFaces = aFiltered;
+ if ( aFaces.size() < 2 ) // no neihgbour faces
+ continue;
+ else if ( myIsOnlyManifold && aFaces.size() > 2 ) // non manifold case
+ {
+ theNonManifold.insert( aLink );
+ continue;
+ }
+ }
+
+ // compare normal with normals of neighbor element
+ SMDS_MeshFace* aPrevFace = aDMapLinkFace[ aLink ];
+ ManifoldPart::TVectorOfFacePtr::iterator pFace = aFaces.begin();
+ for ( ; pFace != aFaces.end(); ++pFace )
+ {
+ SMDS_MeshFace* aNextFace = *pFace;
+ if ( aPrevFace == aNextFace )
+ continue;
+ int anNextFaceID = aNextFace->GetID();
+ if ( myIsOnlyManifold && theResFaces.Contains( anNextFaceID ) )
+ // should not be with non manifold restriction. probably bad topology
+ continue;
+ // check if face was treated and skipped
+ if ( myMapBadGeomIds.Contains( anNextFaceID ) ||
+ !isInPlane( aPrevFace, aNextFace ) )
+ continue;
+ // add new element to connected and extend the boundaries.
+ theResFaces.Add( anNextFaceID );
+ expandBoundary( aMapOfBoundary, aSeqOfBoundary,
+ aDMapLinkFace, theNonManifold, aNextFace );
+ isToReset = true;
+ }
+ }
+ isDone = !isToReset;
+ }
+
+ return !theResFaces.IsEmpty();
+}
+
+bool ManifoldPart::isInPlane( const SMDS_MeshFace* theFace1,
+ const SMDS_MeshFace* theFace2 )
+{
+ gp_Dir aNorm1 = gp_Dir( getNormale( theFace1 ) );
+ gp_XYZ aNorm2XYZ = getNormale( theFace2 );
+ if ( aNorm2XYZ.SquareModulus() <= gp::Resolution() )
+ {
+ myMapBadGeomIds.Add( theFace2->GetID() );
+ return false;
+ }
+ if ( aNorm1.IsParallel( gp_Dir( aNorm2XYZ ), myAngToler ) )
+ return true;
+
+ return false;
+}
+
+void ManifoldPart::expandBoundary
+ ( ManifoldPart::TMapOfLink& theMapOfBoundary,
+ ManifoldPart::TVectorOfLink& theSeqOfBoundary,
+ ManifoldPart::TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
+ ManifoldPart::TMapOfLink& theNonManifold,
+ SMDS_MeshFace* theNextFace ) const
+{
+ ManifoldPart::TVectorOfLink aLinks;
+ getLinks( theNextFace, aLinks );
+ int aNbLink = aLinks.size();
+ for ( int i = 0; i < aNbLink; i++ )
+ {
+ ManifoldPart::Link aLink = aLinks[ i ];
+ if ( myIsOnlyManifold && (theNonManifold.find( aLink ) != theNonManifold.end()) )
+ continue;
+ if ( theMapOfBoundary.find( aLink ) != theMapOfBoundary.end() )
+ {
+ if ( myIsOnlyManifold )
+ {
+ // remove from boundary
+ theMapOfBoundary.erase( aLink );
+ ManifoldPart::TVectorOfLink::iterator pLink = theSeqOfBoundary.begin();
+ for ( ; pLink != theSeqOfBoundary.end(); ++pLink )
+ {
+ ManifoldPart::Link aBoundLink = *pLink;
+ if ( aBoundLink.IsEqual( aLink ) )
+ {
+ theSeqOfBoundary.erase( pLink );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ theMapOfBoundary.insert( aLink );
+ theSeqOfBoundary.push_back( aLink );
+ theDMapLinkFacePtr[ aLink ] = theNextFace;
+ }
+ }
+}
+
+void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
+ ManifoldPart::TVectorOfFacePtr& theFaces ) const
+{
+ SMDS_Mesh::SetOfFaces aSetOfFaces;
+ // take all faces that shared first node
+ SMDS_ElemIteratorPtr anItr = theLink.myNode1->facesIterator();
+ for ( ; anItr->more(); )
+ {
+ SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
+ if ( !aFace )
+ continue;
+ aSetOfFaces.insert( aFace );
+ }
+ // take all faces that shared second node
+ anItr = theLink.myNode2->facesIterator();
+ // find the common part of two sets
+ for ( ; anItr->more(); )
+ {
+ SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
+ if ( aSetOfFaces.find( aFace ) != aSetOfFaces.end() )
+ theFaces.push_back( aFace );
+ }
+}
+
+
+/*
+ ElementsOnSurface
+*/
+
+ElementsOnSurface::ElementsOnSurface()
+{
+ myMesh = 0;
+ myIds.Clear();
+ myType = SMDSAbs_All;
+ mySurf.Nullify();
+ myToler = Precision::Confusion();
+}
+
+ElementsOnSurface::~ElementsOnSurface()
+{
+ myMesh = 0;
+}
+
+void ElementsOnSurface::SetMesh( SMDS_Mesh* theMesh )
+{
+ if ( myMesh == theMesh )
+ return;
+ myMesh = theMesh;
+ myIds.Clear();
+ process();
+}
+
+bool ElementsOnSurface::IsSatisfy( long theElementId )
+{
+ return myIds.Contains( theElementId );
+}
+
+SMDSAbs_ElementType ElementsOnSurface::GetType() const
+{ return myType; }
+
+void ElementsOnSurface::SetTolerance( const double theToler )
+{ myToler = theToler; }
+
+double ElementsOnSurface::GetTolerance() const
+{
+ return myToler;
+}
+
+void ElementsOnSurface::SetSurface( const TopoDS_Shape& theShape,
+ const SMDSAbs_ElementType theType )
+{
+ myType = theType;
+ mySurf.Nullify();
+ if ( theShape.IsNull() || theShape.ShapeType() != TopAbs_FACE )
+ {
+ mySurf.Nullify();
+ return;
+ }
+ TopoDS_Face aFace = TopoDS::Face( theShape );
+ mySurf = BRep_Tool::Surface( aFace );
+}
+
+void ElementsOnSurface::process()
+{
+ myIds.Clear();
+ if ( mySurf.IsNull() )
+ return;
+
+ if ( myMesh == 0 )
+ return;
+
+ if ( myType == SMDSAbs_Face || myType == SMDSAbs_All )
+ {
+ SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+ for(; anIter->more(); )
+ process( anIter->next() );
+ }
+
+ if ( myType == SMDSAbs_Edge || myType == SMDSAbs_All )
+ {
+ SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
+ for(; anIter->more(); )
+ process( anIter->next() );
+ }
+
+ if ( myType == SMDSAbs_Node )
+ {
+ SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
+ for(; anIter->more(); )
+ process( anIter->next() );
+ }
+}
+
+void ElementsOnSurface::process( const SMDS_MeshElement* theElemPtr )
+{
+ SMDS_ElemIteratorPtr aNodeItr = theElemPtr->nodesIterator();
+ bool isSatisfy = true;
+ for ( ; aNodeItr->more(); )
+ {
+ SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
+ if ( !isOnSurface( aNode ) )
+ {
+ isSatisfy = false;
+ break;
+ }
+ }
+ if ( isSatisfy )
+ myIds.Add( theElemPtr->GetID() );
+}
+
+bool ElementsOnSurface::isOnSurface( const SMDS_MeshNode* theNode ) const
+{
+ if ( mySurf.IsNull() )
+ return false;
+
+ gp_Pnt aPnt( theNode->X(), theNode->Y(), theNode->Z() );
+ double aToler2 = myToler * myToler;
+ if ( mySurf->IsKind(STANDARD_TYPE(Geom_Plane)))
+ {
+ gp_Pln aPln = Handle(Geom_Plane)::DownCast(mySurf)->Pln();
+ if ( aPln.SquareDistance( aPnt ) > aToler2 )
+ return false;
+ }
+ else if ( mySurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)))
+ {
+ gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(mySurf)->Cylinder();
+ double aRad = aCyl.Radius();
+ gp_Ax3 anAxis = aCyl.Position();
+ gp_XYZ aLoc = aCyl.Location().XYZ();
+ double aXDist = anAxis.XDirection().XYZ() * ( aPnt.XYZ() - aLoc );
+ double aYDist = anAxis.YDirection().XYZ() * ( aPnt.XYZ() - aLoc );
+ if ( fabs(aXDist*aXDist + aYDist*aYDist - aRad*aRad) > aToler2 )
+ return false;
+ }
+ else
+ return false;
+
+ return true;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _SMESH_CONTROLS_HXX_
+#define _SMESH_CONTROLS_HXX_
+
+#include <set>
+#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "SMDSAbs_ElementType.hxx"
+#include "SMDS_MeshNode.hxx"
+#include <Geom_Surface.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TCollection_AsciiString.hxx>
+
+class SMDS_Mesh;
+class SMESHDS_Mesh;
+class SMESHDS_SubMesh;
+class gp_Pnt;
+class gp_XYZ;
+class TColgp_SequenceOfXYZ;
+class TopoDS_Shape;
+class SMDS_MeshElement;
+class SMDS_MeshFace;
+class SMDS_MeshNode;
+
+namespace SMESH{
+ namespace Controls{
+ class Functor
+ {
+ public:
+ ~Functor(){}
+ virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
+ virtual SMDSAbs_ElementType GetType() const = 0;
+ };
+ typedef boost::shared_ptr<Functor> FunctorPtr;
+
+ class NumericalFunctor: public virtual Functor{
+ public:
+ NumericalFunctor();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual double GetValue( long theElementId );
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints ) = 0;
+ virtual SMDSAbs_ElementType GetType() const = 0;
+ virtual double GetBadRate( double Value, int nbNodes ) const = 0;
+ long GetPrecision() const;
+ void SetPrecision( const long thePrecision );
+
+ bool GetPoints (const int theId,
+ TColgp_SequenceOfXYZ& theRes ) const;
+ static bool GetPoints (const SMDS_MeshElement* theElem,
+ TColgp_SequenceOfXYZ& theRes );
+ protected:
+ SMDS_Mesh* myMesh;
+ long myPrecision;
+ };
+ typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
+
+
+ /*
+ Class : SMESH_MinimumAngle
+ Description : Functor for calculation of minimum angle
+ */
+ class MinimumAngle: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : AspectRatio
+ Description : Functor for calculating aspect ratio
+ */
+ class AspectRatio: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : AspectRatio3D
+ Description : Functor for calculating aspect ratio of 3D elems.
+ */
+ class AspectRatio3D: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : Warping
+ Description : Functor for calculating warping
+ */
+ class Warping: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+
+ private:
+ double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
+ };
+
+
+ /*
+ Class : Taper
+ Description : Functor for calculating taper
+ */
+ class Taper: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : Skew
+ Description : Functor for calculating skew in degrees
+ */
+ class Skew: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : Area
+ Description : Functor for calculating area
+ */
+ class Area: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : Length
+ Description : Functor for calculating length of edge
+ */
+ class Length: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ Class : MultiConnection
+ Description : Functor for calculating number of faces conneted to the edge
+ */
+ class MultiConnection: public virtual NumericalFunctor{
+ public:
+ virtual double GetValue( long theElementId );
+ virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ };
+
+
+ /*
+ PREDICATES
+ */
+ /*
+ Class : Predicate
+ Description : Base class for all predicates
+ */
+ class Predicate: public virtual Functor{
+ public:
+ virtual bool IsSatisfy( long theElementId ) = 0;
+ virtual SMDSAbs_ElementType GetType() const = 0;
+ };
+ typedef boost::shared_ptr<Predicate> PredicatePtr;
+
+
+
+ /*
+ Class : FreeBorders
+ Description : Predicate for free borders
+ */
+ class FreeBorders: public virtual Predicate{
+ public:
+ FreeBorders();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ protected:
+ SMDS_Mesh* myMesh;
+ };
+
+
+ /*
+ Class : FreeEdges
+ Description : Predicate for free Edges
+ */
+ class FreeEdges: public virtual Predicate{
+ public:
+ FreeEdges();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ virtual SMDSAbs_ElementType GetType() const;
+ static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
+ typedef long TElemId;
+ struct Border{
+ TElemId myElemId;
+ TElemId myPntId[2];
+ Border(long theElemId, long thePntId1, long thePntId2);
+ bool operator<(const Border& x) const;
+ };
+ typedef std::set<Border> TBorders;
+ void GetBoreders(TBorders& theBorders);
+
+ protected:
+ SMDS_Mesh* myMesh;
+ };
+ typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
+
+
+ /*
+ Class : RangeOfIds
+ Description : Predicate for Range of Ids.
+ Range may be specified with two ways.
+ 1. Using AddToRange method
+ 2. With SetRangeStr method. Parameter of this method is a string
+ like as "1,2,3,50-60,63,67,70-"
+ */
+ class RangeOfIds: public virtual Predicate
+ {
+ public:
+ RangeOfIds();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theNodeId );
+ virtual SMDSAbs_ElementType GetType() const;
+ virtual void SetType( SMDSAbs_ElementType theType );
+
+ bool AddToRange( long theEntityId );
+ void GetRangeStr( TCollection_AsciiString& );
+ bool SetRangeStr( const TCollection_AsciiString& );
+
+ protected:
+ SMDS_Mesh* myMesh;
+
+ TColStd_SequenceOfInteger myMin;
+ TColStd_SequenceOfInteger myMax;
+ TColStd_MapOfInteger myIds;
+
+ SMDSAbs_ElementType myType;
+ };
+
+ typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
+
+
+ /*
+ Class : Comparator
+ Description : Base class for comparators
+ */
+ class Comparator: public virtual Predicate{
+ public:
+ Comparator();
+ virtual ~Comparator();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual void SetMargin(double theValue);
+ virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
+ virtual bool IsSatisfy( long theElementId ) = 0;
+ virtual SMDSAbs_ElementType GetType() const;
+ double GetMargin();
+
+ protected:
+ double myMargin;
+ NumericalFunctorPtr myFunctor;
+ };
+ typedef boost::shared_ptr<Comparator> ComparatorPtr;
+
+
+ /*
+ Class : LessThan
+ Description : Comparator "<"
+ */
+ class LessThan: public virtual Comparator{
+ public:
+ virtual bool IsSatisfy( long theElementId );
+ };
+
+
+ /*
+ Class : MoreThan
+ Description : Comparator ">"
+ */
+ class MoreThan: public virtual Comparator{
+ public:
+ virtual bool IsSatisfy( long theElementId );
+ };
+
+
+ /*
+ Class : EqualTo
+ Description : Comparator "="
+ */
+ class EqualTo: public virtual Comparator{
+ public:
+ EqualTo();
+ virtual bool IsSatisfy( long theElementId );
+ virtual void SetTolerance( double theTol );
+ virtual double GetTolerance();
+
+ private:
+ double myToler;
+ };
+ typedef boost::shared_ptr<EqualTo> EqualToPtr;
+
+
+ /*
+ Class : LogicalNOT
+ Description : Logical NOT predicate
+ */
+ class LogicalNOT: public virtual Predicate{
+ public:
+ LogicalNOT();
+ virtual ~LogicalNOT();
+ virtual bool IsSatisfy( long theElementId );
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual void SetPredicate(PredicatePtr thePred);
+ virtual SMDSAbs_ElementType GetType() const;
+
+ private:
+ PredicatePtr myPredicate;
+ };
+ typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
+
+
+ /*
+ Class : LogicalBinary
+ Description : Base class for binary logical predicate
+ */
+ class LogicalBinary: public virtual Predicate{
+ public:
+ LogicalBinary();
+ virtual ~LogicalBinary();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual void SetPredicate1(PredicatePtr thePred);
+ virtual void SetPredicate2(PredicatePtr thePred);
+ virtual SMDSAbs_ElementType GetType() const;
+
+ protected:
+ PredicatePtr myPredicate1;
+ PredicatePtr myPredicate2;
+ };
+ typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
+
+
+ /*
+ Class : LogicalAND
+ Description : Logical AND
+ */
+ class LogicalAND: public virtual LogicalBinary{
+ public:
+ virtual bool IsSatisfy( long theElementId );
+ };
+
+
+ /*
+ Class : LogicalOR
+ Description : Logical OR
+ */
+ class LogicalOR: public virtual LogicalBinary{
+ public:
+ virtual bool IsSatisfy( long theElementId );
+ };
+
+
+ /*
+ Class : ManifoldPart
+ Description : Predicate for manifold part of mesh
+ */
+ class ManifoldPart: public virtual Predicate{
+ public:
+
+ /* internal class for algorithm uses */
+ class Link
+ {
+ public:
+ Link( SMDS_MeshNode* theNode1,
+ SMDS_MeshNode* theNode2 );
+ ~Link();
+
+ bool IsEqual( const ManifoldPart::Link& theLink ) const;
+ bool operator<(const ManifoldPart::Link& x) const;
+
+ SMDS_MeshNode* myNode1;
+ SMDS_MeshNode* myNode2;
+ };
+
+ bool IsEqual( const ManifoldPart::Link& theLink1,
+ const ManifoldPart::Link& theLink2 );
+
+ typedef std::set<ManifoldPart::Link> TMapOfLink;
+ typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
+ typedef std::vector<ManifoldPart::Link> TVectorOfLink;
+ typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
+ typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
+
+ ManifoldPart();
+ ~ManifoldPart();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ // inoke when all parameters already set
+ virtual bool IsSatisfy( long theElementId );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ void SetAngleTolerance( const double theAngToler );
+ double GetAngleTolerance() const;
+ void SetIsOnlyManifold( const bool theIsOnly );
+ void SetStartElem( const long theStartElemId );
+
+ private:
+ bool process();
+ bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
+ SMDS_MeshFace* theStartFace,
+ TMapOfLink& theNonManifold,
+ TColStd_MapOfInteger& theResFaces );
+ bool isInPlane( const SMDS_MeshFace* theFace1,
+ const SMDS_MeshFace* theFace2 );
+ void expandBoundary( TMapOfLink& theMapOfBoundary,
+ TVectorOfLink& theSeqOfBoundary,
+ TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
+ TMapOfLink& theNonManifold,
+ SMDS_MeshFace* theNextFace ) const;
+
+ void getFacesByLink( const Link& theLink,
+ TVectorOfFacePtr& theFaces ) const;
+
+ private:
+ SMDS_Mesh* myMesh;
+ TColStd_MapOfInteger myMapIds;
+ TColStd_MapOfInteger myMapBadGeomIds;
+ TVectorOfFacePtr myAllFacePtr;
+ TDataMapFacePtrInt myAllFacePtrIntDMap;
+ double myAngToler;
+ bool myIsOnlyManifold;
+ long myStartElemId;
+
+ };
+ typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
+
+
+ /*
+ Class : ElementsOnSurface
+ Description : Predicate elements that lying on indicated surface
+ (plane or cylinder)
+ */
+ class ElementsOnSurface : public virtual Predicate {
+ public:
+ ElementsOnSurface();
+ ~ElementsOnSurface();
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ void SetTolerance( const double theToler );
+ double GetTolerance() const;
+ void SetSurface( const TopoDS_Shape& theShape,
+ const SMDSAbs_ElementType theType );
+
+ private:
+ void process();
+ void process( const SMDS_MeshElement* theElem );
+ bool isOnSurface( const SMDS_MeshNode* theNode ) const;
+
+ private:
+ SMDS_Mesh* myMesh;
+ TColStd_MapOfInteger myIds;
+ SMDSAbs_ElementType myType;
+ Handle(Geom_Surface) mySurf;
+ double myToler;
+ };
+
+ typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
+
+
+ /*
+ FILTER
+ */
+ class Filter{
+ public:
+ Filter();
+ virtual ~Filter();
+ virtual void SetPredicate(PredicatePtr thePred);
+ typedef std::vector<long> TIdSequence;
+ virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
+
+ protected:
+ PredicatePtr myPredicate;
+ };
+ };
+};
+
+
+#endif
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Document_Reader.cxx
-// Module : SMESH
-
-using namespace std;
-#include "Document_Reader.h"
-
-#include "utilities.h"
-
-void Document_Reader::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void Document_Reader::SetDocument(SMESHDS_Document * aDoc)
-{
- myDocument = aDoc;
-}
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Document_Reader.h
-// Module : SMESH
-
-#ifndef _INCLUDE_DOCUMENT_READER
-#define _INCLUDE_DOCUMENT_READER
-
-#include "SMESHDS_Document.hxx"
-#include <string>
-
-class Document_Reader
-{
- public:
- virtual void Read() = 0;
- void SetFile(string);
- void SetDocument(SMESHDS_Document *);
-
- protected:
- SMESHDS_Document * myDocument;
- string myFile;
-};
-#endif
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Document_Writer.cxx
-// Module : SMESH
-
-using namespace std;
-#include "Document_Writer.h"
-
-void Document_Writer::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void Document_Writer::SetDocument(SMESHDS_Document * aDoc)
-{
- myDocument = aDoc;
-}
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Document_Writer.h
-// Module : SMESH
-
-#ifndef _INCLUDE_DOCUMENT_WRITER
-#define _INCLUDE_DOCUMENT_WRITER
-
-#include "SMESHDS_Document.hxx"
-#include <string>
-
-class Document_Writer
-{
-
- public:virtual void Write() = 0;
- void SetFile(string);
- void SetDocument(SMESHDS_Document *);
-
- protected: SMESHDS_Document * myDocument;
- string myFile;
-
-};
-#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "Driver_Document.h"
+
+Driver_Document::Driver_Document():
+ myDocument(NULL)
+{}
+
+
+void Driver_Document::SetFile(const std::string& theFileName)
+{
+ myFile = theFileName;
+}
+
+
+void Driver_Document::SetDocument(SMESHDS_Document * theDocument)
+{
+ myDocument = theDocument;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _INCLUDE_DRIVER_DOCUMENT
+#define _INCLUDE_DRIVER_DOCUMENT
+
+#include <string>
+
+class SMESHDS_Document;
+
+class Driver_Document
+{
+ public:
+ Driver_Document();
+ virtual ~Driver_Document(){}
+
+ virtual void Perform() = 0;
+ void SetFile(const std::string& theFileName);
+ void SetDocument(SMESHDS_Document *theDocument);
+
+ protected:
+ SMESHDS_Document * myDocument;
+ std::string myFile;
+
+};
+
+
+#endif
--- /dev/null
+// SMESH Driver : implementaion of driver for reading and writing
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Mesh_Reader.cxx
+// Module : SMESH
+
+#include "Driver_Mesh.h"
+
+using namespace std;
+
+Driver_Mesh::Driver_Mesh():
+ myFile(""),
+ myMeshId(-1)
+{}
+
+
+void Driver_Mesh::SetMeshId(int theMeshId)
+{
+ myMeshId = theMeshId;
+}
+
+
+void Driver_Mesh::SetFile(const std::string& theFileName)
+{
+ myFile = theFileName;
+}
--- /dev/null
+// SMESH Driver : implementaion of driver for reading and writing
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Mesh_Reader.h
+// Module : SMESH
+
+#ifndef _INCLUDE_DRIVER_MESH
+#define _INCLUDE_DRIVER_MESH
+
+#include <string>
+
+class Driver_Mesh
+{
+ public:
+ Driver_Mesh();
+ virtual ~Driver_Mesh(){}
+
+ enum Status {
+ DRS_OK,
+ DRS_EMPTY, // a file contains no mesh with the given name
+ DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
+ // so the numbers from the file are ignored
+ DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
+ DRS_FAIL // general failure (exception etc.)
+ };
+
+ virtual Status Perform() = 0;
+ void SetMeshId(int theMeshId);
+ void SetFile(const std::string& theFileName);
+
+ protected:
+ std::string myFile;
+ int myMeshId;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "Driver_SMDS_Mesh.h"
+
+using namespace std;
+
+Driver_SMDS_Mesh::Driver_SMDS_Mesh():
+ myMesh(NULL)
+{}
+
+void Driver_SMDS_Mesh::SetMesh(SMDS_Mesh *theMesh)
+{
+ myMesh = theMesh;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _INCLUDE_DRIVER_SMDS_MESH
+#define _INCLUDE_DRIVER_SMDS_MESH
+
+#include "Driver_Mesh.h"
+
+class SMDS_Mesh;
+
+class Driver_SMDS_Mesh: public Driver_Mesh
+{
+ public:
+ Driver_SMDS_Mesh();
+ void SetMesh(SMDS_Mesh *theMesh);
+
+ protected:
+ SMDS_Mesh *myMesh;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "Driver_SMESHDS_Mesh.h"
+
+using namespace std;
+
+Driver_SMESHDS_Mesh::Driver_SMESHDS_Mesh():
+ myMesh(NULL)
+{}
+
+void Driver_SMESHDS_Mesh::SetMesh(SMESHDS_Mesh *theMesh)
+{
+ myMesh = theMesh;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _INCLUDE_DRIVER_SMESHDS_MESH
+#define _INCLUDE_DRIVER_SMESHDS_MESH
+
+#include "Driver_Mesh.h"
+
+class SMESHDS_Mesh;
+
+class Driver_SMESHDS_Mesh: public Driver_Mesh
+{
+ public:
+ Driver_SMESHDS_Mesh();
+ void SetMesh(SMESHDS_Mesh *theMesh);
+
+ protected:
+ SMESHDS_Mesh *myMesh;
+
+};
+
+#endif
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Driver_dl.cxx
-// Module : SMESH
-
-using namespace std;
-#include "Driver.h"
-
-#include <dlfcn.h>
-#include <stdio.h>
-#include <utilities.h>
-
-#include "DriverDAT_R_SMESHDS_Document.h"
-#include "Test.h"
-
-/*! extern "C"
-{
- void test() {
-
- void *handle;
- double (*cosine)(double);
- char *error;
-
- handle = dlopen ("/usr/lib/libm.so", RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
-
- cosine = dlsym(handle, "cos");
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
-
- printf ("%f\n", (*cosine)(2.0));
- dlclose(handle);
-
- char* error;
- string Extension=string("DAT");
- string Class=string("SMESHDS_Document");
- string myLibrary = string("/home/barberou/barberou/SALOME_3105/build/lib/libMeshDriver")+Extension+string(".so");
- SCRUTE(myLibrary);
- //Document_Reader* myDriver;//a caster ???
- DriverDAT_R_SMESHDS_Document* myDriver;
-
- string myClass = string("Driver")+Extension+string("_R_")+Class;
- SCRUTE(myClass);
-
- void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
- MESSAGE("Open ok");
-
- //int* res = (int*)dlsym(handle, "getOne");
- //SCRUTE(res);
- SCRUTE(dlsym(handle, "getOne"));
- //int res2= (*res)();
- myDriver = (DriverDAT_R_SMESHDS_Document*) dlsym(handle, myClass.c_str());
- MESSAGE("Reading 1");
- SCRUTE(myDriver);
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
- MESSAGE("Reading 2");
-
- dlclose(handle);
- MESSAGE("after close");
-
- }
- }*/
-
-Document_Reader* Driver::GetDocumentReader(string Extension, string Class) {
- test();
- //p-e extern C ?
- /*!
- char* error;
- string myLibrary = string("/home/barberou/barberou/SALOME_3105/build/lib/libMeshDriver")+Extension+string(".so");
- SCRUTE(myLibrary);
- //Document_Reader* myDriver;//a caster ???
- DriverDAT_R_SMESHDS_Document* myDriver;
-
- string myClass = string("Driver")+Extension+string("_R_")+Class;
- SCRUTE(myClass);
-
- void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
- MESSAGE("Open ok");
- //myDriver = (Document_Reader*) dlsym(handle, myClass.c_str());
- int* res = (int*) dlsym(handle, "getOne");
- SCRUTE(res);
- myDriver = (DriverDAT_R_SMESHDS_Document*) dlsym(handle, myClass.c_str());
- MESSAGE("Reading 1");
- SCRUTE(myDriver);
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
- MESSAGE("Reading 2");
-
- dlclose(handle);
- MESSAGE("after close");
- return (myDriver);
- */
-
-}
-
-Document_Writer* Driver::GetDocumentWriter(string Extension, string Class) {
-
- char* error;
- string myLibrary = string("libMeshDriver")+Extension+string(".so");
- Document_Writer* myDriver;//a caster ???
- string myClass = string("Driver")+Extension+string("_W_")+Class;
-
- void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
-
- myDriver = (Document_Writer*) dlsym(handle, myClass.c_str());
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
-
- dlclose(handle);
-
- return (myDriver);
-
-}
-
-Mesh_Reader* Driver::GetMeshReader(string Extension, string Class) {
-
- char* error;
- string myLibrary = string("libMeshDriver")+Extension+string(".so");
- Mesh_Reader* myDriver;//a caster ???
- string myClass = string("Driver")+Extension+string("_R_")+Class;
-
- void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
-
- myDriver = (Mesh_Reader*) dlsym(handle, myClass.c_str());
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
-
- dlclose(handle);
-
- return (myDriver);
-
-}
-
-Mesh_Writer* Driver::GetMeshWriter(string Extension, string Class) {
-
- char* error;
- string myLibrary = string("libMeshDriver")+Extension+string(".so");
- Mesh_Writer* myDriver;//a caster ???
- string myClass = string("Driver")+Extension+string("_W_")+Class;
-
- void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY);
- if (!handle) {
- fputs (dlerror(), stderr);
- exit(1);
- }
-
- myDriver = (Mesh_Writer*) dlsym(handle, myClass.c_str());
- if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\n", error);
- exit(1);
- }
-
- dlclose(handle);
-
- return (myDriver);
-
-}
-
@COMMENCE@
# header files
-EXPORT_HEADERS= Document_Reader.h Document_Writer.h Mesh_Reader.h Mesh_Writer.h
+EXPORT_HEADERS= Driver_Document.h Driver_Mesh.h \
+ Driver_SMDS_Mesh.h Driver_SMESHDS_Mesh.h
# Libraries targets
LIB = libMeshDriver.la
-LIB_SRC = Document_Reader.cxx Document_Writer.cxx Mesh_Reader.cxx Mesh_Writer.cxx
+LIB_SRC = Driver_Document.cxx Driver_Mesh.cxx \
+ Driver_SMDS_Mesh.cxx Driver_SMESHDS_Mesh.cxx
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
# additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -rdynamic -ldl -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS +=
+CXXFLAGS +=
-LDFLAGS += $(MED2_LIBS) -lSMESHDS -lSMDS
+LDFLAGS += $(OCC_KERNEL_LIBS) -lTKTopAlgo -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil
-%_moc.cxx: %.h
- $(MOC) $< -o $@
@CONCLUDE@
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Mesh_Reader.cxx
-// Module : SMESH
-
-using namespace std;
-#include "Mesh_Reader.h"
-
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Mesh_Reader.h
-// Module : SMESH
-
-#ifndef _INCLUDE_MESH_READER
-#define _INCLUDE_MESH_READER
-
-#include <string>
-#include "SMDS_Mesh.hxx"
-
-class Mesh_Reader
-{
-
- public:virtual void Add() = 0;
- virtual void Read() = 0;
- virtual void SetMesh(SMDS_Mesh *) = 0;
- virtual void SetMeshId(int) = 0;
- virtual void SetFile(string) = 0;
-
-};
-#endif
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Mesh_Writer.cxx
-// Module : SMESH
-
-using namespace std;
-#include "Mesh_Writer.h"
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Mesh_Writer.h
-// Module : SMESH
-
-#ifndef _INCLUDE_MESH_WRITER
-#define _INCLUDE_MESH_WRITER
-
-#include <string>
-#include "SMDS_Mesh.hxx"
-
-class Mesh_Writer
-{
-
- public:virtual void Add() = 0;
- virtual void Write() = 0;
- virtual void SetMesh(SMDS_Mesh *) = 0;
- virtual void SetFile(string) = 0;
- virtual void SetMeshId(int) = 0;
-
-};
-#endif
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHDriver.cxx
-// Module : SMESH
-
-using namespace std;
-#include "SMESHDriver.h"
-
-#include <dlfcn.h>
-#include <utilities.h>
-
-//A enlever
-#include "DriverMED_R_SMESHDS_Document.h"
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "DriverMED_R_SMDS_Mesh.h"
-#include "DriverMED_W_SMESHDS_Document.h"
-#include "DriverMED_W_SMESHDS_Mesh.h"
-#include "DriverMED_W_SMDS_Mesh.h"
-
-#include "DriverDAT_R_SMESHDS_Document.h"
-#include "DriverDAT_R_SMESHDS_Mesh.h"
-#include "DriverDAT_R_SMDS_Mesh.h"
-#include "DriverDAT_W_SMESHDS_Document.h"
-#include "DriverDAT_W_SMESHDS_Mesh.h"
-#include "DriverDAT_W_SMDS_Mesh.h"
-//
-
-Document_Reader* SMESHDriver::GetDocumentReader(string Extension, string Class) {
- if (Extension==string("MED")) {
- DriverMED_R_SMESHDS_Document* myDriver = new DriverMED_R_SMESHDS_Document();
- return (myDriver);
- }
- else if (Extension==string("DAT")) {
- DriverDAT_R_SMESHDS_Document* myDriver = new DriverDAT_R_SMESHDS_Document();
- return (myDriver);
- }
- else {
- MESSAGE("No driver known for this extension");
- return (Document_Reader*)NULL;
- }
-
-
-}
-
-Document_Writer* SMESHDriver::GetDocumentWriter(string Extension, string Class) {
- if (Extension==string("MED")) {
- DriverMED_W_SMESHDS_Document* myDriver = new DriverMED_W_SMESHDS_Document();
- return (myDriver);
- }
- else if (Extension==string("DAT")) {
- DriverDAT_W_SMESHDS_Document* myDriver = new DriverDAT_W_SMESHDS_Document();
- return (myDriver);
- }
- else {
- MESSAGE("No driver known for this extension");
- return (Document_Writer*)NULL;
- }
-
-
-}
-
-Mesh_Reader* SMESHDriver::GetMeshReader(string Extension, string Class) {
- if (Extension==string("MED")) {
-
- if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) {
- DriverMED_R_SMESHDS_Mesh* myDriver = new DriverMED_R_SMESHDS_Mesh();
- return (myDriver);
- }
- else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) {
- DriverMED_R_SMDS_Mesh* myDriver = new DriverMED_R_SMDS_Mesh();
- return (myDriver);
- }
-
- }
- else if (Extension==string("DAT")) {
-
- if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) {
- DriverDAT_R_SMESHDS_Mesh* myDriver = new DriverDAT_R_SMESHDS_Mesh();
- return (myDriver);
- }
- else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) {
- DriverDAT_R_SMDS_Mesh* myDriver = new DriverDAT_R_SMDS_Mesh();
- return (myDriver);
- }
-
- }
-
-
-}
-
-Mesh_Writer* SMESHDriver::GetMeshWriter(string Extension, string Class) {
- if (Extension==string("MED")) {
-
- if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) {
- DriverMED_W_SMESHDS_Mesh* myDriver = new DriverMED_W_SMESHDS_Mesh();
- return (myDriver);
- }
- else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) {
- DriverMED_W_SMDS_Mesh* myDriver = new DriverMED_W_SMDS_Mesh();
- return (myDriver);
- }
-
- }
- else if (Extension==string("DAT")) {
-
- if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) {
- DriverDAT_W_SMESHDS_Mesh* myDriver = new DriverDAT_W_SMESHDS_Mesh();
- return (myDriver);
- }
- else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) {
- DriverDAT_W_SMDS_Mesh* myDriver = new DriverDAT_W_SMDS_Mesh();
- return (myDriver);
- }
-
- }
-
-}
-
+++ /dev/null
-// SMESH Driver : implementaion of driver for reading and writing
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHDriver.h
-// Module : SMESH
-
-#ifndef _INCLUDE_SMESHDRIVER
-#define _INCLUDE_SMESHDRIVER
-
-#include "Document_Reader.h"
-#include "Document_Writer.h"
-#include "Mesh_Reader.h"
-#include "Mesh_Writer.h"
-
-class SMESHDriver {
-
- public :
- static Document_Reader* GetDocumentReader(string Extension, string Class);
- static Document_Writer* GetDocumentWriter(string Extension, string Class);
-
- static Mesh_Reader* GetMeshReader(string Extension, string Class);
- static Mesh_Writer* GetMeshWriter(string Extension, string Class);
-
-};
-#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "DriverDAT_R_SMDS_Mesh.h"
+#include "DriverDAT_W_SMDS_Mesh.h"
+
+int main(int argc, char** argv)
+{
+ DriverDAT_R_SMDS_Mesh aR;
+ DriverDAT_W_SMDS_Mesh aW;
+ return 1;
+}
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
+#include <stdio.h>
+
#include "DriverDAT_R_SMDS_Mesh.h"
+#include "SMDS_Mesh.hxx"
#include "utilities.h"
-DriverDAT_R_SMDS_Mesh::DriverDAT_R_SMDS_Mesh()
-{
- ;
-}
-
-DriverDAT_R_SMDS_Mesh::~DriverDAT_R_SMDS_Mesh()
-{
- ;
-}
-
-void DriverDAT_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverDAT_R_SMDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverDAT_R_SMDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverDAT_R_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverDAT_R_SMDS_Mesh::Add()
-{
- ;
-}
+using namespace std;
-void DriverDAT_R_SMDS_Mesh::Read()
+Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform()
{
-
- int i, j;
- int nbNodes, nbCells;
- int intNumPoint;
- float coordX, coordY, coordZ;
- int nbNoeuds;
-
- int intNumMaille, Degre;
- int ValElement;
- int ValDegre;
- int NoeudsMaille[20];
- int NoeudMaille;
-
- bool ok;
-
- MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()");
+ Status aResult = DRS_OK;
+
+ int i, j;
+ int nbNodes, nbCells;
+ int intNumPoint;
+ float coordX, coordY, coordZ;
+ int nbNoeuds;
+
+ int intNumMaille, Degre;
+ int ValElement;
+ int ValDegre;
+ int NoeudsMaille[20];
+ int NoeudMaille;
+
+ bool ok;
+
+ MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()");
/****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "r");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
-
- fscanf(myFileId, "%d %d\n", &nbNodes, &nbCells);
-
+ * OUVERTURE DU FICHIER EN LECTURE *
+ ****************************************************************************/
+ char *file2Read = (char *)myFile.c_str();
+ FILE* aFileId = fopen(file2Read, "r");
+ if (aFileId < 0) {
+ fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+ return DRS_FAIL;
+ }
+
+ fscanf(aFileId, "%d %d\n", &nbNodes, &nbCells);
+
/****************************************************************************
- * LECTURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- for (i = 0; i < nbNodes; i++)
- {
- fscanf(myFileId, "%d %e %e %e\n", &intNumPoint, &coordX, &coordY,
- &coordZ);
- ok = myMesh->AddNodeWithID(coordX, coordY, coordZ, intNumPoint);
- }
-
- fprintf(stdout, "%d noeuds\n", myMesh->NbNodes());
+ * LECTURE DES NOEUDS *
+ ****************************************************************************/
+ fprintf(stdout, "\n(************************)\n");
+ fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+ fprintf(stdout, "(************************)\n");
+
+ for (i = 0; i < nbNodes; i++){
+ fscanf(aFileId, "%d %e %e %e\n", &intNumPoint, &coordX, &coordY, &coordZ);
+ ok = myMesh->AddNodeWithID(coordX, coordY, coordZ, intNumPoint);
+ }
+
+ fprintf(stdout, "%d noeuds\n", myMesh->NbNodes());
/****************************************************************************
- * LECTURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
-
- fprintf(stdout, "%d elements\n", nbCells);
-
- for (i = 0; i < nbCells; i++)
- {
- fscanf(myFileId, "%d %d", &intNumMaille, &ValElement);
- Degre = abs(ValElement / 100);
- nbNoeuds = ValElement - (Degre * 100);
-
- // Recuperation des noeuds de la maille
- for (j = 0; j < nbNoeuds; j++)
- {
- fscanf(myFileId, "%d", &NoeudMaille);
- NoeudsMaille[j] = NoeudMaille;
- }
-
- // Analyse des cas de cellules
- switch (ValElement)
- {
- case 102:;
- case 103:;
- {
- ValDegre = 3;
- nbNoeuds = 2;
- ok = myMesh->AddEdgeWithID(NoeudsMaille[0], NoeudsMaille[1],
- intNumMaille);
- break;
- }
- case 204:;
- case 208:;
- {
- ValDegre = 9;
- nbNoeuds = 4;
- ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
- NoeudsMaille[2], NoeudsMaille[3], intNumMaille);
- break;
- }
- case 203:;
- case 206:;
- {
- ValDegre = 5;
- nbNoeuds = 3;
- ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
- NoeudsMaille[2], intNumMaille);
- break;
- }
- case 308:;
- case 320:;
- {
- ValDegre = 12;
- nbNoeuds = 8;
- if (ValElement == 320)
- {
- //A voir, correspondance VTK
- NoeudsMaille[4] = NoeudsMaille[8];
- NoeudsMaille[5] = NoeudsMaille[9];
- NoeudsMaille[6] = NoeudsMaille[10];
- NoeudsMaille[7] = NoeudsMaille[11];
- }
- ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
- NoeudsMaille[2], NoeudsMaille[3], NoeudsMaille[4],
- NoeudsMaille[5], NoeudsMaille[6], NoeudsMaille[7],
- intNumMaille);
+ * LECTURE DES ELEMENTS *
+ ****************************************************************************/
+ fprintf(stdout, "\n(**************************)\n");
+ fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+ fprintf(stdout, "(**************************)");
+
+ fprintf(stdout, "%d elements\n", nbCells);
+
+ for (i = 0; i < nbCells; i++) {
+ fscanf(aFileId, "%d %d", &intNumMaille, &ValElement);
+ Degre = abs(ValElement / 100);
+ nbNoeuds = ValElement - (Degre * 100);
+
+ // Recuperation des noeuds de la maille
+ for (j = 0; j < nbNoeuds; j++) {
+ fscanf(aFileId, "%d", &NoeudMaille);
+ NoeudsMaille[j] = NoeudMaille;
+ }
+
+ // Analyse des cas de cellules
+ switch (ValElement) {
+ case 102:
+ case 103:
+ ValDegre = 3;
+ nbNoeuds = 2;
+ ok = myMesh->AddEdgeWithID(NoeudsMaille[0], NoeudsMaille[1],
+ intNumMaille);
+ break;
+ case 204:
+ case 208:
+ ValDegre = 9;
+ nbNoeuds = 4;
+ ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
+ NoeudsMaille[2], NoeudsMaille[3],
+ intNumMaille);
+ break;
+ case 203:
+ case 206:
+ ValDegre = 5;
+ nbNoeuds = 3;
+ ok = myMesh->AddFaceWithID(NoeudsMaille[0], NoeudsMaille[1],
+ NoeudsMaille[2], intNumMaille);
+ break;
+ case 308:
+ case 320:
+ ValDegre = 12;
+ nbNoeuds = 8;
+ if (ValElement == 320){
+ //A voir, correspondance VTK
+ NoeudsMaille[4] = NoeudsMaille[8];
+ NoeudsMaille[5] = NoeudsMaille[9];
+ NoeudsMaille[6] = NoeudsMaille[10];
+ NoeudsMaille[7] = NoeudsMaille[11];
+ }
+ ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+ NoeudsMaille[2], NoeudsMaille[3],
+ NoeudsMaille[4], NoeudsMaille[5],
+ NoeudsMaille[6], NoeudsMaille[7],
+ intNumMaille);
+ break;
+ case 304:
+ case 310:
+ ValDegre = 10;
+ nbNoeuds = 4;
+ if (ValElement == 310)
+ NoeudsMaille[3] = NoeudsMaille[6];
+ ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+ NoeudsMaille[2], NoeudsMaille[3],
+ intNumMaille);
+ break;
+ case 306:
+ case 315:
+ ValDegre = 12;
+ nbNoeuds = 8;
+ if (ValElement == 315) {
+ NoeudsMaille[3] = NoeudsMaille[6];
+ NoeudsMaille[4] = NoeudsMaille[7];
+ NoeudsMaille[5] = NoeudsMaille[8];
+ }
+ NoeudsMaille[7] = NoeudsMaille[5];
+ NoeudsMaille[6] = NoeudsMaille[5];
+ NoeudsMaille[5] = NoeudsMaille[4];
+ NoeudsMaille[4] = NoeudsMaille[3];
+ NoeudsMaille[3] = NoeudsMaille[2];
+ ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
+ NoeudsMaille[2], NoeudsMaille[3],
+ NoeudsMaille[4], NoeudsMaille[5],
+ intNumMaille);
break;
- }
- case 304:;
- case 310:;
- {
- ValDegre = 10;
- nbNoeuds = 4;
- if (ValElement == 310)
- NoeudsMaille[3] = NoeudsMaille[6];
- ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
- NoeudsMaille[2], NoeudsMaille[3], intNumMaille);
- break;
- }
- case 306:;
- case 315:;
- {
- ValDegre = 12;
- nbNoeuds = 8;
- if (ValElement == 315)
- {
- NoeudsMaille[3] = NoeudsMaille[6];
- NoeudsMaille[4] = NoeudsMaille[7];
- NoeudsMaille[5] = NoeudsMaille[8];
- }
- NoeudsMaille[7] = NoeudsMaille[5];
- NoeudsMaille[6] = NoeudsMaille[5];
- NoeudsMaille[5] = NoeudsMaille[4];
- NoeudsMaille[4] = NoeudsMaille[3];
- NoeudsMaille[3] = NoeudsMaille[2];
- ok = myMesh->AddVolumeWithID(NoeudsMaille[0], NoeudsMaille[1],
- NoeudsMaille[2], NoeudsMaille[3], NoeudsMaille[4],
- NoeudsMaille[5], intNumMaille);
- break;
- }
-
- }
- }
-
+ }
+ }
/****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- fclose(myFileId);
-
+ * FERMETURE DU FICHIER *
+ ****************************************************************************/
+ fclose(aFileId);
+ return aResult;
}
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMDS_Mesh.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERDAT_R_SMDS_MESH
#define _INCLUDE_DRIVERDAT_R_SMDS_MESH
-#include <stdio.h>
+#include "Driver_SMDS_Mesh.h"
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Reader.h"
-
-class DriverDAT_R_SMDS_Mesh:public Mesh_Reader
+class DriverDAT_R_SMDS_Mesh: public Driver_SMDS_Mesh
{
-
- public:DriverDAT_R_SMDS_Mesh();
- ~DriverDAT_R_SMDS_Mesh();
-
- void Add();
- void Read();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-
+ public:
+ virtual Status Perform();
};
+
#endif
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMESHDS_Document.cxx
-// Module : SMESH
-using namespace std;
#include "DriverDAT_R_SMESHDS_Document.h"
-#include "DriverDAT_R_SMESHDS_Mesh.h"
-
-#include "utilities.h"
-
-int getOne()
-{
- printf("in getOne");
- return (1);
-}
-
-extern "C"
-{
- // Document_Reader* maker() {
- DriverDAT_R_SMESHDS_Document *maker()
- {
- fprintf(stdout, "here in maker\n");
- return new DriverDAT_R_SMESHDS_Document;
- }
-}
-
-DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document()
-{
- myFile = string("");
-}
-
-DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverDAT_R_SMESHDS_Document::SetFile(string aFile) {
-//myFile = aFile;
-//}
-
-//void DriverDAT_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) {
-//myDocument = aDoc;
-//}
-
-void DriverDAT_R_SMESHDS_Document::Read()
-{
-
- int myMeshId;
- MESSAGE("in read");
- SCRUTE(myFile);
- //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- char *file2Read = (char *)myFile.c_str();
- FILE *fid = fopen(file2Read, "r");
- if (fid < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * COMBIEN DE MAILLAGES ? *
- ****************************************************************************/
- int nmaa = 1;
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- fclose(fid);
-
- printf("Nombre de maillages = %d\n", nmaa);
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("DAT");
-
- for (int meshIt = 1; meshIt <= nmaa; meshIt++)
- {
- myMeshId = myDocument->NewMesh();
-
- SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
-
- DriverDAT_R_SMESHDS_Mesh *myReader = new DriverDAT_R_SMESHDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetFile(myFile);
- //myReader->SetFileId(fid);
-
- myReader->Read();
-
- }
-
-}
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMESHDS_Document.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT
-#include <stdio.h>
+#include "Driver_Document.h"
-#include "SMESHDS_Document.hxx"
-#include "Document_Reader.h"
+class DriverDAT_R_SMESHDS_Document : public Driver_Document
+{};
-class DriverDAT_R_SMESHDS_Document : public Document_Reader {
-
-public :
- DriverDAT_R_SMESHDS_Document();
- ~DriverDAT_R_SMESHDS_Document();
-
- void Read();
- //void SetFile(string);
- //void SetDocument(Handle_SMESHDS_Document&);
-
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
-
-};
#endif
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMESHDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
#include "DriverDAT_R_SMESHDS_Mesh.h"
-#include "DriverDAT_R_SMDS_Mesh.h"
-
-#include "utilities.h"
-
-DriverDAT_R_SMESHDS_Mesh::DriverDAT_R_SMESHDS_Mesh()
-{
- ;
-}
-
-DriverDAT_R_SMESHDS_Mesh::~DriverDAT_R_SMESHDS_Mesh()
-{
- ;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
- myMesh = aMesh;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::Add()
-{
- ;
-}
-
-void DriverDAT_R_SMESHDS_Mesh::Read()
-{
- string myClass = string("SMDS_Mesh");
- string myExtension = string("DAT");
-
- MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 1");
- DriverDAT_R_SMDS_Mesh *myReader = new DriverDAT_R_SMDS_Mesh;
-
- MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 2");
- myReader->SetMesh(myMesh);
- MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 3");
- myReader->SetFile(myFile);
- //myReader->SetFileId(myFileId);
-
- MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 4");
- myReader->Read();
-
-}
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_R_SMESHDS_Mesh.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_MESH
#define _INCLUDE_DRIVERDAT_R_SMESHDS_MESH
-#include <stdio.h>
+#include "Driver_SMESHDS_Mesh.h"
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Reader.h"
+class DriverDAT_R_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
+{};
-class DriverDAT_R_SMESHDS_Mesh:public Mesh_Reader
-{
-
- public:DriverDAT_R_SMESHDS_Mesh();
- ~DriverDAT_R_SMESHDS_Mesh();
-
- void Add();
- void Read();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-
-};
#endif
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_W_SMDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
+#include <stdio.h>
+
#include "DriverDAT_W_SMDS_Mesh.h"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
+#include "SMDS_Mesh.hxx"
#include "utilities.h"
-DriverDAT_W_SMDS_Mesh::DriverDAT_W_SMDS_Mesh()
-{
- ;
-}
-
-DriverDAT_W_SMDS_Mesh::~DriverDAT_W_SMDS_Mesh()
-{
- ;
-}
-
-void DriverDAT_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverDAT_W_SMDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverDAT_W_SMDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverDAT_W_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverDAT_W_SMDS_Mesh::Add()
-{
- ;
-}
+using namespace std;
-void DriverDAT_W_SMDS_Mesh::Write()
+Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
{
-
- int nbNodes, nbCells;
- int i;
-
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "w+");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
- SCRUTE(myMesh);
+ Status aResult = DRS_OK;
+
+ int nbNodes, nbCells;
+ int i;
+
+ char *file2Read = (char *)myFile.c_str();
+ FILE* aFileId = fopen(file2Read, "w+");
+ if (aFileId < 0) {
+ fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
+ return DRS_FAIL;
+ }
+ SCRUTE(myMesh);
/****************************************************************************
- * NOMBRES D'OBJETS *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
-
- /* Combien de noeuds ? */
- nbNodes = myMesh->NbNodes();
-
- /* Combien de mailles, faces ou aretes ? */
- int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
- nb_of_edges = myMesh->NbEdges();
- nb_of_faces = myMesh->NbFaces();
- nb_of_volumes = myMesh->NbVolumes();
- nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
- SCRUTE(nb_of_edges);
- SCRUTE(nb_of_faces);
- SCRUTE(nb_of_volumes);
-
- fprintf(stdout, "%d %d\n", nbNodes, nbCells);
- fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
-
+ * NOMBRES D'OBJETS *
+ ****************************************************************************/
+ fprintf(stdout, "\n(****************************)\n");
+ fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
+ fprintf(stdout, "(****************************)\n");
+
+ /* Combien de noeuds ? */
+ nbNodes = myMesh->NbNodes();
+
+ /* Combien de mailles, faces ou aretes ? */
+ int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+ nb_of_edges = myMesh->NbEdges();
+ nb_of_faces = myMesh->NbFaces();
+ nb_of_volumes = myMesh->NbVolumes();
+ nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
+ SCRUTE(nb_of_edges);
+ SCRUTE(nb_of_faces);
+ SCRUTE(nb_of_volumes);
+
+ fprintf(stdout, "%d %d\n", nbNodes, nbCells);
+ fprintf(aFileId, "%d %d\n", nbNodes, nbCells);
+
/****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode * node = itNodes->next();
- fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(),
- node->Y(), node->Z());
- }
+ * ECRITURE DES NOEUDS *
+ ****************************************************************************/
+ fprintf(stdout, "\n(************************)\n");
+ fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
+ fprintf(stdout, "(************************)\n");
+
+ SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
+ while(itNodes->more()){
+ const SMDS_MeshNode * node = itNodes->next();
+ fprintf(aFileId, "%d %e %e %e\n", node->GetID(), node->X(), node->Y(), node->Z());
+ }
/****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
- while(itEdges->more())
- {
- const SMDS_MeshElement * elem = itEdges->next();
-
- switch (elem->NbNodes())
- {
- case 2:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 102);
- break;
- }
- case 3:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 103);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- while(itFaces->more())
- {
- const SMDS_MeshElement * elem = itFaces->next();
-
- switch (elem->NbNodes())
- {
- case 3:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 203);
- break;
- }
- case 4:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 204);
- break;
- }
- case 6:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 206);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshElement * elem = itVolumes->next();
-
- switch (elem->NbNodes())
- {
- case 8:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 308);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- fclose(myFileId);
+ * ECRITURE DES ELEMENTS *
+ ****************************************************************************/
+ fprintf(stdout, "\n(**************************)\n");
+ fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
+ fprintf(stdout, "(**************************)");
+ /* Ecriture des connectivites, noms, numeros des mailles */
+
+ SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
+ while(itEdges->more()){
+ const SMDS_MeshElement * elem = itEdges->next();
+ switch (elem->NbNodes()) {
+ case 2:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 102);
+ break;
+ case 3:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 103);
+ break;
+ }
+ SMDS_ElemIteratorPtr it=elem->nodesIterator();
+ while(it->more())
+ fprintf(aFileId, "%d ", it->next()->GetID());
+ fprintf(aFileId, "\n");
+ }
+
+ SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
+ while(itFaces->more()){
+ const SMDS_MeshElement * elem = itFaces->next();
+ switch (elem->NbNodes()) {
+ case 3:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 203);
+ break;
+ case 4:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 204);
+ break;
+ case 6:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 206);
+ break;
+ }
+ SMDS_ElemIteratorPtr it=elem->nodesIterator();
+ while(it->more())
+ fprintf(aFileId, "%d ", it->next()->GetID());
+ fprintf(aFileId, "\n");
+ }
+
+ SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
+ while(itVolumes->more()){
+ const SMDS_MeshElement * elem = itVolumes->next();
+ switch (elem->NbNodes()) {
+ case 8:
+ fprintf(aFileId, "%d %d ", elem->GetID(), 308);
+ break;
+ }
+
+ SMDS_ElemIteratorPtr it=elem->nodesIterator();
+ while(it->more())
+ fprintf(aFileId, "%d ", it->next()->GetID());
+
+ fprintf(aFileId, "\n");
+ }
+
+ fclose(aFileId);
+
+ return aResult;
}
#ifndef _INCLUDE_DRIVERDAT_W_SMDS_MESH
#define _INCLUDE_DRIVERDAT_W_SMDS_MESH
-#include <stdio.h>
-#include <string>
+#include "Driver_SMDS_Mesh.h"
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Writer.h"
-
-class DriverDAT_W_SMDS_Mesh:public Mesh_Writer
+class DriverDAT_W_SMDS_Mesh: public Driver_SMDS_Mesh
{
-
- public:DriverDAT_W_SMDS_Mesh();
- ~DriverDAT_W_SMDS_Mesh();
-
- void Add();
- void Write();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-
+ public:
+ virtual Status Perform();
};
+
#endif
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_W_SMESHDS_Document.cxx
-// Module : SMESH
-using namespace std;
#include "DriverDAT_W_SMESHDS_Document.h"
-#include "DriverDAT_W_SMESHDS_Mesh.h"
-
-#include "utilities.h"
-
-extern "C"
-{
- Document_Writer *Wmaker()
- {
- return new DriverDAT_W_SMESHDS_Document;
- }
-}
-
-DriverDAT_W_SMESHDS_Document::DriverDAT_W_SMESHDS_Document()
-{
- ;
-}
-
-DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverDAT_W_SMESHDS_Document::SetFile(string aFile) {
-//myFile = aFile;
-//}
-
-//void DriverDAT_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) {
-//myDocument = aDocument;
-//}
-
-void DriverDAT_W_SMESHDS_Document::Write()
-{
-
- SMESHDS_Mesh * myMesh;
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN ECRITURE *
- ****************************************************************************/
- char *file2Write = (char *)myFile.c_str();
- FILE *fid = fopen(file2Write, "w+");
- if (fid < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Write);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
-
- fclose(fid);
-
- /******** Nombre de maillages ********/
- int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
- //nb_of_meshes = 1;
- int numero = 0;
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("DAT");
-
- //while (numero<nb_of_meshes) {
- //numero++;
- //myMesh = myDocument->GetMesh(numero);
- myDocument->InitMeshesIterator();
- while(myDocument->MoreMesh())
- {
- numero++;
- myMesh = myDocument->NextMesh();
-
- DriverDAT_W_SMESHDS_Mesh *myWriter = new DriverDAT_W_SMESHDS_Mesh;
- //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass);
-
- myWriter->SetMesh(myMesh);
- myWriter->SetFile(myFile);
- SCRUTE(myMesh);
- //myWriter->SetFileId(fid);
- myWriter->SetMeshId(numero);
- myWriter->Write();
- }
-
-}
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_W_SMESHDS_Document.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT
-#include <stdio.h>
-#include <string>
+#include "Driver_Document.h"
-#include "SMESHDS_Document.hxx"
-#include "Document_Writer.h"
+class DriverDAT_W_SMESHDS_Document: public Driver_Document
+{};
-class DriverDAT_W_SMESHDS_Document : public Document_Writer {
-
-public :
- DriverDAT_W_SMESHDS_Document();
- ~DriverDAT_W_SMESHDS_Document();
-
- void Write();
- //void SetFile(string);
- //void SetDocument(Handle(SMESHDS_Document)&);
-
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
-
-};
#endif
-// SMESH DriverDAT : driver to read and write 'dat' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverDAT_W_SMESHDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
#include "DriverDAT_W_SMESHDS_Mesh.h"
-#include "DriverDAT_W_SMDS_Mesh.h"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-
-
-
-
-
-#include "utilities.h"
-
-DriverDAT_W_SMESHDS_Mesh::DriverDAT_W_SMESHDS_Mesh()
-{
- ;
-}
-
-DriverDAT_W_SMESHDS_Mesh::~DriverDAT_W_SMESHDS_Mesh()
-{
- ;
-}
-
-void DriverDAT_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
- myMesh = aMesh;
-}
-
-void DriverDAT_W_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverDAT_W_SMESHDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverDAT_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverDAT_W_SMESHDS_Mesh::Write()
-{
-
- string myClass = string("SMDS_Mesh");
- string myExtension = string("DAT");
-
- DriverDAT_W_SMDS_Mesh *myWriter = new DriverDAT_W_SMDS_Mesh;
-
- myWriter->SetMesh(myMesh);
- myWriter->SetFile(myFile);
- myWriter->SetMeshId(myMeshId);
- //myWriter->SetFileId(myFileId);
-
- myWriter->Write();
-
-}
-
-void DriverDAT_W_SMESHDS_Mesh::Add()
-{
- int nbNodes, nbCells;
- int i;
-
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "w+");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * NOMBRES D'OBJETS *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
-
- /* Combien de noeuds ? */
- nbNodes = myMesh->NbNodes();
-
- /* Combien de mailles, faces ou aretes ? */
- int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
- nb_of_edges = myMesh->NbEdges();
- nb_of_faces = myMesh->NbFaces();
- nb_of_volumes = myMesh->NbVolumes();
- nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
-
- fprintf(stdout, "%d %d\n", nbNodes, nbCells);
- fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
-
- /****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode * node = itNodes->next();
- fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(),
- node->Y(), node->Z());
- }
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
- while(itEdges->more())
- {
- const SMDS_MeshEdge * elem = itEdges->next();
-
- switch (elem->NbNodes())
- {
- case 2:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 102);
- break;
- }
- case 3:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 103);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
- while(itNodes->more())
- fprintf(myFileId, "%d ", itNodes->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- while(itFaces->more())
- {
- const SMDS_MeshElement * elem = itFaces->next();
-
- switch (elem->NbNodes())
- {
- case 3:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 203);
- break;
- }
- case 4:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 204);
- break;
- }
- case 6:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 206);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
- while(itNodes->more())
- fprintf(myFileId, "%d ", itNodes->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshElement * elem = itVolumes->next();
-
- switch (elem->NbNodes())
- {
- case 8:
- {
- fprintf(myFileId, "%d %d ", elem->GetID(), 308);
- break;
- }
- }
-
- SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
- while(itNodes->more())
- fprintf(myFileId, "%d ", itNodes->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- fclose(myFileId);
-}
#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_MESH
#define _INCLUDE_DRIVERDAT_W_SMESHDS_MESH
-#include <stdio.h>
-#include <string>
+#include "Driver_SMESHDS_Mesh.h"
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Writer.h"
+class DriverDAT_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
+{};
-class DriverDAT_W_SMESHDS_Mesh:public Mesh_Writer
-{
-
- public:DriverDAT_W_SMESHDS_Mesh();
- ~DriverDAT_W_SMESHDS_Mesh();
-
- void Add();
- void Write();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-
-};
#endif
LIB = libMeshDriverDAT.la
LIB_SRC = DriverDAT_R_SMDS_Mesh.cxx DriverDAT_R_SMESHDS_Mesh.cxx DriverDAT_R_SMESHDS_Document.cxx DriverDAT_W_SMDS_Mesh.cxx DriverDAT_W_SMESHDS_Mesh.cxx DriverDAT_W_SMESHDS_Document.cxx
+# Executables targets
+BIN = DAT_Test
+
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
# additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(MED2_LIBS) -lMeshDriver
+CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS += -lMeshDriver
-%_moc.cxx: %.h
- $(MOC) $< -o $@
+LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
#include "DriverMED_Family.h"
#include <sstream>
+using namespace std;
+
//=============================================================================
/*!
* Split each group from list <aGroups> on some parts (families)
#include <boost/shared_ptr.hpp>
#include <set>
-using namespace std;
-
#define REST_NODES_FAMILY 1
#define REST_EDGES_FAMILY -1
#define REST_FACES_FAMILY -2
// Methods for groups storing to MED
- static list<DriverMED_FamilyPtr> MakeFamilies (const map <int, SMESHDS_SubMesh*>& theSubMeshes,
- const list<SMESHDS_Group*>& theGroups,
- const bool doGroupOfNodes,
- const bool doGroupOfEdges,
- const bool doGroupOfFaces,
- const bool doGroupOfVolumes);
+ static std::list<DriverMED_FamilyPtr> MakeFamilies (const std::map <int, SMESHDS_SubMesh*>& theSubMeshes,
+ const std::list<SMESHDS_Group*>& theGroups,
+ const bool doGroupOfNodes,
+ const bool doGroupOfEdges,
+ const bool doGroupOfFaces,
+ const bool doGroupOfVolumes);
// Split each group from list <theGroups> and each sub-mesh from list <theSubMeshes>
// on some parts (families) on the basis of the elements membership in other groups
// from <theGroups> and other sub-meshes from <theSubMeshes>.
MEDA::PFamilyInfo GetFamilyInfo (const MEDA::PMeshInfo& theMeshInfo) const;
// Create TFamilyInfo for this family
- const set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
+ const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
// Returns elements of this family
int GetId () const { return myId; }
void AddElement (const SMDS_MeshElement* theElement) { myElements.insert(theElement); }
- void AddGroupName (string theGroupName) { myGroupNames.insert(theGroupName); }
+ void AddGroupName (std::string theGroupName) { myGroupNames.insert(theGroupName); }
void SetType (const SMDSAbs_ElementType theType) { myType = theType; }
SMDSAbs_ElementType GetType () { return myType; }
- bool MemberOf (string theGroupName) const
+ bool MemberOf (std::string theGroupName) const
{ return (myGroupNames.find(theGroupName) != myGroupNames.end()); }
const MED::TStringSet& GetGroupNames () const { return myGroupNames; }
void Init (SMESHDS_Group* group);
// Initialize the tool by SMESHDS_Group
- static list<DriverMED_FamilyPtr> SplitByType (SMESHDS_SubMesh* theSubMesh,
- const int theId);
+ static std::list<DriverMED_FamilyPtr> SplitByType (SMESHDS_SubMesh* theSubMesh,
+ const int theId);
// Split <theSubMesh> on some parts (families)
// on the basis of the elements type.
private:
int myId;
SMDSAbs_ElementType myType;
- set<const SMDS_MeshElement *> myElements;
+ std::set<const SMDS_MeshElement *> myElements;
MED::TStringSet myGroupNames;
};
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_R_SMDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
#include "DriverMED_R_SMDS_Mesh.h"
-#include "utilities.h"
-
-DriverMED_R_SMDS_Mesh::DriverMED_R_SMDS_Mesh()
-{
-}
-
-DriverMED_R_SMDS_Mesh::~DriverMED_R_SMDS_Mesh()
-{
- ;
-}
-
-void DriverMED_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverMED_R_SMDS_Mesh::SetFile(string aFile)
-{
- myFileId = -1;
- myFile = aFile;
-}
-
-void DriverMED_R_SMDS_Mesh::SetFileId(med_idt aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverMED_R_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverMED_R_SMDS_Mesh::Add()
-{
- ;
-}
-
-void DriverMED_R_SMDS_Mesh::Read()
-{
-
- med_err ret = 0;
- int i, j, k, l;
- int numero;
- char message[200];
- bool ok;
- /* nombre d'objets MED */
- char nom_universel[MED_TAILLE_LNOM + 1];
- med_int long_fichier_en_tete;
- char *fichier_en_tete;
- char version_hdf[10];
- char version_med[10];
- med_int nmaa, mdim, nnoe;
- med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
- med_int nare[MED_NBR_GEOMETRIE_ARETE];
- /* nom du maillage */
- char nommaa[MED_TAILLE_NOM + 1];
- /* noeuds */
- med_float *coo;
- char nomcoo[3 * MED_TAILLE_PNOM + 1];
- char unicoo[3 * MED_TAILLE_PNOM + 1];
- char *nomnoe;
- med_int *numnoe;
- med_int *nufano;
- med_repere rep;
- med_booleen inonoe, inunoe;
- med_mode_switch mode_coo;
- char str[MED_TAILLE_PNOM + 1];
- /* elements */
- med_int nsup;
- med_int edim;
- med_int taille;
- med_int elem_id;
- med_int cmpt = 0;
- med_int *connectivite;
- char *nomele;
- med_int *numele;
- med_int *nufael;
- med_booleen inoele, inuele;
- med_connectivite typ_con;
- med_geometrie_element typgeo;
- med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
- { MED_POINT1, MED_SEG2,
- MED_SEG3, MED_TRIA3,
- MED_TRIA6, MED_QUAD4,
- MED_QUAD8, MED_TETRA4,
- MED_TETRA10, MED_HEXA8,
- MED_HEXA20, MED_PENTA6,
- MED_PENTA15, MED_PYRA5,
- MED_PYRA13
- };
- med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
- { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
- med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
- char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
- "MED_SEG2",
- "MED_SEG3",
- "MED_TRIA3",
- "MED_TRIA6",
- "MED_QUAD4",
- "MED_QUAD8",
- "MED_TETRA4",
- "MED_TETRA10",
- "MED_HEXA8",
- "MED_HEXA20",
- "MED_PENTA6",
- "MED_PENTA15",
- "MED_PYRA5",
- "MED_PYRA13"
- };
- med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
- { MED_TRIA3, MED_TRIA6,
- MED_QUAD4, MED_QUAD8
- };
- med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
- med_int nfaces[MED_NBR_GEOMETRIE_FACE];
- char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
- { "MED_TRIA3", "MED_TRIA6",
- "MED_QUAD4", "MED_QUAD8"
- };
- med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
- { MED_SEG2, MED_SEG3 };
- med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
- med_int naretes[MED_NBR_GEOMETRIE_ARETE];
- char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
- { "MED_SEG2", "MED_SEG3" };
- /* familles */
- med_int nfam;
- med_int natt, ngro;
- char *attdes, *gro;
- med_int *attval, *attide;
- char nomfam[MED_TAILLE_NOM + 1];
- med_int numfam;
- char str1[MED_TAILLE_DESC + 1];
- char str2[MED_TAILLE_LNOM + 1];
-
- char *file2Read;
- bool locally_managed;
- SCRUTE(myFileId);
- if (myFileId == -1)
- locally_managed = true;
- else
- locally_managed = false;
-
- if (locally_managed)
- {
- file2Read = (char *)myFile.c_str();
- myFileId = MEDouvrir(file2Read, MED_LECT);
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n",
- file2Read);
- exit(EXIT_FAILURE);
- }
- numero = 1;
- }
- else
- numero = myMeshId;
-
- typ_con = MED_NOD;
- mode_coo = MED_FULL_INTERLACE;
-
- /****************************************************************************
- * NOMBRES D'OBJETS MED *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
-
- /* lecture du nom et de la dimension du maillage */
- fprintf(stdout, "%d %d\n", myFileId, numero);
- ret = MEDmaaInfo(myFileId, numero, nommaa, &mdim);
- fprintf(stdout, "%d\n", ret);
- if (ret < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nom du maillage \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nom du maillage : <<%s>>\n", nommaa);
- fprintf(stdout, "- Dimension du maillage : %d\n", mdim);
-
- /* Combien de noeuds ? */
- nnoe =
- MEDnEntMaa(myFileId, nommaa, MED_COOR, MED_NOEUD, MED_POINT1, typ_con);
- if (nnoe < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
-
- /* Combien de mailles, faces ou aretes ? */
- for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- {
- nmailles[i] =
- MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_MAILLE, typmai[i],
- typ_con);
- if (nmailles[i] < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre de mailles \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nombre de mailles de type %s : %d \n", nommai[i],
- nmailles[i]);
- }
-
- for (i = 0; i < MED_NBR_GEOMETRIE_FACE; i++)
- {
- nfaces[i] = MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_FACE, typfac[i],
- typ_con);
- if (nfaces[i] < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre de faces \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nombre de faces de type %s : %d \n", nomfac[i],
- nfaces[i]);
- }
-
- for (i = 0; i < MED_NBR_GEOMETRIE_ARETE; i++)
- {
- naretes[i] =
- MEDnEntMaa(myFileId, nommaa, MED_CONN, MED_ARETE, typare[i],
- typ_con);
- if (naretes[i] < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre d'aretes \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nombre d'aretes de type %s : %d \n", nomare[i],
- naretes[i]);
- }
-
- /* nombre de familles */
- nfam = MEDnFam(myFileId, nommaa, 0, MED_FAMILLE);
- if (nfam < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout, "- Nombre de familles : %d \n", nfam);
-
- /****************************************************************************
- * LECTURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- /* Allocations memoires */
- /* table des coordonnees
- * profil : (dimension * nombre de noeuds ) */
- coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
- /* table des numeros, des numeros de familles des noeuds
- * profil : (nombre de noeuds) */
- numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
- nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
- /* table des noms des noeuds
- * profil : (nnoe*MED_TAILLE_PNOM+1) */
- nomnoe = (char *)malloc(MED_TAILLE_PNOM * nnoe + 1);
-
- /* lecture des noeuds :
- * - coordonnees
- * - noms (optionnel dans un fichier MED)
- * - numeros (optionnel dans un fichier MED)
- * - numeros des familles */
- ret = MEDnoeudsLire(myFileId, nommaa, mdim, coo, mode_coo, &rep,
- nomcoo, unicoo, nomnoe, &inonoe, numnoe, &inunoe, nufano, nnoe);
- if (ret < 0)
- strcpy(message, ">> ERREUR : lecture des noeuds \n");
-
- if (inunoe)
- {
- for (int i = 0; i < nnoe; i++)
- {
- ok = myMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
- coo[i * 3 + 2], numnoe[i]);
- //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],coo[i*3+2]);
- }
- }
- else
- {
- for (int i = 0; i < nnoe; i++)
- {
- ok = myMesh->AddNodeWithID(coo[i * 3], coo[i * 3 + 1],
- coo[i * 3 + 2], i + 1);
- //fprintf(Out,"%d %f %f %f\n",numnoe[i],coo[i*3],coo[i*3+1],i);
- }
- }
-
- //fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
- //for (i=0;i<nnoe;i++)
- //fprintf(stdout," %d ",*(nufano+i));
- //fprintf(stdout,"\n");
-
- SCRUTE(myMesh->NbNodes());
-
- /* liberation memoire */
- free(coo);
- free(nomnoe);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * LECTURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- //fprintf(Out,"CELLS\n");
- /* Lecture des connectivites, noms, numeros des mailles */
- //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
-
- if (ret == 0)
- for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- {
- if (nmailles[i] > 0 && ret == 0)
- {
- /* dimension de la maille */
- edim = typmai[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
-
- taille = nsup + typmai[i] % 100;
- //taille = typmai[i]%100;
-
- /* allocation memoire */
- connectivite = (med_int *) malloc(sizeof(med_int) *
- taille * nmailles[i]);
- nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
- nmailles[i] + 1);
- numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
- nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
-
- /* lecture des données */
- ret =
- MEDelementsLire(myFileId, nommaa, mdim, connectivite,
- mode_coo, nomele, &inoele, numele, &inuele, nufael,
- nmailles[i], MED_MAILLE, typmai[i], typ_con);
- SCRUTE(typmai[i]);
- switch (typmai[i])
- {
- case MED_SEG2:
- {
- if (inuele)
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- elem_id = *(numele + j);
- ok = myMesh->AddEdgeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1), elem_id);
- }
- }
- else
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- cmpt++;
- ok = myMesh->AddEdgeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1), cmpt);
- }
- }
-
- break;
- }
- case MED_TRIA3:
- {
- if (inuele)
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- elem_id = *(numele + j);
- ok = myMesh->AddFaceWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2), elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
- }
- }
- else
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- cmpt++;
- ok = myMesh->AddFaceWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2), cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
- }
- }
-
- break;
- }
- case MED_QUAD4:
- {
- if (inuele)
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- elem_id = *(numele + j);
- ok = myMesh->AddFaceWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3), elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
- }
- }
- else
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- cmpt++;
- ok = myMesh->AddFaceWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3), cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
- }
- }
- break;
- }
- case MED_TETRA4:
- {
- if (inuele)
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- elem_id = *(numele + j);
- ok = myMesh->AddVolumeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3), elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
- }
- }
- else
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- cmpt++;
- ok = myMesh->AddVolumeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3), cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
- }
- }
- break;
- }
- case MED_HEXA8:
- {
- if (inuele)
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- elem_id = *(numele + j);
- ok = myMesh->AddVolumeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3),
- *(connectivite + j * (taille) + 4),
- *(connectivite + j * (taille) + 5),
- *(connectivite + j * (taille) + 6),
- *(connectivite + j * (taille) + 7), elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
- }
- }
- else
- {
- for (j = 0; j < nmailles[i]; j++)
- {
- cmpt++;
- ok = myMesh->AddVolumeWithID(*(connectivite +
- j * (taille)),
- *(connectivite + j * (taille) + 1),
- *(connectivite + j * (taille) + 2),
- *(connectivite + j * (taille) + 3),
- *(connectivite + j * (taille) + 4),
- *(connectivite + j * (taille) + 5),
- *(connectivite + j * (taille) + 6),
- *(connectivite + j * (taille) + 7), cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
- }
- }
- break;
- }
- default:
- {
- break;
- }
- }
-
- //fprintf(stdout,"\n - Numéros de familles : \n");
- //for (j=0;j<nmailles[i];j++)
- //fprintf(stdout," %d ",*(nufael+j));
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- SCRUTE(myMesh->NbEdges());
- SCRUTE(myMesh->NbFaces());
- /****************************************************************************
- * LECTURE DES FAMILLES *
- ****************************************************************************/
- printf("\n(*************************)\n");
- printf("(* FAMILLES DU MAILLAGE : *)\n");
- printf("(*************************)\n");
- if (ret == 0)
- for (i = 0; i < nfam; i++)
- {
-
- /* nombre de groupes */
- ngro = MEDnFam(myFileId, nommaa, i + 1, MED_GROUPE);
- if (ngro < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre de groupes d'une famille \n");
- }
-
- /* nombre d'attributs */
- if (ret == 0)
- {
- natt = MEDnFam(myFileId, nommaa, i + 1, MED_ATTR);
- if (natt < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
- }
- }
-
- if (ret == 0)
- fprintf(stdout, "- Famille %d a %d attributs et %d groupes \n",
- i + 1, natt, ngro);
-
- /* nom,numero,attributs,groupes */
- if (ret == 0)
- {
- attide = (med_int *) malloc(sizeof(med_int) * natt);
- attval = (med_int *) malloc(sizeof(med_int) * natt);
- attdes = (char *)malloc(MED_TAILLE_DESC * natt + 1);
- gro = (char *)malloc(MED_TAILLE_LNOM * ngro + 1);
- ret =
- MEDfamInfo(myFileId, nommaa, i + 1, nomfam, &numfam, attide,
- attval, attdes, &natt, gro, &ngro);
- fprintf(stdout, " - Famille de nom %s et de numero %d : \n",
- nomfam, numfam);
- fprintf(stdout, " - Attributs : \n");
- for (j = 0; j < natt; j++)
- {
- strncpy(str1, attdes + j * MED_TAILLE_DESC,
- MED_TAILLE_DESC);
- str1[MED_TAILLE_DESC] = '\0';
- fprintf(stdout, " ide = %d - val = %d - des = %s\n",
- *(attide + j), *(attval + j), str1);
- }
- free(attide);
- free(attval);
- free(attdes);
- fprintf(stdout, " - Groupes :\n");
- for (j = 0; j < ngro; j++)
- {
- strncpy(str2, gro + j * MED_TAILLE_LNOM, MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM] = '\0';
- fprintf(stdout, " gro = %s\n", str2);
- }
- free(gro);
- }
- }
-
- if (locally_managed)
- ret = MEDfermer(myFileId);
-
-}
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_R_SMDS_Mesh.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERMED_R_SMDS_MESH
#define _INCLUDE_DRIVERMED_R_SMDS_MESH
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Reader.h"
+#include "Driver_SMDS_Mesh.h"
-extern "C"
-{
-#include <med.h>
-}
+class DriverMED_R_SMDS_Mesh: public Driver_SMDS_Mesh
+{};
-class DriverMED_R_SMDS_Mesh:public Mesh_Reader
-{
-
- public:DriverMED_R_SMDS_Mesh();
- ~DriverMED_R_SMDS_Mesh();
-
- void Add();
- void Read();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(med_idt);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- med_idt myFileId;
- int myMeshId;
-
-};
#endif
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_R_SMESHDS_Document.cxx
-// Module : SMESH
-using namespace std;
#include "DriverMED_R_SMESHDS_Document.h"
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "utilities.h"
-
-extern "C"
-{
- Document_Reader *maker()
- {
- return new DriverMED_R_SMESHDS_Document;
- }
-}
-
-DriverMED_R_SMESHDS_Document::DriverMED_R_SMESHDS_Document()
-{
- ;
-}
-
-DriverMED_R_SMESHDS_Document::~DriverMED_R_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverMED_R_SMESHDS_Document::SetFile(string aFile) {
-// myFile = aFile;
-//}
-
-void DriverMED_R_SMESHDS_Document::Read()
-{
-
- med_err ret = 0;
- med_idt fid;
- med_int nmaa;
-
- int myMeshId;
-
- //string myFile = string("/home/home_users/cai/projects/salome_prev04/SALOME_ROOT/data/fra1.med");
-
-/****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- char *file2Read = (char *)myFile.c_str();
- fid = MEDouvrir(file2Read, MED_LECT);
- if (fid < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * COMBIEN DE MAILLAGES ? *
- ****************************************************************************/
- nmaa = MEDnMaa(fid);
- if (nmaa < 0)
- {
- fprintf(stderr, ">> ERREUR : lecture du nombre de maillages \n");
- exit(EXIT_FAILURE);
- }
- printf("Nombre de maillages = %d\n", nmaa);
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("MED");
-
- for (int meshIt = 1; meshIt <= nmaa; meshIt++)
- {
- myMeshId = myDocument->NewMesh();
- printf("MeshId = %d\n", myMeshId);
-
- SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
- SCRUTE(myMesh);
-
- // Handle (SMDS_Mesh) MMM =.........
- //ex SMESHDS_Mesh * myMesh2 =SMESHDS_Mesh *::DownCast(MMM);
-
- DriverMED_R_SMESHDS_Mesh *myReader = new DriverMED_R_SMESHDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetMeshId(myMeshId);
-
- //myReader->SetFile(myFile);
- SCRUTE(fid);
- myReader->SetFileId(fid);
-
- myReader->Add();
-
- }
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- ret = MEDfermer(fid);
-
- if (ret != 0)
- fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n",
- file2Read);
-
-}
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_R_SMESHDS_Document.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERMED_R_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERMED_R_SMESHDS_DOCUMENT
-#include "SMESHDS_Document.hxx"
-#include "Document_Reader.h"
+#include "Driver_Document.h"
-extern "C"
-{
-#include <med.h>
-}
+class DriverMED_R_SMESHDS_Document : public Driver_Document
+{};
-class DriverMED_R_SMESHDS_Document : public Document_Reader {
-
-public :
- DriverMED_R_SMESHDS_Document();
- ~DriverMED_R_SMESHDS_Document();
-
- void Read();
- //void SetFile(string);
-
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
-
-};
#endif
#include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverMED_R_SMDS_Mesh.h"
+#include "SMESHDS_Mesh.hxx"
#include "utilities.h"
#include "DriverMED_Family.h"
#define _EDF_NODE_IDS_
-DriverMED_R_SMESHDS_Mesh::DriverMED_R_SMESHDS_Mesh()
- :
- myMesh (NULL),
- myFile (""),
- myFileId (-1),
- myMeshId (-1)
-{
-}
-
-DriverMED_R_SMESHDS_Mesh::~DriverMED_R_SMESHDS_Mesh()
-{
-// map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
-// for (; aFamsIter != myFamilies.end(); aFamsIter++)
-// {
-// delete (*aFamsIter).second;
-// }
-}
-
-void DriverMED_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverMED_R_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverMED_R_SMESHDS_Mesh::SetFileId(med_idt aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverMED_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName)
{
myMeshName = theMeshName;
}
-void DriverMED_R_SMESHDS_Mesh::Read()
-{
-
- string myClass = string("SMDS_Mesh");
- string myExtension = string("MED");
-
- DriverMED_R_SMDS_Mesh *myReader = new DriverMED_R_SMDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetMeshId(myMeshId);
- myReader->SetFile(myFile);
- myReader->SetFileId(-1);
-
- myReader->Read();
-}
-
-void DriverMED_R_SMESHDS_Mesh::Add()
-{
- string myClass = string("SMDS_Mesh");
- string myExtension = string("MED");
-
- DriverMED_R_SMDS_Mesh *myReader = new DriverMED_R_SMDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetMeshId(myMeshId);
-
- SCRUTE(myFileId);
- myReader->SetFileId(myFileId);
-
- myReader->Read();
-}
-
-
static const SMDS_MeshNode*
FindNode(const SMDS_Mesh* theMesh, med_int theId){
const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
-DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
+Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
{
- ReadStatus result = DRS_FAIL;
+ Status aResult = DRS_FAIL;
try{
using namespace MEDA;
myFamilies.clear();
- MESSAGE("ReadMySelf - myFile : "<<myFile);
+ MESSAGE("Perform - myFile : "<<myFile);
TWrapper aMed(myFile);
- result = DRS_EMPTY;
+ aResult = DRS_EMPTY;
if(med_int aNbMeshes = aMed.GetNbMeshes()){
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
// Reading the MED mesh
} else {
aMeshName = myMeshName;
}
- MESSAGE("ReadMySelf - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
+ MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue;
- result = DRS_OK;
-
+ aResult = DRS_OK;
+ med_int aMeshDim = aMeshInfo->GetDim();
+
// Reading MED families to the temporary structure
//------------------------------------------------
med_int aNbFams = aMed.GetNbFamilies(aMeshInfo);
med_booleen anIsNodeNum = aNodeInfo->IsElemNum();
med_int aNbElems = aNodeInfo->GetNbElem();
- MESSAGE("ReadMySelf - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
+ MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
for(med_int iElem = 0; iElem < aNbElems; iElem++){
double aCoords[3] = {0.0, 0.0, 0.0};
for(med_int iDim = 0; iDim < 3; iDim++)
PCellInfo aCellInfo = aMed.GetCellInfo(aMeshInfo,anEntity,aGeom);
med_booleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : MED_FAUX;
med_int aNbElems = aCellInfo->GetNbElem();
- MESSAGE("ReadMySelf - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
- MESSAGE("ReadMySelf - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
+ MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){
med_int aNbNodes = -1;
}
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());
- result = DRS_FAIL;
+ aResult = DRS_FAIL;
}catch(...){
//INFOS("Unknown exception was cought !!!");
- result = DRS_FAIL;
+ aResult = DRS_FAIL;
}
if (!anElement) {
- result = DRS_WARN_SKIP_ELEM;
+ aResult = DRS_WARN_SKIP_ELEM;
}
else {
if (isRenum) {
anIsElemNum = MED_FAUX;
takeNumbers = false;
- if (result < DRS_WARN_RENUMBER)
- result = DRS_WARN_RENUMBER;
+ if (aResult < DRS_WARN_RENUMBER)
+ aResult = DRS_WARN_RENUMBER;
}
if (myFamilies.find(aFamNum) != myFamilies.end()) {
// Save reference to this element from its family
}
}catch(const std::exception& exc){
INFOS("Follow exception was cought:\n\t"<<exc.what());
- result = DRS_FAIL;
+ aResult = DRS_FAIL;
}catch(...){
INFOS("Unknown exception was cought !!!");
- result = DRS_FAIL;
+ aResult = DRS_FAIL;
}
- MESSAGE("ReadMySelf - result status = "<<result);
- return result;
+ MESSAGE("Perform - aResult status = "<<aResult);
+ return aResult;
}
-list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames()
+list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
{
list<string> aMeshNames;
using namespace MEDA;
MESSAGE("GetMeshNames - myFile : " << myFile);
+ theStatus = DRS_OK;
TWrapper aMed (myFile);
if (med_int aNbMeshes = aMed.GetNbMeshes()) {
}
}catch(const std::exception& exc){
INFOS("Follow exception was cought:\n\t"<<exc.what());
+ theStatus = DRS_FAIL;
}catch(...){
INFOS("Unknown exception was cought !!!");
+ theStatus = DRS_FAIL;
}
return aMeshNames;
void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes ()
{
- SMESHDS_Mesh* aSMESHDSMesh = dynamic_cast<SMESHDS_Mesh*>(myMesh);
- if (!aSMESHDSMesh) {
- EXCEPTION(runtime_error,"Can not cast SMDS_Mesh to SMESHDS_Mesh");
- }
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++)
{
{
for (; anElemsIter != anElements.end(); anElemsIter++)
{
- const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>(*anElemsIter);
- aSMESHDSMesh->SetNodeInVolume(node, Id);
-// aSMESHDSMesh->SetNodeOnFace(node, Id);
-// aSMESHDSMesh->SetNodeOnEdge(node, Id);
-// aSMESHDSMesh->SetNodeOnVertex(node, Id);
+ SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>
+ ( static_cast<const SMDS_MeshNode*>( *anElemsIter ));
+ // find out a shape type
+ TopoDS_Shape aShape = myMesh->IndexToShape( Id );
+ int aShapeType = ( aShape.IsNull() ? -1 : aShape.ShapeType() );
+ switch ( aShapeType ) {
+ case TopAbs_FACE:
+ myMesh->SetNodeOnFace(node, Id); break;
+ case TopAbs_EDGE:
+ myMesh->SetNodeOnEdge(node, Id); break;
+ case TopAbs_VERTEX:
+ myMesh->SetNodeOnVertex(node, Id); break;
+ default:
+ myMesh->SetNodeInVolume(node, Id);
+ }
}
}
else
{
for (; anElemsIter != anElements.end(); anElemsIter++)
{
- aSMESHDSMesh->SetMeshElementOnShape(*anElemsIter, Id);
+ myMesh->SetMeshElementOnShape(*anElemsIter, Id);
}
}
}
#ifndef _INCLUDE_DRIVERMED_R_SMESHDS_MESH
#define _INCLUDE_DRIVERMED_R_SMESHDS_MESH
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Reader.h"
+#include "Driver_SMESHDS_Mesh.h"
#include "DriverMED_Family.h"
#include <list>
-extern "C"
-{
-#include <med.h>
-}
-
-using namespace std;
+class SMESHDS_Mesh;
class SMESHDS_Group;
class SMESHDS_SubMesh;
-class DriverMED_R_SMESHDS_Mesh:public Mesh_Reader
+class DriverMED_R_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
{
public:
+ virtual Status Perform();
- DriverMED_R_SMESHDS_Mesh();
- ~DriverMED_R_SMESHDS_Mesh();
-
- enum ReadStatus {
- DRS_OK,
- DRS_EMPTY, // a MED file contains no mesh with the given name
- DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
- // so the numbers from the file are ignored
- DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
- DRS_FAIL // general failure (exception etc.)
- };
-
- void Read();
- ReadStatus ReadMySelf();
- void Add();
-
- list<string> GetGroupNames();
+ std::list<std::string> GetGroupNames();
void GetGroup(SMESHDS_Group* theGroup);
void CreateAllSubMeshes();
void GetSubMesh(SMESHDS_SubMesh* theSubMesh, const int theId);
- list<string> GetMeshNames();
-
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
- void SetFileId(med_idt);
- void SetMeshId(int);
- void SetMeshName(string theMeshName);
+ std::list<std::string> GetMeshNames(Status& theStatus);
+ void SetMeshName(std::string theMeshName);
private:
-
- SMDS_Mesh * myMesh;
- string myFile;
- med_idt myFileId;
- int myMeshId;
- string myMeshName;
- map<int, DriverMED_FamilyPtr> myFamilies;
+ std::string myMeshName;
+ std::map<int, DriverMED_FamilyPtr> myFamilies;
};
+
#endif
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_W_SMDS_Mesh.cxx
-// Module : SMESH
-using namespace std;
#include "DriverMED_W_SMDS_Mesh.h"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-
-
-
-
-#include "utilities.h"
-#include <vector>
-
-DriverMED_W_SMDS_Mesh::DriverMED_W_SMDS_Mesh()
-{
- ;
-}
-
-DriverMED_W_SMDS_Mesh::~DriverMED_W_SMDS_Mesh()
-{
- ;
-}
-
-void DriverMED_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverMED_W_SMDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverMED_W_SMDS_Mesh::SetFileId(med_idt aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverMED_W_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverMED_W_SMDS_Mesh::Add()
-{
- ;
-}
-
-void DriverMED_W_SMDS_Mesh::Write()
-{
-
- med_err ret = 0;
- int i, j, k, l;
- int numero;
- char message[200];
- bool ok;
- /* nombre d'objets MED */
- char nom_universel[MED_TAILLE_LNOM + 1];
- med_int long_fichier_en_tete;
- char *fichier_en_tete;
- char version_hdf[10];
- char version_med[10];
- med_int nmaa, mdim, nnoe;
- med_int nmai[MED_NBR_GEOMETRIE_MAILLE], nfac[MED_NBR_GEOMETRIE_FACE];
- med_int nare[MED_NBR_GEOMETRIE_ARETE];
- /* nom du maillage */
- char nommaa[MED_TAILLE_NOM + 1];
- /* noeuds */
- med_float *coo;
- char nomcoo[3 * MED_TAILLE_PNOM + 1];
- char unicoo[3 * MED_TAILLE_PNOM + 1];
- char *nomnoe;
- med_int *numnoe;
- med_int *nufano;
- med_repere rep;
- med_booleen inonoe, inunoe;
- med_mode_switch mode_coo;
- char str[MED_TAILLE_PNOM + 1];
- med_int nbNodes;
- /* elements */
- med_int nsup;
- med_int edim;
- med_int taille;
- med_int elem_id, myId;
- med_int *connectivite;
- char *nomele;
- med_int *numele;
- med_int *nufael;
- med_booleen inoele, inuele;
- med_connectivite typ_con;
- med_geometrie_element typgeo;
- med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] =
- { MED_POINT1, MED_SEG2,
- MED_SEG3, MED_TRIA3,
- MED_TRIA6, MED_QUAD4,
- MED_QUAD8, MED_TETRA4,
- MED_TETRA10, MED_HEXA8,
- MED_HEXA20, MED_PENTA6,
- MED_PENTA15, MED_PYRA5,
- MED_PYRA13
- };
- med_int desmai[MED_NBR_GEOMETRIE_MAILLE] =
- { 0, 2, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 5, 5, 5 };
- med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
- char nommai[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] = { "MED_POINT1",
- "MED_SEG2",
- "MED_SEG3",
- "MED_TRIA3",
- "MED_TRIA6",
- "MED_QUAD4",
- "MED_QUAD8",
- "MED_TETRA4",
- "MED_TETRA10",
- "MED_HEXA8",
- "MED_HEXA20",
- "MED_PENTA6",
- "MED_PENTA15",
- "MED_PYRA5",
- "MED_PYRA13"
- };
- med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] =
- { MED_TRIA3, MED_TRIA6,
- MED_QUAD4, MED_QUAD8
- };
- med_int desfac[MED_NBR_GEOMETRIE_FACE] = { 3, 3, 4, 4 };
- med_int nfaces[MED_NBR_GEOMETRIE_FACE];
- char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM + 1] =
- { "MED_TRIA3", "MED_TRIA6",
- "MED_QUAD4", "MED_QUAD8"
- };
- med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] =
- { MED_SEG2, MED_SEG3 };
- med_int desare[MED_NBR_GEOMETRIE_ARETE] = { 2, 3 };
- med_int naretes[MED_NBR_GEOMETRIE_ARETE];
- char nomare[MED_NBR_GEOMETRIE_ARETE][MED_TAILLE_NOM + 1] =
- { "MED_SEG2", "MED_SEG3" };
- /* familles */
- med_int nfam;
- med_int natt, ngro;
- char *attdes, *gro;
- med_int *attval, *attide;
- char nomfam[MED_TAILLE_NOM + 1];
- med_int numfam;
- char str1[MED_TAILLE_DESC + 1];
- char str2[MED_TAILLE_LNOM + 1];
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN ECRITURE *
- ****************************************************************************/
- /*! char* file2Read = (char*)myFile.c_str();
- * myFileId = MEDouvrir(file2Read,MED_REMP);
- * if (myFileId < 0)
- * {
- * fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
- * exit(EXIT_FAILURE);
- * }
- */
- typ_con = MED_NOD;
- mode_coo = MED_FULL_INTERLACE;
- numero = myMeshId;
-
- /****************************************************************************
- * NOMBRES D'OBJETS MED *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
-
- /* creation du maillage */
- mdim = 3;
- //nommaa = QString("Mesh "+myMeshId).latin1();
- //nommaa = "";
- //plutot recuperer le nom du maillage dans l'etude
- if (ret == 0)
- ret = MEDmaaCr(myFileId, nommaa, mdim);
- printf("%d\n", ret);
-
- /* Combien de noeuds ? */
- nnoe = myMesh->NbNodes();
- //SCRUTE(nnoe);
- /* Combien de mailles, faces ou aretes ? */
- for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- nmailles[i] = 0;
-
- SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- int nb_of_nodes, nb_of_faces;
- nb_of_faces = myMesh->NbFaces();
- //SCRUTE(nb_of_faces);
-
- //med_int elem_Id[MED_NBR_GEOMETRIE_FACE][nb_of_faces];
- vector<int> elem_Id[MED_NBR_GEOMETRIE_MAILLE];
- //typedef vector<int> Integer_vector;
- //vector<Integer_vector> elem_Id;
- //elem_Id.resize(MED_NBR_GEOMETRIE_MAILLE);
-
- while(itFaces->more())
- {
- const SMDS_MeshFace * elem = itFaces->next();
-
- nb_of_nodes = elem->NbNodes();
-
- switch (nb_of_nodes)
- {
- case 3:
- {
- //elem_Id[3][nmailles[3]] = elem->GetID();
- elem_Id[3].push_back(elem->GetID());
- nmailles[3]++;
- break;
- }
- case 4:
- {
- //elem_Id[5][nmailles[5]] = elem->GetID();
- elem_Id[5].push_back(elem->GetID());
- nmailles[5]++;
- break;
- }
- case 6:
- {
- //elem_Id[4][nmailles[4]] = elem->GetID();
- elem_Id[4].push_back(elem->GetID());
- nmailles[4]++;
- break;
- }
- }
-
- }
-
- SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshVolume * elem = itVolumes->next();
-
- nb_of_nodes = elem->NbNodes();
- switch (nb_of_nodes)
- {
- case 8:
- {
- //elem_Id[9][nmailles[9]] = elem->GetID();
- elem_Id[9].push_back(elem->GetID());
- nmailles[9]++;
- break;
- }
- case 4 :
- {
- elem_Id[7].push_back(elem->GetID());
- nmailles[7]++;
- break;
- }
- }
- }
-
- /****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- /* Allocations memoires */
- /* table des coordonnees
- * profil : (dimension * nombre de noeuds ) */
- coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
- /* table des numeros, des numeros de familles des noeuds
- * profil : (nombre de noeuds) */
- numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
- nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
- /* table des noms des noeuds
- * profil : (nnoe*MED_TAILLE_PNOM+1) */
- nomnoe = "";
-
- i = 0;
- SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode * node = itNodes->next();
- coo[i * 3] = node->X();
- coo[i * 3 + 1] = node->Y();
- coo[i * 3 + 2] = node->Z();
- numnoe[i] = node->GetID();
- nufano[i] = 0;
- i++;
- }
-
- /* ecriture des noeuds :
- * - coordonnees
- * - noms (optionnel dans un fichier MED)
- * - numeros (optionnel dans un fichier MED)
- * - numeros des familles */
- ret = MEDnoeudsEcr(myFileId, nommaa, mdim, coo, mode_coo, MED_CART,
- nomcoo, unicoo, nomnoe, MED_FAUX, numnoe, MED_VRAI,
- nufano, nnoe, MED_REMP);
-
- /* liberation memoire */
- free(coo);
- //free(nomnoe);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- //fprintf(Out,"CELLS\n");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- if (ret == 0)
- for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- {
- if (nmailles[i] > 0 && ret == 0)
- {
- MESSAGE(" Start " << typmai[i]);
- /* dimension de la maille */
- edim = typmai[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
-
- taille = nsup + typmai[i] % 100;
- //taille = typmai[i]%100;
-
- /* allocation memoire */
- connectivite = (med_int *) malloc(sizeof(med_int) *
- taille * nmailles[i]);
- nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
- nmailles[i] + 1);
- numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
- nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
- nomele = "";
- nbNodes = typmai[i] % 100;
-
- //penser a mater les (taille-nsup)
- for (j = 0; j < nmailles[i]; j++)
- {
- myId = elem_Id[i][j];
- const SMDS_MeshElement * elem =
- myMesh->FindElement(myId);
- *(numele + j) = myId;
- //elem_id=*(numele+j);
- //fprintf(stdout,"%d \n",myId);
-
- SMDS_ElemIteratorPtr itNode= elem->nodesIterator();
-
- while(itNode->more())
- {
- //*(connectivite+j*(taille-1)+k)=cnx[k];
- *(connectivite + j * (taille - nsup) + k) =
- itNode->next()->GetID();
- //fprintf(stdout,"%d ",*(connectivite+j*(taille-nsup)+k));
- }
- nufael[j] = 0;
- //fprintf(stdout,"\n");
- }
-
- /* ecriture des données */
-
- ret =
- MEDelementsEcr(myFileId, nommaa, mdim, connectivite,
- mode_coo, nomele, MED_FAUX, numele, MED_VRAI, nufael,
- nmailles[i], MED_MAILLE, typmai[i], typ_con, MED_REMP);
-
- if (ret < 0)
- MESSAGE(">> ERREUR : lecture des mailles \n");
-
- /* liberation memoire */
- free(connectivite);
- //free(nomele);
- free(numele);
- free(nufael);
- MESSAGE(" End " << typmai[i]);
- }
- }
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
-
- /*! ret = MEDfermer(myFileId);
- *
- * if (ret != 0)
- * fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
- */
-
-}
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_W_SMDS_Mesh.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERMED_W_SMDS_MESH
#define _INCLUDE_DRIVERMED_W_SMDS_MESH
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Writer.h"
+#include "Driver_SMDS_Mesh.h"
-#include <string>
+class DriverMED_W_SMDS_Mesh: public Driver_SMDS_Mesh
+{};
-extern "C"
-{
-#include <med.h>
-}
-
-class DriverMED_W_SMDS_Mesh:public Mesh_Writer
-{
-
- public:DriverMED_W_SMDS_Mesh();
- ~DriverMED_W_SMDS_Mesh();
-
- void Add();
- void Write();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(med_idt);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- med_idt myFileId;
- int myMeshId;
-
-};
#endif
// File : DriverMED_W_SMESHDS_Document.cxx
// Module : SMESH
-using namespace std;
#include "DriverMED_W_SMESHDS_Document.h"
-#include "DriverMED_W_SMESHDS_Mesh.h"
-#include "utilities.h"
-
-#include <stdio.h>
-
-extern "C"
-{
- Document_Writer *Wmaker()
- {
- return new DriverMED_W_SMESHDS_Document;
- }
-}
-
-DriverMED_W_SMESHDS_Document::DriverMED_W_SMESHDS_Document()
-{
- ;
-}
-
-DriverMED_W_SMESHDS_Document::~DriverMED_W_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverMED_W_SMESHDS_Document::SetFile(string aFile) {
-//myFile = aFile;
-//}
-
-//void DriverMED_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) {
-//myDocument = aDocument;
-//}
-
-void DriverMED_W_SMESHDS_Document::Write()
-{
-
- med_err ret = 0;
- med_idt fid;
- med_int nmaa, numero, nb_of_meshes;
- med_mode_switch mode_coo;
- med_connectivite typ_con;
-
- SCRUTE(myFile);
- SMESHDS_Mesh * myMesh;
-
- /******** Nombre de maillages ********/
- nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
- MESSAGE("nb_of_meshes = " << nb_of_meshes << "\n");
- SCRUTE(nb_of_meshes);
- //nb_of_meshes = 1;
- numero = 0;
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("MED");
-
- //while (numero<nb_of_meshes) {
- //numero++;
- //myMesh = myDocument->GetMesh(numero);
-
- myDocument->InitMeshesIterator();
- if (nb_of_meshes != 0)
- while(myDocument->MoreMesh())
- {
- numero++;
- myMesh = myDocument->NextMesh();
-
- DriverMED_W_SMESHDS_Mesh *myWriter = new DriverMED_W_SMESHDS_Mesh;
-
- myWriter->SetMesh(myMesh);
- myWriter->SetFile(myFile);
- //myWriter->SetFileId(fid);
- myWriter->SetMeshId(numero);
-
- //myWriter->Write();
- myWriter->Add();
- }
-}
-// SMESH DriverMED : driver to read and write 'med' files
-//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : DriverMED_W_SMESHDS_Document.h
-// Module : SMESH
#ifndef _INCLUDE_DRIVERMED_W_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERMED_W_SMESHDS_DOCUMENT
-#include "SMESHDS_Document.hxx"
-#include "Document_Writer.h"
+#include "Driver_Document.h"
-#include <string>
+class DriverMED_W_SMESHDS_Document : public Driver_Document
+{};
-extern "C"
-{
-#include <med.h>
-}
-
-class DriverMED_W_SMESHDS_Document : public Document_Writer {
-
-public :
- DriverMED_W_SMESHDS_Document();
- ~DriverMED_W_SMESHDS_Document();
-
- void Write();
- //void SetFile(string);
- //void SetDocument(Handle(SMESHDS_Document)&);
-
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
-
-};
#endif
// File : DriverMED_W_SMESHDS_Mesh.cxx
// Module : SMESH
+#include <sstream>
+
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverMED_W_SMDS_Mesh.h"
#include "DriverMED_Family.h"
+#include "SMESHDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
#include "MEDA_Wrapper.hxx"
-#include <sstream>
-
#include "MED_Utilities.hxx"
#define _EDF_NODE_IDS_
#define _ELEMENTS_BY_DIM_
-DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh()
- :
- myMesh (NULL),
- myFile (""),
- myFileId (-1),
- myMeshId (-1),
- myAllSubMeshes (false),
- myDoGroupOfNodes (false),
- myDoGroupOfEdges (false),
- myDoGroupOfFaces (false),
- myDoGroupOfVolumes (false)
-{
-}
-
-DriverMED_W_SMESHDS_Mesh::~DriverMED_W_SMESHDS_Mesh()
-{
-}
-
-void DriverMED_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-
-void DriverMED_W_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverMED_W_SMESHDS_Mesh::SetFileId(med_idt aFileId)
-{
- myFileId = aFileId;
-}
+using namespace std;
-void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
+DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
+ myAllSubMeshes (false),
+ myDoGroupOfNodes (false),
+ myDoGroupOfEdges (false),
+ myDoGroupOfFaces (false),
+ myDoGroupOfVolumes (false)
+{}
-void DriverMED_W_SMESHDS_Mesh::SetMeshName(string theMeshName)
+void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
{
myMeshName = theMeshName;
}
myDoGroupOfVolumes = true;
}
-void DriverMED_W_SMESHDS_Mesh::Write()
-{
- string myClass = string("SMDS_Mesh");
- string myExtension = string("MED");
-
- DriverMED_W_SMDS_Mesh *myWriter = new DriverMED_W_SMDS_Mesh;
-
- myWriter->SetMesh(myMesh);
- // myWriter->SetFile(myFile);
- myWriter->SetMeshId(myMeshId);
- myWriter->SetFileId(myFileId);
-
- myWriter->Write();
-}
-
-
typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TName;
typedef const char* TUnit;
return myCurrentNode;
}
MED::TIntVector::value_type GetID(){
- myCurrentNode->GetID();
+ return myCurrentNode->GetID();
}
MED::TFloatVector::value_type GetCoord(med_int theCoodId){
return (myCurrentNode->*myGetCoord[theCoodId])();
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
-void DriverMED_W_SMESHDS_Mesh::Add()
+Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
{
+ Status aResult = DRS_OK;
if (myMesh->hasConstructionEdges() || myMesh->hasConstructionFaces()) {
INFOS("SMDS_MESH with hasConstructionEdges() or hasConstructionFaces() do not supports!!!");
- return;
+ return DRS_FAIL;
}
try{
using namespace MEDA;
using namespace boost;
- MESSAGE("Add - myFile : "<<myFile);
+ MESSAGE("Perform - myFile : "<<myFile);
TWrapper aMed(myFile);
// Creating the MED mesh for corresponding SMDS structure
if (myDoGroupOfVolumes)
myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY;
- MESSAGE("Add - aFamilyInfo");
+ MESSAGE("Perform - aFamilyInfo");
map<const SMDS_MeshElement *, int> anElemFamMap;
list<DriverMED_FamilyPtr> aFamilies;
if (myAllSubMeshes) {
- SMESHDS_Mesh* aSMESHDSMesh = dynamic_cast<SMESHDS_Mesh*>(myMesh);
- if (!aSMESHDSMesh) {
- EXCEPTION(runtime_error,"Can not cast SMDS_Mesh to SMESHDS_Mesh");
- }
aFamilies = DriverMED_Family::MakeFamilies
- (aSMESHDSMesh->SubMeshes(), myGroups,
+ (myMesh->SubMeshes(), myGroups,
myDoGroupOfNodes, myDoGroupOfEdges, myDoGroupOfFaces, myDoGroupOfVolumes);
} else {
aFamilies = DriverMED_Family::MakeFamilies
aCoordUnits,
aFamilyNums,
anElemNums);
- MESSAGE("Add - aNodeInfo->GetNbElem() = "<<aNbElems);
+ MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
aMed.SetNodeInfo(aNodeInfo);
aTriaConn,
aTriaFamilyNums,
anTriaElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TRIA3<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TRIA3<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
if(med_int aNbElems = aQuadElemNums.size()){
aQuadConn,
aQuadFamilyNums,
aQuadElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_QUAD4<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_QUAD4<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
}
aTetraConn,
aTetraFamilyNums,
anTetraElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TETRA4<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TETRA4<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
if(med_int aNbElems = anPyraElemNums.size()){
aPyraConn,
aPyraFamilyNums,
anPyraElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PYRA5<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PYRA5<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
if(med_int aNbElems = anPentaElemNums.size()){
aPentaConn,
aPentaFamilyNums,
anPentaElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PENTA6<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PENTA6<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
if(med_int aNbElems = aHexaElemNums.size()){
aHexaConn,
aHexaFamilyNums,
aHexaElemNums);
- MESSAGE("Add - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_HEXA8<<"; aNbElems = "<<aNbElems);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_HEXA8<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo);
}
}
myMeshId = -1;
myGroups.clear();
mySubMeshes.clear();
+ return aResult;
}
#ifndef _INCLUDE_DRIVERMED_W_SMESHDS_MESH
#define _INCLUDE_DRIVERMED_W_SMESHDS_MESH
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Writer.h"
+#include "Driver_SMESHDS_Mesh.h"
#include <string>
#include <list>
#include <map>
-extern "C"
-{
-#include <med.h>
-}
-
-using namespace std;
-
+class SMESHDS_Mesh;
class SMESHDS_Group;
class SMESHDS_SubMesh;
-class DriverMED_W_SMESHDS_Mesh:public Mesh_Writer
+class DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
{
public:
DriverMED_W_SMESHDS_Mesh();
- ~DriverMED_W_SMESHDS_Mesh();
/*! sets file name; only for usage with Add(), not Write()
*/
- void SetFile(string);
void AddGroupOfNodes();
void AddGroupOfEdges();
void AddGroupOfFaces();
/*! functions to prepare adding one mesh
*/
- void SetMesh(SMDS_Mesh * aMesh);
- void SetMeshId(int);
- void SetMeshName(string theMeshName);
+ void SetMeshName(const std::string& theMeshName);
void AddGroup(SMESHDS_Group* theGroup);
void AddAllSubMeshes();
void AddSubMesh(SMESHDS_SubMesh* theSubMesh, int theID);
/*! add one mesh
*/
- void Add();
-
- /*! functions to write via DriverMED_W_SMDS_Mesh (no groups)
- */
- void SetFileId(med_idt);
- void Write();
+ virtual Status Perform();
private:
- SMDS_Mesh * myMesh;
- string myFile;
- med_idt myFileId;
- int myMeshId;
- string myMeshName;
- list<SMESHDS_Group*> myGroups;
+ std::string myMeshName;
+ std::list<SMESHDS_Group*> myGroups;
bool myAllSubMeshes;
- map<int,SMESHDS_SubMesh*> mySubMeshes;
+ std::map<int,SMESHDS_SubMesh*> mySubMeshes;
bool myDoGroupOfNodes;
bool myDoGroupOfEdges;
bool myDoGroupOfFaces;
bool myDoGroupOfVolumes;
};
+
+
#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "DriverMED_R_SMESHDS_Mesh.h"
+#include "DriverMED_W_SMESHDS_Mesh.h"
+
+int main(int argc, char** argv)
+{
+ DriverMED_R_SMESHDS_Mesh aR;
+ DriverMED_W_SMESHDS_Mesh aW;
+ return 1;
+}
DriverMED_W_SMESHDS_Mesh.cxx \
DriverMED_Family.cxx
+# Executables targets
+BIN = MED_Test
+
LIB_CLIENT_IDL =
+
LIB_SERVER_IDL =
# additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(MED2_LIBS) -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
+LDFLAGS += -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
-%_moc.cxx: %.h
- $(MOC) $< -o $@
+LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <stdio.h>
+
+#include "DriverSTL_R_SMDS_Mesh.h"
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include <gp_Pnt.hxx>
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_FromWhere.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_SingleProtection.hxx>
+#include <NCollection_DataMap.hxx>
+#include <Standard_NoMoreObject.hxx>
+
+#include "utilities.h"
+
+static const int HEADER_SIZE = 84;
+static const int SIZEOF_STL_FACET = 50;
+//static const int STL_MIN_FILE_SIZE = 284;
+static const int ASCII_LINES_PER_FACET = 7;
+
+static Standard_Real tab1[3];
+static Standard_Real tab2[3];
+
+typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr;
+//typedef NCollection_BaseCollection<SMDS_MeshNodePtr> DriverSTL_ColOfNodePtr;
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+inline Standard_Integer HashCode
+ (const gp_Pnt& point, const Standard_Integer Upper)
+{
+ union
+ {
+ Standard_Real R[3];
+ Standard_Integer I[6];
+ } U;
+
+ point.Coord(U.R[0],U.R[1],U.R[2]);
+
+ return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose :
+//=======================================================================
+inline Standard_Boolean IsEqual
+ (const gp_Pnt& point1, const gp_Pnt& point2)
+{
+ point1.Coord(tab1[0],tab1[1],tab1[2]);
+ point2.Coord(tab2[0],tab2[1],tab2[2]);
+ return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
+}
+
+//=======================================================================
+//function : DriverSTL_R_SMDS_Mesh
+//purpose :
+//=======================================================================
+
+DriverSTL_R_SMDS_Mesh::DriverSTL_R_SMDS_Mesh()
+{
+ myIsCreateFaces = true;
+ myIsAscii = Standard_True;
+}
+
+//=======================================================================
+//function : SetIsCreateFaces
+//purpose :
+//=======================================================================
+
+void DriverSTL_R_SMDS_Mesh::SetIsCreateFaces( const bool theIsCreate )
+{ myIsCreateFaces = theIsCreate; }
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+
+Driver_Mesh::Status DriverSTL_R_SMDS_Mesh::Perform()
+{
+ Status aResult = DRS_OK;
+
+ TCollection_AsciiString aFileName( (char *)myFile.c_str() );
+ if ( aFileName.IsEmpty() ) {
+ fprintf(stderr, ">> ERREOR : invalid file name \n");
+ return DRS_FAIL;
+ }
+
+ filebuf fic;
+ Standard_IStream is(&fic);
+ if (!fic.open(aFileName.ToCString(),ios::in)) {
+ fprintf(stderr, ">> ERROR : cannot open file %s \n", aFileName.ToCString());
+ return DRS_FAIL;
+ }
+
+
+ OSD_Path aPath( aFileName );
+ OSD_File file = OSD_File( aPath );
+ file.Open(OSD_ReadOnly,OSD_Protection(OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWD));
+ unsigned char str[128];
+ Standard_Integer lread,i;
+ Standard_Address ach;
+ ach = (Standard_Address)str;
+ // we skip the header which is in Ascii for both modes
+ file.Read(ach,HEADER_SIZE,lread);
+
+ // we read 128 characters to detect if we have a non-ascii char
+ file.Read(ach,sizeof(str),lread);
+
+ myIsAscii = Standard_True;
+ for (i = 0; i < lread; ++i) {
+ if (str[i] > '~') {
+ myIsAscii = Standard_False;
+ break;
+ }
+ }
+
+ file.Close();
+
+ if ( !myMesh ) {
+ fprintf(stderr, ">> ERREOR : cannot create mesh \n");
+ return DRS_FAIL;
+ }
+
+ if ( myIsAscii )
+ aResult = readAscii();
+ else
+ aResult = readBinary();
+
+ return aResult;
+}
+
+// static methods
+
+static Standard_Real readFloat(OSD_File& theFile)
+{
+ union {
+ Standard_Boolean i;
+ Standard_ShortReal f;
+ }u;
+
+ char c[4];
+ Standard_Address adr;
+ adr = (Standard_Address)c;
+ Standard_Integer lread;
+ theFile.Read(adr,4,lread);
+ u.i = c[0] & 0xFF;
+ u.i |= (c[1] & 0xFF) << 0x08;
+ u.i |= (c[2] & 0xFF) << 0x10;
+ u.i |= (c[3] & 0xFF) << 0x18;
+
+ return u.f;
+}
+
+static SMDS_MeshNode* addNode(const gp_Pnt& P,
+ DriverSTL_DataMapOfPntNodePtr& uniqnodes,
+ SMDS_Mesh* theMesh)
+{
+ SMDS_MeshNode* node = 0;
+ if ( uniqnodes.IsBound(P) ) {
+ node = uniqnodes.Find(P);
+ } else {
+ node = theMesh->AddNode(P.X(), P.Y(), P.Z() );
+ uniqnodes.Bind(P,node);
+ }
+
+ return node;
+}
+
+static SMDS_MeshNode* readNode(FILE* file,
+ DriverSTL_DataMapOfPntNodePtr& uniqnodes,
+ SMDS_Mesh* theMesh)
+{
+ Standard_ShortReal coord[3];
+ // reading vertex
+ fscanf(file,"%*s %f %f %f\n",&coord[0],&coord[1],&coord[2]);
+
+ gp_Pnt P(coord[0],coord[1],coord[2]);
+ return addNode( P, uniqnodes, theMesh );
+}
+
+static SMDS_MeshNode* readNode(OSD_File& theFile,
+ DriverSTL_DataMapOfPntNodePtr& uniqnodes,
+ SMDS_Mesh* theMesh)
+{
+ Standard_ShortReal coord[3];
+ coord[0] = readFloat(theFile);
+ coord[1] = readFloat(theFile);
+ coord[2] = readFloat(theFile);
+
+ gp_Pnt P(coord[0],coord[1],coord[2]);
+ return addNode( P, uniqnodes, theMesh );
+}
+
+//=======================================================================
+//function : readAscii
+//purpose :
+//=======================================================================
+
+Driver_Mesh::Status DriverSTL_R_SMDS_Mesh::readAscii() const
+{
+ Status aResult = DRS_OK;
+ long ipos;
+ Standard_Integer nbLines = 0;
+
+ // Open the file
+ TCollection_AsciiString aFileName( (char *)myFile.c_str() );
+ FILE* file = fopen(aFileName.ToCString(),"r");
+ fseek(file,0L,SEEK_END);
+ // get the file size
+ long filesize = ftell(file);
+ fclose(file);
+ file = fopen(aFileName.ToCString(),"r");
+
+ // count the number of lines
+ for (ipos = 0; ipos < filesize; ++ipos) {
+ if (getc(file) == '\n')
+ nbLines++;
+ }
+
+ // go back to the beginning of the file
+// fclose(file);
+// file = fopen(aFileName.ToCString(),"r");
+ rewind(file);
+
+ Standard_Integer nbTri = (nbLines / ASCII_LINES_PER_FACET);
+
+ DriverSTL_DataMapOfPntNodePtr uniqnodes;
+ // skip header
+ while (getc(file) != '\n');
+
+ // main reading
+ for (Standard_Integer iTri = 0; iTri < nbTri; ++iTri) {
+
+ // skipping the facet normal
+ Standard_ShortReal normal[3];
+ fscanf(file,"%*s %*s %f %f %f\n",&normal[0],&normal[1],&normal[2]);
+
+ // skip the keywords "outer loop"
+ fscanf(file,"%*s %*s");
+
+ // reading nodes
+ SMDS_MeshNode* node1 = readNode( file, uniqnodes, myMesh );
+ SMDS_MeshNode* node2 = readNode( file, uniqnodes, myMesh );
+ SMDS_MeshNode* node3 = readNode( file, uniqnodes, myMesh );
+
+ if (myIsCreateFaces)
+ myMesh->AddFace(node1,node2,node3);
+
+ // skip the keywords "endloop"
+ fscanf(file,"%*s");
+
+ // skip the keywords "endfacet"
+ fscanf(file,"%*s");
+ }
+
+ fclose(file);
+ return aResult;
+}
+
+//=======================================================================
+//function : readBinary
+//purpose :
+//=======================================================================
+
+Driver_Mesh::Status DriverSTL_R_SMDS_Mesh::readBinary() const
+{
+ Status aResult = DRS_OK;
+
+ char buftest[5];
+ Standard_Address adr;
+ adr = (Standard_Address)buftest;
+
+ TCollection_AsciiString aFileName( (char *)myFile.c_str() );
+ OSD_File aFile = OSD_File(OSD_Path( aFileName ));
+ aFile.Open(OSD_ReadOnly,OSD_Protection(OSD_RWD,OSD_RWD,OSD_RWD,OSD_RWD));
+
+ // the size of the file (minus the header size)
+ // must be a multiple of SIZEOF_STL_FACET
+
+ // compute file size
+ Standard_Integer filesize = aFile.Size();
+
+ if ( (filesize - HEADER_SIZE) % SIZEOF_STL_FACET !=0
+ // Commented to allow reading small files (ex: 1 face)
+ /*|| (filesize < STL_MIN_FILE_SIZE)*/) {
+ Standard_NoMoreObject::Raise("DriverSTL_R_SMDS_MESH::readBinary (wrong file size)");
+ }
+
+ // don't trust the number of triangles which is coded in the file
+ // sometimes it is wrong, and with this technique we don't need to swap endians for integer
+ Standard_Integer nbTri = ((filesize - HEADER_SIZE) / SIZEOF_STL_FACET);
+
+ // skip the header
+ aFile.Seek(HEADER_SIZE,OSD_FromBeginning);
+
+ DriverSTL_DataMapOfPntNodePtr uniqnodes;
+ Standard_Integer lread;
+
+ for (Standard_Integer iTri = 0; iTri < nbTri; ++iTri) {
+
+ // ignore normals
+ readFloat(aFile);
+ readFloat(aFile);
+ readFloat(aFile);
+
+ // read vertices
+ SMDS_MeshNode* node1 = readNode( aFile, uniqnodes, myMesh );
+ SMDS_MeshNode* node2 = readNode( aFile, uniqnodes, myMesh );
+ SMDS_MeshNode* node3 = readNode( aFile, uniqnodes, myMesh );
+
+ if (myIsCreateFaces)
+ myMesh->AddFace(node1,node2,node3);
+
+ // skip extra bytes
+ aFile.Read(adr,2,lread);
+ }
+ aFile.Close();
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _INCLUDE_DRIVERSTL_R_SMDS_MESH
+#define _INCLUDE_DRIVERSTL_R_SMDS_MESH
+
+#include "Driver_SMDS_Mesh.h"
+
+#include <Standard_TypeDef.hxx>
+
+class DriverSTL_R_SMDS_Mesh: public Driver_SMDS_Mesh
+{
+ public:
+ DriverSTL_R_SMDS_Mesh();
+ virtual Status Perform();
+ void SetIsCreateFaces( const bool theIsCreate = true );
+
+ private:
+ // PRIVATE METHODS
+ Status readAscii() const;
+ Status readBinary() const;
+
+ private:
+ // PRIVATE FIELDS
+ bool myIsCreateFaces;
+ bool myIsAscii;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <stdio.h>
+
+#include "DriverSTL_W_SMDS_Mesh.h"
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include <gp_XYZ.hxx>
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+#include <OSD_FromWhere.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_SingleProtection.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColgp_Array1OfXYZ.hxx>
+
+#include "utilities.h"
+
+//using namespace std;
+
+// definition des constantes
+static const int LABEL_SIZE = 80;
+
+DriverSTL_W_SMDS_Mesh::DriverSTL_W_SMDS_Mesh()
+{
+ myIsAscii = false;
+}
+
+void DriverSTL_W_SMDS_Mesh::SetIsAscii( const bool theIsAscii )
+{
+ myIsAscii = theIsAscii;
+}
+
+Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::Perform()
+{
+ Status aResult = DRS_OK;
+
+ if ( !myMesh ) {
+ fprintf(stderr, ">> ERROR : Mesh is null \n");
+ return DRS_FAIL;
+ }
+ if ( myIsAscii )
+ aResult = writeAscii();
+ else
+ aResult = writeBinary();
+
+ return aResult;
+}
+
+// static methods
+
+static void writeInteger( const Standard_Integer& theVal,
+ OSD_File& ofile )
+{
+ union {
+ Standard_Integer i;
+ char c[4];
+ }u;
+
+ u.i = theVal;
+
+ Standard_Integer entier;
+ entier = u.c[0] & 0xFF;
+ entier |= (u.c[1] & 0xFF) << 0x08;
+ entier |= (u.c[2] & 0xFF) << 0x10;
+ entier |= (u.c[3] & 0xFF) << 0x18;
+
+ ofile.Write((char *)&entier,sizeof(u.c));
+}
+
+static void writeFloat ( const Standard_ShortReal& theVal,
+ OSD_File& ofile)
+{
+ union {
+ Standard_ShortReal f;
+ char c[4];
+ }u;
+
+ u.f = theVal;
+
+ Standard_Integer entier;
+
+ entier = u.c[0] & 0xFF;
+ entier |= (u.c[1] & 0xFF) << 0x08;
+ entier |= (u.c[2] & 0xFF) << 0x10;
+ entier |= (u.c[3] & 0xFF) << 0x18;
+
+ ofile.Write((char *)&entier,sizeof(u.c));
+}
+
+static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
+{
+ gp_XYZ n;
+ int aNbNode = theFace->NbNodes();
+ TColgp_Array1OfXYZ anArrOfXYZ(1,4);
+ gp_XYZ p1, p2, p3, p4;
+ SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
+ int i = 1;
+ for ( ; aNodeItr->more() && i <= 4; i++ )
+ {
+ SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
+ anArrOfXYZ.SetValue(i, gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+ }
+
+ gp_XYZ q1 = anArrOfXYZ.Value(2) - anArrOfXYZ.Value(1);
+ gp_XYZ q2 = anArrOfXYZ.Value(3) - anArrOfXYZ.Value(1);
+ n = q1 ^ q2;
+ if ( aNbNode > 3 )
+ {
+ gp_XYZ q3 = anArrOfXYZ.Value(4) - anArrOfXYZ.Value(1);
+ n += q2 ^ q3;
+ }
+ double len = n.Modulus();
+ if ( len > 0 )
+ n /= len;
+
+ return n;
+}
+
+// private methods
+
+Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
+{
+ Status aResult = DRS_OK;
+ TCollection_AsciiString aFileName( (char *)myFile.c_str() );
+ if ( aFileName.IsEmpty() ) {
+ fprintf(stderr, ">> ERREOR : invalid file name \n");
+ return DRS_FAIL;
+ }
+
+ OSD_File aFile = OSD_File(OSD_Path(aFileName));
+ aFile.Build(OSD_WriteOnly,OSD_Protection());
+ TCollection_AsciiString buf = TCollection_AsciiString ("solid\n");
+ aFile.Write (buf,buf.Length());buf.Clear();
+ char sval[16];
+
+ SMDS_FaceIteratorPtr itFaces = myMesh->facesIterator();
+
+ for (; itFaces->more() ;) {
+ SMDS_MeshFace* aFace = (SMDS_MeshFace*)itFaces->next();
+
+ if (aFace->NbNodes() == 3) {
+ gp_XYZ normale = getNormale( aFace );
+
+ buf += " facet normal ";
+ sprintf (sval,"% 12e",normale.X());
+ buf += sval;
+ buf += " ";
+ sprintf (sval,"% 12e",normale.Y());
+ buf += sval;
+ buf += " ";
+ sprintf (sval,"% 12e",normale.Z());
+ buf += sval;
+ buf += '\n';
+ aFile.Write (buf,buf.Length());buf.Clear();
+ buf += " outer loop\n";
+ aFile.Write (buf,buf.Length());buf.Clear();
+
+ SMDS_ElemIteratorPtr aNodeIter = aFace->nodesIterator();
+ for (; aNodeIter->more(); ) {
+ SMDS_MeshNode* node = (SMDS_MeshNode*)aNodeIter->next();
+ buf += " vertex ";
+ sprintf (sval,"% 12e",node->X());
+ buf += sval;
+ buf += " ";
+ sprintf (sval,"% 12e",node->Y());
+ buf += sval;
+ buf += " ";
+ sprintf (sval,"% 12e",node->Z());
+ buf += sval;
+ buf += '\n';
+ aFile.Write (buf,buf.Length());buf.Clear();
+ }
+ buf += " endloop\n";
+ aFile.Write (buf,buf.Length());buf.Clear();
+ buf += " endfacet\n";
+ aFile.Write (buf,buf.Length());buf.Clear();
+ }
+ }
+ buf += "endsolid\n";
+ aFile.Write (buf,buf.Length());buf.Clear();
+
+ aFile.Close ();
+
+ return aResult;
+}
+
+Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeBinary() const
+{
+ Status aResult = DRS_OK;
+ TCollection_AsciiString aFileName( (char *)myFile.c_str() );
+ if ( aFileName.IsEmpty() ) {
+ fprintf(stderr, ">> ERREOR : invalid filename \n");
+ return DRS_FAIL;
+ }
+
+ OSD_File aFile = OSD_File(OSD_Path(aFileName));
+ aFile.Build(OSD_WriteOnly,OSD_Protection());
+
+ char sval[80];
+ Standard_Integer nbTri = 0;
+ SMDS_FaceIteratorPtr itFaces = myMesh->facesIterator();
+
+ // we first count the number of triangles
+ for (;itFaces->more();) {
+ SMDS_MeshFace* aFace = (SMDS_MeshFace*)itFaces->next();
+ if (aFace->NbNodes() == 3)
+ nbTri++;
+ }
+
+ // write number of triangles
+ unsigned int NBT = nbTri;
+ aFile.Write((Standard_Address)sval,LABEL_SIZE);
+ writeInteger(nbTri,aFile);
+
+ // loop writing nodes. take face iterator again
+ int dum=0;
+ itFaces = myMesh->facesIterator();
+
+ for (;itFaces->more();) {
+ SMDS_MeshFace* aFace = (SMDS_MeshFace*)itFaces->next();
+
+ if (aFace->NbNodes() == 3) {
+ gp_XYZ aNorm = getNormale( aFace );
+ writeFloat(aNorm.X(),aFile);
+ writeFloat(aNorm.Y(),aFile);
+ writeFloat(aNorm.Z(),aFile);
+
+ SMDS_ElemIteratorPtr aNodeIter = aFace->nodesIterator();
+ for (; aNodeIter->more(); ) {
+ SMDS_MeshNode* node = (SMDS_MeshNode*)aNodeIter->next();
+ writeFloat(node->X(),aFile);
+ writeFloat(node->Y(),aFile);
+ writeFloat(node->Z(),aFile);
+ }
+ aFile.Write (&dum,2);
+ }
+ }
+ aFile.Close ();
+
+ return aResult;
+}
--- /dev/null
+// SMESH DriverSTL : driver to read and write 'stl' files
+//
+// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : DriverSTL_W_SMDS_Mesh.h
+// Module : SMESH
+
+#ifndef _INCLUDE_DRIVERSTL_W_SMDS_MESH
+#define _INCLUDE_DRIVERSTL_W_SMDS_MESH
+
+#include "Driver_SMDS_Mesh.h"
+#include <Standard_TypeDef.hxx>
+
+class DriverSTL_W_SMDS_Mesh: public Driver_SMDS_Mesh
+{
+ public:
+
+ DriverSTL_W_SMDS_Mesh();
+ virtual Status Perform();
+ void SetIsAscii( const bool theIsAscii = false );
+
+ private:
+ // PRIVATE METHODS
+ Status writeAscii () const;
+ Status writeBinary () const;
+
+ private:
+ // PRIVATE FIELDS
+ bool myIsAscii;
+};
+
+#endif
--- /dev/null
+# SMESH DriverSTL : driver to read and write 'stl' files
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Marc Tajchman (CEA)
+# Module : SMESH
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= DriverSTL_R_SMDS_Mesh.h DriverSTL_W_SMDS_Mesh.h
+
+# Libraries targets
+LIB = libMeshDriverSTL.la
+LIB_SRC = DriverSTL_R_SMDS_Mesh.cxx DriverSTL_W_SMDS_Mesh.cxx
+
+# Executables targets
+BIN = STL_Test
+
+LIB_CLIENT_IDL =
+
+LIB_SERVER_IDL =
+
+# additionnal information to compil and link file
+CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS += $(OCC_KERNEL_LIBS) -lMeshDriver -lTKSTL
+
+LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace $(OCC_KERNEL_LIBS) -lTKSTL -lTKBO
+
+@CONCLUDE@
+
+
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+//#include "DriverSTL_R_SMDS_Mesh.h"
+#include "DriverSTL_W_SMDS_Mesh.h"
+
+int main(int argc, char** argv)
+{
+// DriverSTL_R_SMDS_Mesh aR;
+ DriverSTL_W_SMDS_Mesh aW;
+ return 1;
+}
-using namespace std;
#include "DriverUNV_R_SMDS_Mesh.h"
+#include "SMDS_Mesh.hxx"
#include "utilities.h"
-DriverUNV_R_SMDS_Mesh::DriverUNV_R_SMDS_Mesh()
-{
- ;
-}
+#include "UNV2411_Structure.hxx"
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
-DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh()
-{
- ;
-}
+using namespace std;
-void DriverUNV_R_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
-void DriverUNV_R_SMDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
-void DriverUNV_R_SMDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-void DriverUNV_R_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
+static const SMDS_MeshNode*
+FindNode(const SMDS_Mesh* theMesh, int theId){
+ const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
+ if(aNode) return aNode;
+ EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
}
-void DriverUNV_R_SMDS_Mesh::Add()
-{
- ;
-}
-void DriverUNV_R_SMDS_Mesh::Read()
+Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
{
-
- int cell = 0, node = 0, n1, n2, n3, n4, n_nodes, nodes[6], blockId, i;
- char *s1, *s2, *s3;
- string str1, str2, str3;
- int i1 = 0;
- bool ok, found_block2411, found_block2412;
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "r");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
+ Status aResult = DRS_OK;
+ std::ifstream in_stream(myFile.c_str());
+ try{
+ {
+ using namespace UNV2411;
+ TDataSet aDataSet2411;
+ UNV2411::Read(in_stream,aDataSet2411);
+ if(MYDEBUG) MESSAGE("Perform - aDataSet2411.size() = "<<aDataSet2411.size());
+ TDataSet::const_iterator anIter = aDataSet2411.begin();
+ for(; anIter != aDataSet2411.end(); anIter++){
+ const TNodeLab& aLabel = anIter->first;
+ const TRecord& aRec = anIter->second;
+ const SMDS_MeshNode* aNode =
+ myMesh->AddNodeWithID(aRec.coord[0],aRec.coord[1],aRec.coord[2],aLabel);
+ }
+ }
+ {
+ using namespace UNV2412;
+ in_stream.seekg(0);
+ TDataSet aDataSet2412;
+ UNV2412::Read(in_stream,aDataSet2412);
+ TDataSet::const_iterator anIter = aDataSet2412.begin();
+ if(MYDEBUG) MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
+ for(; anIter != aDataSet2412.end(); anIter++){
+ SMDS_MeshElement* anElement = NULL;
+ const TElementLab& aLabel = anIter->first;
+ const TRecord& aRec = anIter->second;
+ int aNbNodes = aRec.node_labels.size();
+ if(IsBeam(aRec.fe_descriptor_id)){
+ anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aLabel);
+ }else if(IsFace(aRec.fe_descriptor_id)){
+ switch(aRec.fe_descriptor_id){
+ case 71: // TRI3
+ case 72:
+ case 74:
+
+ case 41: // Plane Stress Linear Triangle - TRI3
+ case 91: // Thin Shell Linear Triangle - TRI3
+
+ case 42: // Plane Stress Quadratic Triangle - TRI6
+ case 92: // Thin Shell Quadratic Triangle - TRI6
+
+ anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aLabel);
+ break;
+
+ case 44: // Plane Stress Linear Quadrilateral - QUAD4
+ case 94: // Thin Shell Linear Quadrilateral - QUAD4
+
+ case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
+ case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
+ anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aRec.node_labels[3],
+ aLabel);
+ break;
+ }
+ }else if(IsVolume(aRec.fe_descriptor_id)){
+ switch(aRec.fe_descriptor_id){
+
+ case 111: // Solid Linear Tetrahedron - TET4
+ case 118: // Solid Quadratic Tetrahedron - TET10
+
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aRec.node_labels[3],
+ aLabel);
+ break;
+
+ case 112: // Solid Linear Prism - PRISM6
+
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[2],
+ aRec.node_labels[1],
+ aRec.node_labels[3],
+ aRec.node_labels[5],
+ aRec.node_labels[4],
+ aLabel);
+ break;
+
+ case 113: // Solid Quadratic Prism - PRISM15
+
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[4],
+ aRec.node_labels[2],
+ aRec.node_labels[9],
+ aRec.node_labels[13],
+ aRec.node_labels[11],
+ aLabel);
+ break;
+
+ case 115: // Solid Linear Brick - HEX8
+
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aRec.node_labels[3],
+ aRec.node_labels[4],
+ aRec.node_labels[5],
+ aRec.node_labels[6],
+ aRec.node_labels[7],
+ aLabel);
+ break;
+
+ case 116: // Solid Quadratic Brick - HEX20
+
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[2],
+ aRec.node_labels[4],
+ aRec.node_labels[6],
+ aRec.node_labels[12],
+ aRec.node_labels[14],
+ aRec.node_labels[16],
+ aRec.node_labels[18],
+ aLabel);
+ break;
+ }
}
-
- s1 = (char *)malloc(sizeof(char) * 100);
- s2 = (char *)malloc(sizeof(char) * 100);
- s3 = (char *)malloc(sizeof(char) * 100);
-
- found_block2411 = false;
- found_block2412 = false;
-
- do
- {
-
- while (i1 == -1)
- {
- fscanf(myFileId, "%d\n", &blockId);
- switch (blockId)
- {
- case 2411:
- {
- MESSAGE("BlockId " << blockId);
- fscanf(myFileId, "%d", &node);
- //MESSAGE("Node "<<node);
- while (node != -1)
- {
- fscanf(myFileId, "%d %d %d\n", &n1, &n2, &n3);
- fscanf(myFileId, "%s %s %s\n", s1, s2, s3);
- str1 = string(s1);
- str2 = string(s2);
- str3 = string(s3);
- if (str1.find("D") != string::npos)
- str1.replace(str1.find("D"), 1, "E");
- if (str2.find("D") != string::npos)
- str2.replace(str2.find("D"), 1, "E");
- if (str3.find("D") != string::npos)
- str3.replace(str3.find("D"), 1, "E");
- ok = myMesh->AddNodeWithID(atof(str1.c_str()),
- atof(str2.c_str()), atof(str3.c_str()), node);
- fscanf(myFileId, "%d", &node);
- }
- i1 = 0;
- found_block2411 = true;
- break;
- }
- case 2412:
- {
- MESSAGE("BlockId " << blockId);
- fscanf(myFileId, "%d", &cell);
- //MESSAGE("Cell "<<cell);
- while (cell != -1)
- {
- fscanf(myFileId, "%d %d %d %d %d\n", &n1, &n2, &n3, &n4,
- &n_nodes);
-
- if ((n1 == 71) || (n1 == 72) || (n1 == 74) || (n1 == 91) ||
- (n1 == 92))
- { //203
- if (n_nodes == 3)
- {
- for (i = 1; i <= n_nodes; i++)
- fscanf(myFileId, "%d", &nodes[i - 1]);
- ok = myMesh->AddFaceWithID(nodes[0], nodes[1],
- nodes[2], cell);
- }
- else if (n_nodes == 6)
- { //206
- for (i = 1; i <= n_nodes; i++)
- fscanf(myFileId, "%d", &nodes[i - 1]);
- ok = myMesh->AddFaceWithID(nodes[0], nodes[2],
- nodes[4], cell);
- }
- }
-
- else if ((n1 == 11) || (n1 == 21) || (n1 == 24) ||
- (n1 == 25))
- { //103
- fgets(s2, 100, myFileId);
- if (n_nodes == 3)
- {
- for (i = 1; i <= n_nodes; i++)
- fscanf(myFileId, "%d", &nodes[i - 1]);
- ok = myMesh->AddEdgeWithID(nodes[0], nodes[1],
- cell);
- //MESSAGE("in 103 "<<cell);
- }
- else if (n_nodes == 2)
- { //102
- for (i = 1; i <= n_nodes; i++)
- fscanf(myFileId, "%d", &nodes[i - 1]);
- ok = myMesh->AddEdgeWithID(nodes[0], nodes[1],
- cell);
- //MESSAGE("in 102 "<<cell);
- }
- }
-
- fscanf(myFileId, "\n");
- fscanf(myFileId, "%d", &cell);
- }
-
- i1 = 0;
- found_block2412 = true;
- break;
- }
- case -1:
- {
- break;
- }
- default:
- MESSAGE("BlockId " << blockId);
- i1 = 0;
- break;
- }
- }
-
- fscanf(myFileId, "%s\n", s1);
- i1 = atoi(s1);
-
- }
- while ((!feof(myFileId)) && ((!found_block2411) || (!found_block2412)));
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- free(s1);
- free(s2);
- free(s3);
- fclose(myFileId);
-
+ if(!anElement)
+ MESSAGE("DriverUNV_R_SMDS_Mesh::Perform - can not add element with ID = "<<aLabel<<" and type = "<<aRec.fe_descriptor_id);
+ }
+ }
+ }catch(const std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ return aResult;
}
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_R_SMDS_MESH
#define _INCLUDE_DRIVERUNV_R_SMDS_MESH
-#include <stdio.h>
+#include "Driver_SMDS_Mesh.h"
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Reader.h"
+class SMDS_Mesh;
-class DriverUNV_R_SMDS_Mesh:public Mesh_Reader
+class DriverUNV_R_SMDS_Mesh: public Driver_SMDS_Mesh
{
-
- public:DriverUNV_R_SMDS_Mesh();
- ~DriverUNV_R_SMDS_Mesh();
-
- void Add();
- void Read();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-
+ public:
+ virtual Status Perform();
};
+
#endif
-using namespace std;
-#include "DriverUNV_R_SMESHDS_Document.h"
-#include "DriverUNV_R_SMESHDS_Mesh.h"
-
-#include "utilities.h"
-
-int getOne()
-{
- printf("in getOne");
- return (1);
-}
-
-extern "C"
-{
- // Document_Reader* maker() {
- DriverUNV_R_SMESHDS_Document *maker()
- {
- fprintf(stdout, "here in maker\n");
- return new DriverUNV_R_SMESHDS_Document;
- }
-}
-
-DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document()
-{
- myFile = string("");
-}
-
-DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverUNV_R_SMESHDS_Document::SetFile(string aFile) {
-//myFile = aFile;
-//}
-
-//void DriverUNV_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) {
-//myDocument = aDoc;
-//}
-
-void DriverUNV_R_SMESHDS_Document::Read()
-{
-
- int myMeshId;
- SCRUTE(myFile);
- //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1);
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- char *file2Read = (char *)myFile.c_str();
- FILE *fid = fopen(file2Read, "r");
- if (fid < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
- /****************************************************************************
- * COMBIEN DE MAILLAGES ? *
- ****************************************************************************/
- int nmaa = 1;
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- fclose(fid);
-
- printf("Nombre de maillages = %d\n", nmaa);
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("UNV");
-
- for (int meshIt = 1; meshIt <= nmaa; meshIt++)
- {
- myMeshId = myDocument->NewMesh();
-
- SMDS_Mesh * myMesh = myDocument->GetMesh(myMeshId);
-
- DriverUNV_R_SMESHDS_Mesh *myReader = new DriverUNV_R_SMESHDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetFile(myFile);
- //myReader->SetFileId(fid);
-
- myReader->Read();
-
- }
-
-}
+#include "DriverUNV_R_SMESHDS_Document.h"
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT
-#include <stdio.h>
-
-#include "SMESHDS_Document.hxx"
-#include "Document_Reader.h"
-
-class DriverUNV_R_SMESHDS_Document : public Document_Reader {
-
-public :
- DriverUNV_R_SMESHDS_Document();
- ~DriverUNV_R_SMESHDS_Document();
-
- void Read();
- //void SetFile(string);
- //void SetDocument(Handle_SMESHDS_Document&);
+#include "Driver_Document.h"
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
+class DriverUNV_R_SMESHDS_Document: public Driver_Document
+{};
-};
#endif
-using namespace std;
-#include "DriverUNV_R_SMESHDS_Mesh.h"
-#include "DriverUNV_R_SMDS_Mesh.h"
-
-#include "utilities.h"
-
-DriverUNV_R_SMESHDS_Mesh::DriverUNV_R_SMESHDS_Mesh()
-{
- ;
-}
-
-DriverUNV_R_SMESHDS_Mesh::~DriverUNV_R_SMESHDS_Mesh()
-{
- ;
-}
-
-void DriverUNV_R_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
- myMesh = aMesh;
-}
-
-void DriverUNV_R_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverUNV_R_SMESHDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-void DriverUNV_R_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverUNV_R_SMESHDS_Mesh::Add()
-{
- ;
-}
-
-void DriverUNV_R_SMESHDS_Mesh::Read()
-{
- string myClass = string("SMDS_Mesh");
- string myExtension = string("UNV");
-
- DriverUNV_R_SMDS_Mesh *myReader = new DriverUNV_R_SMDS_Mesh;
-
- myReader->SetMesh(myMesh);
- myReader->SetFile(myFile);
- //myReader->SetFileId(myFileId);
-
- myReader->Read();
-
-}
+#include "DriverUNV_R_SMESHDS_Mesh.h"
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_MESH
#define _INCLUDE_DRIVERUNV_R_SMESHDS_MESH
-#include <stdio.h>
-
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Reader.h"
-
-class DriverUNV_R_SMESHDS_Mesh:public Mesh_Reader
-{
-
- public:DriverUNV_R_SMESHDS_Mesh();
- ~DriverUNV_R_SMESHDS_Mesh();
-
- void Add();
- void Read();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
+#include "Driver_SMESHDS_Mesh.h"
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
+class DriverUNV_R_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
+{};
-};
#endif
-using namespace std;
-#include "DriverUNV_W_SMDS_Mesh.h"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-
-
-
-
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <algorithm>
-#include <utilities.h>
-
-#define sNODE_UNV_ID " 2411"
-#define sELT_UNV_ID " 2412"
-#define sUNV_SEPARATOR " -1"
-#define sNODE_UNV_DESCR "%10d 1 1 11\n"
-#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n"
-#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n"
-#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n"
-#define sELT_BEAM_DESC2 " 0 1 1\n"
-
-DriverUNV_W_SMDS_Mesh::DriverUNV_W_SMDS_Mesh()
-{
- ;
-}
-
-DriverUNV_W_SMDS_Mesh::~DriverUNV_W_SMDS_Mesh()
-{
- ;
-}
+#include "DriverUNV_W_SMDS_Mesh.h"
-void DriverUNV_W_SMDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- myMesh = aMesh;
-}
+#include "SMDS_Mesh.hxx"
-void DriverUNV_W_SMDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
+#include "utilities.h"
-void DriverUNV_W_SMDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
+#include "UNV2411_Structure.hxx"
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
-void DriverUNV_W_SMDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverUNV_W_SMDS_Mesh::Add()
-{
- ;
-}
+using namespace std;
-void DriverUNV_W_SMDS_Mesh::Write()
+Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
{
-
- int nbNodes, nbCells;
- int i;
-
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "w+");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
+ Status aResult = DRS_OK;
+ std::ofstream out_stream(myFile.c_str());
+ try{
+ {
+ using namespace UNV2411;
+ TDataSet aDataSet2411;
+ // Storing SMDS nodes to the UNV file
+ //-----------------------------------
+ MESSAGE("Perform - myMesh->NbNodes() = "<<myMesh->NbNodes());
+ SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
+ for(; aNodesIter->more();){
+ const SMDS_MeshNode* aNode = aNodesIter->next();
+ TRecord aRec;
+ aRec.coord[0] = aNode->X();
+ aRec.coord[1] = aNode->Y();
+ aRec.coord[2] = aNode->Z();
+ const TNodeLab& aLabel = aNode->GetID();
+ aDataSet2411.insert(TDataSet::value_type(aLabel,aRec));
+ }
+ MESSAGE("Perform - aDataSet2411.size() = "<<aDataSet2411.size());
+ UNV2411::Write(out_stream,aDataSet2411);
+ }
+ {
+ using namespace UNV2412;
+ TDataSet aDataSet2412;
+ // Storing SMDS Edges
+ MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
+ if(myMesh->NbEdges()){
+ SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
+ for(; anIter->more();){
+ const SMDS_MeshEdge* anElem = anIter->next();
+ const TElementLab& aLabel = anElem->GetID();
+ int aNbNodes = anElem->NbNodes();
+ TRecord aRec;
+ aRec.node_labels.reserve(aNbNodes);
+ SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+ for(; aNodesIter->more();){
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ aRec.node_labels.push_back(aNode->GetID());
+ }
+ aRec.fe_descriptor_id = 11;
+ aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
}
- SCRUTE(myMesh);
- /****************************************************************************
- * NOMBRES D'OBJETS *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
-
- /* Combien de noeuds ? */
- nbNodes = myMesh->NbNodes();
-
- /* Combien de mailles, faces ou aretes ? */
- int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
- nb_of_edges = myMesh->NbEdges();
- nb_of_faces = myMesh->NbFaces();
- nb_of_volumes = myMesh->NbVolumes();
- nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
- SCRUTE(nb_of_edges);
- SCRUTE(nb_of_faces);
- SCRUTE(nb_of_volumes);
-
- fprintf(stdout, "%d %d\n", nbNodes, nbCells);
- fprintf(myFileId, "%d %d\n", nbNodes, nbCells);
-
- /****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
- fprintf(myFileId, "%s\n", sNODE_UNV_ID);
-
- SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode * node = itNodes->next();
-
- fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
- fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
- node->Z());
+ MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
+ }
+ MESSAGE("Perform - myMesh->NbFaces() = "<<myMesh->NbFaces());
+ if(myMesh->NbFaces()){
+ SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+ for(; anIter->more();){
+ const SMDS_MeshFace* anElem = anIter->next();
+ const TElementLab& aLabel = anElem->GetID();
+ int aNbNodes = anElem->NbNodes();
+ TRecord aRec;
+ aRec.node_labels.reserve(aNbNodes);
+ SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+ for(; aNodesIter->more();){
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ aRec.node_labels.push_back(aNode->GetID());
+ }
+ switch(aNbNodes){
+ case 3:
+ aRec.fe_descriptor_id = 41;
+ break;
+ case 4:
+ aRec.fe_descriptor_id = 44;
+ break;
+ default:
+ continue;
+ }
+ aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
}
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
- fprintf(myFileId, "%s\n", sELT_UNV_ID);
-
- SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
- while(itEdges->more())
- {
- const SMDS_MeshElement * elem = itEdges->next();
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
-
- switch (elem->NbNodes())
- {
- case 2:
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21,
- elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d\n", itn->next()->GetID(),
- itn->next()->GetID());
- break;
-
- case 3:
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24,
- elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d%10d\n", itn->next()->GetID(),
- itn->next()->GetID(), itn->next()->GetID());
-
- break;
- }
+ MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
+ }
+ MESSAGE("Perform - myMesh->NbVolumes() = "<<myMesh->NbVolumes());
+ if(myMesh->NbVolumes()){
+ SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
+ for(; anIter->more();){
+ const SMDS_MeshVolume* anElem = anIter->next();
+ const TElementLab& aLabel = anElem->GetID();
+ int aNbNodes = anElem->NbNodes();
+ TRecord aRec;
+ aRec.node_labels.reserve(aNbNodes);
+ SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+ for(; aNodesIter->more();){
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ aRec.node_labels.push_back(aNode->GetID());
+ }
+ switch(aNbNodes){
+ case 4:
+ aRec.fe_descriptor_id = 111;
+ break;
+ case 6:
+ aRec.fe_descriptor_id = 112;
+ swap(aRec.node_labels[1],aRec.node_labels[2]);
+ swap(aRec.node_labels[4],aRec.node_labels[5]);
+ break;
+ case 8:
+ aRec.fe_descriptor_id = 115;
+ break;
+ default:
+ continue;
+ }
+ aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
}
-
- SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- while(itFaces->more())
- {
- const SMDS_MeshElement * elem = itFaces->next();
-
- switch (elem->NbNodes())
- {
- case 3:
- // linear triangle
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74,
- elem->NbNodes());
- break;
- case 4:
- // linear quadrilateral
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71,
- elem->NbNodes());
- break;
- case 6:
- // parabolic triangle
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72,
- elem->NbNodes());
- break;
- case 8:
- // parabolic quadrilateral
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75,
- elem->NbNodes());
- break;
- default:
- fprintf(myFileId, "element not registered\n");
- }
-
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
- while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshElement * elem = itVolumes->next();
-
- switch (elem->NbNodes())
- {
- case 4:
- // linear tetrahedron
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111,
- elem->NbNodes());
- break;
- case 6:
- // linear tetrahedron
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112,
- elem->NbNodes());
- break;
- case 8:
- // linear brick
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115,
- elem->NbNodes());
- break;
- }
-
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
- while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
-
- fclose(myFileId);
+ MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
+ }
+ UNV2412::Write(out_stream,aDataSet2412);
+ }
+ }catch(const std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ return aResult;
}
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_W_SMDS_MESH
#define _INCLUDE_DRIVERUNV_W_SMDS_MESH
-#include <stdio.h>
-#include <string>
-
-#include "SMDS_Mesh.hxx"
-#include "Mesh_Writer.h"
+#include "Driver_SMDS_Mesh.h"
-class DriverUNV_W_SMDS_Mesh:public Mesh_Writer
+class DriverUNV_W_SMDS_Mesh: public Driver_SMDS_Mesh
{
+ public:
+ virtual Status Perform();
+};
- public:DriverUNV_W_SMDS_Mesh();
- ~DriverUNV_W_SMDS_Mesh();
-
- void Add();
- void Write();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
-
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
-};
#endif
-using namespace std;
-#include "DriverUNV_W_SMESHDS_Document.h"
-#include "DriverUNV_W_SMESHDS_Mesh.h"
-
-#include "utilities.h"
-
-extern "C"
-{
- Document_Writer *Wmaker()
- {
- return new DriverUNV_W_SMESHDS_Document;
- }
-}
-
-DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document()
-{
- ;
-}
-
-DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document()
-{
- ;
-}
-
-//void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) {
-//myFile = aFile;
-//}
-
-//void DriverUNV_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) {
-//myDocument = aDocument;
-//}
-
-void DriverUNV_W_SMESHDS_Document::Write()
-{
-
- SMESHDS_Mesh * myMesh;
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
- /****************************************************************************
- * OUVERTURE DU FICHIER EN ECRITURE *
- ****************************************************************************/
- char *file2Write = (char *)myFile.c_str();
- FILE *fid = fopen(file2Write, "w+");
- if (fid < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Write);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
-
- fclose(fid);
-
- /******** Nombre de maillages ********/
- int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves
- //nb_of_meshes = 1;
- int numero = 0;
-
- string myClass = string("SMESHDS_Mesh");
- string myExtension = string("UNV");
-
- //while (numero<nb_of_meshes) {
- //numero++;
- //myMesh = myDocument->GetMesh(numero);
- myDocument->InitMeshesIterator();
- while(myDocument->MoreMesh())
- {
- numero++;
- myMesh = myDocument->NextMesh();
-
- DriverUNV_W_SMESHDS_Mesh *myWriter = new DriverUNV_W_SMESHDS_Mesh;
- //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass);
-
- myWriter->SetMesh(myMesh);
- myWriter->SetFile(myFile);
- SCRUTE(myMesh);
- //myWriter->SetFileId(fid);
- myWriter->SetMeshId(numero);
- myWriter->Write();
- }
-
-}
+#include "DriverUNV_W_SMESHDS_Document.h"
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT
#define _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT
-#include <stdio.h>
-#include <string>
-
-#include "SMESHDS_Document.hxx"
-#include "Document_Writer.h"
-
-class DriverUNV_W_SMESHDS_Document : public Document_Writer {
-
-public :
- DriverUNV_W_SMESHDS_Document();
- ~DriverUNV_W_SMESHDS_Document();
-
- void Write();
- //void SetFile(string);
- //void SetDocument(Handle(SMESHDS_Document)&);
+#include "Driver_Document.h"
-private :
- //Handle_SMESHDS_Document myDocument;
- //string myFile;
+class DriverUNV_W_SMESHDS_Document : public Driver_Document
+{};
-};
#endif
-using namespace std;
-#include "DriverUNV_W_SMESHDS_Mesh.h"
-#include "DriverUNV_W_SMDS_Mesh.h"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-
-
-
-
-
-#include "utilities.h"
-
-#define sNODE_UNV_ID " 2411"
-#define sELT_UNV_ID " 2412"
-#define sUNV_SEPARATOR " -1"
-#define sNODE_UNV_DESCR "%10d 1 1 11\n"
-#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n"
-#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n"
-#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n"
-#define sELT_BEAM_DESC2 " 0 1 1\n"
-
-DriverUNV_W_SMESHDS_Mesh::DriverUNV_W_SMESHDS_Mesh()
-{
- ;
-}
-
-DriverUNV_W_SMESHDS_Mesh::~DriverUNV_W_SMESHDS_Mesh()
-{
- ;
-}
-
-void DriverUNV_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
-{
- //myMesh = SMESHDS_Mesh *::DownCast(aMesh);
- myMesh = aMesh;
-}
-
-void DriverUNV_W_SMESHDS_Mesh::SetFile(string aFile)
-{
- myFile = aFile;
-}
-
-void DriverUNV_W_SMESHDS_Mesh::SetFileId(FILE * aFileId)
-{
- myFileId = aFileId;
-}
-
-void DriverUNV_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
-{
- myMeshId = aMeshId;
-}
-
-void DriverUNV_W_SMESHDS_Mesh::Write()
-{
-
- string myClass = string("SMDS_Mesh");
- string myExtension = string("UNV");
-
- DriverUNV_W_SMDS_Mesh *myWriter = new DriverUNV_W_SMDS_Mesh;
-
- myWriter->SetMesh(myMesh);
- myWriter->SetFile(myFile);
- myWriter->SetMeshId(myMeshId);
- //myWriter->SetFileId(myFileId);
-
- myWriter->Write();
-
-}
-
-void DriverUNV_W_SMESHDS_Mesh::Add()
-{
- int nbNodes, nbCells;
- int i;
-
- char *file2Read = (char *)myFile.c_str();
- myFileId = fopen(file2Read, "w+");
- if (myFileId < 0)
- {
- fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * NOMBRES D'OBJETS *
- ****************************************************************************/
- fprintf(stdout, "\n(****************************)\n");
- fprintf(stdout, "(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout, "(****************************)\n");
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
- /* Combien de noeuds ? */
- nbNodes = myMesh->NbNodes();
-
- /* Combien de mailles, faces ou aretes ? */
- int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
- nb_of_edges = myMesh->NbEdges();
- nb_of_faces = myMesh->NbFaces();
- nb_of_volumes = myMesh->NbVolumes();
- nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
-
- fprintf(stdout, "%d %d\n", nbNodes, nbCells);
-//fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
-
- /****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout, "\n(************************)\n");
- fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout, "(************************)\n");
-
-
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
- fprintf(myFileId, "%s\n", sNODE_UNV_ID);
-
- SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more())
- {
- const SMDS_MeshNode * node = itNodes->next();
-
- fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
- fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
- node->Z());
- }
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
- fprintf(myFileId, "%s\n", sELT_UNV_ID);
-
- SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
- while(itEdges->more())
- {
- const SMDS_MeshEdge * elem = itEdges->next();
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
-
- switch (elem->NbNodes())
- {
- case 2:
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21,
- elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d\n", itn->next()->GetID(),
- itn->next()->GetID());
- break;
-
- case 3:
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24,
- elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d%10d\n", itn->next()->GetID(),
- itn->next()->GetID(), itn->next()->GetID());
- break;
- }
- }
-
- SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- while(itFaces->more())
- {
- const SMDS_MeshElement * elem = itFaces->next();
-
- switch (elem->NbNodes())
- {
- case 3:
- // linear triangle
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74,
- elem->NbNodes());
- break;
- case 4:
- // linear quadrilateral
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71,
- elem->NbNodes());
- break;
- case 6:
- // parabolic triangle
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72,
- elem->NbNodes());
- break;
- case 8:
- // parabolic quadrilateral
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75,
- elem->NbNodes());
- break;
- default:
- fprintf(myFileId, "element not registered\n");
- }
-
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
- while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
-
- SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more())
- {
- const SMDS_MeshElement * elem = itVolumes->next();
-
- switch (elem->NbNodes())
- {
- case 4:
- // linear tetrahedron
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111,
- elem->NbNodes());
- break;
- case 6:
- // linear tetrahedron
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112,
- elem->NbNodes());
- break;
- case 8:
- // linear brick
- fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115,
- elem->NbNodes());
- break;
- }
-
- SMDS_ElemIteratorPtr itn=elem->nodesIterator();
- while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
-
- fprintf(myFileId, "\n");
- }
- fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
-
- fclose(myFileId);
-}
+#include "DriverUNV_W_SMESHDS_Mesh.h"
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_MESH
#define _INCLUDE_DRIVERUNV_W_SMESHDS_MESH
-#include <stdio.h>
-#include <string>
-
-#include "SMESHDS_Mesh.hxx"
-#include "Mesh_Writer.h"
-
-class DriverUNV_W_SMESHDS_Mesh:public Mesh_Writer
-{
-
- public:DriverUNV_W_SMESHDS_Mesh();
- ~DriverUNV_W_SMESHDS_Mesh();
-
- void Add();
- void Write();
- void SetMesh(SMDS_Mesh * aMesh);
- void SetFile(string);
-
- void SetFileId(FILE *);
- void SetMeshId(int);
+#include "Driver_SMESHDS_Mesh.h"
- private: SMDS_Mesh * myMesh;
- string myFile;
- FILE *myFileId;
- int myMeshId;
+class DriverUNV_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
+{};
-};
#endif
@COMMENCE@
# header files
-EXPORT_HEADERS= DriverUNV_R_SMDS_Mesh.h DriverUNV_R_SMESHDS_Mesh.h DriverUNV_R_SMESHDS_Document.h \
- DriverUNV_W_SMDS_Mesh.h DriverUNV_W_SMESHDS_Mesh.h DriverUNV_W_SMESHDS_Document.h
+EXPORT_HEADERS= DriverUNV_R_SMDS_Mesh.h \
+ DriverUNV_R_SMESHDS_Mesh.h \
+ DriverUNV_R_SMESHDS_Document.h \
+ DriverUNV_W_SMDS_Mesh.h \
+ DriverUNV_W_SMESHDS_Mesh.h \
+ DriverUNV_W_SMESHDS_Document.h
# Libraries targets
LIB = libMeshDriverUNV.la
DriverUNV_R_SMESHDS_Document.cxx \
DriverUNV_W_SMESHDS_Document.cxx \
DriverUNV_W_SMDS_Mesh.cxx \
- DriverUNV_W_SMESHDS_Mesh.cxx
+ DriverUNV_W_SMESHDS_Mesh.cxx \
+ UNV_Utilities.cxx UNV2411_Structure.cxx UNV2412_Structure.cxx
+
+# Executables targets
+BIN = UNV_Test
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
# additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(MED2_LIBS) -lMeshDriver
+CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS += -lMeshDriver
-%_moc.cxx: %.h
- $(MOC) $< -o $@
+LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
@CONCLUDE@
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <fstream>
+#include <stdio.h>
+
+#include "UNV2411_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+using namespace UNV;
+using namespace UNV2411;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static string _label_dataset = "2411";
+
+UNV2411::TRecord::TRecord():
+ exp_coord_sys_num(0),
+ disp_coord_sys_num(0),
+ color(0)
+{}
+
+void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
+{
+ if(!in_stream.good())
+ EXCEPTION(runtime_error,"ERROR: Input file not good.");
+
+ /*
+ * adjust the \p istream to our
+ * position
+ */
+ if(!beginning_of_dataset(in_stream,_label_dataset))
+ EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
+
+ /**
+ * always 3 coordinates in the UNV file, no matter
+ * which dimensionality libMesh is in
+ */
+ TNodeLab aLabel;
+ std::string num_buf;
+ for(; !in_stream.eof();){
+ in_stream >> aLabel ;
+ if(aLabel == -1){
+ // end of dataset is reached
+ break;
+ }
+
+ TRecord aRec;
+ in_stream>>aRec.exp_coord_sys_num;
+ in_stream>>aRec.disp_coord_sys_num;
+ in_stream>>aRec.color;
+
+ /*
+ * take care of the
+ * floating-point data
+ */
+ for(int d = 0; d < 3; d++){
+ in_stream>>num_buf;
+ aRec.coord[d] = D_to_e(num_buf);
+ }
+
+ theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+ }
+}
+
+
+void UNV2411::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
+{
+ if(!out_stream.good())
+ EXCEPTION(runtime_error,"ERROR: Output file not good.");
+
+ /*
+ * Write beginning of dataset
+ */
+ out_stream<<" -1\n";
+ out_stream<<" "<<_label_dataset<<"\n";
+
+ TDataSet::const_iterator anIter = theDataSet.begin();
+ for(; anIter != theDataSet.end(); anIter++){
+ const TNodeLab& aLabel = anIter->first;
+ const TRecord& aRec = anIter->second;
+ char buf[78];
+ sprintf(buf, "%10d%10d%10d%10d\n",
+ aLabel,
+ aRec.exp_coord_sys_num,
+ aRec.disp_coord_sys_num,
+ aRec.color);
+ out_stream<<buf;
+
+ // the coordinates
+ sprintf(buf, "%25.16E%25.16E%25.16E\n",
+ aRec.coord[0],
+ aRec.coord[1],
+ aRec.coord[2]);
+ out_stream<<buf;
+ }
+
+
+ /*
+ * Write end of dataset
+ */
+ out_stream<<" -1\n";
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef UNV2411_Structure_HeaderFile
+#define UNV2411_Structure_HeaderFile
+
+#include <map>
+#include <fstream>
+
+namespace UNV2411{
+
+ struct TRecord{
+ TRecord();
+ int exp_coord_sys_num; // export coordinate system number
+ int disp_coord_sys_num; // displacement coordinate system number
+ int color; // color
+ double coord[3]; // node coordinates in the part coordinate system
+ };
+
+ typedef int TNodeLab; // type of node label
+ typedef std::map<TNodeLab,TRecord> TDataSet;
+
+ void Read(std::ifstream& in_stream, TDataSet& theDataSet);
+
+ void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <fstream>
+#include <iomanip>
+
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+using namespace UNV;
+using namespace UNV2412;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static string _label_dataset = "2412";
+
+UNV2412::TRecord::TRecord():
+ phys_prop_tab_num(2),
+ mat_prop_tab_num(1),
+ color(7),
+ beam_orientation(0),
+ beam_fore_end(0),
+ beam_aft_end(0)
+{}
+
+void UNV2412::Read(std::ifstream& in_stream, TDataSet& theDataSet)
+{
+ if(!in_stream.good())
+ EXCEPTION(runtime_error,"ERROR: Input file not good.");
+
+ /*
+ * adjust the \p istream to our
+ * position
+ */
+ if(!beginning_of_dataset(in_stream,_label_dataset))
+ EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
+
+ TElementLab aLabel;
+ for(; !in_stream.eof();){
+ in_stream >> aLabel ;
+ if(aLabel == -1){
+ // end of dataset is reached
+ break;
+ }
+
+ int n_nodes;
+ TRecord aRec;
+ in_stream>>aRec.fe_descriptor_id;
+ in_stream>>aRec.phys_prop_tab_num;
+ in_stream>>aRec.mat_prop_tab_num;
+ in_stream>>aRec.color;
+ in_stream>>n_nodes;
+
+ if(IsBeam(aRec.fe_descriptor_id)){
+ in_stream>>aRec.beam_orientation;
+ in_stream>>aRec.beam_fore_end;
+ in_stream>>aRec.beam_aft_end;
+ }
+
+ aRec.node_labels.resize(n_nodes);
+ for(int j=0; j < n_nodes; j++){
+ // read node labels
+ in_stream>>aRec.node_labels[j];
+ }
+
+ theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+ }
+
+}
+
+
+void UNV2412::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
+{
+ if(!out_stream.good())
+ EXCEPTION(runtime_error,"ERROR: Output file not good.");
+
+ /*
+ * Write beginning of dataset
+ */
+ out_stream<<" -1\n";
+ out_stream<<" "<<_label_dataset<<"\n";
+
+ TDataSet::const_iterator anIter = theDataSet.begin();
+ for(; anIter != theDataSet.end(); anIter++){
+ const TElementLab& aLabel = anIter->first;
+ const TRecord& aRec = anIter->second;
+ out_stream<<std::setw(10)<<aLabel; /* element ID */
+ out_stream<<std::setw(10)<<aRec.fe_descriptor_id; /* type of element */
+ out_stream<<std::setw(10)<<aRec.phys_prop_tab_num;
+ out_stream<<std::setw(10)<<aRec.mat_prop_tab_num;
+ out_stream<<std::setw(10)<<aRec.color;
+ out_stream<<std::setw(10)<<aRec.node_labels.size()<<std::endl; /* No. of nodes per element */
+
+ if(IsBeam(aRec.fe_descriptor_id)){
+ out_stream<<std::setw(10)<<aRec.beam_orientation;
+ out_stream<<std::setw(10)<<aRec.beam_fore_end;
+ out_stream<<std::setw(10)<<aRec.beam_aft_end<<std::endl;
+ }
+
+ int n_nodes = aRec.node_labels.size();
+ int iEnd = (n_nodes-1)/8 + 1;
+ for(int i = 0, k = 0; i < iEnd; i++){
+ int jEnd = n_nodes - 8*(i+1);
+ if(jEnd < 0)
+ jEnd = 8 + jEnd;
+ else
+ jEnd = 8;
+ for(int j = 0; j < jEnd ; k++, j++){
+ out_stream<<std::setw(10)<<aRec.node_labels[k];
+ }
+ out_stream<<std::endl;
+ }
+ }
+
+ /*
+ * Write end of dataset
+ */
+ out_stream<<" -1\n";
+}
+
+
+bool UNV2412::IsBeam(int theFeDescriptorId){
+ switch (theFeDescriptorId){
+ case 11:
+ case 21:
+ case 22:
+ case 24:
+ case 25:
+ return true;
+ }
+ return false;
+}
+
+
+bool UNV2412::IsFace(int theFeDescriptorId){
+ switch (theFeDescriptorId){
+
+ case 71: // TRI3
+ case 72:
+ case 74:
+
+ case 41: // Plane Stress Linear Triangle - TRI3
+ case 91: // Thin Shell Linear Triangle - TRI3
+
+ case 42: // Plane Stress Quadratic Triangle - TRI6
+ case 92: // Thin Shell Quadratic Triangle - TRI6
+
+ case 43: // Plane Stress Cubic Triangle
+
+ case 44: // Plane Stress Linear Quadrilateral - QUAD4
+ case 94: // Thin Shell Linear Quadrilateral - QUAD4
+
+ case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
+ case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
+
+ case 46: // Plane Stress Cubic Quadrilateral
+
+ return true;
+ }
+ return false;
+}
+
+
+bool UNV2412::IsVolume(int theFeDescriptorId){
+ //if(!IsBeam(theFeDescriptorId) && !IsFace(theFeDescriptorId))
+ // return true;
+ switch (theFeDescriptorId){
+
+ case 111: // Solid Linear Tetrahedron - TET4
+ case 118: // Solid Quadratic Tetrahedron - TET10
+
+ case 112: // Solid Linear Prism - PRISM6
+ case 113: // Solid Quadratic Prism - PRISM15
+
+ case 115: // Solid Linear Brick - HEX8
+ case 116: // Solid Quadratic Brick - HEX20
+
+ case 117: // Solid Cubic Brick
+ return true;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef UNV2412_Structure_HeaderFile
+#define UNV2412_Structure_HeaderFile
+
+#include <map>
+#include <vector>
+#include <fstream>
+
+
+namespace UNV2412{
+
+ typedef std::vector<int> TNodeLabels; // Nodal connectivities
+
+ struct TRecord{
+ TRecord();
+
+ int fe_descriptor_id; // FE descriptor id
+ int phys_prop_tab_num; // physical property table number
+ int mat_prop_tab_num; // material property table number
+ int color; // color
+ TNodeLabels node_labels; // node labels defining element
+
+ //FOR BEAM ELEMENTS ONLY
+ int beam_orientation; // beam orientation node number
+ int beam_fore_end; // beam fore-end cross section number
+ int beam_aft_end; // beam aft-end cross section number
+ };
+
+ typedef int TElementLab; // type of element label
+ typedef std::map<TElementLab,TRecord> TDataSet;
+
+ void Read(std::ifstream& in_stream, TDataSet& theDataSet);
+
+ void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
+
+ bool IsBeam(int theFeDescriptorId);
+ bool IsFace(int theFeDescriptorId);
+ bool IsVolume(int theFeDescriptorId);
+
+};
+
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "UNV2411_Structure.hxx"
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+#include "DriverUNV_R_SMDS_Mesh.h"
+#include "DriverUNV_W_SMDS_Mesh.h"
+
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+void ReadMed(const char* theFileName){
+ std::ifstream in_stream(theFileName);
+
+ UNV2411::TDataSet aDataSet2411;
+ UNV2411::Read(in_stream,aDataSet2411);
+
+ in_stream.seekg(0);
+ UNV2412::TDataSet aDataSet2412;
+ UNV2412::Read(in_stream,aDataSet2412);
+
+ string aFileName(theFileName);
+ aFileName += "-";
+ std::ofstream out_stream(aFileName.c_str());
+
+ UNV2411::Write(out_stream,aDataSet2411);
+ UNV2412::Write(out_stream,aDataSet2412);
+}
+
+
+int main(int argc, char** argv){
+ DriverUNV_R_SMDS_Mesh aR;
+ DriverUNV_W_SMDS_Mesh aW;
+ try{
+ if(argc > 1){
+ ReadMed(argv[1]);
+ }
+ return 0;
+ }catch(std::exception& exc){
+ MESSAGE("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ MESSAGE("Unknown exception was accured !!!");
+ }
+ return 1;
+}
--- /dev/null
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VISU_DatConvertor.cxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+int UNV::PrefixPrinter::myCounter = 0;
+
+UNV::PrefixPrinter::PrefixPrinter()
+{
+ myCounter++;
+}
+
+UNV::PrefixPrinter::~PrefixPrinter()
+{
+ myCounter--;
+}
+
+string UNV::PrefixPrinter::GetPrefix()
+{
+ if(myCounter)
+ return string(myCounter*2,' ');
+ return "";
+}
--- /dev/null
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VISU_DatConvertor.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef MED_Utilities_HeaderFile
+#define MED_Utilities_HeaderFile
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <stdexcept>
+
+
+namespace UNV{
+ using namespace std;
+
+ class PrefixPrinter{
+ static int myCounter;
+ public:
+ PrefixPrinter();
+ ~PrefixPrinter();
+
+ static string GetPrefix();
+ };
+
+ /**
+ * @returns \p false when error occured, \p true otherwise.
+ * Adjusts the \p in_stream to the beginning of the
+ * dataset \p ds_name.
+ */
+ inline bool beginning_of_dataset(std::istream& in_file, const std::string& ds_name)
+ {
+ assert (in_file.good());
+ assert (!ds_name.empty());
+
+ std::string olds, news;
+
+ while(true){
+ in_file >> olds >> news;
+ /*
+ * a "-1" followed by a number means the beginning of a dataset
+ * stop combing at the end of the file
+ */
+ while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ){
+ olds = news;
+ in_file >> news;
+ }
+ if(in_file.eof())
+ return false;
+ if (news == ds_name)
+ return true;
+ }
+ // should never end up here
+ return false;
+ }
+
+ /**
+ * Method for converting exponential notation
+ * from "D" to "e", for example
+ * \p 3.141592654D+00 \p --> \p 3.141592654e+00
+ * in order to make it readable for C++.
+ */
+ inline double D_to_e(std::string& number)
+ {
+ /* find "D" in string, start looking at
+ * 6th element, to improve speed.
+ * We dont expect a "D" earlier
+ */
+ const int position = number.find("D",6);
+ if(position != std::string::npos){
+ number.replace(position, 1, "e");
+ }
+ return atof (number.c_str());
+ }
+
+};
+
+
+#ifndef MESSAGE
+
+#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl;
+
+#define BEGMSG(msg) std::cout<<UNV::PrefixPrinter::GetPrefix()<<msg
+
+#define ADDMSG(msg) std::cout<<msg
+
+#endif
+
+
+#ifndef EXCEPTION
+
+#define EXCEPTION(TYPE, MSG) {\
+ std::ostringstream aStream;\
+ aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
+ throw TYPE(aStream.str());\
+}
+
+#endif
+
+#endif
#include <iostream>
#include <cmath>
-using namespace std;
template<class T> inline T Abs (const T &a){return a <0 ? -a : a;}
template<class T> inline void Echange (T& a,T& b) {T c=a;a=b;b=c;}
//============
class R2
{
- friend ostream& operator << (ostream& f, const R2 & P)
+ friend std::ostream& operator << (std::ostream& f, const R2 & P)
{ f << P.x << ' ' << P.y ; return f; }
- friend istream& operator >> (istream& f, R2 & P)
+ friend std::istream& operator >> (std::istream& f, R2 & P)
{ f >> P.x >> P.y ; return f; }
- friend ostream& operator << (ostream& f, const R2 * P)
+ friend std::ostream& operator << (std::ostream& f, const R2 * P)
{ f << P->x << ' ' << P->y ; return f; }
- friend istream& operator >> (istream& f, R2 * P)
+ friend std::istream& operator >> (std::istream& f, R2 * P)
{ f >> P->x >> P->y ; return f; }
public:
//============
class R3
{
- friend ostream& operator << (ostream& f, const R3 & P)
+ friend std::ostream& operator << (std::ostream& f, const R3 & P)
{ f << P.x << ' ' << P.y << ' ' << P.z ; return f; }
- friend istream& operator >> (istream& f, R3 & P)
+ friend std::istream& operator >> (std::istream& f, R3 & P)
{ f >> P.x >> P.y >> P.z ; return f; }
- friend ostream& operator << (ostream& f, const R3 * P)
+ friend std::ostream& operator << (std::ostream& f, const R3 * P)
{ f << P->x << ' ' << P->y << ' ' << P->z ; return f; }
- friend istream& operator >> (istream& f, R3 * P)
+ friend std::istream& operator >> (std::istream& f, R3 * P)
{ f >> P->x >> P->y >> P->z ; return f; }
public:
//============
class R4: public R3
{
- friend ostream& operator <<(ostream& f, const R4 & P )
+ friend std::ostream& operator <<(std::ostream& f, const R4 & P )
{ f << P.x << ' ' << P.y << ' ' << P.z << ' ' << P.omega; return f; }
friend istream& operator >>(istream& f, R4 & P)
{ f >> P.x >> P.y >> P.z >> P.omega ; return f; }
- friend ostream& operator <<(ostream& f, const R4 * P )
+ friend std::ostream& operator <<(std::ostream& f, const R4 * P )
{ f << P->x << ' ' << P->y << ' ' << P->z << ' ' << P->omega; return f; }
friend istream& operator >>(istream& f, R4 * P)
{ f >> P->x >> P->y >> P->z >> P->omega ; return f; }
// Module : SMESH
// Author: Alain PERRONNET
-using namespace std;
#include "Rn.h"
#include "aptrte.h"
#include "utilities.h"
+using namespace std;
+
extern "C"
{
R aretemaxface_;
mnpxyd[ns0].x = uvslf[ns0].x;
mnpxyd[ns0].y = uvslf[ns0].y;
mnpxyd[ns0].z = areteideale_( mnpxyd[ns0], direction );
-// cout << "Sommet " << ns0 << ": " << mnpxyd[ns0].x
-// << " " << mnpxyd[ns0].y << " longueur arete=" << mnpxyd[ns0].z << endl;
+// MESSAGE("Sommet " << ns0 << ": " << mnpxyd[ns0].x
+// << " " << mnpxyd[ns0].y << " longueur arete=" << mnpxyd[ns0].z);
//carre de la longueur de l'arete 1 de la ligne fermee n
d = pow( uvslf[ns0+1].x - uvslf[ns0].x, 2 )
mnpxyd[ns].x = uvslf[ns].x;
mnpxyd[ns].y = uvslf[ns].y;
mnpxyd[ns].z = areteideale_( mnpxyd[ns], direction );
-// cout << "Sommet " << ns << ": " << mnpxyd[ns].x
-// << " " << mnpxyd[ns].y << " longueur arete=" << mnpxyd[ns].z << endl;
+// MESSAGE("Sommet " << ns << ": " << mnpxyd[ns].x
+// << " " << mnpxyd[ns].y << " longueur arete=" << mnpxyd[ns].z);
//carre de la longueur de l'arete
d = pow( uvslf[ns2-1].x - uvslf[ns1-1].x, 2)
aremax = sqrt( aremax ); //longueur maximale d'une arete
aretmx = Min( aretmx, aremax ); //pour homogeneiser
- cout << "nutysu=" << nutysu << " aretmx=" << aretmx
- << " arete min=" << aremin << " arete max=" << aremax << endl;
+ MESSAGE("nutysu=" << nutysu << " aretmx=" << aretmx
+ << " arete min=" << aremin << " arete max=" << aremax);
//chainage des aretes frontalieres : la derniere arete frontaliere
mnsoar[ mosoar * noar - mosoar + 5 ] = 0;
deltacpu_( d );
tcpu += d;
- cout << "Temps de l'adaptation et l'homogeneisation de l'arbre-4 des TE="
- << d << " secondes" << endl;
+ MESSAGE("Temps de l'adaptation et l'homogeneisation de l'arbre-4 des TE="
+ << d << " secondes");
if( ierr != 0 )
{
//destruction du tableau auxiliaire et de l'arbre
MESSAGE( "Nombre d'echanges des diagonales de 2 triangles=" << n );
deltacpu_( d );
tcpu += d;
- cout << "Temps de la triangulation Delaunay par echange des diagonales="
- << d << " secondes" << endl;
+ MESSAGE("Temps de la triangulation Delaunay par echange des diagonales="
+ << d << " secondes");
//qualites de la triangulation actuelle
qualitetrte( mnpxyd, mosoar, mxsoar, mnsoar, moartr, mxartr, mnartr,
MESSAGE( "Restauration de " << n << " aretes perdues de la frontiere" );
deltacpu_( d );
tcpu += d;
- cout << "Temps de la recuperation des aretes perdues de la frontiere="
- << d << " secondes" << endl;
+ MESSAGE("Temps de la recuperation des aretes perdues de la frontiere="
+ << d << " secondes");
if( ierr != 0 ) goto ERREUR;
}
}
nbt /= 4; //le nombre final de triangles de la surface
- cout << "Nombre de sommets=" << nbst
- << " Nombre de triangles=" << nbt << endl;
+ MESSAGE("Nombre de sommets=" << nbst
+ << " Nombre de triangles=" << nbt);
deltacpu_( d );
tcpu += d;
{
//un triangle d'aire negative de plus
nbtrianeg++;
- cout << "ATTENTION: le triangle " << nt << " de sommets:"
+ MESSAGE("ATTENTION: le triangle " << nt << " de sommets:"
<< nosotr[0] << " " << nosotr[1] << " " << nosotr[2]
- << " a une aire " << d <<"<=0" << endl;
+ << " a une aire " << d <<"<=0");
}
//aire des triangles actuels
//les affichages
quamoy /= nbtria;
- cout << "Qualite moyenne=" << quamoy
+ MESSAGE("Qualite moyenne=" << quamoy
<< " Qualite minimale=" << quamin
<< " des " << nbtria << " triangles de surface totale="
- << aire << endl;
+ << aire);
if( nbtrianeg>0 )
MESSAGE( "ATTENTION: nombre de triangles d'aire negative=" << nbtrianeg );
@COMMENCE@
SUBDIRS = \
- SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV \
+ SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL \
SMESH SMESH_I OBJECT SMESHFiltersSelection SMESHGUI SMESH_SWIG \
MEFISTO2 StdMeshers StdMeshers_I StdMeshersGUI
@COMMENCE@
-EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h
+EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ActorUtils.h
# Libraries targets
LIB = libSMESHObject.la
-LIB_SRC = SMESH_Object.cxx SMESH_DeviceActor.cxx SMESH_Actor.cxx
+LIB_SRC = SMESH_Object.cxx SMESH_DeviceActor.cxx SMESH_Actor.cxx \
+ SMESH_ExtractGeometry.cxx SMESH_ActorUtils.cxx
LIB_CLIENT_IDL = SALOME_Exception.idl \
SALOME_GenericObj.idl \
SMESH_Mesh.idl \
- SMESH_Filter.idl \
SMESH_Group.idl
CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS) $(QT_INCLUDES)
LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSMDS \
- -lSalomeGUI -lSalomeObject -lOpUtil
+ -lSalomeGUI -lSalomeObject -lSMESHControls
@CONCLUDE@
#include "SMESH_Actor.h"
+#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
#include "SALOME_ExtractUnstructuredGrid.h"
#include "utilities.h"
#include <qstringlist.h>
+#include <vtkTimeStamp.h>
#include <vtkObjectFactory.h>
#include <vtkShrinkPolyData.h>
#include <vtkMergeFilter.h>
+#include <vtkMatrix4x4.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+
+#include <vtkMapper.h>
+#include <vtkRenderer.h>
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+
#include <vtkActor2D.h>
+#include <vtkProperty2D.h>
#include <vtkPolyData.h>
#include <vtkMaskPoints.h>
#include <vtkCellCenters.h>
#include <vtkScalarBarActor.h>
#include <vtkLookupTable.h>
-#include <vtkDoubleArray.h>
+
+#include <vtkMath.h>
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#endif
-using namespace std;
-
-
-inline float GetFloat(const QString& theValue, float theDefault = 0){
- if(theValue.isEmpty()) return theDefault;
- QString aValue = QAD_CONFIG->getSetting(theValue);
- if(aValue.isEmpty()) return theDefault;
- return aValue.toFloat();
-}
+static int aLineWidthInc = 2;
+static int aPointSizeInc = 2;
SMESH_Actor* SMESH_Actor::New(){
SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
- SMESH::FilterManager_ptr theFilterMgr,
const char* theEntry,
const char* theName,
int theIsClear)
{
SMESH_Actor* anActor = SMESH_Actor::New();
- anActor->Init(theVisualObj,theFilterMgr,theEntry,theName,theIsClear);
+ if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
+ anActor->Delete();
+ anActor = NULL;
+ }
return anActor;
}
SMESH_Actor::SMESH_Actor(){
if(MYDEBUG) MESSAGE("SMESH_Actor");
+ myTimeStamp = vtkTimeStamp::New();
+
myIsPointsVisible = false;
myIsShrinkable = false;
myIsShrunk = false;
- float aPointSize = GetFloat("SMESH:SettingsNodesSize",3);
- float aLineWidth = GetFloat("SMESH:SettingsWidth",1);
+ myControlsPrecision = (long)SMESH::GetFloat( "SMESH:ControlsPrecision", -1 );
+
+ float aPointSize = SMESH::GetFloat("SMESH:SettingsNodesSize",3);
+ float aLineWidth = SMESH::GetFloat("SMESH:SettingsWidth",1);
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
SALOME_ExtractUnstructuredGrid* aFilter = NULL;
//-----------------------------------------
float anRGB[3] = {1,1,1};
mySurfaceProp = vtkProperty::New();
- anRGB[0] = GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
- anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
- anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
mySurfaceProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myBackSurfaceProp = vtkProperty::New();
- anRGB[0] = GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
- anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
- anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
myBackSurfaceProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my2DActor = SMESH_DeviceActor::New();
myEdgeProp->SetAmbient(1.0);
myEdgeProp->SetDiffuse(0.0);
myEdgeProp->SetSpecular(0.0);
- anRGB[0] = GetFloat("SMESH:SettingsOutlineColorRed", 0)/255.;
- anRGB[1] = GetFloat("SMESH:SettingsOutlineColorGreen", 170)/255.;
- anRGB[2] = GetFloat("SMESH:SettingsOutlineColorBlue", 255)/255.;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsOutlineColorRed", 0)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsOutlineColorGreen", 170)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsOutlineColorBlue", 255)/255.;
myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myEdgeProp->SetLineWidth(aLineWidth);
my1DActor->SetUserMatrix(aMatrix);
my1DActor->SetStoreMapping(true);
my1DActor->PickableOff();
+ my1DActor->SetHighlited(true);
my1DActor->SetProperty(myEdgeProp);
my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = my1DActor->GetExtractUnstructuredGrid();
my1DProp = vtkProperty::New();
my1DProp->DeepCopy(myEdgeProp);
- static int aCotnrolLineWidth = 3;
- my1DProp->SetLineWidth(aCotnrolLineWidth);
+ my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
my1DProp->SetPointSize(aPointSize);
my1DExtProp = vtkProperty::New();
anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2];
my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- my1DExtProp->SetLineWidth(aCotnrolLineWidth);
+ my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
+ my1DExtProp->SetPointSize(aPointSize + aPointSizeInc);
my1DExtActor = SMESH_DeviceActor::New();
my1DExtActor->SetUserMatrix(aMatrix);
my1DExtActor->SetStoreMapping(true);
my1DExtActor->PickableOff();
+ my1DExtActor->SetHighlited(true);
my1DExtActor->SetVisibility(false);
my1DExtActor->SetProperty(my1DExtProp);
my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
//Definition 0D divice of the actor
//---------------------------------
myNodeProp = vtkProperty::New();
- anRGB[0] = GetFloat("SMESH:SettingsNodeColorRed",255)/255.;
- anRGB[1] = GetFloat("SMESH:SettingsNodeColorGreen",0)/255.;
- anRGB[2] = GetFloat("SMESH:SettingsNodeColorBlue",0)/255.;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsNodeColorRed",255)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsNodeColorGreen",0)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsNodeColorBlue",0)/255.;
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myNodeProp->SetPointSize(aPointSize);
myHighlightProp->SetAmbient(1.0);
myHighlightProp->SetDiffuse(0.0);
myHighlightProp->SetSpecular(0.0);
- anRGB[0] = GetFloat("SMESH:SettingsSelectColorRed", 255)/255.; // 1;
- anRGB[1] = GetFloat("SMESH:SettingsSelectColorGreen", 255)/255.; // 1;
- anRGB[2] = GetFloat("SMESH:SettingsSelectColorBlue", 255)/255.; // 1;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsSelectColorRed", 255)/255.; // 1;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsSelectColorGreen", 255)/255.; // 1;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsSelectColorBlue", 255)/255.; // 1;
myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myHighlightProp->SetPointSize(aPointSize);
myHighlightProp->SetRepresentation(1);
myPreselectProp->SetAmbient(1.0);
myPreselectProp->SetDiffuse(0.0);
myPreselectProp->SetSpecular(0.0);
- anRGB[0] = GetFloat("SMESH:SettingsPreSelectColorRed", 0)/255.; // 0;
- anRGB[1] = GetFloat("SMESH:SettingsPreSelectColorGreen", 255)/255.; // 1;
- anRGB[2] = GetFloat("SMESH:SettingsPreSelectColorBlue", 255)/255.; // 1;
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsPreSelectColorRed", 0)/255.; // 0;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsPreSelectColorGreen", 255)/255.; // 1;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsPreSelectColorBlue", 255)/255.; // 1;
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myPreselectProp->SetPointSize(aPointSize);
myPreselectProp->SetRepresentation(1);
myHighlitableActor->PickableOff();
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
+ myNodeHighlitableActor = SMESH_DeviceActor::New();
+ myNodeHighlitableActor->SetUserMatrix(aMatrix);
+ myNodeHighlitableActor->SetStoreMapping(false);
+ myNodeHighlitableActor->PickableOff();
+ myNodeHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
+ aFilter = myNodeHighlitableActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
+
- SetShrinkFactor(GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.);
+ SetShrinkFactor(SMESH::GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.);
myName = "";
myIO = NULL;
- myDisplayMode = 0;
-
- ishighlighted = false;
- ispreselected = false;
myColorMode = eNone;
my1DColorMode = e1DNone;
myCellsLabels->SetMapper(myClsLabeledDataMapper);
myCellsLabels->GetProperty()->SetColor(0,1,0);
myCellsLabels->SetVisibility(myIsCellsLabeled);
+
+ // Clipping planes
+ myImplicitBoolean = vtkImplicitBoolean::New();
+ myImplicitBoolean->SetOperationTypeToIntersection();
}
myNodeActor->Delete();
myBaseActor->Delete();
+
myHighlitableActor->Delete();
+ myNodeHighlitableActor->Delete();
//Deleting of pints numbering pipeline
myCellCenters->Delete();
myCellsLabels->Delete();
+
+ myImplicitBoolean->Delete();
+
+ myTimeStamp->Delete();
}
void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
{
- myIsPointsLabeled = theIsPointsLabeled;
+ vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
+ myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
if ( myIsPointsLabeled )
{
- myPointsNumDataSet->ShallowCopy( GetUnstructuredGrid() );
+ myPointsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myPointsNumDataSet;
int aNbElem = aDataSet->GetNumberOfPoints();
{
myPointLabels->SetVisibility( false );
}
-
- SetRepresentation( GetRepresentation() );
+ SetRepresentation(GetRepresentation());
+ myTimeStamp->Modified();
}
void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
- myIsCellsLabeled = theIsCellsLabeled;
+ vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
+ myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){
- myCellsNumDataSet->ShallowCopy(GetUnstructuredGrid());
+ myCellsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myCellsNumDataSet;
int aNbElem = aDataSet->GetNumberOfCells();
vtkIntArray *anArray = vtkIntArray::New();
}else{
myCellsLabels->SetVisibility(false);
}
+ myTimeStamp->Modified();
}
bool anIsScalarVisible = theMode > eNone;
if(anIsScalarVisible){
- SMESH::NumericalFunctor_var aFunctor;
- SMESH::Predicate_var aPredicate;
-
+ SMESH::Controls::FunctorPtr aFunctor;
switch(theMode){
case eLengthEdges:
- aFunctor = myFilterMgr->CreateLength();
+ {
+ SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my1DActor;
break;
+ }
case eFreeBorders:
- aPredicate = myFilterMgr->CreateFreeBorders();
+ aFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
break;
+ case eFreeEdges:
+ aFunctor.reset(new SMESH::Controls::FreeEdges());
+ myControlActor = my2DActor;
+ break;
case eMultiConnection:
- aFunctor = myFilterMgr->CreateMultiConnection();
+ aFunctor.reset(new SMESH::Controls::MultiConnection());
myControlActor = my1DActor;
break;
case eArea:
- aFunctor = myFilterMgr->CreateArea();
+ {
+ SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
case eTaper:
- aFunctor = myFilterMgr->CreateTaper();
+ {
+ SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
case eAspectRatio:
- aFunctor = myFilterMgr->CreateAspectRatio();
+ {
+ SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
case eMinimumAngle:
- aFunctor = myFilterMgr->CreateMinimumAngle();
+ {
+ SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
case eWarping:
- aFunctor = myFilterMgr->CreateWarping();
+ {
+ SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
case eSkew:
- aFunctor = myFilterMgr->CreateSkew();
+ {
+ SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
+ }
default:
return;
}
-
+
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
if(aNbCells){
- if(theMode == eFreeBorders){
- if(!aPredicate->_is_nil()){
- myVisualObj->UpdateFunctor(aPredicate);
- SALOME_ExtractUnstructuredGrid* aFilter =
- my1DExtActor->GetExtractUnstructuredGrid();
- aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
- aFilter->ClearRegisteredCells();
- for( vtkIdType i = 0; i < aNbCells; i++ ){
- vtkIdType anObjId = myControlActor->GetElemObjId( i );
- CORBA::Boolean aValue = aPredicate->IsSatisfy(anObjId);
- if(aValue)
- aFilter->RegisterCell(i);
- }
- if(!aFilter->IsCellsRegistered())
- aFilter->RegisterCell(-1);
- aPredicate->Destroy();
- }
- myColorMode = theMode;
+ myColorMode = theMode;
+ if(theMode == eFreeBorders || theMode == eFreeEdges){
my1DColorMode = e1DHighlited;
+ my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
}else{
- myColorMode = theMode;
if(myControlActor == my1DActor)
my1DColorMode = e1DColored;
-
- vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
- aDataSet->ShallowCopy(aGrid);
- myScalarBarActor->SetVisibility(true);
- myControlActor->GetMapper()->SetScalarVisibility(true);
-
- vtkDoubleArray *aScalars = vtkDoubleArray::New();
- aScalars->SetNumberOfComponents( 1 );
- aScalars->SetNumberOfTuples(aNbCells);
-
- if(!aFunctor->_is_nil()){
- myVisualObj->UpdateFunctor(aFunctor);
- for( vtkIdType i = 0; i < aNbCells; i++ ){
- vtkIdType anObjId = myControlActor->GetElemObjId( i );
- CORBA::Double aValue = aFunctor->GetValue(anObjId);
- aScalars->SetValue( i, aValue );
- }
- aFunctor->Destroy();
- }else if(!aPredicate->_is_nil()){
- myVisualObj->UpdateFunctor(aPredicate);
- for( vtkIdType i = 0; i < aNbCells; i++ ){
- vtkIdType anObjId = myControlActor->GetElemObjId( i );
- CORBA::Boolean aValue = aPredicate->IsSatisfy(anObjId);
- aScalars->SetValue( i, aValue );
- }
- aPredicate->Destroy();
- }
- aDataSet->GetCellData()->SetScalars(aScalars);
- aScalars->Delete();
-
- float aRange[2];
- aScalars->GetRange(aRange);
- myLookupTable->SetRange(aRange);
- myLookupTable->Build();
-
- myControlActor->GetMergeFilter()->SetScalars(aDataSet);
- aDataSet->Delete();
- if(MYDEBUGWITHFILES)
- WriteUnstructuredGrid(aDataSet,"/tmp/SetControlMode.vtk");
+ myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
}
}
}
SetRepresentation(GetRepresentation());
-
+
+ myTimeStamp->Modified();
Modified();
}
theRenderer->AddActor(my1DExtActor);
theRenderer->AddActor(myHighlitableActor);
+ theRenderer->AddActor(myNodeHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
theRenderer->RemoveActor(myNodeActor);
theRenderer->RemoveActor(myBaseActor);
+
theRenderer->RemoveActor(myHighlitableActor);
+ theRenderer->RemoveActor(myNodeHighlitableActor);
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
}
-void SMESH_Actor::Init(TVisualObjPtr theVisualObj,
- SMESH::FilterManager_ptr theFilterMgr,
+bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear)
{
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(strdup(theEntry),strdup("MESH"),strdup(theName));
+ Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
setIO(anIO);
- setName(strdup(theName));
+ setName(theName);
myVisualObj = theVisualObj;
myNodeActor->myVisualObj = myVisualObj;
myBaseActor->myVisualObj = myVisualObj;
+
myHighlitableActor->myVisualObj = myVisualObj;
+ myNodeHighlitableActor->myVisualObj = myVisualObj;
my1DActor->myVisualObj = myVisualObj;
my1DExtActor->myVisualObj = myVisualObj;
my3DActor->myVisualObj = myVisualObj;
myVisualObj->Update(theIsClear);
- SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ myNodeActor->Init(myVisualObj,myImplicitBoolean);
+ myBaseActor->Init(myVisualObj,myImplicitBoolean);
+
+ myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
+ myNodeHighlitableActor->Init(myVisualObj,myImplicitBoolean);
+
+ my1DActor->Init(myVisualObj,myImplicitBoolean);
+ my1DExtActor->Init(myVisualObj,myImplicitBoolean);
+
+ my2DActor->Init(myVisualObj,myImplicitBoolean);
+ my3DActor->Init(myVisualObj,myImplicitBoolean);
- myFilterMgr = SMESH::FilterManager::_duplicate(theFilterMgr);
+ my1DActor->GetMapper()->SetLookupTable(myLookupTable);
+ my2DActor->GetMapper()->SetLookupTable(myLookupTable);
+ my3DActor->GetMapper()->SetLookupTable(myLookupTable);
+
+ float aFactor, aUnits;
+ my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
+ my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
+ //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
+ SetIsShrunkable(true);
+
QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
SetRepresentation(-1);
if(aMode.compare("Wireframe") == 0){
SetShrink();
}
+ myTimeStamp->Modified();
Modified();
+ return true;
}
-vtkPolyData* SMESH_Actor::GetPolyDataInput(){
- return myPickableActor->GetPolyDataInput();
+float* SMESH_Actor::GetBounds(){
+ return myNodeActor->GetBounds();
+}
+
+
+vtkDataSet* SMESH_Actor::GetInput(){
+ return GetUnstructuredGrid();
}
void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
myNodeActor->SetTransform(theTransform);
myBaseActor->SetTransform(theTransform);
+
myHighlitableActor->SetTransform(theTransform);
+ myNodeHighlitableActor->SetTransform(theTransform);
my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform);
}
-void SMESH_Actor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
- if(theGrid){
- myNodeActor->SetUnstructuredGrid(theGrid);
- myBaseActor->SetUnstructuredGrid(theGrid);
- myHighlitableActor->SetUnstructuredGrid(theGrid);
-
- my1DActor->SetUnstructuredGrid(theGrid);
- my1DExtActor->SetUnstructuredGrid(theGrid);
-
- my2DActor->SetUnstructuredGrid(theGrid);
- my3DActor->SetUnstructuredGrid(theGrid);
-
- my1DActor->GetMapper()->SetLookupTable(myLookupTable);
- my2DActor->GetMapper()->SetLookupTable(myLookupTable);
- my3DActor->GetMapper()->SetLookupTable(myLookupTable);
-
- float aFactor, aUnits;
- my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
- my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
-
- //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
- SetIsShrunkable(true);
-
- Modified();
- }
-}
-
-
void SMESH_Actor::SetMapper(vtkMapper* theMapper){
vtkLODActor::SetMapper(theMapper);
}
bool SMESH_Actor::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
- myIsInfinite = aDataSet->GetNumberOfCells() == 0;
+ myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
+ aDataSet->GetNumberOfCells() == 1 &&
+ aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX;
return SALOME_Actor::IsInfinitive();
}
}
-int SMESH_Actor::GetObjId(int theVtkID){
- if (GetRepresentation() == 0){
- return GetNodeObjId(theVtkID);
- }else{
- return GetElemObjId(theVtkID);
- }
-}
-
-SALOME_Actor::TVectorId SMESH_Actor::GetVtkId(int theObjID){
- if (GetRepresentation() == 0){
- return GetNodeVtkId(theObjID);
- }else{
- return GetElemVtkId(theObjID);
- }
-}
-
-
int SMESH_Actor::GetNodeObjId(int theVtkID){
return myPickableActor->GetNodeObjId(theVtkID);
}
-SALOME_Actor::TVectorId SMESH_Actor::GetNodeVtkId(int theObjID){
- return myPickableActor->GetNodeVtkId(theObjID);
+float* SMESH_Actor::GetNodeCoord(int theObjID){
+ return myPickableActor->GetNodeCoord(theObjID);
}
return myPickableActor->GetElemObjId(theVtkID);
}
-SALOME_Actor::TVectorId SMESH_Actor::GetElemVtkId(int theObjID){
- return myPickableActor->GetElemVtkId(theObjID);
+vtkCell* SMESH_Actor::GetElemCell(int theObjID){
+ return myPickableActor->GetElemCell(theObjID);
}
void SMESH_Actor::SetVisibility(int theMode){
+ SetVisibility(theMode,true);
+}
+
+
+void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){
SALOME_Actor::SetVisibility(theMode);
if(GetVisibility()){
- SetRepresentation(GetRepresentation());
+ if(theIsUpdateRepersentation)
+ SetRepresentation(GetRepresentation());
if(myColorMode != eNone){
if(my1DColorMode == e1DHighlited)
switch(myRepresentation){
case ePoint:
myPickableActor = myNodeActor;
+ myNodeActor->SetVisibility(true);
+
aProp = aBackProp = myNodeProp;
aReperesent = SMESH_DeviceActor::ePoint;
break;
my1DActor->SetProperty(aProp);
my1DActor->SetBackfaceProperty(aBackProp);
my1DActor->SetRepresentation(aReperesent);
+
+ my1DExtActor->SetRepresentation(aReperesent);
- if ( GetPointRepresentation() || !GetUnstructuredGrid()->GetNumberOfCells() || myIsPointsLabeled )
- {
+ if(myIsPointsVisible)
myPickableActor = myNodeActor;
+
+ if(GetPointRepresentation())
myNodeActor->SetVisibility(true);
- }
SetMapper(myPickableActor->GetMapper());
+ SetVisibility(GetVisibility(),false);
+
Modified();
}
-void SMESH_Actor::SetPointRepresentation(int theIsPointsVisible){
+void SMESH_Actor::SetPointRepresentation(bool theIsPointsVisible){
myIsPointsVisible = theIsPointsVisible;
SetRepresentation(GetRepresentation());
}
+bool SMESH_Actor::GetPointRepresentation(){
+ return myIsPointsVisible || myIsPointsLabeled;
+}
+
void SMESH_Actor::UpdateHighlight(){
myHighlitableActor->SetVisibility(false);
- myNodeActor->SetProperty(myNodeProp);
- if(myPickableActor != myNodeActor)
- myNodeActor->SetVisibility(false);
+ myHighlitableActor->SetHighlited(false);
+
+ myNodeHighlitableActor->SetVisibility(false);
+ myNodeHighlitableActor->SetHighlited(false);
- if(ishighlighted){
+ if(myIsHighlighted){
myHighlitableActor->SetProperty(myHighlightProp);
- }else if(ispreselected){
+ }else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp);
}
- if(ishighlighted || ispreselected){
- if(!GetUnstructuredGrid()->GetNumberOfCells()){
- myNodeActor->SetProperty(myHighlitableActor->GetProperty());
- myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
- myNodeActor->SetVisibility(GetVisibility());
- }else{
+ bool isVisible = GetVisibility();
+
+ if(myIsHighlighted || myIsPreselected){
+ if(GetUnstructuredGrid()->GetNumberOfCells()){
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
- myHighlitableActor->SetVisibility(GetVisibility());
+ myHighlitableActor->SetVisibility(isVisible);
+ myHighlitableActor->SetHighlited(isVisible);
+ }
+ if(myRepresentation == ePoint || GetPointRepresentation()){
+ myNodeHighlitableActor->SetProperty(myHighlitableActor->GetProperty());
+ myNodeHighlitableActor->SetVisibility(isVisible);
+ myNodeHighlitableActor->SetHighlited(isVisible);
}
}
}
-void SMESH_Actor::highlight(Standard_Boolean highlight){
- ishighlighted = highlight;
+void SMESH_Actor::highlight(bool theHighlight){
+ myIsHighlighted = theHighlight;
UpdateHighlight();
}
-void SMESH_Actor::SetPreSelected(Standard_Boolean presel){
- ispreselected = presel;
+void SMESH_Actor::SetPreSelected(bool thePreselect){
+ myIsPreselected = thePreselect;
UpdateHighlight();
}
}
-void SMESH_Actor::Render(vtkRenderer *ren){}
+void SMESH_Actor::Render(vtkRenderer *ren){
+ unsigned long mTime = myTimeStamp->GetMTime();
+ unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
+ if(anObjTime > mTime)
+ Update();
+}
+
+
+void SMESH_Actor::Update(){
+ SetVisibility(GetVisibility());
+ unsigned long int anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
+ unsigned long int aClippingTime = myImplicitBoolean->GetMTime();
+ unsigned long int aTime = myTimeStamp->GetMTime();
+ if(MYDEBUG) MESSAGE("SMESH_Actor::Update");
+
+ if(GetControlMode() != eNone) {
+ if(anObjTime > aTime || aClippingTime > aTime){
+ SetControlMode(GetControlMode());
+ SetVisibility(GetVisibility());
+ }
+ }
+ if(myIsPointsLabeled){
+ if(anObjTime > aTime || aClippingTime > aTime)
+ SetPointsLabeled(myIsPointsLabeled);
+ }
+ if(myIsCellsLabeled){
+ if(anObjTime > aTime || aClippingTime > aTime)
+ SetCellsLabeled(myIsCellsLabeled);
+ }
+
+ myTimeStamp->Modified();
+ Modified();
+}
void SMESH_Actor::ReleaseGraphicsResources(vtkWindow *renWin){
void SMESH_Actor::SetLineWidth(float theVal){
myEdgeProp->SetLineWidth(theVal);
+
+ my1DProp->SetLineWidth(theVal + aLineWidthInc);
+ my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
+
Modified();
}
-void SMESH_Actor::SetNodeSize(float theSize){
- myNodeProp->SetPointSize(theSize);
- myHighlightProp->SetPointSize(theSize);
- myPreselectProp->SetPointSize(theSize);
+void SMESH_Actor::SetNodeSize(float theVal){
+ myNodeProp->SetPointSize(theVal);
+ myHighlightProp->SetPointSize(theVal);
+ myPreselectProp->SetPointSize(theVal);
- my1DExtProp->SetPointSize(theSize);
- my1DProp->SetPointSize(theSize);
+ my1DProp->SetPointSize(theVal + aPointSizeInc);
+ my1DExtProp->SetPointSize(theVal + aPointSizeInc);
Modified();
}
{
return myVisualObj->GetElemDimension( theObjId );
}
+
+
+vtkImplicitBoolean* SMESH_Actor::GetPlaneContainer(){
+ return myImplicitBoolean;
+}
+
+
+static void ComputeBoundsParam(vtkDataSet* theDataSet,
+ float theDirection[3], float theMinPnt[3],
+ float& theMaxBoundPrj, float& theMinBoundPrj)
+{
+ float aBounds[6];
+ theDataSet->GetBounds(aBounds);
+
+ //Enlarge bounds in order to avoid conflicts of precision
+ for(int i = 0; i < 6; i += 2){
+ static double EPS = 1.0E-3;
+ float aDelta = (aBounds[i+1] - aBounds[i])*EPS;
+ aBounds[i] -= aDelta;
+ aBounds[i+1] += aDelta;
+ }
+
+ float aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
+
+ int aMaxId = 0, aMinId = aMaxId;
+ theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
+ theMinBoundPrj = theMaxBoundPrj;
+ for(int i = 1; i < 8; i++){
+ float aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
+ if(theMaxBoundPrj < aTmp){
+ theMaxBoundPrj = aTmp;
+ aMaxId = i;
+ }
+ if(theMinBoundPrj > aTmp){
+ theMinBoundPrj = aTmp;
+ aMinId = i;
+ }
+ }
+ float *aMinPnt = aBoundPoints[aMaxId];
+ theMinPnt[0] = aMinPnt[0];
+ theMinPnt[1] = aMinPnt[1];
+ theMinPnt[2] = aMinPnt[2];
+}
+
+
+static void DistanceToPosition(vtkDataSet* theDataSet,
+ float theDirection[3], float theDist, float thePos[3])
+{
+ float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
+ float aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
+ thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
+ thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
+ thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
+}
+
+
+static void PositionToDistance(vtkDataSet* theDataSet,
+ float theDirection[3], float thePos[3], float& theDist)
+{
+ float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
+ float aPrj = vtkMath::Dot(theDirection,thePos);
+ theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+}
+
+
+void SMESH_Actor::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
+{
+ thePlane->SetNormal(theDir);
+ float anOrigin[3];
+ ::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin);
+ thePlane->SetOrigin(anOrigin);
+ Update();
+}
+
+
+void SMESH_Actor::GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane)
+{
+ thePlane->GetNormal(theDir);
+
+ float anOrigin[3];
+ thePlane->GetOrigin(anOrigin);
+ ::PositionToDistance(GetUnstructuredGrid(),theDir,anOrigin,theDist);
+}
class vtkMapper;
class vtkActor2D;
class vtkMaskPoints;
+class vtkCellCenters;
class vtkLabeledDataMapper;
class vtkSelectVisiblePoints;
class vtkScalarBarActor;
class vtkLookupTable;
+class vtkPlane;
+class vtkImplicitBoolean;
+
+class vtkTimeStamp;
+
class SMESH_DeviceActor;
-class SALOME_ExtractUnstructuredGrid;
class SMESH_Actor : public SALOME_Actor{
public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor);
static SMESH_Actor* New(TVisualObjPtr theVisualObj,
- SMESH::FilterManager_ptr theFilterMgr,
const char* theEntry,
const char* theName,
int theIsClear);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
virtual bool hasHighlight() { return true; }
- virtual void highlight(Standard_Boolean highlight);
- virtual void SetPreSelected(Standard_Boolean presel = Standard_False);
+ virtual void highlight(bool theHighlight);
+ virtual void SetPreSelected(bool thePreselect = false);
virtual bool IsInfinitive();
void SetNodeSize(float size) ;
float GetNodeSize() ;
- virtual int GetObjId(int theVtkID);
- virtual TVectorId GetVtkId(int theObjID);
-
virtual int GetNodeObjId(int theVtkID);
- virtual TVectorId GetNodeVtkId(int theObjID);
+ virtual float* GetNodeCoord(int theObjID);
virtual int GetElemObjId(int theVtkID);
- virtual TVectorId GetElemVtkId(int theObjID);
+ virtual vtkCell* GetElemCell(int theObjID);
virtual int GetObjDimension( const int theObjId );
virtual void SetVisibility(int theMode);
+ void SetVisibility(int theMode, bool theIsUpdateRepersentation);
enum EReperesent { ePoint, eEdge, eSurface};
virtual void SetRepresentation(int theMode);
- void SetPointRepresentation(int theIsPointsVisible);
- bool GetPointRepresentation(){ return myIsPointsVisible;}
+ void SetPointRepresentation(bool theIsPointsVisible);
+ bool GetPointRepresentation();
- virtual vtkPolyData* GetPolyDataInput();
+ virtual float* GetBounds();
virtual void SetTransform(SALOME_Transform* theTransform);
vtkUnstructuredGrid* GetUnstructuredGrid();
+ virtual vtkDataSet* GetInput();
virtual vtkMapper* GetMapper();
- float GetShrinkFactor();
- void SetShrinkFactor(float value );
+ virtual float GetShrinkFactor();
+ virtual void SetShrinkFactor(float value );
- bool IsShrunkable() { return myIsShrinkable;}
- bool IsShrunk() { return myIsShrunk;}
- void SetShrink();
- void UnShrink();
+ virtual bool IsShrunkable() { return myIsShrinkable;}
+ virtual bool IsShrunk() { return myIsShrunk;}
+ virtual void SetShrink();
+ virtual void UnShrink();
void SetPointsLabeled(bool theIsPointsLabeled);
bool GetPointsLabeled(){ return myIsPointsLabeled;}
void SetCellsLabeled(bool theIsCellsLabeled);
bool GetCellsLabeled(){ return myIsCellsLabeled;}
- enum eControl{eNone, eLengthEdges, eFreeBorders, eMultiConnection,
+ enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
void SetControlMode(eControl theMode);
eControl GetControlMode(){ return myColorMode;}
vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
+ void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
+ void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
+
+ vtkImplicitBoolean* GetPlaneContainer();
+
TVisualObjPtr GetObject() { return myVisualObj;}
+ void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
+ long GetControlsPrecision() const { return myControlsPrecision; }
+
protected:
TVisualObjPtr myVisualObj;
+ vtkTimeStamp* myTimeStamp;
- SMESH::FilterManager_var myFilterMgr;
vtkScalarBarActor* myScalarBarActor;
vtkLookupTable* myLookupTable;
vtkProperty* myHighlightProp;
vtkProperty* myPreselectProp;
SMESH_DeviceActor* myHighlitableActor;
+ SMESH_DeviceActor* myNodeHighlitableActor;
eControl myColorMode;
SMESH_DeviceActor* my2DActor;
vtkLabeledDataMapper* myClsLabeledDataMapper;
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
+ vtkImplicitBoolean* myImplicitBoolean;
+
+ long myControlsPrecision;
+
SMESH_Actor();
~SMESH_Actor();
- void Init(TVisualObjPtr theVisualObj,
- SMESH::FilterManager_ptr theFilterMgr,
+ bool Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
- void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
+ void Update();
private:
// hide the two parameter Render() method from the user and the compiler.
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESH_ActorUtils.h"
+
+#include "QAD_Config.h"
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace SMESH{
+ float GetFloat(const QString& theValue, float theDefault){
+ if(theValue.isEmpty()) return theDefault;
+ QString aValue = QAD_CONFIG->getSetting(theValue);
+ if(aValue.isEmpty()) return theDefault;
+ return aValue.toFloat();
+ }
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESH_ACTORUTILS_H
+#define SMESH_ACTORUTILS_H
+
+#include <qstring.h>
+
+
+namespace SMESH{
+ float GetFloat(const QString& theValue, float theDefault = 0);
+}
+
+
+#endif
#include "SMESH_DeviceActor.h"
+#include "SMESH_ExtractGeometry.h"
#include "SALOME_Transform.h"
#include "SALOME_TransformFilter.h"
#include <vtkPolyDataMapper.h>
#include <vtkUnstructuredGrid.h>
+#include <vtkScalarBarActor.h>
+#include <vtkLookupTable.h>
+#include <vtkDoubleArray.h>
+#include <vtkCellData.h>
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+
+#include <vtkImplicitBoolean.h>
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits);
- //myMapper->SetResolveCoincidentTopologyToShiftZBuffer();
- //myMapper->SetResolveCoincidentTopologyZShift(0.02);
-
+
myMapper->UseLookupTableScalarRangeOn();
myMapper->SetColorModeToMapScalars();
myShrinkFilter = vtkShrinkFilter::New();
+ myExtractGeometry = SMESH_ExtractGeometry::New();
+ myExtractGeometry->SetStoreMapping(true);
+
myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
myExtractUnstructuredGrid->SetStoreMapping(true);
myGeomFilter->UnRegisterAllOutputs();
myGeomFilter->Delete();
+ myExtractGeometry->UnRegisterAllOutputs();
+ myExtractGeometry->Delete();
+
myTransformFilter->UnRegisterAllOutputs();
myTransformFilter->Delete();
}
+void SMESH_DeviceActor::Init(TVisualObjPtr theVisualObj,
+ vtkImplicitBoolean* theImplicitBoolean)
+{
+ myVisualObj = theVisualObj;
+ myExtractGeometry->SetImplicitFunction(theImplicitBoolean);
+ SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+}
+
+
void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
if(theGrid){
//myIsShrinkable = theGrid->GetNumberOfCells() > 10;
myIsShrinkable = true;
- myExtractUnstructuredGrid->SetInput(theGrid);
+ myExtractGeometry->SetInput(theGrid);
+
+ myExtractUnstructuredGrid->SetInput(myExtractGeometry->GetOutput());
myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
}
-vtkMergeFilter* SMESH_DeviceActor::GetMergeFilter(){
- return myMergeFilter;
+void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
+{
+ bool anIsInitialized = theFunctor;
+ if(anIsInitialized){
+ vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+ vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
+ aDataSet->ShallowCopy(aGrid);
+
+ vtkDoubleArray *aScalars = vtkDoubleArray::New();
+ vtkIdType aNbCells = aGrid->GetNumberOfCells();
+ aScalars->SetNumberOfComponents(1);
+ aScalars->SetNumberOfTuples(aNbCells);
+
+ myVisualObj->UpdateFunctor(theFunctor);
+
+ using namespace SMESH::Controls;
+ if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
+ for(vtkIdType i = 0; i < aNbCells; i++){
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anId2 = myExtractGeometry->GetElemObjId(anId);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId2);
+ double aValue = aNumericalFunctor->GetValue(anObjId);
+ aScalars->SetValue(i,aValue);
+ }
+ }else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
+ for(vtkIdType i = 0; i < aNbCells; i++){
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anId2 = myExtractGeometry->GetElemObjId(anId);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId2);
+ bool aValue = aPredicate->IsSatisfy(anObjId);
+ aScalars->SetValue(i,aValue);
+ }
+ }
+
+ aDataSet->GetCellData()->SetScalars(aScalars);
+ aScalars->Delete();
+
+ theLookupTable->SetRange(aScalars->GetRange());
+ theLookupTable->Build();
+
+ myMergeFilter->SetScalars(aDataSet);
+ aDataSet->Delete();
+ }
+ GetMapper()->SetScalarVisibility(anIsInitialized);
+ theScalarBarActor->SetVisibility(anIsInitialized);
}
-vtkPolyData* SMESH_DeviceActor::GetPolyDataInput(){
- return myPassFilter.back()->GetPolyDataOutput();
+void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ SMESH_DeviceActor* theDeviceActor)
+{
+ myExtractUnstructuredGrid->ClearRegisteredCells();
+ myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
+ myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
+ myVisualObj->UpdateFunctor(theFunctor);
+
+ using namespace SMESH::Controls;
+ if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
+ myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+ myExtractUnstructuredGrid->ClearRegisteredCells();
+ vtkUnstructuredGrid* aGrid = theDeviceActor->GetUnstructuredGrid();
+ vtkIdType aNbCells = aGrid->GetNumberOfCells();
+ for( vtkIdType i = 0; i < aNbCells; i++ ){
+ vtkIdType anObjId = theDeviceActor->GetElemObjId(i);
+ if(aFreeBorders->IsSatisfy(anObjId))
+ myExtractUnstructuredGrid->RegisterCell(i);
+ }
+ if(!myExtractUnstructuredGrid->IsCellsRegistered())
+ myExtractUnstructuredGrid->RegisterCell(-1);
+ SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+ }else if(FreeEdges* aFreeEdges = dynamic_cast<FreeEdges*>(theFunctor.get())){
+ SMESH::Controls::FreeEdges::TBorders aBorders;
+ aFreeEdges->GetBoreders(aBorders);
+ vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+ vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
+ aDataSet->SetPoints(aGrid->GetPoints());
+
+ vtkIdType aNbCells = aBorders.size();
+ vtkIdType aCellsSize = 3*aNbCells;
+ vtkCellArray* aConnectivity = vtkCellArray::New();
+ aConnectivity->Allocate( aCellsSize, 0 );
+
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents( 1 );
+ aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds(2);
+
+ FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
+ for(vtkIdType aVtkId; anIter != aBorders.end(); anIter++){
+ const FreeEdges::Border& aBorder = *anIter;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
+ };
+ //cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ }
+ }
+
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ aCellLocationsArray->SetNumberOfComponents( 1 );
+ aCellLocationsArray->SetNumberOfTuples( aNbCells );
+
+ aConnectivity->InitTraversal();
+ for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+ aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+
+ SetUnstructuredGrid(aDataSet);
+ aDataSet->Delete();
+ }
}
unsigned long int SMESH_DeviceActor::GetMTime(){
unsigned long mTime = this->Superclass::GetMTime();
+ mTime = max(mTime,myExtractGeometry->GetMTime());
mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
mTime = max(mTime,myMergeFilter->GetMTime());
mTime = max(mTime,myGeomFilter->GetMTime());
}
-void SMESH_DeviceActor::SetShrink()
-{
+void SMESH_DeviceActor::SetShrink() {
if ( !myIsShrinkable ) return;
if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
{
}
}
-void SMESH_DeviceActor::UnShrink()
-{
+void SMESH_DeviceActor::UnShrink() {
if ( !myIsShrunk ) return;
if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
{
myGeomFilter->SetInside(false);
}
myRepresentation = theMode;
+ GetProperty()->Modified();
myMapper->Modified();
Modified();
}
}
-int SMESH_DeviceActor::GetObjId(int theVtkID){
- if (GetRepresentation() == ePoint){
- return GetNodeObjId(theVtkID);
- }else{
- return GetElemObjId(theVtkID);
- }
-}
-
-
-SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetVtkId(int theObjID){
- if (GetRepresentation() == ePoint){
- return GetNodeVtkId(theObjID);
- }else{
- return GetElemVtkId(theObjID);
- }
-}
-
-
int SMESH_DeviceActor::GetNodeObjId(int theVtkID){
- vtkIdType aRetID = myVisualObj->GetNodeObjId(theVtkID);
+ vtkIdType anID = myExtractGeometry->GetNodeObjId(theVtkID);
+ vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; aRetID = "<<aRetID);
return aRetID;
}
-SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetNodeVtkId(int theObjID){
- SMESH_DeviceActor::TVectorId aVecId;
+float* SMESH_DeviceActor::GetNodeCoord(int theObjID){
+ vtkDataSet* aDataSet = myExtractGeometry->GetInput();
vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
- if(anID < 0)
- return aVecId;
- aVecId.push_back(anID);
- return aVecId;
+ float* aCoord = aDataSet->GetPoint(anID);
+ if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
+ return aCoord;
}
int SMESH_DeviceActor::GetElemObjId(int theVtkID){
- vtkIdType aGridID = myGeomFilter->GetObjId(theVtkID);
- if(aGridID < 0)
+ vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID);
+ if(anId < 0)
+ return -1;
+ vtkIdType anId2 = myExtractUnstructuredGrid->GetInputId(anId);
+ if(anId2 < 0)
return -1;
- vtkIdType anExtractID = myExtractUnstructuredGrid->GetOutId(aGridID);
- if(anExtractID < 0)
+ vtkIdType anId3 = myExtractGeometry->GetElemObjId(anId2);
+ if(anId3 < 0)
return -1;
- vtkIdType aRetID = myVisualObj->GetElemObjId(anExtractID);
+ vtkIdType aRetID = myVisualObj->GetElemObjId(anId3);
if(MYDEBUG)
- MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anExtractID = "<<anExtractID<<"; aGridID = "<<aGridID<<"; aRetID = "<<aRetID);
+ MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
return aRetID;
}
-SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetElemVtkId(int theObjID){
- TVectorId aVecId;
+vtkCell* SMESH_DeviceActor::GetElemCell(int theObjID){
+ vtkDataSet* aDataSet = myExtractGeometry->GetInput();
vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
- if(aGridID < 0)
- return aVecId;
- aVecId = myGeomFilter->GetVtkId(aGridID);
+ vtkCell* aCell = aDataSet->GetCell(aGridID);
if(MYDEBUG)
- MESSAGE("GetElemVtkId - theObjID = "<<theObjID<<"; aGridID = "<<aGridID<<"; aGridID = "<<aGridID<<"; aVecId[0] = "<<aVecId[0]);
- return aVecId;
+ MESSAGE("GetElemCell - theObjID = "<<theObjID<<"; aGridID = "<<aGridID);
+ return aCell;
}
}
+void SMESH_DeviceActor::SetHighlited(bool theIsHighlited){
+ myIsHighlited = theIsHighlited;
+ Modified();
+}
+
void SMESH_DeviceActor::Render(vtkRenderer *ren, vtkMapper* m){
int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
- float aFactor, aUnit;
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+ float aStoredFactor, aStoredUnit;
+ vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
- vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ float aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
+ if(myIsHighlited){
+ static float EPS = .01;
+ aUnits *= (1.0-EPS);
+ }
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnits);
vtkLODActor::Render(ren,m);
- vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
}
#define SMESH_DEVICE_ACTOR_H
#include "SALOME_GeometryFilter.h"
+#include "SMESH_Controls.hxx"
#include "SMESH_Object.h"
#include <vtkLODActor.h>
+#include <vtkSmartPointer.h>
+class vtkCell;
class vtkProperty;
class vtkMergeFilter;
class vtkShrinkFilter;
class vtkPolyDataMapper;
class vtkUnstructuredGrid;
+class vtkScalarBarActor;
+class vtkLookupTable;
+class vtkImplicitBoolean;
class SALOME_Transform;
class SALOME_TransformFilter;
class SALOME_PassThroughFilter;
class SALOME_ExtractUnstructuredGrid;
+class SMESH_ExtractGeometry;
+
class SMESH_DeviceActor: public vtkLODActor{
friend class SMESH_Actor;
void SetStoreMapping(int theStoreMapping);
int GetStoreMapping(){ return myStoreMapping;}
- typedef SALOME_GeometryFilter::TVectorId TVectorId;
- int GetObjId(int theVtkID);
- TVectorId GetVtkId(int theObjID);
-
- int GetNodeObjId(int theVtkID);
- TVectorId GetNodeVtkId(int theObjID);
+ virtual int GetNodeObjId(int theVtkID);
+ virtual float* GetNodeCoord(int theObjID);
- int GetElemObjId(int theVtkID);
- TVectorId GetElemVtkId(int theObjID);
-
- vtkPolyData* GetPolyDataInput();
+ virtual int GetElemObjId(int theVtkID);
+ virtual vtkCell* GetElemCell(int theObjID);
virtual void SetTransform(SALOME_Transform* theTransform);
virtual unsigned long int GetMTime();
SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
vtkUnstructuredGrid* GetUnstructuredGrid();
- vtkMergeFilter* GetMergeFilter();
+
+ void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
+ void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ SMESH_DeviceActor* theDeviceActor);
+
+ bool IsHighlited() { return myIsHighlited;}
+ void SetHighlited(bool theIsHighlited);
virtual void Render(vtkRenderer *, vtkMapper *);
protected:
+ void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
vtkPolyDataMapper *myMapper;
vtkProperty *myProperty;
EReperesent myRepresentation;
+ SMESH_ExtractGeometry* myExtractGeometry;
+
vtkMergeFilter* myMergeFilter;
SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
bool myIsShrinkable;
bool myIsShrunk;
+ bool myIsHighlited;
+
float myPolygonOffsetFactor;
float myPolygonOffsetUnits;
SMESH_DeviceActor();
~SMESH_DeviceActor();
- SMESH_DeviceActor(const SMESH_DeviceActor&) {};
- void operator=(const SMESH_DeviceActor&) {};
+ SMESH_DeviceActor(const SMESH_DeviceActor&);
+ void operator=(const SMESH_DeviceActor&);
};
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESH_ExtractGeometry.h"
+
+#include "vtkCell.h"
+#include "vtkCellData.h"
+#include "vtkFloatArray.h"
+#include "vtkIdList.h"
+#include "vtkImplicitFunction.h"
+#include "vtkObjectFactory.h"
+#include "vtkPointData.h"
+#include "vtkUnstructuredGrid.h"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+
+vtkStandardNewMacro(SMESH_ExtractGeometry);
+
+
+SMESH_ExtractGeometry::SMESH_ExtractGeometry()
+{}
+
+
+SMESH_ExtractGeometry::~SMESH_ExtractGeometry(){}
+
+
+vtkIdType SMESH_ExtractGeometry::GetElemObjId(int theVtkID){
+ if(myElemVTK2ObjIds.empty() || theVtkID > myElemVTK2ObjIds.size()) return -1;
+#if defined __GNUC_2__
+ return myElemVTK2ObjIds[theVtkID];
+#else
+ return myElemVTK2ObjIds.at(theVtkID);
+#endif
+}
+
+
+vtkIdType SMESH_ExtractGeometry::GetNodeObjId(int theVtkID){
+ if(myNodeVTK2ObjIds.empty() || theVtkID > myNodeVTK2ObjIds.size()) return -1;
+#if defined __GNUC_2__
+ return myNodeVTK2ObjIds[theVtkID];
+#else
+ return myNodeVTK2ObjIds.at(theVtkID);
+#endif
+}
+
+
+void SMESH_ExtractGeometry::Execute()
+{
+ vtkIdType ptId, numPts, numCells, i, cellId, newCellId, newId, *pointMap;
+ vtkIdList *cellPts;
+ vtkCell *cell;
+ int numCellPts;
+ float *x;
+ float multiplier;
+ vtkPoints *newPts;
+ vtkIdList *newCellPts;
+ vtkDataSet *input = this->GetInput();
+ vtkPointData *pd = input->GetPointData();
+ vtkCellData *cd = input->GetCellData();
+ vtkUnstructuredGrid *output = this->GetOutput();
+ vtkPointData *outputPD = output->GetPointData();
+ vtkCellData *outputCD = output->GetCellData();
+ int npts;
+ numCells = input->GetNumberOfCells();
+ numPts = input->GetNumberOfPoints();
+
+ vtkDebugMacro(<< "Extracting geometry");
+
+ if ( ! this->ImplicitFunction )
+ {
+ vtkErrorMacro(<<"No implicit function specified");
+ return;
+ }
+
+ newCellPts = vtkIdList::New();
+ newCellPts->Allocate(VTK_CELL_SIZE);
+
+ if ( this->ExtractInside )
+ {
+ multiplier = 1.0;
+ }
+ else
+ {
+ multiplier = -1.0;
+ }
+
+ // Loop over all points determining whether they are inside the
+ // implicit function. Copy the points and point data if they are.
+ //
+ pointMap = new vtkIdType[numPts]; // maps old point ids into new
+ for (i=0; i < numPts; i++)
+ {
+ pointMap[i] = -1;
+ }
+
+ output->Allocate(numCells/4); //allocate storage for geometry/topology
+ newPts = vtkPoints::New();
+ newPts->Allocate(numPts/4,numPts);
+ outputPD->CopyAllocate(pd);
+ outputCD->CopyAllocate(cd);
+ vtkFloatArray *newScalars = NULL;
+
+ if(myStoreMapping){
+ myElemVTK2ObjIds.clear();
+ myElemVTK2ObjIds.reserve(numCells);
+ myNodeVTK2ObjIds.clear();
+ myNodeVTK2ObjIds.reserve(numPts);
+ }
+
+ if ( ! this->ExtractBoundaryCells )
+ {
+ for ( ptId=0; ptId < numPts; ptId++ )
+ {
+ x = input->GetPoint(ptId);
+ if ( (this->ImplicitFunction->FunctionValue(x)*multiplier) < 0.0 )
+ {
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ }
+ }
+ else
+ {
+ // To extract boundary cells, we have to create supplemental information
+ if ( this->ExtractBoundaryCells )
+ {
+ float val;
+ newScalars = vtkFloatArray::New();
+ newScalars->SetNumberOfValues(numPts);
+
+ for (ptId=0; ptId < numPts; ptId++ )
+ {
+ x = input->GetPoint(ptId);
+ val = this->ImplicitFunction->FunctionValue(x) * multiplier;
+ newScalars->SetValue(ptId, val);
+ if ( val < 0.0 )
+ {
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ }
+ }
+ }
+
+ // Now loop over all cells to see whether they are inside implicit
+ // function (or on boundary if ExtractBoundaryCells is on).
+ //
+ for (cellId=0; cellId < numCells; cellId++)
+ {
+ cell = input->GetCell(cellId);
+ cellPts = cell->GetPointIds();
+ numCellPts = cell->GetNumberOfPoints();
+
+ newCellPts->Reset();
+ if ( ! this->ExtractBoundaryCells ) //requires less work
+ {
+ for ( npts=0, i=0; i < numCellPts; i++, npts++)
+ {
+ ptId = cellPts->GetId(i);
+ if ( pointMap[ptId] < 0 )
+ {
+ break; //this cell won't be inserted
+ }
+ else
+ {
+ newCellPts->InsertId(i,pointMap[ptId]);
+ }
+ }
+ } //if don't want to extract boundary cells
+
+ else //want boundary cells
+ {
+ for ( npts=0, i=0; i < numCellPts; i++ )
+ {
+ ptId = cellPts->GetId(i);
+ if ( newScalars->GetValue(ptId) <= 0.0 )
+ {
+ npts++;
+ }
+ }
+ if ( npts > 0 )
+ {
+ for ( i=0; i < numCellPts; i++ )
+ {
+ ptId = cellPts->GetId(i);
+ if ( pointMap[ptId] < 0 )
+ {
+ x = input->GetPoint(ptId);
+ newId = newPts->InsertNextPoint(x);
+ pointMap[ptId] = newId;
+ myNodeVTK2ObjIds.push_back(ptId);
+ outputPD->CopyData(pd,ptId,newId);
+ }
+ newCellPts->InsertId(i,pointMap[ptId]);
+ }
+ }//a boundary or interior cell
+ }//if mapping boundary cells
+
+ if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
+ {
+ newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
+ myElemVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }//for all cells
+
+ // Update ourselves and release memory
+ //
+ delete [] pointMap;
+ newCellPts->Delete();
+ output->SetPoints(newPts);
+ newPts->Delete();
+
+ if ( this->ExtractBoundaryCells )
+ {
+ newScalars->Delete();
+ }
+
+ output->Squeeze();
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SALOME_ExtractGeometry_HeaderFile
+#define SALOME_ExtractGeometry_HeaderFile
+
+#include <vtkExtractGeometry.h>
+#include <vector>
+
+
+class SMESH_ExtractGeometry : public vtkExtractGeometry{
+public:
+ vtkTypeMacro(SMESH_ExtractGeometry,vtkExtractGeometry);
+
+ static SMESH_ExtractGeometry *New();
+
+ void SetStoreMapping(bool theStoreMapping){
+ myStoreMapping = theStoreMapping;
+ Modified();
+ }
+ bool GetStoreMapping(){ return myStoreMapping;}
+
+ virtual vtkIdType GetNodeObjId(int theVtkID);
+ virtual vtkIdType GetElemObjId(int theVtkID);
+
+protected:
+ SMESH_ExtractGeometry();
+ ~SMESH_ExtractGeometry();
+
+ void Execute();
+
+private:
+ bool myStoreMapping;
+ typedef std::vector<vtkIdType> TVectorId;
+ TVectorId myElemVTK2ObjIds;
+ TVectorId myNodeVTK2ObjIds;
+
+ SMESH_ExtractGeometry(const SMESH_ExtractGeometry&); // Not implemented.
+ void operator=(const SMESH_ExtractGeometry&); // Not implemented.
+};
+
+
+#endif
+
+
#include CORBA_SERVER_HEADER(SALOME_Exception)
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+
#include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkUnstructuredGridReader.h>
#endif
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
aWriter->SetInput(theGrid);
- aWriter->Write();
+ if(theGrid->GetNumberOfCells()){
+ aWriter->Write();
+ }
aWriter->Delete();
}
myGrid->SetCells( 0, 0, 0 );
// Create cells
-
- /*vtkIdList *anIdList = vtkIdList::New();
+ /*
+ vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds( 1 );
vtkCellArray *aCells = vtkCellArray::New();
aCellLocationsArray->Delete();
aCellTypesArray->Delete();
aCells->Delete();
- anIdList->Delete(); */
+ anIdList->Delete();
+ */
}
//=================================================================================
anIdList->Delete();
}
+//=================================================================================
+// function : GetEdgeNodes
+// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
+//=================================================================================
+bool SMESH_VisualObj::GetEdgeNodes( const int theElemId,
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const
+{
+ const SMDS_Mesh* aMesh = GetMesh();
+ if ( aMesh == 0 )
+ return false;
+
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theElemId );
+ if ( anElem == 0 )
+ return false;
+
+ int nbNodes = anElem->NbNodes();
+
+ if ( theEdgeNum < 1 || theEdgeNum > 4 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
+ return false;
+
+ int anIds[ nbNodes ];
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ int i = 0;
+ while( anIter->more() )
+ anIds[ i++ ] = anIter->next()->GetID();
+
+ if ( nbNodes != theEdgeNum )
+ {
+ theNodeId1 = anIds[ theEdgeNum - 1 ];
+ theNodeId2 = anIds[ theEdgeNum ];
+ }
+ else
+ {
+ theNodeId1 = anIds[ nbNodes - 1 ];
+ theNodeId2 = anIds[ 0 ];
+ }
+
+ return true;
+}
+
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
for( ; anElemId < aNbElems; anElemId++ )
myMesh->RemoveElement( FindElement( myMesh, anIndexes[anElemId] ) );
break;
+
+ case SMESH::MOVE_NODE:
+ for(CORBA::Long aCoordId=0; anElemId < aNbElems; anElemId++, aCoordId+=3)
+ {
+ SMDS_MeshNode* node =
+ const_cast<SMDS_MeshNode*>( FindNode( myMesh, anIndexes[anElemId] ));
+ node->setXYZ( aCoords[aCoordId], aCoords[aCoordId+1], aCoords[aCoordId+2] );
+ }
+ break;
+
+ case SMESH::CHANGE_ELEMENT_NODES:
+ for ( CORBA::Long i = 0; anElemId < aNbElems; anElemId++ )
+ {
+ // find element
+ const SMDS_MeshElement* elem = FindElement( myMesh, anIndexes[i++] );
+ // nb nodes
+ int nbNodes = anIndexes[i++];
+ // nodes
+ ASSERT( nbNodes < 9 );
+ const SMDS_MeshNode* aNodes[ 8 ];
+ for ( int iNode = 0; iNode < nbNodes; iNode++ )
+ aNodes[ iNode ] = FindNode( myMesh, anIndexes[i++] );
+ // change
+ myMesh->ChangeElementNodes( elem, aNodes, nbNodes );
+ }
+ break;
+
+ case SMESH::RENUMBER:
+ for(CORBA::Long i=0; anElemId < aNbElems; anElemId++, i+=3)
+ {
+ myMesh->Renumber( anIndexes[i], anIndexes[i+1], anIndexes[i+2] );
+ }
+ break;
+
+ default:;
}
}
}
catch ( SALOME::SALOME_Exception& exc )
{
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ INFOS("Following exception was cought:\n\t"<<exc.details.text);
}
catch( const std::exception& exc)
{
- INFOS("Follow exception was cought:\n\t"<<exc.what());
+ INFOS("Following exception was cought:\n\t"<<exc.what());
}
catch(...)
{
// function : UpdateFunctor
// purpose : Update functor in accordance with current mesh
//=================================================================================
-void SMESH_MeshObj::UpdateFunctor( SMESH::Functor_ptr f )
+void SMESH_MeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor )
{
- f->SetMesh( myMeshServer );
+ theFunctor->SetMesh( GetMesh() );
}
//=================================================================================
// function : UpdateFunctor
// purpose : Update functor in accordance with current mesh
//=================================================================================
-void SMESH_SubMeshObj::UpdateFunctor( SMESH::Functor_ptr f )
+void SMESH_SubMeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor )
{
- f->SetMesh( myMeshObj->GetMeshServer() );
+ theFunctor->SetMesh( myMeshObj->GetMesh() );
}
//=================================================================================
-// function : UpdateFunctor
+// function : Update
// purpose : Update mesh object and fill grid with new values
//=================================================================================
void SMESH_SubMeshObj::Update( int theIsClear )
{
case SMESH::NODE:
{
- return mySubMeshServer->GetNumberOfNodes();
+ return mySubMeshServer->GetNumberOfNodes( false );
}
break;
case SMESH::EDGE:
#define SMESH_OBJECT_H
// IDL Headers
-#include <SALOMEconfig.h>
+#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
-#include CORBA_SERVER_HEADER(SMESH_Filter)
#include <map>
#include <list>
#include <boost/shared_ptr.hpp>
#include <vtkSystemIncludes.h>
+#include "SMESH_Controls.hxx"
+
class vtkUnstructuredGrid;
class vtkPoints;
class SALOME_ExtractUnstructuredGrid;
Class : SMESH_VisualObj
Description : Base class for all mesh objects to be visuilised
*/
-
class SMESH_VisualObj
{
protected:
virtual ~SMESH_VisualObj();
virtual void Update( int theIsClear = true ) = 0;
- virtual void UpdateFunctor( SMESH::Functor_ptr theFunctor ) = 0;
+ virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
virtual int GetElemDimension( const int theObjId ) = 0;
virtual int GetNbEntities( const SMESH::ElementType) const = 0;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
virtual bool IsNodePrs() const = 0;
+ virtual SMDS_Mesh* GetMesh() const = 0;
+
+ bool GetEdgeNodes( const int theElemId,
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const;
vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
void buildNodePrs();
void buildElemPrs();
-private:
+private:
TMapOfIds mySMDS2VTKNodes;
TMapOfIds myVTK2SMDSNodes;
virtual int GetElemDimension( const int theObjId );
- virtual void UpdateFunctor( SMESH::Functor_ptr f );
+ virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshServer.in(); }
- SMDS_Mesh* GetMesh() { return myMesh; }
+ SMDS_Mesh* GetMesh() const { return myMesh; }
protected:
virtual void Update( int theIsClear = true );
- virtual void UpdateFunctor( SMESH::Functor_ptr );
+ virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
virtual int GetElemDimension( const int theObjId );
+ virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
protected:
SMDS_VolumeOfNodes.cxx \
SMDS_FaceOfEdges.cxx \
SMDS_FaceOfNodes.cxx \
- SMDS_Tria3OfNodes.cxx \
- SMDS_HexahedronOfNodes.cxx
+ SMDS_VolumeTool.cxx
+# SMDS_Tria3OfNodes.cxx \
+# SMDS_HexahedronOfNodes.cxx
#SMDSControl_BoundaryEdges.cxx \
#SMDSControl_BoundaryFaces.cxx \
SMDS_VolumeOfNodes.hxx \
SMDS_FaceOfEdges.hxx \
SMDS_FaceOfNodes.hxx \
- SMDS_Tria3OfNodes.hxx \
- SMDS_HexahedronOfNodes.hxx
+ SMDS_VolumeTool.hxx
+# SMDS_Tria3OfNodes.hxx \
+# SMDS_HexahedronOfNodes.hxx
#SMDSControl_BoundaryEdges.hxx \
#SMDSControl_BoundaryFaces.hxx \
/// Type (node, edge, face or volume) of elements
///////////////////////////////////////////////////////////////////////////////
enum SMDSAbs_ElementType
-{
+{
SMDSAbs_All,
SMDSAbs_Node,
SMDSAbs_Edge,
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDSControl.ixx"
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_ListOfMeshElement.hxx"
-#include "SMDS_ListIteratorOfListOfMeshElement.hxx"
-
-//=======================================================================
-//function : ComputeNeighborFaces
-//purpose :
-//=======================================================================
-
-Standard_Integer SMDSControl::ComputeNeighborFaces(const Handle(SMDS_Mesh)& M,
- const Handle(SMDS_MeshElement)& ME,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2)
-{
- const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
- const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
- const SMDS_ListOfMeshElement& lstInvFaces1 = node1->InverseElements();
- const SMDS_ListOfMeshElement& lstInvFaces2 = node2->InverseElements();
- Standard_Integer neighbor=0;
-
- SMDS_ListIteratorOfListOfMeshElement it1(lstInvFaces1);
- for (;it1.More();it1.Next()) {
- const Handle(SMDS_MeshElement)& face = it1.Value();
- if (M->Contains(face) && !face->IsSame(ME)) {
- if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor > 0) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it2(lstInvFaces2);
- for (;it2.More();it2.Next()) {
- const Handle(SMDS_MeshElement)& face = it2.Value();
- if (M->Contains(face) && !face->IsSame(ME)) {
- if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) {
- neighbor++;
- }
- }
- }
-
- return neighbor;
-}
-
-//=======================================================================
-//function : ComputeNeighborVolumes
-//purpose :
-//=======================================================================
-
-Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,
- const Handle(SMDS_MeshElement)& ME,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3)
-{
-
- const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
- const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
- const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3);
- const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements();
- const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements();
- const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements();
-
- Standard_Integer neighbor=0;
-
- SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1);
- for (;it1.More() && neighbor == 0;it1.Next()) {
- const Handle(SMDS_MeshElement)& vol = it1.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if (vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor > 0) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2);
- for (;it2.More() && neighbor == 0;it2.Next()) {
- const Handle(SMDS_MeshElement)& vol = it2.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if (vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor > 0) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3);
- for (;it3.More() && neighbor == 0;it3.Next()) {
- const Handle(SMDS_MeshElement)& vol = it3.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if (vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)) {
- neighbor++;
- }
- }
- }
-
- return neighbor;
-
-}
-
-//=======================================================================
-//function : ComputeNeighborVolumes
-//purpose :
-//=======================================================================
-
-Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,
- const Handle(SMDS_MeshElement)& ME,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4)
-{
-
- const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1);
- const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2);
- const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3);
- const Handle(SMDS_MeshElement)& node4 = M->FindNode(idnode4);
- const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements();
- const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements();
- const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements();
- const SMDS_ListOfMeshElement& lstInvVol4 = node4->InverseElements();
- Standard_Integer neighbor=0;
-
- SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1);
- for (;it1.More();it1.Next()) {
- const Handle(SMDS_MeshElement)& vol = it1.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if ( vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)
- && vol->IsNodeInElement(idnode4)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor >= 2) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2);
- for (;it2.More();it2.Next()) {
- const Handle(SMDS_MeshElement)& vol = it2.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if ( vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)
- && vol->IsNodeInElement(idnode4)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor >= 2) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3);
- for (;it3.More();it3.Next()) {
- const Handle(SMDS_MeshElement)& vol = it3.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if ( vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)
- && vol->IsNodeInElement(idnode4)) {
- neighbor++;
- }
- }
- }
-
- if (neighbor >= 2) {
- return neighbor;
- }
-
- SMDS_ListIteratorOfListOfMeshElement it4(lstInvVol4);
- for (;it4.More();it4.Next()) {
- const Handle(SMDS_MeshElement)& vol = it4.Value();
- if (M->Contains(vol) && !vol->IsSame(ME)) {
- if ( vol->IsNodeInElement(idnode1)
- && vol->IsNodeInElement(idnode2)
- && vol->IsNodeInElement(idnode3)
- && vol->IsNodeInElement(idnode4)) {
- neighbor++;
- }
- }
- }
-
- return neighbor;
-}
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl.hxx
-// Module : SMESH
-
-#ifndef _SMDSControl_HeaderFile
-#define _SMDSControl_HeaderFile
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_SMDS_Mesh_HeaderFile
-#include "Handle_SMDS_Mesh.hxx"
-#endif
-#ifndef _Handle_SMDS_MeshElement_HeaderFile
-#include "Handle_SMDS_MeshElement.hxx"
-#endif
-class SMDS_Mesh;
-class SMDS_MeshElement;
-class SMDSControl_MeshBoundary;
-class SMDSControl_BoundaryEdges;
-class SMDSControl_BoundaryFaces;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SMDSControl {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static Standard_Integer ComputeNeighborFaces(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2) ;
-Standard_EXPORT static Standard_Integer ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
-Standard_EXPORT static Standard_Integer ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-friend class SMDSControl_MeshBoundary;
-friend class SMDSControl_BoundaryEdges;
-friend class SMDSControl_BoundaryFaces;
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_BoundaryEdges.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDSControl_BoundaryEdges.ixx"
-#include "SMDSControl.hxx"
-
-#include "SMDS_MeshFacesIterator.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshEdge.hxx"
-#include "SMDS_MapIteratorOfExtendedMap.hxx"
-
-//=======================================================================
-//function : SMDSControl_BoundaryEdges
-//purpose :
-//=======================================================================
-
-SMDSControl_BoundaryEdges::SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M)
- :SMDSControl_MeshBoundary(M)
-{
-}
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void SMDSControl_BoundaryEdges::Compute()
-{
- Standard_Integer idnode1;
- Standard_Integer idnode2;
- Standard_Integer nbedg;
-
- myBoundaryMesh = myMesh->AddSubMesh();
- SMDS_MeshFacesIterator itface(myMesh);
-
- for (;itface.More();itface.Next()) {
- Handle(SMDS_MeshElement) ME = itface.Value();
-
- nbedg = ME->NbEdges();
-
- for (Standard_Integer iedge=1; iedge<=nbedg; ++iedge) {
- ME->GetEdgeDefinedByNodes(iedge,idnode1,idnode2);
- Handle(SMDS_MeshElement) edge = new SMDS_MeshEdge(0,idnode1,idnode2);
- if (!myBoundaryEdges.Add(edge))
- myBoundaryEdges.Remove(edge);
- }
- }
-
- SMDS_MapIteratorOfExtendedMap itbound(myBoundaryEdges);
-
- for (;itbound.More();itbound.Next()) {
- const Handle(SMDS_MeshElement)& edge = itbound.Key();
- myBoundaryMesh->AddEdge(edge->GetConnection(1),edge->GetConnection(2));
- }
-}
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_BoundaryEdges.hxx
-// Module : SMESH
-
-#ifndef _SMDSControl_BoundaryEdges_HeaderFile
-#define _SMDSControl_BoundaryEdges_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDSControl_BoundaryEdges_HeaderFile
-#include "Handle_SMDSControl_BoundaryEdges.hxx"
-#endif
-
-#ifndef _SMDS_MapOfMeshElement_HeaderFile
-#include "SMDS_MapOfMeshElement.hxx"
-#endif
-#ifndef _SMDSControl_MeshBoundary_HeaderFile
-#include "SMDSControl_MeshBoundary.hxx"
-#endif
-#ifndef _Handle_SMDS_Mesh_HeaderFile
-#include "Handle_SMDS_Mesh.hxx"
-#endif
-class SMDS_Mesh;
-
-
-class SMDSControl_BoundaryEdges : public SMDSControl_MeshBoundary {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M);
-Standard_EXPORT virtual void Compute() ;
-Standard_EXPORT ~SMDSControl_BoundaryEdges();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDSControl_BoundaryEdges_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-SMDS_MapOfMeshElement myBoundaryEdges;
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_BoundaryFaces.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDSControl_BoundaryFaces.ixx"
-#include "SMDSControl.hxx"
-
-#include "SMDS_MeshVolumesIterator.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshFace.hxx"
-#include "SMDS_MeshTriangle.hxx"
-#include "SMDS_MeshQuadrangle.hxx"
-#include "SMDS_MapIteratorOfExtendedMap.hxx"
-
-//=======================================================================
-//function : SMDSControl_BoundaryFaces
-//purpose :
-//=======================================================================
-
-SMDSControl_BoundaryFaces::SMDSControl_BoundaryFaces(const Handle(SMDS_Mesh)& M)
- :SMDSControl_MeshBoundary(M)
-{
-}
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void SMDSControl_BoundaryFaces::Compute()
-{
- myBoundaryMesh = myMesh->AddSubMesh();
- SMDS_MeshVolumesIterator itvol(myMesh);
-
- Standard_Integer idnode[4]; // max number of nodes for a face
- Standard_Integer nbnode;
-
- for (;itvol.More();itvol.Next()) {
- Handle(SMDS_MeshElement) ME = itvol.Value();
-
-
- Standard_Integer nbfaces = ME->NbFaces();
-
- for (Standard_Integer iface=1; iface<=nbfaces; ++iface) {
-
- ME->GetFaceDefinedByNodes(iface,idnode,nbnode);
- // Triangle
- if (nbnode == 3) {
- Handle(SMDS_MeshElement) face = new SMDS_MeshTriangle(0,idnode[0],idnode[1],idnode[2]);
- if (!myBoundaryFaces.Add(face))
- myBoundaryFaces.Remove(face);
-
-
- } else {
- // Quadrangle
-
- Handle(SMDS_MeshElement) face = new SMDS_MeshQuadrangle(0,idnode[0],idnode[1],idnode[2],idnode[3]);
- if (!myBoundaryFaces.Add(face))
- myBoundaryFaces.Remove(face);
-
- }
- } // end iface
-
- } // end itvol
-
- SMDS_MapIteratorOfExtendedMap itbound(myBoundaryFaces);
-
- for (;itbound.More();itbound.Next()) {
- const Handle(SMDS_MeshElement)& face = itbound.Key();
- if (face->NbNodes() == 3)
- myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3));
- else
- myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3),
- face->GetConnection(4));
- }
-
-}
-
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_BoundaryFaces.hxx
-// Module : SMESH
-
-#ifndef _SMDSControl_BoundaryFaces_HeaderFile
-#define _SMDSControl_BoundaryFaces_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDSControl_BoundaryFaces_HeaderFile
-#include <Handle_SMDSControl_BoundaryFaces.hxx>
-#endif
-
-#ifndef _SMDS_MapOfMeshElement_HeaderFile
-#include "SMDS_MapOfMeshElement.hxx"
-#endif
-#ifndef _SMDSControl_MeshBoundary_HeaderFile
-#include "SMDSControl_MeshBoundary.hxx"
-#endif
-#ifndef _Handle_SMDS_Mesh_HeaderFile
-#include "Handle_SMDS_Mesh.hxx"
-#endif
-class SMDS_Mesh;
-
-
-class SMDSControl_BoundaryFaces : public SMDSControl_MeshBoundary {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDSControl_BoundaryFaces(const Handle(SMDS_Mesh)& M);
-Standard_EXPORT virtual void Compute() ;
-Standard_EXPORT ~SMDSControl_BoundaryFaces();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDSControl_BoundaryFaces_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-SMDS_MapOfMeshElement myBoundaryFaces;
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_MeshBoundary.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDSControl_MeshBoundary.ixx"
-
-//=======================================================================
-//function : SMDSControl_MeshBoundary
-//purpose :
-//=======================================================================
-
-SMDSControl_MeshBoundary::SMDSControl_MeshBoundary()
-{
-}
-
-//=======================================================================
-//function : SMDSControl_MeshBoundary
-//purpose :
-//=======================================================================
-
-SMDSControl_MeshBoundary::SMDSControl_MeshBoundary(const Handle(SMDS_Mesh)& M)
- :myMesh(M)
-{
-}
-
-//=======================================================================
-//function : ResultMesh
-//purpose :
-//=======================================================================
-
-Handle(SMDS_Mesh) SMDSControl_MeshBoundary::ResultMesh()
-{
- if (myBoundaryMesh.IsNull())
- Compute();
- return myBoundaryMesh;
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSControl_MeshBoundary.hxx
-// Module : SMESH
-
-#ifndef _SMDSControl_MeshBoundary_HeaderFile
-#define _SMDSControl_MeshBoundary_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDSControl_MeshBoundary_HeaderFile
-#include "Handle_SMDSControl_MeshBoundary.hxx"
-#endif
-
-#ifndef _Handle_SMDS_Mesh_HeaderFile
-#include "Handle_SMDS_Mesh.hxx"
-#endif
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#endif
-class SMDS_Mesh;
-
-
-class SMDSControl_MeshBoundary : public MMgt_TShared {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT virtual void Compute() = 0;
-Standard_EXPORT Handle_SMDS_Mesh ResultMesh() ;
-Standard_EXPORT ~SMDSControl_MeshBoundary();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDSControl_MeshBoundary_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-Standard_EXPORT SMDSControl_MeshBoundary();
-Standard_EXPORT SMDSControl_MeshBoundary(const Handle(SMDS_Mesh)& M);
-
-
- // Fields PROTECTED
- //
-Handle_SMDS_Mesh myMesh;
-Handle_SMDS_Mesh myBoundaryMesh;
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSEdit_Transform.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDSEdit_Transform.ixx"
-#include "SMDS_MeshNode.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNodesIterator.hxx"
-#include "SMDS_ListIteratorOfListOfMeshElement.hxx"
-#include "TColStd_MapOfInteger.hxx"
-
-
-//=======================================================================
-//function : SMDSEdit_Transform
-//purpose :
-//=======================================================================
-
-SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const gp_Trsf& aTrsf)
- :myMesh(aMesh),myTrsf(aTrsf)
-{
-}
-
-//=======================================================================
-//function : SMDSEdit_Transform
-//purpose :
-//=======================================================================
-
-SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,
- const SMDS_ListOfMeshElement& aListOfME,
- const gp_Trsf& aTrsf)
- :myMesh(aMesh),myTrsf(aTrsf)
-{
- myListOfME = aListOfME;
-}
-
-//=======================================================================
-//function : SetTrsf
-//purpose :
-//=======================================================================
-
-void SMDSEdit_Transform::SetTrsf(const gp_Trsf& aTrsf)
-{
- myTrsf = aTrsf;
-}
-
-//=======================================================================
-//function : GetTrsf
-//purpose :
-//=======================================================================
-
-gp_Trsf SMDSEdit_Transform::GetTrsf() const
-{
- return myTrsf;
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-void SMDSEdit_Transform::Perform()
-{
- if (myListOfME.IsEmpty()) {
- // transform the whole mesh
- SMDS_MeshNodesIterator itNodes(myMesh);
-
- for (;itNodes.More();itNodes.Next()) {
- const Handle(SMDS_MeshElement)& elem = itNodes.Value();
- Handle(SMDS_MeshNode) node = *((Handle(SMDS_MeshNode)*)&elem);
-
- gp_Pnt P = node->Pnt();
- P.Transform(myTrsf);
- node->SetPnt(P);
- }
-
- } else {
- TColStd_MapOfInteger mapnode;
- Standard_Integer nbnodes,inode;
-
- SMDS_ListIteratorOfListOfMeshElement itME(myListOfME);
- for (;itME.More();itME.Next()) {
- const Handle(SMDS_MeshElement)& elem = itME.Value();
- nbnodes = elem->NbNodes();
-
- for (inode = 1; inode <= nbnodes; ++inode) {
- const Handle(SMDS_MeshNode)& node = myMesh->GetNode(inode,elem);
- if (mapnode.Add(node->GetID())) {
- gp_Pnt P = node->Pnt();
- P.Transform(myTrsf);
- node->SetPnt(P);
- }
- }
-
- }
- }
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org or email : webmaster@opencascade.org
-//
-//
-//
-// File : SMDSEdit_Transform.hxx
-// Module : SMESH
-
-#ifndef _SMDSEdit_Transform_HeaderFile
-#define _SMDSEdit_Transform_HeaderFile
-
-#ifndef _Handle_SMDS_Mesh_HeaderFile
-#include "Handle_SMDS_Mesh.hxx"
-#endif
-#ifndef _gp_Trsf_HeaderFile
-#include <gp_Trsf.hxx>
-#endif
-#ifndef _SMDS_ListOfMeshElement_HeaderFile
-#include "SMDS_ListOfMeshElement.hxx"
-#endif
-class SMDS_Mesh;
-class gp_Trsf;
-class SMDS_ListOfMeshElement;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SMDSEdit_Transform {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const gp_Trsf& aTrsf);
-Standard_EXPORT SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const SMDS_ListOfMeshElement& aListOfME,const gp_Trsf& aTrsf);
-Standard_EXPORT void Perform() ;
-Standard_EXPORT void SetTrsf(const gp_Trsf& aTrsf) ;
-Standard_EXPORT gp_Trsf GetTrsf() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_SMDS_Mesh myMesh;
-gp_Trsf myTrsf;
-SMDS_ListOfMeshElement myListOfME;
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
// Module : SMESH
#include "SMDS_EdgePosition.hxx"
+
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function : SMDS_EdgePosition
//purpose :
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
+using namespace std;
+
//=======================================================================
//function : NbEdges
//purpose :
#ifndef _SMDS_FaceOfEdges_HeaderFile
#define _SMDS_FaceOfEdges_HeaderFile
-#include <iostream>
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_Iterator.hxx"
+#include <iostream>
+
+
class SMDS_FaceOfEdges:public SMDS_MeshFace
{
public:
- void Print(ostream & OS) const;
+ void Print(std::ostream & OS) const;
SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3);
elementsIterator(SMDSAbs_ElementType type) const;
private:
- vector<const SMDS_MeshEdge*> myEdges;
+ std::vector<const SMDS_MeshEdge*> myEdges;
};
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function : NbEdges
//purpose :
(new SMDS_IteratorOfElements
(this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes))));
}
+ return SMDS_ElemIteratorPtr();
}
SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
myNodes[2]=node3;
myNodes[3]=node4;
}
+bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes)
+{
+ if (nbNodes == 3) {
+ myNodes.resize(3);
+ myNodes[0]=nodes[0];
+ myNodes[1]=nodes[1];
+ myNodes[2]=nodes[2];
+ }
+ else if ( nbNodes == 4) {
+ myNodes.resize(4);
+ myNodes[0]=nodes[0];
+ myNodes[1]=nodes[1];
+ myNodes[2]=nodes[2];
+ myNodes[3]=nodes[3];
+ }
+ else
+ return false;
+
+ return true;
+}
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
{
#ifndef _SMDS_FaceOfNodes_HeaderFile
#define _SMDS_FaceOfNodes_HeaderFile
-#include <iostream>
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_Iterator.hxx"
+#include <iostream>
+
class SMDS_FaceOfNodes:public SMDS_MeshFace
{
public:
- void Print(ostream & OS) const;
+ void Print(std::ostream & OS) const;
SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3);
const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4);
-
+ bool ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes);
int NbEdges() const;
int NbFaces() const;
int NbNodes() const;
elementsIterator(SMDSAbs_ElementType type) const;
private:
- vector<const SMDS_MeshNode*> myNodes;
+ std::vector<const SMDS_MeshNode*> myNodes;
};
// Module : SMESH
#include "SMDS_FacePosition.hxx"
+
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function : SMDS_FacePosition
//purpose :
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-
-#include "utilities.h"
-#include "SMDS_HexahedronOfNodes.hxx"
-#include "SMDS_IteratorOfArray.hxx"
-#include "SMDS_MeshNode.hxx"
-
-///////////////////////////////////////////////////////////////////////////////
-/// Create an hexahedron. node 1,2,3,4 and 5,6,7,8 are quadrangle and
-/// 5,1 and 7,3 are an edges.
-///////////////////////////////////////////////////////////////////////////////
-SMDS_HexahedronOfNodes::SMDS_HexahedronOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
- const SMDS_MeshNode * node5,
- const SMDS_MeshNode * node6,
- const SMDS_MeshNode * node7,
- const SMDS_MeshNode * node8)
-{
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
- myNodes[3]=node4;
- myNodes[4]=node5;
- myNodes[5]=node6;
- myNodes[6]=node7;
- myNodes[7]=node8;
-}
-//=======================================================================
-//function : Print
-//purpose :
-//=======================================================================
-
-void SMDS_HexahedronOfNodes::Print(ostream & OS) const
-{
- OS << "volume <" << GetID() << "> : ";
- int i;
- for (i = 0; i < 7; ++i) OS << myNodes[i] << ",";
- OS << myNodes[7]<< ") " << endl;
-}
-
-int SMDS_HexahedronOfNodes::NbFaces() const
-{
- return 6;
-}
-
-int SMDS_HexahedronOfNodes::NbNodes() const
-{
- return 8;
-}
-
-int SMDS_HexahedronOfNodes::NbEdges() const
-{
- return 12;
-}
-
-SMDS_ElemIteratorPtr SMDS_HexahedronOfNodes::
- elementsIterator(SMDSAbs_ElementType type) const
-{
- switch(type)
- {
- case SMDSAbs_Volume:
- return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
- case SMDSAbs_Node:
- return SMDS_ElemIteratorPtr (new SMDS_IteratorOfArray<const SMDS_MeshElement *, 8,
- const SMDS_MeshNode*>(myNodes));
- default: MESSAGE("ERROR : Iterator not implemented");
- }
-}
-
-SMDSAbs_ElementType SMDS_HexahedronOfNodes::GetType() const
-{
- return SMDSAbs_Volume;
-}
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshVolume.hxx
-// Module : SMESH
-
-#ifndef _SMDS_HexahedronOfNodes_HeaderFile
-#define _SMDS_HexahedronOfNodes_HeaderFile
-
-#include "SMDS_MeshVolume.hxx"
-#include <vector>
-using namespace std;
-
-class SMDS_HexahedronOfNodes:public SMDS_MeshVolume
-{
-
- public:
- SMDS_HexahedronOfNodes(
- const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
- const SMDS_MeshNode * node4,
- const SMDS_MeshNode * node5,
- const SMDS_MeshNode * node6,
- const SMDS_MeshNode * node7,
- const SMDS_MeshNode * node8);
-
- void Print(ostream & OS) const;
- int NbFaces() const;
- int NbNodes() const;
- int NbEdges() const;
- SMDSAbs_ElementType GetType() const;
- protected:
- SMDS_ElemIteratorPtr
- elementsIterator(SMDSAbs_ElementType type) const;
- const SMDS_MeshNode * myNodes[8];
-};
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-
-#include "SMDS_Iterator.hxx"
-
-template<typename T, int SIZE, typename T2=T> class SMDS_IteratorOfArray:public SMDS_Iterator<T>
-{
- T2 const* myArray;
- int index;
- public:
- SMDS_IteratorOfArray(T2 const* a):myArray(a),index(0)
- {}
-
- bool more()
- {
- return index<SIZE;
- }
-
- T next()
- {
- index++;
- return static_cast<T>(myArray[index-1]);
- }
-};
#include "SMDS_MeshElement.hxx"
#include <set>
-using namespace std;
class SMDS_IteratorOfElements:public SMDS_ElemIterator
{
const SMDS_MeshElement * myElement;
bool myReverseIteration;
- set<const SMDS_MeshElement*> alreadyReturnedElements;
- set<const SMDS_MeshElement*>::iterator itAlreadyReturned;
+ std::set<const SMDS_MeshElement*> alreadyReturnedElements;
+ std::set<const SMDS_MeshElement*>::iterator itAlreadyReturned;
bool subMore();
const SMDS_MeshElement * subNext();
};
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_FaceOfNodes.hxx"
-#include "SMDS_Tria3OfNodes.hxx"
-#include "SMDS_HexahedronOfNodes.hxx"
#include "SMDS_FaceOfEdges.hxx"
#include <algorithm>
return NULL;
}
else {
- volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
+// volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
+ volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
myVolumes.insert(volume);
}
}
else
{
- SMDS_MeshFace * face = new SMDS_Tria3OfNodes(node1,node2,node3);
+ SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
myFaces.insert(face);
return face;
}
return found;
}
+//=======================================================================
+//function : ChangeElementNodes
+//purpose :
+//=======================================================================
+
+bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
+ const SMDS_MeshNode * nodes[],
+ const int nbnodes)
+{
+ // keep current nodes of elem
+ set<const SMDS_MeshElement*> oldNodes;
+ SMDS_ElemIteratorPtr itn = elem->nodesIterator();
+ while(itn->more())
+ oldNodes.insert( itn->next() );
+
+ // change nodes
+ bool Ok = false;
+ switch ( elem->GetType() )
+ {
+ case SMDSAbs_Edge: {
+ if ( nbnodes == 2 ) {
+ const SMDS_MeshEdge* edge = dynamic_cast<const SMDS_MeshEdge*>( elem );
+ if ( edge )
+ Ok = const_cast<SMDS_MeshEdge*>( edge )->ChangeNodes( nodes[0], nodes[1] );
+ }
+ break;
+ }
+ case SMDSAbs_Face: {
+ const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
+ if ( face )
+ Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
+ break;
+ }
+ case SMDSAbs_Volume: {
+ const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
+ if ( vol )
+ Ok = const_cast<SMDS_VolumeOfNodes*>( vol )->ChangeNodes( nodes, nbnodes );
+ break;
+ }
+ default:
+ MESSAGE ( "WRONG ELEM TYPE");
+ }
+
+ if ( Ok ) { // update InverseElements
+
+ // AddInverseElement to new nodes
+ for ( int i = 0; i < nbnodes; i++ )
+ if ( oldNodes.find( nodes[i] ) == oldNodes.end() )
+ // new node
+ const_cast<SMDS_MeshNode*>( nodes[i] )->AddInverseElement( elem );
+ else
+ // remove from oldNodes a node that remains in elem
+ oldNodes.erase( nodes[i] );
+
+
+ // RemoveInverseElement from the nodes removed from elem
+ set<const SMDS_MeshElement*>::iterator it;
+ for ( it = oldNodes.begin(); it != oldNodes.end(); it++ )
+ {
+ SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
+ (const_cast<SMDS_MeshElement *>( *it ));
+ n->RemoveInverseElement( elem );
+ }
+ }
+
+ //MESSAGE ( "::ChangeNodes() Ok = " << Ok);
+
+ return Ok;
+}
//=======================================================================
//function : FindEdge
//#include "Profiler.h"
const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2) const
+ const SMDS_MeshNode * node2)
{
const SMDS_MeshEdge * toReturn=NULL;
//PROFILER_Init();
const SMDS_MeshFace* SMDS_Mesh::FindFace(
const SMDS_MeshNode *node1,
const SMDS_MeshNode *node2,
- const SMDS_MeshNode *node3) const
+ const SMDS_MeshNode *node3)
{
const SMDS_MeshFace * face;
const SMDS_MeshElement * node;
const SMDS_MeshNode *node1,
const SMDS_MeshNode *node2,
const SMDS_MeshNode *node3,
- const SMDS_MeshNode *node4) const
+ const SMDS_MeshNode *node4)
{
const SMDS_MeshFace * face;
const SMDS_MeshElement * node;
}
///////////////////////////////////////////////////////////////////////////////
-/// Return an iterator on nodes of the current mesh. Once used this iterator
-/// must be free by the caller
+/// Return an iterator on nodes of the current mesh
///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
{
- typedef SMDS_Mesh::SetOfNodes SetOfNodes;
- const SetOfNodes& mySet;
- SetOfNodes::iterator myIterator;
+ const SMDS_IdElementMap& myIdElemMap;
+ SMDS_IdElementMap::const_iterator myIterator;
public:
- SMDS_Mesh_MyNodeIterator(const SetOfNodes& s):mySet(s)
+ SMDS_Mesh_MyNodeIterator(const SMDS_IdElementMap& s):myIdElemMap(s)
{
- myIterator=mySet.begin();
+ myIterator=myIdElemMap.begin();
}
bool more()
{
- return myIterator!=mySet.end();
+ return myIterator!=myIdElemMap.end();
}
const SMDS_MeshNode* next()
{
- const SMDS_MeshNode* current=*myIterator;
+ const SMDS_MeshElement* current=(*myIterator).second;
myIterator++;
- return current;
- }
+ return static_cast<const SMDS_MeshNode*>( current );
+ }
};
SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
{
- return SMDS_NodeIteratorPtr(new SMDS_Mesh_MyNodeIterator(myNodes));
+ return SMDS_NodeIteratorPtr
+ (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->GetIdElementMap()));
+}
+///////////////////////////////////////////////////////////////////////////////
+/// Return an iterator on nodes of the current mesh
+///////////////////////////////////////////////////////////////////////////////
+class SMDS_Mesh_MyElemIterator:public SMDS_ElemIterator
+{
+ const SMDS_IdElementMap& myIdElemMap;
+ SMDS_IdElementMap::const_iterator myIterator;
+ public:
+ SMDS_Mesh_MyElemIterator(const SMDS_IdElementMap& s):myIdElemMap(s)
+ {
+ myIterator=myIdElemMap.begin();
+ }
+
+ bool more()
+ {
+ return myIterator!=myIdElemMap.end();
+ }
+
+ const SMDS_MeshElement* next()
+ {
+ const SMDS_MeshElement* current=(*myIterator).second;
+ myIterator++;
+ return current;
+ }
+};
+
+SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const
+{
+ return SMDS_ElemIteratorPtr
+ (new SMDS_Mesh_MyElemIterator(myElementIDFactory->GetIdElementMap()));
}
///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on volumes of the current mesh. Once used this iterator
-///must be free by the caller
+///Return an iterator on volumes of the current mesh.
///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator
{
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
list<const SMDS_MeshElement *>& removedElems,
list<const SMDS_MeshElement *>& removedNodes,
- const bool removenodes)
+ bool removenodes)
{
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
// get exclusive nodes (which would become free afterwards)
set<const SMDS_MeshElement*> * s2;
- if (s1->empty() && elem->GetType() == SMDSAbs_Node)
+ if (elem->GetType() == SMDSAbs_Node) // a node is removed
{
+ // do not remove nodes except elem
s2 = new set<const SMDS_MeshElement*>();
s2->insert(elem);
+ removenodes = true;
}
else
s2 = getExclusiveNodes(*s1);
return true;
return false;
}
+
+//=======================================================================
+//function : MaxNodeID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MaxNodeID() const
+{
+ return myNodeIDFactory->GetMaxID();
+}
+
+//=======================================================================
+//function : MinNodeID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MinNodeID() const
+{
+ return myNodeIDFactory->GetMinID();
+}
+
+//=======================================================================
+//function : MaxElementID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MaxElementID() const
+{
+ return myElementIDFactory->GetMaxID();
+}
+
+//=======================================================================
+//function : MinElementID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MinElementID() const
+{
+ return myElementIDFactory->GetMinID();
+}
+
+//=======================================================================
+//function : Renumber
+//purpose : Renumber all nodes or elements.
+//=======================================================================
+
+void SMDS_Mesh::Renumber (const bool isNodes, const int startID, const int deltaID)
+{
+ if ( deltaID == 0 )
+ return;
+
+ SMDS_MeshElementIDFactory * idFactory =
+ isNodes ? myNodeIDFactory : myElementIDFactory;
+
+ // get existing elements in the order of ID increasing and release their ids
+ list< SMDS_MeshElement * > elemList;
+ const SMDS_IdElementMap& idElemMap = idFactory->GetIdElementMap();
+ SMDS_IdElementMap::const_iterator idElemIt = idElemMap.begin();
+ while ( idElemIt != idElemMap.end() ) {
+ SMDS_MeshElement* elem = (*idElemIt).second;
+ int id = (*idElemIt).first;
+ idElemIt++;
+ elemList.push_back( elem );
+ idFactory->ReleaseID( id );
+ }
+ // set new IDs
+ int ID = startID;
+ list< SMDS_MeshElement * >::iterator elemIt = elemList.begin();
+ for ( ; elemIt != elemList.end(); elemIt++ )
+ {
+ idFactory->BindID( ID, *elemIt );
+ ID += deltaID;
+ }
+}
+
#include <set>
#include <list>
-class SMDSControl_BoundaryEdges;
-
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
SMDS_EdgeIteratorPtr edgesIterator() const;
SMDS_FaceIteratorPtr facesIterator() const;
SMDS_VolumeIteratorPtr volumesIterator() const;
-
+ SMDS_ElemIteratorPtr elementsIterator() const;
+
SMDS_Mesh *AddSubMesh();
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
const SMDS_MeshFace * f6);
virtual void RemoveElement(const SMDS_MeshElement * elem,
- list<const SMDS_MeshElement *>& removedElems,
- list<const SMDS_MeshElement *>& removedNodes,
+ std::list<const SMDS_MeshElement *>& removedElems,
+ std::list<const SMDS_MeshElement *>& removedNodes,
const bool removenodes = false);
- virtual void RemoveElement(const SMDS_MeshElement * elem, const bool removenodes = false);
+ virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false);
virtual void RemoveNode(const SMDS_MeshNode * node);
virtual void RemoveEdge(const SMDS_MeshEdge * edge);
virtual void RemoveFace(const SMDS_MeshFace * face);
virtual bool RemoveFromParent();
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
-
+
+ static bool ChangeElementNodes(const SMDS_MeshElement * elem,
+ const SMDS_MeshNode * nodes[],
+ const int nbnodes);
+
+ virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
+ // Renumber all nodes or elements.
+
const SMDS_MeshNode *FindNode(int idnode) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
const SMDS_MeshElement *FindElement(int IDelem) const;
-
+ static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2);
+ static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
+ const SMDS_MeshNode *n2,
+ const SMDS_MeshNode *n3);
+ static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
+ const SMDS_MeshNode *n2,
+ const SMDS_MeshNode *n3,
+ const SMDS_MeshNode *n4);
+ int MaxNodeID() const;
+ int MinNodeID() const;
+ int MaxElementID() const;
+ int MinElementID() const;
+
+
int NbNodes() const;
int NbEdges() const;
int NbFaces() const;
*/
bool Contains (const SMDS_MeshElement* elem) const;
- typedef set<SMDS_MeshNode *> SetOfNodes;
- typedef set<SMDS_MeshEdge *> SetOfEdges;
- typedef set<SMDS_MeshFace *> SetOfFaces;
- typedef set<SMDS_MeshVolume *> SetOfVolumes;
+ typedef std::set<SMDS_MeshNode *> SetOfNodes;
+ typedef std::set<SMDS_MeshEdge *> SetOfEdges;
+ typedef std::set<SMDS_MeshFace *> SetOfFaces;
+ typedef std::set<SMDS_MeshVolume *> SetOfVolumes;
private:
SMDS_Mesh(SMDS_Mesh * parent);
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3);
-
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4);
-
- bool registerElement(int ID, SMDS_MeshElement * element);
-
- const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2) const;
-
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
-
- const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
- const SMDS_MeshNode *n2,
- const SMDS_MeshNode *n3) const;
-
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
-
- const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
- const SMDS_MeshNode *n2,
- const SMDS_MeshNode *n3,
- const SMDS_MeshNode *n4) const;
-
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
- void addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
+ bool registerElement(int ID, SMDS_MeshElement * element);
+
+ void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
- set<const SMDS_MeshElement*>& nodes);
+ std::set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE
SetOfFaces myFaces;
SetOfVolumes myVolumes;
SMDS_Mesh *myParent;
- list<SMDS_Mesh *> myChildren;
+ std::list<SMDS_Mesh *> myChildren;
SMDS_MeshElementIDFactory *myNodeIDFactory;
SMDS_MeshElementIDFactory *myElementIDFactory;
bool myHasInverseElements;
};
+
#endif
#include "SMDS_MeshEdge.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
-#include <iostream>
+
+using namespace std;
//=======================================================================
//function : SMDS_MeshEdge
else if(id11==id21) return (id21<id22);
else return false;
}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose :
+//=======================================================================
+
+bool SMDS_MeshEdge::ChangeNodes(const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2)
+{
+ myNodes[0]=node1;
+ myNodes[1]=node2;
+ return true;
+}
+
public:
SMDS_MeshEdge(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2);
- void Print(ostream & OS) const;
+ bool ChangeNodes(const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2);
+ void Print(std::ostream & OS) const;
SMDSAbs_ElementType GetType() const;
int NbNodes() const;
#include "SMDS_MeshVolume.hxx"
#include "utilities.h"
+using namespace std;
+
SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID)
{
}
default : MESSAGE("Internal Error");
}
+ return false;
}
#include <vector>
#include <iostream>
-using namespace std;
class SMDS_MeshNode;
class SMDS_MeshEdge;
class SMDS_MeshFace;
///Return the type of the current element
virtual SMDSAbs_ElementType GetType() const = 0;
- friend ostream & operator <<(ostream & OS, const SMDS_MeshElement *);
+ friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
protected:
SMDS_MeshElement(int ID=-1);
- virtual void Print(ostream & OS) const;
+ virtual void Print(std::ostream & OS) const;
private:
int myID;
#include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_MeshElement.hxx"
+using namespace std;
+
//=======================================================================
//function : SMDS_MeshElementIDFactory
//purpose :
myIDElements.erase(ID);
SMDS_MeshIDFactory::ReleaseID(ID);
}
+
+//=======================================================================
+//function : GetMaxID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshElementIDFactory::GetMaxID() const
+{
+ map<int, SMDS_MeshElement*>::const_reverse_iterator it = myIDElements.rbegin();
+ if ( it != myIDElements.rend() )
+ return (*it).first;
+
+ return 0;
+}
+
+//=======================================================================
+//function : GetMinID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshElementIDFactory::GetMinID() const
+{
+ map<int, SMDS_MeshElement*>::const_iterator it = myIDElements.begin();
+ if ( it != myIDElements.end() )
+ return (*it).first;
+
+ return 0;
+}
+
#include "SMDS_MeshIDFactory.hxx"
#include <map>
-using namespace std;
class SMDS_MeshElement;
+typedef std::map<int, SMDS_MeshElement *> SMDS_IdElementMap;
+
class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
{
public:
SMDS_MeshElement * MeshElement(int ID);
virtual int GetFreeID();
virtual void ReleaseID(int ID);
+ int GetMaxID() const;
+ int GetMinID() const;
+ const SMDS_IdElementMap & GetIdElementMap() const { return myIDElements; }
private:
- map<int, SMDS_MeshElement *> myIDElements;
+ SMDS_IdElementMap myIDElements;
};
// Author : Jean-Michel BOULCOURT
// Module : SMESH
-using namespace std;
#include "SMDS_MeshGroup.hxx"
#include "utilities.h"
+
+using namespace std;
+
//=======================================================================
//function : SMDS_MeshGroup
//purpose :
#include "SMDS_Mesh.hxx"
#include <set>
-using namespace std;
+
class SMDS_MeshGroup:public SMDS_MeshObject
{
bool Contains(const SMDS_MeshElement * theElem) const;
void InitIterator() const
- { const_cast<iterator&>(myIterator) = myElements.begin(); }
+ { const_cast<TIterator&>(myIterator) = myElements.begin(); }
bool More() const { return myIterator != myElements.end(); }
const SMDS_MeshElement* Next() const
- { return *(const_cast<iterator&>(myIterator))++; }
+ { return *(const_cast<TIterator&>(myIterator))++; }
private:
SMDS_MeshGroup(SMDS_MeshGroup* theParent,
const SMDSAbs_ElementType theType = SMDSAbs_All);
- typedef set<const SMDS_MeshElement *>::iterator iterator;
+ typedef std::set<const SMDS_MeshElement *>::iterator TIterator;
const SMDS_Mesh * myMesh;
SMDSAbs_ElementType myType;
- set<const SMDS_MeshElement *> myElements;
+ std::set<const SMDS_MeshElement *> myElements;
SMDS_MeshGroup * myParent;
- list<const SMDS_MeshGroup*> myChildren;
- iterator myIterator;
+ std::list<const SMDS_MeshGroup*> myChildren;
+ TIterator myIterator;
};
#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshHexahedron.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshHexahedron.ixx"
-#include <Standard_ConstructionError.hxx>
-
-
-//=======================================================================
-//function : SMDS_MeshHexahedron
-//purpose : Hexaedra
-//=======================================================================
-
-SMDS_MeshHexahedron::SMDS_MeshHexahedron(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5,
- const Standard_Integer idnode6,
- const Standard_Integer idnode7,
- const Standard_Integer idnode8):SMDS_MeshVolume(ID,8)
-{
- SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8);
- ComputeKey();
-}
-
-
-//=======================================================================
-//function : SetConnections
-//purpose : Heaxahedron
-//=======================================================================
-void SMDS_MeshHexahedron::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5,
- const Standard_Integer idnode6,
- const Standard_Integer idnode7,
- const Standard_Integer idnode8)
-{
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
- idmin = (idmin < idnode4 ? idmin : idnode4);
- idmin = (idmin < idnode5 ? idmin : idnode5);
- idmin = (idmin < idnode6 ? idmin : idnode6);
- idmin = (idmin < idnode7 ? idmin : idnode7);
- idmin = (idmin < idnode8 ? idmin : idnode8);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) { // 1 2 3 4 5 6 7 8
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- myNodes[3] = idnode4;
- myNodes[4] = idnode5;
- myNodes[5] = idnode6;
- myNodes[6] = idnode7;
- myNodes[7] = idnode8;
- } else if (idmin == idnode2) { // 2 3 4 1 6 7 8 5
- myNodes[1] = idnode3;
- myNodes[2] = idnode4;
- myNodes[3] = idnode1;
- myNodes[4] = idnode6;
- myNodes[5] = idnode7;
- myNodes[6] = idnode8;
- myNodes[7] = idnode5;
- } else if (idmin == idnode3) { // 3 4 1 2 7 8 5 6
- myNodes[1] = idnode4;
- myNodes[2] = idnode1;
- myNodes[3] = idnode2;
- myNodes[4] = idnode7;
- myNodes[5] = idnode8;
- myNodes[6] = idnode5;
- myNodes[7] = idnode6;
- } else if (idmin == idnode4) { // 4 1 2 3 8 5 6 7
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- myNodes[3] = idnode3;
- myNodes[4] = idnode8;
- myNodes[5] = idnode5;
- myNodes[6] = idnode6;
- myNodes[7] = idnode7;
- } else if (idmin == idnode5) { // 5 6 7 8 1 2 3 4
- myNodes[1] = idnode6;
- myNodes[2] = idnode7;
- myNodes[3] = idnode8;
- myNodes[4] = idnode1;
- myNodes[5] = idnode2;
- myNodes[6] = idnode3;
- myNodes[7] = idnode4;
- } else if (idmin == idnode6){ // 6 7 8 5 2 3 4 1
- myNodes[1] = idnode7;
- myNodes[2] = idnode8;
- myNodes[3] = idnode5;
- myNodes[4] = idnode2;
- myNodes[5] = idnode3;
- myNodes[6] = idnode4;
- myNodes[7] = idnode1;
- } else if (idmin == idnode7) { // 7 8 5 6 3 4 1 2
- myNodes[1] = idnode8;
- myNodes[2] = idnode5;
- myNodes[3] = idnode6;
- myNodes[4] = idnode3;
- myNodes[5] = idnode4;
- myNodes[6] = idnode1;
- myNodes[7] = idnode2;
- } else { // 8 5 6 7 4 1 2 3
- myNodes[1] = idnode5;
- myNodes[2] = idnode6;
- myNodes[3] = idnode7;
- myNodes[4] = idnode4;
- myNodes[5] = idnode1;
- myNodes[6] = idnode2;
- myNodes[7] = idnode3;
- }
-
-}
-
-//=======================================================================
-//function : NodesOfFace
-//purpose : returns the rank node in mynodes. Useful to extract faces from volume
-//=======================================================================
-Standard_Integer SMDS_MeshHexahedron::NodesOfFace(const Standard_Integer rankface,
- const Standard_Integer ranknode)
-{
- static Standard_Integer facenode[6][4] = {
- {0,1,2,3},
- {4,7,6,5},
- {0,4,5,1},
- {1,5,6,2},
- {2,6,7,3},
- {0,3,7,4}
- };
-
- return facenode[rankface-1][ranknode-1];
-}
-
-//=======================================================================
-//function : NodesOfEdge
-//purpose : returns the rank node in mynodes. Useful to extract edges from volume
-//=======================================================================
-Standard_Integer SMDS_MeshHexahedron::NodesOfEdge(const Standard_Integer rankedge,
- const Standard_Integer ranknode) const
-{
- static Standard_Integer faceedge[12][2] = {
- {0,1},
- {1,2},
- {2,3},
- {0,3},
- {4,7},
- {6,7},
- {5,6},
- {4,5},
- {0,4},
- {1,5},
- {2,6},
- {3,7}
-
- };
-
- return faceedge[rankedge-1][ranknode-1];
-}
-
-//=======================================================================
-//function : GetFaceDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshHexahedron::GetFaceDefinedByNodes(const Standard_Integer rank,
- const Standard_Address idnode,
- Standard_Integer& nb) const
-{
- Standard_Integer *ptr;
- nb = 4;
- ptr = (Standard_Integer *)idnode;
- ptr[0] = myNodes[NodesOfFace(rank,1)];
- ptr[1] = myNodes[NodesOfFace(rank,2)];
- ptr[2] = myNodes[NodesOfFace(rank,3)];
- ptr[3] = myNodes[NodesOfFace(rank,4)];
-
-}
-
-//=======================================================================
-//function : GetEdgeDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshHexahedron::GetEdgeDefinedByNodes(const Standard_Integer rank,
- Standard_Integer& idnode1,
- Standard_Integer& idnode2) const
-{
- idnode1 = myNodes[NodesOfEdge(rank,1)];
- idnode2 = myNodes[NodesOfEdge(rank,2)];
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshHexahedron.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshHexahedron_HeaderFile
-#define _SMDS_MeshHexahedron_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshHexahedron_HeaderFile
-#include "Handle_SMDS_MeshHexahedron.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_MeshVolume_HeaderFile
-#include "SMDS_MeshVolume.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-class Standard_ConstructionError;
-
-
-class SMDS_MeshHexahedron : public SMDS_MeshVolume {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshHexahedron(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8);
-Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT inline Standard_Integer NbEdges() const;
-Standard_EXPORT inline Standard_Integer NbFaces() const;
-Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ;
-Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const;
-Standard_EXPORT ~SMDS_MeshHexahedron();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshHexahedron_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[8];
-
-
-};
-
-
-#include "SMDS_MeshHexahedron.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
#include "SMDS_MeshIDFactory.hxx"
+using namespace std;
+
//=======================================================================
//function : SMDS_MeshIDFactory
//purpose :
#include "SMDS_MeshObject.hxx"
#include <stack>
-using namespace std;
+
class SMDS_MeshIDFactory:public SMDS_MeshObject
{
protected:
SMDS_MeshIDFactory();
int myMaxID;
- stack<int> myPoolOfID;
+ std::stack<int> myPoolOfID;
};
#endif
#include "SMDS_SpacePosition.hxx"
#include "SMDS_IteratorOfElements.hxx"
+using namespace std;
+
//=======================================================================
//function : SMDS_MeshNode
//purpose :
#include "SMDS_Position.hxx"
#include <set>
-using namespace std;
+
class SMDS_MeshNode:public SMDS_MeshElement
{
public:
SMDS_MeshNode(double x, double y, double z);
- void Print(ostream & OS) const;
+ void Print(std::ostream & OS) const;
double X() const;
double Y() const;
double Z() const;
private:
double myX, myY, myZ;
SMDS_PositionPtr myPosition;
- set<const SMDS_MeshElement*> myInverseElements;
+ std::set<const SMDS_MeshElement*> myInverseElements;
};
#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshNodeIDFactory.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshNodeIDFactory.ixx"
-
-//=======================================================================
-//function : SMDS_MeshNodeIDFactory
-//purpose :
-//=======================================================================
-
-SMDS_MeshNodeIDFactory::SMDS_MeshNodeIDFactory() : SMDS_MeshIDFactory()
-{
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshNodeIDFactory.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshNodeIDFactory_HeaderFile
-#define _SMDS_MeshNodeIDFactory_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshNodeIDFactory_HeaderFile
-#include "Handle_SMDS_MeshNodeIDFactory.hxx"
-#endif
-
-#ifndef _SMDS_MeshIDFactory_HeaderFile
-#include "SMDS_MeshIDFactory.hxx"
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-
-
-class SMDS_MeshNodeIDFactory : public SMDS_MeshIDFactory {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshNodeIDFactory();
-Standard_EXPORT inline Standard_Integer GetFreeID() ;
-Standard_EXPORT inline void ReleaseID(const Standard_Integer ID) ;
-Standard_EXPORT ~SMDS_MeshNodeIDFactory();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshNodeIDFactory_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-#include "SMDS_MeshNodeIDFactory.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshPrism.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshPrism.ixx"
-#include "Standard_ConstructionError.hxx"
-
-
-//=======================================================================
-//function : SMDS_MeshPrism
-//purpose : Prism
-//=======================================================================
-
-SMDS_MeshPrism::SMDS_MeshPrism(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5,
- const Standard_Integer idnode6):SMDS_MeshVolume(ID,6)
-{
- SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6);
- ComputeKey();
-}
-
-
-//=======================================================================
-//function : SetConnections
-//purpose : Prism
-//=======================================================================
-void SMDS_MeshPrism::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5,
- const Standard_Integer idnode6)
-{
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
- idmin = (idmin < idnode4 ? idmin : idnode4);
- idmin = (idmin < idnode5 ? idmin : idnode5);
- idmin = (idmin < idnode6 ? idmin : idnode6);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) { // 1 2 3 4 5 6
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- myNodes[3] = idnode4;
- myNodes[4] = idnode5;
- myNodes[5] = idnode6;
- } else if (idmin == idnode2) { // 2 3 1 5 6 4
- myNodes[1] = idnode3;
- myNodes[2] = idnode1;
- myNodes[3] = idnode5;
- myNodes[4] = idnode6;
- myNodes[5] = idnode4;
- } else if (idmin == idnode3) { // 3 1 2 6 4 5
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- myNodes[3] = idnode6;
- myNodes[4] = idnode4;
- myNodes[5] = idnode5;
- } else if (idmin == idnode4) { // 4 5 6 1 2 3
- myNodes[1] = idnode5;
- myNodes[2] = idnode6;
- myNodes[3] = idnode1;
- myNodes[4] = idnode2;
- myNodes[5] = idnode3;
- } else if (idmin == idnode5) { // 5 6 4 2 3 1
- myNodes[1] = idnode6;
- myNodes[2] = idnode4;
- myNodes[3] = idnode2;
- myNodes[4] = idnode3;
- myNodes[5] = idnode1;
- } else { // 6 4 5 3 1 2
- myNodes[1] = idnode4;
- myNodes[2] = idnode5;
- myNodes[3] = idnode3;
- myNodes[4] = idnode1;
- myNodes[5] = idnode2;
- }
-
-}
-
-
-//=======================================================================
-//function : NodesOfFace
-//purpose : returns the rank node in mynodes. Useful to extract faces from volume
-//=======================================================================
-Standard_Integer SMDS_MeshPrism::NodesOfFace(const Standard_Integer rankface,
- const Standard_Integer ranknode)
-{
- static Standard_Integer facenode[5][4] = {
- {0,1,2,-1},
- {3,5,4,-1},
- {0,3,4,1},
- {1,4,5,2},
- {2,5,3,0}
- };
-
- return facenode[rankface-1][ranknode-1];
-}
-
-//=======================================================================
-//function : NodesOfEdge
-//purpose : returns the rank node in mynodes. Useful to extract edges from volume
-//=======================================================================
-Standard_Integer SMDS_MeshPrism::NodesOfEdge(const Standard_Integer rankedge,
- const Standard_Integer ranknode) const
-{
- static Standard_Integer faceedge[9][2] = {
- {0,1},
- {1,2},
- {0,2},
- {3,5},
- {4,5},
- {3,4},
- {0,3},
- {1,4},
- {2,5}
-
- };
-
- return faceedge[rankedge-1][ranknode-1];
-}
-
-//=======================================================================
-//function : GetFaceDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshPrism::GetFaceDefinedByNodes(const Standard_Integer rank,
- const Standard_Address idnode,
- Standard_Integer& nb) const
-{
- Standard_Integer *ptr;
- ptr = (Standard_Integer *)idnode;
- ptr[0] = myNodes[NodesOfFace(rank,1)];
- ptr[1] = myNodes[NodesOfFace(rank,2)];
- ptr[2] = myNodes[NodesOfFace(rank,3)];
- ptr[3] = myNodes[NodesOfFace(rank,4)];
- nb = (NodesOfFace(rank,4) == -1 ? 3 : 4);
- if (nb == 4)
- ptr[3] = myNodes[NodesOfFace(rank,4)];
-
-}
-
-//=======================================================================
-//function : GetEdgeDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshPrism::GetEdgeDefinedByNodes(const Standard_Integer rank,
- Standard_Integer& idnode1,
- Standard_Integer& idnode2) const
-{
- idnode1 = myNodes[NodesOfEdge(rank,1)];
- idnode2 = myNodes[NodesOfEdge(rank,2)];
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshPrism.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshPrism_HeaderFile
-#define _SMDS_MeshPrism_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshPrism_HeaderFile
-#include "Handle_SMDS_MeshPrism.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include "Standard_Integer.hxx"
-#endif
-#ifndef _SMDS_MeshVolume_HeaderFile
-#include "SMDS_MeshVolume.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-class Standard_ConstructionError;
-
-
-class SMDS_MeshPrism : public SMDS_MeshVolume {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshPrism(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6);
-Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT inline Standard_Integer NbEdges() const;
-Standard_EXPORT inline Standard_Integer NbFaces() const;
-Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ;
-Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const;
-Standard_EXPORT ~SMDS_MeshPrism();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshPrism_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[6];
-
-
-};
-
-
-#include "SMDS_MeshPrism.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshPyramid.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshPyramid.ixx"
-#include <Standard_ConstructionError.hxx>
-
-
-//=======================================================================
-//function : SMDS_MeshPyramid
-//purpose : Pyramid
-//=======================================================================
-
-SMDS_MeshPyramid::SMDS_MeshPyramid(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5):SMDS_MeshVolume(ID,5)
-{
- SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5);
- ComputeKey();
-}
-
-
-
-//=======================================================================
-//function : SetConnections
-//purpose : Pyramid
-//=======================================================================
-void SMDS_MeshPyramid::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4,
- const Standard_Integer idnode5)
-{
-
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
- idmin = (idmin < idnode4 ? idmin : idnode4);
- idmin = (idmin < idnode5 ? idmin : idnode5);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) { // 1 2 3 4 5
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- myNodes[3] = idnode4;
- myNodes[4] = idnode5;
- } else if (idmin == idnode2) { // 2 3 4 5 1
- myNodes[1] = idnode3;
- myNodes[2] = idnode4;
- myNodes[3] = idnode5;
- myNodes[4] = idnode1;
- } else if (idmin == idnode3) { // 3 4 5 1 2
- myNodes[1] = idnode4;
- myNodes[2] = idnode5;
- myNodes[3] = idnode1;
- myNodes[4] = idnode2;
- } else if (idmin == idnode4) { // 4 5 1 2 3
- myNodes[1] = idnode5;
- myNodes[2] = idnode1;
- myNodes[3] = idnode2;
- myNodes[4] = idnode3;
- } else { // 5 1 2 3 4
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- myNodes[3] = idnode3;
- myNodes[4] = idnode4;
- }
-
-}
-
-//=======================================================================
-//function : NodesOfFace
-//purpose : returns the rank node in mynodes. Useful to extract faces from volume
-//=======================================================================
-Standard_Integer SMDS_MeshPyramid::NodesOfFace(const Standard_Integer rankface,
- const Standard_Integer ranknode)
-{
- static Standard_Integer facenode[5][4] = {
- {0,1,2,3},
- {0,4,1,-1},
- {1,4,2,-1},
- {2,4,3,-1},
- {0,3,4,-1}
- };
-
- return facenode[rankface-1][ranknode-1];
-}
-
-//=======================================================================
-//function : NodesOfEdge
-//purpose : returns the rank node in mynodes. Useful to extract edges from volume
-//=======================================================================
-Standard_Integer SMDS_MeshPyramid::NodesOfEdge(const Standard_Integer rankedge,
- const Standard_Integer ranknode) const
-{
- static Standard_Integer faceedge[8][2] = {
- {0,1},
- {1,2},
- {2,3},
- {0,3},
- {0,4},
- {1,4},
- {2,4},
- {3,4}
-
- };
-
- return faceedge[rankedge-1][ranknode-1];
-}
-
-
-//=======================================================================
-//function : GetFaceDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshPyramid::GetFaceDefinedByNodes(const Standard_Integer rank,
- const Standard_Address idnode,
- Standard_Integer& nb) const
-{
- Standard_Integer *ptr;
- ptr = (Standard_Integer *)idnode;
- ptr[0] = myNodes[NodesOfFace(rank,1)];
- ptr[1] = myNodes[NodesOfFace(rank,2)];
- ptr[2] = myNodes[NodesOfFace(rank,3)];
- nb = (NodesOfFace(rank,4) == -1 ? 3 : 4);
- if (nb == 4)
- ptr[3] = myNodes[NodesOfFace(rank,4)];
-
-}
-
-//=======================================================================
-//function : GetEdgeDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshPyramid::GetEdgeDefinedByNodes(const Standard_Integer rank,
- Standard_Integer& idnode1,
- Standard_Integer& idnode2) const
-{
- idnode1 = myNodes[NodesOfEdge(rank,1)];
- idnode2 = myNodes[NodesOfEdge(rank,2)];
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshPyramid.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshPyramid_HeaderFile
-#define _SMDS_MeshPyramid_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshPyramid_HeaderFile
-#include "Handle_SMDS_MeshPyramid.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_MeshVolume_HeaderFile
-#include "SMDS_MeshVolume.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-class Standard_ConstructionError;
-
-
-class SMDS_MeshPyramid : public SMDS_MeshVolume {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshPyramid(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5);
-Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
-Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT inline Standard_Integer NbEdges() const;
-Standard_EXPORT inline Standard_Integer NbFaces() const;
-Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ;
-Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const;
-Standard_EXPORT ~SMDS_MeshPyramid();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshPyramid_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[5];
-
-
-};
-
-
-#include "SMDS_MeshPyramid.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshQuadrangle.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshQuadrangle.ixx"
-
-
-
-//=======================================================================
-//function : SMDS_MeshQuadrangle
-//purpose :
-//=======================================================================
-
-SMDS_MeshQuadrangle::SMDS_MeshQuadrangle(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4):SMDS_MeshFace(ID,4)
-{
- SetConnections(idnode1,idnode2,idnode3,idnode4);
- ComputeKey();
-}
-
-
-
-//=======================================================================
-//function : SetConnections
-//purpose :
-//=======================================================================
-void SMDS_MeshQuadrangle::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4)
-{
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
- idmin = (idmin < idnode4 ? idmin : idnode4);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) {
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- myNodes[3] = idnode4;
- } else if (idmin == idnode2) {
- myNodes[1] = idnode3;
- myNodes[2] = idnode4;
- myNodes[3] = idnode1;
- } else if (idmin == idnode3) {
- myNodes[1] = idnode4;
- myNodes[2] = idnode1;
- myNodes[3] = idnode2;
- } else {
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- myNodes[3] = idnode3;
- }
-
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshQuadrangle.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshQuadrangle_HeaderFile
-#define _SMDS_MeshQuadrangle_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshQuadrangle_HeaderFile
-#include "Handle_SMDS_MeshQuadrangle.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_MeshFace_HeaderFile
-#include "SMDS_MeshFace.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-
-
-class SMDS_MeshQuadrangle : public SMDS_MeshFace {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshQuadrangle(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4);
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT ~SMDS_MeshQuadrangle();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshQuadrangle_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[4];
-
-
-};
-
-
-#include "SMDS_MeshQuadrangle.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshTetrahedron.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshTetrahedron.ixx"
-#include "Standard_ConstructionError.hxx"
-
-//=======================================================================
-//function : SMDS_MeshTetrahedron
-//purpose : Tetrahedra
-//=======================================================================
-
-SMDS_MeshTetrahedron::SMDS_MeshTetrahedron(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4):SMDS_MeshVolume(ID,4)
-{
- SetConnections(idnode1,idnode2,idnode3,idnode4);
- ComputeKey();
-}
-
-
-//=======================================================================
-//function : SetConnections
-//purpose : Tetrahedra
-//=======================================================================
-void SMDS_MeshTetrahedron::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3,
- const Standard_Integer idnode4)
-{
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
- idmin = (idmin < idnode4 ? idmin : idnode4);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) {
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- myNodes[3] = idnode4;
- } else if (idmin == idnode2) {
- myNodes[1] = idnode3;
- myNodes[2] = idnode4;
- myNodes[3] = idnode1;
- } else if (idmin == idnode3) {
- myNodes[1] = idnode4;
- myNodes[2] = idnode1;
- myNodes[3] = idnode2;
- } else {
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- myNodes[3] = idnode3;
- }
-
-}
-
-
-//=======================================================================
-//function : NodesOfFace
-//purpose : returns the rank node in mynodes. Useful to extract faces from volume
-//=======================================================================
-Standard_Integer SMDS_MeshTetrahedron::NodesOfFace(const Standard_Integer rankface,
- const Standard_Integer ranknode)
-{
- static Standard_Integer facenode[4][3] = {
- {0,1,2},
- {0,3,1},
- {1,3,2},
- {0,2,3}
- };
-
- return facenode[rankface-1][ranknode-1];
-}
-
-
-//=======================================================================
-//function : NodesOfEdge
-//purpose : returns the rank node in mynodes. Useful to extract edges from volume
-//=======================================================================
-Standard_Integer SMDS_MeshTetrahedron::NodesOfEdge(const Standard_Integer rankedge,
- const Standard_Integer ranknode) const
-{
- static Standard_Integer faceedge[6][2] = {
- {0,1},
- {1,2},
- {0,2},
- {0,3},
- {1,3},
- {2,3}
- };
-
- return faceedge[rankedge-1][ranknode-1];
-}
-
-
-//=======================================================================
-//function : GetFaceDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshTetrahedron::GetFaceDefinedByNodes(const Standard_Integer rank,
- const Standard_Address idnode,
- Standard_Integer& nb) const
-{
- Standard_Integer *ptr;
- nb = 3;
- ptr = (Standard_Integer *)idnode;
- ptr[0] = myNodes[NodesOfFace(rank,1)];
- ptr[1] = myNodes[NodesOfFace(rank,2)];
- ptr[2] = myNodes[NodesOfFace(rank,3)];
-
-}
-
-//=======================================================================
-//function : GetEdgeDefinedByNodes
-//purpose :
-//=======================================================================
-void SMDS_MeshTetrahedron::GetEdgeDefinedByNodes(const Standard_Integer rank,
- Standard_Integer& idnode1,
- Standard_Integer& idnode2) const
-{
- idnode1 = myNodes[NodesOfEdge(rank,1)];
- idnode2 = myNodes[NodesOfEdge(rank,2)];
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshTetrahedron.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshTetrahedron_HeaderFile
-#define _SMDS_MeshTetrahedron_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshTetrahedron_HeaderFile
-#include "Handle_SMDS_MeshTetrahedron.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_MeshVolume_HeaderFile
-#include "SMDS_MeshVolume.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-class Standard_ConstructionError;
-
-
-class SMDS_MeshTetrahedron : public SMDS_MeshVolume {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshTetrahedron(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4);
-Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
-Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT inline Standard_Integer NbEdges() const;
-Standard_EXPORT inline Standard_Integer NbFaces() const;
-Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ;
-Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const;
-Standard_EXPORT ~SMDS_MeshTetrahedron();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshTetrahedron_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[4];
-
-
-};
-
-
-#include "SMDS_MeshTetrahedron.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshTriangle.cxx
-// Author : Jean-Michel BOULCOURT
-// Module : SMESH
-
-using namespace std;
-#include "SMDS_MeshTriangle.ixx"
-
-
-//=======================================================================
-//function : SMDS_MeshTriangle
-//purpose :
-//=======================================================================
-
-SMDS_MeshTriangle::SMDS_MeshTriangle(const Standard_Integer ID,
- const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3):SMDS_MeshFace(ID,3)
-{
- SetConnections(idnode1,idnode2,idnode3);
- ComputeKey();
-}
-
-
-//=======================================================================
-//function : SetConnections
-//purpose :
-//=======================================================================
-void SMDS_MeshTriangle::SetConnections(const Standard_Integer idnode1,
- const Standard_Integer idnode2,
- const Standard_Integer idnode3)
-{
- Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
- idmin = (idmin < idnode3 ? idmin : idnode3);
-
- myNodes[0] = idmin;
- if (idmin == idnode1) {
- myNodes[1] = idnode2;
- myNodes[2] = idnode3;
- } else if (idmin == idnode2) {
- myNodes[1] = idnode3;
- myNodes[2] = idnode1;
- } else {
- myNodes[1] = idnode1;
- myNodes[2] = idnode2;
- }
-
-}
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMDS_MeshTriangle.hxx
-// Module : SMESH
-
-#ifndef _SMDS_MeshTriangle_HeaderFile
-#define _SMDS_MeshTriangle_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SMDS_MeshTriangle_HeaderFile
-#include "Handle_SMDS_MeshTriangle.hxx"
-#endif
-
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _SMDS_MeshFace_HeaderFile
-#include "SMDS_MeshFace.hxx"
-#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-
-
-class SMDS_MeshTriangle : public SMDS_MeshFace {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SMDS_MeshTriangle(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3);
-Standard_EXPORT inline void ComputeKey() ;
-Standard_EXPORT inline void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
-Standard_EXPORT inline Standard_Address GetConnections() const;
-Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const;
-Standard_EXPORT ~SMDS_MeshTriangle();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshTriangle_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ;
-
-
- // Fields PRIVATE
- //
-Standard_Integer myNodes[3];
-
-
-};
-
-
-#include "SMDS_MeshTriangle.lxx"
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
{
return myShapeId;
}
+
+//=======================================================================
+//function : GetDim
+//purpose :
+//=======================================================================
+
+int SMDS_Position::GetDim() const
+{
+// switch ( GetTypeOfPosition() ) {
+// case SMDS_TOP_UNSPEC: return -1;
+// case SMDS_TOP_VERTEX: return 0;
+// case SMDS_TOP_EDGE: return 1;
+// case SMDS_TOP_FACE: return 2;
+// case SMDS_TOP_3DSPACE: return 3;
+// }
+ return GetTypeOfPosition();
+}
+
+
class SMDS_Position;
typedef boost::shared_ptr<SMDS_Position> SMDS_PositionPtr;
+
class SMDS_Position
{
public:
const virtual double * Coords() const = 0;
- virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const = 0;
+ virtual SMDS_TypeOfPosition GetTypeOfPosition() const = 0;
+ virtual int GetDim() const;
void SetShapeId(int aShapeId);
int GetShapeId() const;
virtual ~SMDS_Position() {}
private:
int myShapeId;
};
+
+
#endif
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-
-#include "SMDS_Tria3OfNodes.hxx"
-#include "SMDS_IteratorOfElements.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "utilities.h"
-
-//=======================================================================
-//function : NbEdges
-//purpose :
-//=======================================================================
-
-int SMDS_Tria3OfNodes::NbEdges() const
-{
- return 3;
-}
-
-int SMDS_Tria3OfNodes::NbFaces() const
-{
- return 3;
-}
-
-int SMDS_Tria3OfNodes::NbNodes() const
-{
- return 3;
-}
-//=======================================================================
-//function : Print
-//purpose :
-//=======================================================================
-
-void SMDS_Tria3OfNodes::Print(ostream & OS) const
-{
- OS << "face <" << GetID() << " > : ";
- int i;
- for (i = 0; i < NbNodes() - 1; i++) OS << myNodes[i] << ",";
- OS << myNodes[i] << ") " << endl;
-}
-
-class SMDS_Tria3OfNodes_MyIterator:public SMDS_ElemIterator
-{
- const SMDS_MeshNode * const* mySet;
- int index;
- public:
- SMDS_Tria3OfNodes_MyIterator(const SMDS_MeshNode * const* s):
- mySet(s),index(0) {}
-
- bool more()
- {
- return index<3;
- }
-
- const SMDS_MeshElement* next()
- {
- index++;
- return mySet[index-1];
- }
-};
-
-SMDS_ElemIteratorPtr SMDS_Tria3OfNodes::
- elementsIterator(SMDSAbs_ElementType type) const
-{
- switch(type)
- {
- case SMDSAbs_Face:
- return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
- case SMDSAbs_Node:
- return SMDS_ElemIteratorPtr(new SMDS_Tria3OfNodes_MyIterator(myNodes));
- case SMDSAbs_Edge:
- MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
- break;
- default:
- return SMDS_ElemIteratorPtr
- (new SMDS_IteratorOfElements
- (this,type,SMDS_ElemIteratorPtr(new SMDS_Tria3OfNodes_MyIterator(myNodes))));
- }
-}
-
-SMDS_Tria3OfNodes::SMDS_Tria3OfNodes(const SMDS_MeshNode* node1,
- const SMDS_MeshNode* node2,
- const SMDS_MeshNode* node3)
-{
- myNodes[0]=node1;
- myNodes[1]=node2;
- myNodes[2]=node3;
-}
-
-
+++ /dev/null
-// SMESH SMDS : implementaion of Salome mesh data structure
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-
-#ifndef _SMDS_Tria3OfNodes_HeaderFile
-#define _SMDS_Tria3OfNodes_HeaderFile
-
-#include <iostream>
-#include "SMDS_MeshFace.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "SMDS_Iterator.hxx"
-
-class SMDS_Tria3OfNodes:public SMDS_MeshFace
-{
- public:
- void Print(ostream & OS) const;
- SMDS_Tria3OfNodes(const SMDS_MeshNode* node1,
- const SMDS_MeshNode* node2,
- const SMDS_MeshNode* node3);
-
- int NbEdges() const;
- int NbFaces() const;
- int NbNodes() const;
- protected:
- SMDS_ElemIteratorPtr
- elementsIterator(SMDSAbs_ElementType type) const;
-
- private:
- const SMDS_MeshNode* myNodes[3];
-
-};
-
-#endif
#ifndef _SMDS_TypeOfPosition_HeaderFile
#define _SMDS_TypeOfPosition_HeaderFile
-enum SMDS_TypeOfPosition
+enum SMDS_TypeOfPosition // Value is equal to shape dimention
{
- SMDS_TOP_UNSPEC,
- SMDS_TOP_3DSPACE,
- SMDS_TOP_VERTEX,
- SMDS_TOP_EDGE,
- SMDS_TOP_FACE
+ SMDS_TOP_UNSPEC = -1,
+ SMDS_TOP_VERTEX = 0,
+ SMDS_TOP_EDGE = 1,
+ SMDS_TOP_FACE = 2,
+ SMDS_TOP_3DSPACE = 3
};
#endif
// Module : SMESH
#include "SMDS_VertexPosition.hxx"
+
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function : SMDS_VertexPosition
//purpose :
#include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_IteratorOfElements.hxx"
+
+using namespace std;
+
//=======================================================================
//function : Print
//purpose :
#include "SMDS_Iterator.hxx"
#include <vector>
#include <iostream>
-using namespace std;
+
class SMDS_VolumeOfFaces:public SMDS_MeshVolume
{
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6);
- void Print(ostream & OS) const;
+ void Print(std::ostream & OS) const;
int NbFaces() const;
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
- vector<const SMDS_MeshFace *> myFaces;
+ std::vector<const SMDS_MeshFace *> myFaces;
};
#endif
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#include "utilities.h"
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
+
+using namespace std;
///////////////////////////////////////////////////////////////////////////////
/// Create an hexahedron. node 1,2,3,4 and 5,6,7,8 are quadrangle and
myNodes[4]=node5;
myNodes[5]=node6;
}
+bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes)
+{
+ if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
+ return false;
+
+ myNodes.resize( nbNodes );
+ for ( int i = 0; i < nbNodes; i++ )
+ myNodes[ i ] = nodes [ i ];
+
+ return true;
+}
//=======================================================================
//function : Print
//purpose :
case 8: return 6;
default: MESSAGE("invalid number of nodes");
}
+ return 0;
}
int SMDS_VolumeOfNodes::NbNodes() const
case 8: return 12;
default: MESSAGE("invalid number of nodes");
}
+ return 0;
}
class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
#include "SMDS_MeshVolume.hxx"
#include <vector>
-using namespace std;
+
class SMDS_VolumeOfNodes:public SMDS_MeshVolume
{
const SMDS_MeshNode * node6,
const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8);
+ bool ChangeNodes(const SMDS_MeshNode* nodes[],
+ const int nbNodes);
- void Print(ostream & OS) const;
+ void Print(std::ostream & OS) const;
int NbFaces() const;
int NbNodes() const;
int NbEdges() const;
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
- vector<const SMDS_MeshNode *> myNodes;
+ std::vector<const SMDS_MeshNode *> myNodes;
};
#endif
--- /dev/null
+// File : SMDS_VolumeTool.cxx
+// Created : Tue Jul 13 12:22:13 2004
+// Author : Edward AGAPOV (eap)
+// Copyright : Open CASCADE
+
+
+#include "SMDS_VolumeTool.hxx"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include <map>
+#include <float.h>
+
+using namespace std;
+
+/*
+// N3
+// +
+// /|\
+// / | \
+// / | \
+// N0 +---|---+ N2 TETRAHEDRON
+// \ | /
+// \ | /
+// \ | /
+// \|/
+// +
+// N1
+*/
+static int Tetra_F [4][4] = { // FORWARD == REVERSED EXTERNAL
+ { 0, 1, 2, 0 }, // Bottom face has an internal normal, other - external
+ { 0, 1, 3, 0 },
+ { 1, 2, 3, 1 },
+ { 0, 3, 2, 0 }};
+static int Tetra_R [4][4] = { // REVERSED == FORWARD EXTERNAL
+ { 0, 2, 1, 0 }, // All faces have external normals
+ { 0, 1, 3, 0 },
+ { 1, 2, 3, 1 },
+ { 0, 3, 2, 0 }};
+static int Tetra_nbN [] = { 3, 3, 3, 3 };
+
+/*
+// + N4
+// /|\
+// / | \
+// / | \
+// / | \
+// N3 +---------+ N5
+// | | |
+// | + N1 |
+// | / \ | PENTAHEDRON
+// | / \ |
+// | / \ |
+// |/ \|
+// N0 +---------+ N2
+*/
+static int Penta_F [5][5] = { // FORWARD
+ { 0, 1, 2, 0, 0 }, // Top face has an internal normal, other - external
+ { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
+ { 0, 2, 5, 3, 0 },
+ { 1, 2, 5, 4, 1 },
+ { 1, 0, 3, 4, 1 }};
+static int Penta_R [5][5] = { // REVERSED
+ { 0, 2, 1, 0, 0 }, // Bottom face has an internal normal, other - external
+ { 3, 5, 4, 3, 3 }, // 0 is bottom, 1 is top face
+ { 0, 2, 5, 3, 0 },
+ { 1, 2, 5, 4, 1 },
+ { 1, 0, 3, 4, 1 }};
+static int Penta_FE [5][5] = { // EXTERNAL
+ { 0, 1, 2, 0, 0 },
+ { 3, 5, 4, 3, 3 },
+ { 0, 2, 5, 3, 0 },
+ { 1, 2, 5, 4, 1 },
+ { 1, 0, 3, 4, 1 }};
+static int Penta_RE [5][5] = { // REVERSED EXTERNAL
+ { 0, 0, 2, 1, 0 },
+ { 3, 3, 4, 5, 3 },
+ { 0, 2, 5, 3, 0 },
+ { 1, 2, 5, 4, 1 },
+ { 1, 0, 3, 4, 1 }};
+static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
+
+/*
+// N7+----------+N6
+// /| /|
+// / | / |
+// / | / |
+// N4+----------+N5 |
+// | | | | HEXAHEDRON
+// | | | |
+// | | | |
+// | N3+------|---+N2
+// | / | /
+// | / | /
+// |/ |/
+// N0+----------+N1
+*/
+static int Hexa_F [6][5] = { // FORWARD
+ { 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
+ { 4, 5, 6, 7, 4 }, // even face normal is internal, odd - external
+ { 1, 0, 4, 5, 1 }, // same index nodes nodes of opposite faces are linked
+ { 2, 3, 7, 6, 2 },
+ { 0, 3, 7, 4, 0 },
+ { 1, 2, 6, 5, 1 }};
+static int Hexa_R [6][5] = { // REVERSED
+ { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
+ { 4, 7, 6, 5, 4 }, // even face normal is external, odd - internal
+ { 1, 5, 4, 0, 1 }, // same index nodes nodes of opposite faces are linked
+ { 2, 6, 7, 3, 2 },
+ { 0, 4, 7, 3, 0 },
+ { 1, 5, 6, 2, 1 }};
+static int Hexa_FE [6][5] = { // EXTERNAL
+ { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
+ { 4, 5, 6, 7, 4 }, // all face normals are external,
+ { 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+ { 3, 7, 6, 2, 3 },
+ { 1, 2, 6, 5, 1 },
+ { 0, 4, 7, 3, 0 }};
+static int Hexa_RE [6][5] = { // REVERSED EXTERNAL
+ { 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
+ { 4, 7, 6, 5, 4 }, // all face normals are external,
+ { 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+ { 3, 7, 6, 2, 3 },
+ { 1, 2, 6, 5, 1 },
+ { 0, 4, 7, 3, 0 }};
+static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
+
+// ========================================================
+// to perform some calculations without linkage to CASCADE
+// ========================================================
+struct XYZ {
+ double x;
+ double y;
+ double z;
+ XYZ() { x = 0; y = 0; z = 0; }
+ XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
+ XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; }
+ XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); }
+ XYZ operator-( const XYZ& other );
+ XYZ Crossed( const XYZ& other );
+ double Dot( const XYZ& other );
+ double Magnitude();
+};
+XYZ XYZ::operator-( const XYZ& Right ) {
+ return XYZ(x - Right.x, y - Right.y, z - Right.z);
+}
+XYZ XYZ::Crossed( const XYZ& Right ) {
+ return XYZ (y * Right.z - z * Right.y,
+ z * Right.x - x * Right.z,
+ x * Right.y - y * Right.x);
+}
+double XYZ::Dot( const XYZ& Other ) {
+ return(x * Other.x + y * Other.y + z * Other.z);
+}
+double XYZ::Magnitude() {
+ return sqrt (x * x + y * y + z * z);
+}
+
+//=======================================================================
+//function : SMDS_VolumeTool
+//purpose :
+//=======================================================================
+
+SMDS_VolumeTool::SMDS_VolumeTool ()
+ : myVolume( 0 ),
+ myVolForward( true ),
+ myNbFaces( 0 ),
+ myVolumeNbNodes( 0 ),
+ myForwardFaces( false ),
+ myExternalFaces( false )
+{
+}
+//=======================================================================
+//function : SMDS_VolumeTool
+//purpose :
+//=======================================================================
+
+SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
+ : myForwardFaces( false ),
+ myExternalFaces( false )
+{
+ Set( theVolume );
+}
+
+//=======================================================================
+//function : SMDS_VolumeTool
+//purpose :
+//=======================================================================
+
+SMDS_VolumeTool::~SMDS_VolumeTool()
+{
+}
+
+//=======================================================================
+//function : SetVolume
+//purpose : Set volume to iterate on
+//=======================================================================
+
+bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
+{
+ myVolume = 0;
+ myVolForward = true;
+ myCurFace = -1;
+ myVolumeNbNodes = 0;
+ myNbFaces = 0;
+ if ( theVolume && theVolume->GetType() == SMDSAbs_Volume )
+ {
+ myVolumeNbNodes = theVolume->NbNodes();
+ switch ( myVolumeNbNodes ) {
+ case 4:
+ case 6:
+ case 8:
+ {
+ myVolume = theVolume;
+ myNbFaces = theVolume->NbFaces();
+
+ // set volume nodes
+ int iNode = 0;
+ SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
+ while ( nodeIt->more() )
+ myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+
+ // nb nodes in each face
+ if ( myVolumeNbNodes == 4 )
+ myFaceNbNodes = Tetra_nbN;
+ else if ( myVolumeNbNodes == 6 )
+ myFaceNbNodes = Penta_nbN;
+ else
+ myFaceNbNodes = Hexa_nbN;
+ break;
+ // define volume orientation
+ XYZ botNormal;
+ GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
+ const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
+ const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
+ XYZ upDir (topNode->X() - botNode->X(),
+ topNode->Y() - botNode->Y(),
+ topNode->Z() - botNode->Z() );
+ bool diffDir = ( botNormal.Dot( upDir ) < 0 );
+ myVolForward = ( myVolumeNbNodes == 6 ? diffDir : !diffDir );
+
+ }
+ default: myVolume = 0;
+ }
+ }
+ return ( myVolume != 0 );
+}
+
+//=======================================================================
+//function : GetInverseNodes
+//purpose : Return nodes vector of an inverse volume
+//=======================================================================
+
+#define SWAP_NODES(nodes,i1,i2) \
+{ \
+ const SMDS_MeshNode* tmp = nodes[ i1 ]; \
+ nodes[ i1 ] = nodes[ i2 ]; \
+ nodes[ i2 ] = tmp; \
+}
+void SMDS_VolumeTool::Inverse ()
+{
+ if ( !myVolume ) return;
+
+ myVolForward = !myVolForward;
+ myCurFace = -1;
+
+ // inverse top and bottom faces
+ switch ( myVolumeNbNodes ) {
+ case 4:
+ SWAP_NODES( myVolumeNodes, 1, 2 );
+ break;
+ case 6:
+ SWAP_NODES( myVolumeNodes, 1, 2 );
+ SWAP_NODES( myVolumeNodes, 4, 5 );
+ break;
+ case 8:
+ SWAP_NODES( myVolumeNodes, 1, 3 );
+ SWAP_NODES( myVolumeNodes, 5, 7 );
+ break;
+ default:;
+ }
+}
+
+//=======================================================================
+//function : GetSize
+//purpose : Return element volume
+//=======================================================================
+
+double SMDS_VolumeTool::GetSize() const
+{
+ return 0;
+}
+
+//=======================================================================
+//function : GetBaryCenter
+//purpose :
+//=======================================================================
+
+bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
+{
+ X = Y = Z = 0.;
+ if ( !myVolume )
+ return false;
+
+ for ( int i = 0; i < myVolumeNbNodes; i++ ) {
+ X += myVolumeNodes[ i ]->X();
+ Y += myVolumeNodes[ i ]->Y();
+ Z += myVolumeNodes[ i ]->Z();
+ }
+ X /= myVolumeNbNodes;
+ Y /= myVolumeNbNodes;
+ Z /= myVolumeNbNodes;
+
+ return true;
+}
+
+//=======================================================================
+//function : SetForwardOrientation
+//purpose : Node order will be as for forward orientation
+//=======================================================================
+
+void SMDS_VolumeTool::SetForwardOrientation ()
+{
+ myForwardFaces = true;
+}
+
+//=======================================================================
+//function : SetExternalNormal
+//purpose : Node order will be so that faces normals are external
+//=======================================================================
+
+void SMDS_VolumeTool::SetExternalNormal ()
+{
+ myExternalFaces = true;
+}
+
+//=======================================================================
+//function : NbFaceNodes
+//purpose : Return number of nodes in the array of face nodes
+//=======================================================================
+
+int SMDS_VolumeTool::NbFaceNodes( int faceIndex )
+{
+ if ( !setFace( faceIndex ))
+ return 0;
+ return myFaceNbNodes[ faceIndex ];
+}
+
+//=======================================================================
+//function : GetFaceNodes
+//purpose : Return pointer to the array of face nodes.
+// To comfort link iteration, the array
+// length == NbFaceNodes( faceIndex ) + 1 and
+// the last node == the first one.
+//=======================================================================
+
+const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
+{
+ if ( !setFace( faceIndex ))
+ return 0;
+ return myFaceNodes;
+}
+
+//=======================================================================
+//function : GetFaceNodesIndices
+//purpose : Return pointer to the array of face nodes indices
+// To comfort link iteration, the array
+// length == NbFaceNodes( faceIndex ) + 1 and
+// the last node index == the first one.
+//=======================================================================
+
+const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
+{
+ if ( !setFace( faceIndex ))
+ return 0;
+ return myFaceNodeIndices;
+}
+
+//=======================================================================
+//function : GetFaceNodes
+//purpose : Return a set of face nodes.
+//=======================================================================
+
+bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
+ std::set<const SMDS_MeshNode*>& theFaceNodes )
+{
+ if ( !setFace( faceIndex ))
+ return false;
+
+ theFaceNodes.clear();
+ int iNode, nbNode = myFaceNbNodes[ faceIndex ];
+ for ( int iNode = 0; iNode < nbNode; iNode++ )
+ theFaceNodes.insert( myFaceNodes[ iNode ]);
+
+ return true;
+}
+
+//=======================================================================
+//function : IsFaceExternal
+//purpose : Check normal orientation of a returned face
+//=======================================================================
+
+bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
+{
+ if ( myExternalFaces || !myVolume )
+ return true;
+
+ bool reversed = ( !myForwardFaces && !myVolForward );
+ switch ( myVolumeNbNodes ) {
+ case 4:
+ // only the bottom of a forward tetrahedron can be internal
+ return ( reversed || faceIndex != 0 );
+ case 6:
+ // in a forward pentahedron, the top is internal, in a reversed one - bottom
+ return ( reversed ? faceIndex != 0 : faceIndex != 1 );
+ case 8: {
+ // in a forward hexahedron, odd face normal is external, else vice versa
+ bool odd = faceIndex % 2;
+ return ( reversed ? !odd : odd );
+ }
+ default:;
+ }
+ return false;
+}
+
+//=======================================================================
+//function : GetFaceNormal
+//purpose : Return a normal to a face
+//=======================================================================
+
+bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, double & Z)
+{
+ if ( !setFace( faceIndex ))
+ return false;
+
+ XYZ p1 ( myFaceNodes[0] );
+ XYZ p2 ( myFaceNodes[1] );
+ XYZ p3 ( myFaceNodes[2] );
+ XYZ aVec12( p2 - p1 );
+ XYZ aVec13( p3 - p1 );
+ XYZ cross = aVec12.Crossed( aVec13 );
+
+ double size = cross.Magnitude();
+ if ( size <= DBL_MIN )
+ return false;
+
+ X = cross.x / size;
+ Y = cross.y / size;
+ Z = cross.z / size;
+
+ return true;
+}
+
+
+//=======================================================================
+//function : GetFaceArea
+//purpose : Return face area
+//=======================================================================
+
+double SMDS_VolumeTool::GetFaceArea( int faceIndex )
+{
+ if ( !setFace( faceIndex ))
+ return 0;
+
+ XYZ p1 ( myFaceNodes[0] );
+ XYZ p2 ( myFaceNodes[1] );
+ XYZ p3 ( myFaceNodes[2] );
+ XYZ aVec12( p2 - p1 );
+ XYZ aVec13( p3 - p1 );
+ double area = aVec12.Crossed( aVec13 ).Magnitude() * 0.5;
+
+ if ( myFaceNbNodes[ faceIndex ] == 4 ) {
+ XYZ p4 ( myFaceNodes[3] );
+ XYZ aVec14( p4 - p1 );
+ area += aVec14.Crossed( aVec13 ).Magnitude() * 0.5;
+ }
+ return area;
+}
+
+//=======================================================================
+//function : GetOppFaceIndex
+//purpose : Return index of the opposite face if it exists, else -1.
+//=======================================================================
+
+int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const
+{
+ int ind = -1;
+ if ( faceIndex >= 0 && faceIndex < NbFaces() ) {
+ switch ( myVolumeNbNodes ) {
+ case 6:
+ if ( faceIndex == 0 || faceIndex == 1 )
+ ind = 1 - faceIndex;
+ break;
+ case 8:
+ ind = faceIndex + ( faceIndex % 2 ? -1 : 1 );
+ break;
+ default:;
+ }
+ }
+ return ind;
+}
+
+//=======================================================================
+//function : IsLinked
+//purpose : return true if theNode1 is linked with theNode2
+//=======================================================================
+
+bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
+ const SMDS_MeshNode* theNode2) const
+{
+ if ( !myVolume )
+ return false;
+
+ // find nodes indices
+ int i1 = -1, i2 = -1;
+ for ( int i = 0; i < myVolumeNbNodes; i++ ) {
+ if ( myVolumeNodes[ i ] == theNode1 )
+ i1 = i;
+ else if ( myVolumeNodes[ i ] == theNode2 )
+ i2 = i;
+ }
+ return IsLinked( i1, i2 );
+}
+
+//=======================================================================
+//function : IsLinked
+//purpose : return true if the node with theNode1Index is linked
+// with the node with theNode2Index
+//=======================================================================
+
+bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
+ const int theNode2Index) const
+{
+ int minInd = theNode1Index < theNode2Index ? theNode1Index : theNode2Index;
+ int maxInd = theNode1Index < theNode2Index ? theNode2Index : theNode1Index;
+
+ if ( minInd < 0 || maxInd > myVolumeNbNodes - 1 || maxInd == minInd )
+ return false;
+
+ switch ( myVolumeNbNodes ) {
+ case 4:
+ return true;
+ case 6:
+ switch ( maxInd - minInd ) {
+ case 1: return minInd != 2;
+ case 2: return minInd == 0 || minInd == 3;
+ case 3: return true;
+ default:;
+ }
+ break;
+ case 8:
+ switch ( maxInd - minInd ) {
+ case 1: return minInd != 3;
+ case 3: return minInd == 0 || minInd == 4;
+ case 4: return true;
+ default:;
+ }
+ break;
+ default:;
+ }
+ return false;
+}
+
+//=======================================================================
+//function : GetNodeIndex
+//purpose : Return an index of theNode
+//=======================================================================
+
+int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
+{
+ if ( myVolume ) {
+ for ( int i = 0; i < myVolumeNbNodes; i++ ) {
+ if ( myVolumeNodes[ i ] == theNode )
+ return i;
+ }
+ }
+ return -1;
+}
+
+
+//=======================================================================
+//function : IsFreeFace
+//purpose : check that only one volume is build on the face nodes
+//=======================================================================
+
+bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
+{
+ const int free = true;
+ if ( !setFace( faceIndex ))
+ return !free;
+
+ const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
+ int nbFaceNodes = NbFaceNodes( faceIndex );
+
+ // evaluate nb of face nodes shared by other volume
+ int maxNbShared = -1;
+ typedef map< const SMDS_MeshElement*, int > TElemIntMap;
+ TElemIntMap volNbShared;
+ TElemIntMap::iterator vNbIt;
+ for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
+ {
+ const SMDS_MeshNode* n = nodes[ iNode ];
+ SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* elem = eIt->next();
+ if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
+ int nbShared = 1;
+ vNbIt = volNbShared.find( elem );
+ if ( vNbIt == volNbShared.end() )
+ volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
+ else
+ nbShared = ++(*vNbIt).second;
+ if ( nbShared > maxNbShared )
+ maxNbShared = nbShared;
+ }
+ }
+ }
+ if ( maxNbShared < 3 )
+ return free; // is free
+
+ // find volumes laying on the opposite side of the face
+ // and sharing all nodes
+ XYZ intNormal; // internal normal
+ GetFaceNormal( faceIndex, intNormal.x, intNormal.y, intNormal.z );
+ if ( IsFaceExternal( faceIndex ))
+ intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
+ XYZ p0 ( nodes[0] ), baryCenter;
+ for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
+ {
+ int nbShared = (*vNbIt).second;
+ if ( nbShared >= 3 ) {
+ SMDS_VolumeTool volume( (*vNbIt).first );
+ volume.GetBaryCenter( baryCenter.x, baryCenter.y, baryCenter.z );
+ XYZ intNormal2( baryCenter - p0 );
+ if ( intNormal.Dot( intNormal2 ) < 0 )
+ continue; // opposite side
+ }
+ // remove a volume from volNbShared map
+ volNbShared.erase( vNbIt );
+ }
+ // here volNbShared contains only volumes laying on the
+ // opposite side of the face
+ if ( volNbShared.empty() )
+ return free; // is free
+
+ // check if the whole area of a face is shared
+ bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
+ for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
+ {
+ SMDS_VolumeTool volume( (*vNbIt).first );
+ bool prevLinkShared = false;
+ int nbSharedLinks = 0;
+ for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
+ {
+ bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
+ if ( linkShared )
+ nbSharedLinks++;
+ if ( linkShared && prevLinkShared &&
+ volume.IsLinked( nodes[ iNode - 1 ], nodes[ iNode + 1] ))
+ isShared[ iNode ] = true;
+ prevLinkShared = linkShared;
+ }
+ if ( nbSharedLinks == nbFaceNodes )
+ return !free; // is not free
+ if ( nbFaceNodes == 4 ) {
+ // check traingle parts 1 & 3
+ if ( isShared[1] && isShared[3] )
+ return !free; // is not free
+ // check traingle parts 0 & 2;
+ // 0 part could not be checked in the loop; check it here
+ if ( isShared[2] && prevLinkShared &&
+ volume.IsLinked( nodes[ 0 ], nodes[ 1 ] ) &&
+ volume.IsLinked( nodes[ 1 ], nodes[ 3 ] ) )
+ return !free; // is not free
+ }
+ }
+ return free;
+}
+
+//=======================================================================
+//function : GetFaceIndex
+//purpose : Return index of a face formed by theFaceNodes
+//=======================================================================
+
+int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes )
+{
+ for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
+ const SMDS_MeshNode** nodes = GetFaceNodes( iFace );
+ int nbFaceNodes = NbFaceNodes( iFace );
+ set<const SMDS_MeshNode*> nodeSet;
+ for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
+ nodeSet.insert( nodes[ iNode ] );
+ if ( theFaceNodes == nodeSet )
+ return iFace;
+ }
+ return -1;
+}
+
+//=======================================================================
+//function : GetFaceIndex
+//purpose : Return index of a face formed by theFaceNodes
+//=======================================================================
+
+int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
+{
+ for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
+ const int* nodes = GetFaceNodesIndices( iFace );
+ int nbFaceNodes = NbFaceNodes( iFace );
+ set<int> nodeSet;
+ for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
+ nodeSet.insert( nodes[ iNode ] );
+ if ( theFaceNodesIndices == nodeSet )
+ return iFace;
+ }
+ return -1;
+}
+
+//=======================================================================
+//function : setFace
+//purpose :
+//=======================================================================
+
+bool SMDS_VolumeTool::setFace( int faceIndex )
+{
+ if ( !myVolume )
+ return false;
+
+ if ( myCurFace == faceIndex )
+ return true;
+
+ if ( faceIndex < 0 || faceIndex >= NbFaces() )
+ return false;
+
+ // choose face node indices
+ switch ( myVolumeNbNodes ) {
+ case 4:
+ if ( myExternalFaces )
+ myFaceNodeIndices = myVolForward ? Tetra_R[ faceIndex ] : Tetra_F[ faceIndex ];
+ else if ( myForwardFaces )
+ myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
+ else
+ myFaceNodeIndices = Tetra_F[ faceIndex ];
+ break;
+ case 6:
+ if ( myExternalFaces )
+ myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
+ else if ( myForwardFaces )
+ myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
+ else
+ myFaceNodeIndices = Penta_F[ faceIndex ];
+ break;
+ case 8:
+ if ( myExternalFaces )
+ myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
+ else if ( myForwardFaces )
+ myFaceNodeIndices = myVolForward ? Hexa_F[ faceIndex ] : Hexa_R[ faceIndex ];
+ else
+ myFaceNodeIndices = Hexa_F[ faceIndex ];
+ break;
+ default: return false;
+ }
+
+ // set face nodes
+ int iNode, nbNode = myFaceNbNodes[ faceIndex ];
+ for ( iNode = 0; iNode <= nbNode; iNode++ )
+ myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
+
+ myCurFace = faceIndex;
+
+ return true;
+}
--- /dev/null
+// SMESH SMDS : implementaion of Salome mesh data structure
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMDS_VolumeTool.hxx
+// Module : SMESH
+// Created : Tue Jul 13 11:27:17 2004
+// Author : Edward AGAPOV (eap)
+
+
+#ifndef SMDS_VolumeTool_HeaderFile
+#define SMDS_VolumeTool_HeaderFile
+
+class SMDS_MeshElement;
+class SMDS_MeshNode;
+
+#include <vector>
+#include <set>
+
+// =========================================================================
+//
+// Class providing topological and other information about SMDS_MeshVolume:
+// allows iteration on faces or, to be precise, on nodes of volume sides;
+// provides info on nodes connection etc.
+//
+// =========================================================================
+
+class SMDS_VolumeTool
+{
+ public:
+
+ SMDS_VolumeTool ();
+ ~SMDS_VolumeTool ();
+ SMDS_VolumeTool (const SMDS_MeshElement* theVolume);
+
+ bool Set (const SMDS_MeshElement* theVolume);
+ // Set volume.
+ // Return false if theVolume is not of type SMDSAbs_Volume
+
+ // -----------------------
+ // general info
+ // -----------------------
+
+ bool IsForward() const { return myVolForward; }
+ // Check volume orientation. can be changed by Inverse().
+ // See node order of forward volumes at file bottom
+
+ void Inverse();
+ // Change nodes order as if the volume changes its orientation:
+ // top and bottom faces are reversed.
+ // Result of IsForward() and methods returning nodes change
+
+ const SMDS_MeshNode** GetNodes() { return myVolumeNodes; }
+ // Return array of volume nodes
+
+ int NbNodes() { return myVolumeNbNodes; }
+ // Return array of volume nodes
+
+ double GetSize() const;
+ // Return element volume
+
+ bool GetBaryCenter (double & X, double & Y, double & Z) const;
+
+
+ // -----------------------
+ // info on node connection
+ // -----------------------
+
+ bool IsLinked (const SMDS_MeshNode* theNode1,
+ const SMDS_MeshNode* theNode2) const;
+ // Return true if theNode1 is linked with theNode2.
+
+ bool IsLinked (const int theNode1Index,
+ const int theNode2Index) const;
+ // Return true if the node with theNode1Index is linked
+ // with the node with theNode2Index
+
+ int GetNodeIndex(const SMDS_MeshNode* theNode) const;
+ // Return an index of theNode
+
+ // -------------
+ // info on faces
+ // -------------
+
+ void SetForwardOrientation ();
+ // Node order in faces will be as for forward orientation
+
+ void SetExternalNormal ();
+ // Node order in faces will be so that faces normals are external.
+ // It overrides SetForwardOrientation()
+
+ int NbFaces() const { return myNbFaces; }
+ // Return number of faces of the volume. In the following
+ // methods 0 <= faceIndex < NbFaces()
+
+ int NbFaceNodes( int faceIndex );
+ // Return number of nodes in the array of face nodes
+
+ const int* GetFaceNodesIndices( int faceIndex );
+ // Return the array of face nodes indices
+ // To comfort link iteration, the array
+ // length == NbFaceNodes( faceIndex ) + 1 and
+ // the last node index == the first one.
+
+ const SMDS_MeshNode** GetFaceNodes( int faceIndex );
+ // Return the array of face nodes.
+ // To comfort link iteration, the array
+ // length == NbFaceNodes( faceIndex ) + 1 and
+ // the last node == the first one.
+ // WARNING: do not modify the array, some methods
+ // work basing on its contents
+
+ bool GetFaceNodes (int faceIndex,
+ std::set<const SMDS_MeshNode*>& theFaceNodes );
+ // Return a set of face nodes.
+
+ bool IsFaceExternal( int faceIndex );
+ // Check normal orientation of a face.
+ // SetForwardOrientation() and SetForwardOrientation() are taken
+ // into account.
+
+ bool IsFreeFace( int faceIndex );
+ // Check that all volumes built on the face nodes lays on one side
+
+ bool GetFaceNormal (int faceIndex, double & X, double & Y, double & Z);
+ // Return a normal to a face
+
+ double GetFaceArea( int faceIndex );
+ // Return face area
+
+ int GetOppFaceIndex( int faceIndex ) const;
+ // Return index of the opposite face if it exists, else -1.
+
+ int GetFaceIndex( const std::set<const SMDS_MeshNode*>& theFaceNodes );
+ // Return index of a face formed by theFaceNodes.
+ // Return -1 if a face not found
+
+ int GetFaceIndex( const std::set<int>& theFaceNodesIndices );
+ // Return index of a face formed by theFaceNodesIndices
+ // Return -1 if a face not found
+
+
+ private:
+
+ bool setFace( int faceIndex );
+
+ const SMDS_MeshElement* myVolume;
+ bool myVolForward;
+ int myNbFaces;
+ int myVolumeNbNodes;
+ const SMDS_MeshNode* myVolumeNodes[ 8 ];
+
+ bool myForwardFaces;
+ bool myExternalFaces;
+ int* myFaceNodeIndices;
+ int* myFaceNbNodes;
+ const SMDS_MeshNode* myFaceNodes[ 5 ];
+ int myCurFace;
+
+};
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// ORDER OF NODES OF FORWARD ELEMENT
+//
+///////////////////////////////////////////////////////////////////////////
+/*
+// N3
+// +
+// /|\
+// / | \
+// / | \
+// N0 +---|---+ N2 TETRAHEDRON
+// \ | /
+// \ | /
+// \ | /
+// \|/
+// +
+// N1
+
+// + N4
+// /|\
+// / | \
+// / | \
+// / | \
+// N3 +---------+ N5
+// | | |
+// | + N1 |
+// | / \ | PENTAHEDRON
+// | / \ |
+// | / \ |
+// |/ \|
+// N0 +---------+ N2
+
+// N7+----------+N6
+// /| /|
+// / | / |
+// / | / |
+// N4+----------+N5 |
+// | | | | HEXAHEDRON
+// | | | |
+// | | | |
+// | N3+------|---+N2
+// | / | /
+// | / | /
+// |/ |/
+// N0+----------+N1
+//
+*/
# Author : Paul RASCLE, EDF
# Module : SMESH
# $Header$
-
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
SMESH_1D_Algo.hxx \
SMESH_2D_Algo.hxx \
SMESH_3D_Algo.hxx \
- SMESH_Group.hxx
+ SMESH_Group.hxx \
+ SMESH_MeshEditor.hxx \
+ SMESH_Pattern.hxx
EXPORT_PYSCRIPTS =
SMESH_1D_Algo.cxx \
SMESH_2D_Algo.cxx \
SMESH_3D_Algo.cxx \
- SMESH_Group.cxx
+ SMESH_Group.cxx \
+ SMESH_MeshEditor.cxx \
+ SMESH_Pattern.cxx
LIB_SERVER_IDL =
BIN =
BIN_SRC =
-# additionnal information to compil and link file
+# additionnal information to compile and link file
CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS)
CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-#IDLCXXFLAGS+= -Wbtp
-
-LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSMESHDS -lMeshDriverDAT -lMeshDriverSTL -lMeshDriverMED -lMeshDriverUNV
@CONCLUDE@
#include <string>
#include <vector>
#include <list>
-using namespace std;
class SMESH_Gen;
class SMESH_Mesh;
SMESH_Algo(int hypId, int studyId, SMESH_Gen * gen);
virtual ~ SMESH_Algo();
- const vector < string > &GetCompatibleHypothesis();
+ const std::vector < std::string > &GetCompatibleHypothesis();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus) = 0;
virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = 0;
- virtual const list <const SMESHDS_Hypothesis *> &
+ virtual const std::list <const SMESHDS_Hypothesis *> &
GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
const list <const SMESHDS_Hypothesis *> &
protected:
bool _onlyUnaryInput;
bool _requireDescretBoundary;
- vector<string> _compatibleHypothesis;
- list<const SMESHDS_Hypothesis *> _appliedHypList;
- list<const SMESHDS_Hypothesis *> _usedHypList;
+ std::vector<std::string> _compatibleHypothesis;
+ std::list<const SMESHDS_Hypothesis *> _appliedHypList;
+ std::list<const SMESHDS_Hypothesis *> _usedHypList;
};
#endif
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "utilities.h"
#include "OpUtil.hxx"
+#include "Utils_ExceptHandlers.hxx"
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include "Utils_ExceptHandlers.hxx"
+using namespace std;
//=============================================================================
/*!
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
StudyContextStruct *myStudyContext = GetStudyContext(studyId);
- // create a new SMESH_mesh object
+ // create a new SMESH_mesh object
SMESH_Mesh *mesh = new SMESH_Mesh(_localId++,
studyId,
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
{
MESSAGE("SMESH_Gen::Compute");
// bool isDone = false;
- /*
+ /*
Algo : s'appuie ou non sur une geometrie
Si geometrie:
Vertex : rien à faire (range le point)
bool ret = true;
- if ( !CheckAlgoState( aMesh, aShape ))
- {
- INFOS( "ABORT MESHING: some algos or hypothesis are missing");
- return false;
- }
+// if ( !CheckAlgoState( aMesh, aShape ))
+// {
+// INFOS( "ABORT MESHING: some algos or hypothesis are missing");
+// return false;
+// }
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
// apply algos that do not require descretized boundaries, starting
// from the most complex shapes
// -----------------------------------------------------------------
-
+
// map containing all subshapes in the order: vertices, edges, faces...
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
if ( GetShapeDim( aSubShape ) < 1 ) break;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
- if (algo &&
- !algo->NeedDescretBoundary() &&
- smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE )
- {
- ret = smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+ if (algo && !algo->NeedDescretBoundary()) {
+ if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
+ ret = smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+ } else if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) {
+ // JFA for PAL6524
+ ret = false;
+ } else {
+ }
}
if (!ret)
return false;
else
smToCompute = 0;
}
-
+
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
-
+
smToCompute = sm->GetFirstToCompute();
while (smToCompute)
{
int dim = GetShapeDim(subShape);
if (dim > 0)
{
- //MESSAGE ( "MESH shape id=" << smToCompute->GetId() <<
- // " type=" << smToCompute->GetSubShape().ShapeType());
- bool ret1 = smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE);
- ret = ret && ret1;
+ if ( !smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE) )
+ ret = false;
}
else
{
- ASSERT(dim == 0);
- ASSERT(smToCompute->_vertexSet == false);
TopoDS_Vertex V1 = TopoDS::Vertex(subShape);
gp_Pnt P1 = BRep_Tool::Pnt(V1);
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- //MESSAGE("point "<<nodeId<<" "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z());
SMDS_MeshNode * node = meshDS->AddNode(P1.X(), P1.Y(), P1.Z());
if ( node ) { // san - increase robustness
meshDS->SetNodeOnVertex(node, V1);
- smToCompute->GetSubMeshDS();
- smToCompute->_vertexSet = true;
smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE);
}
}
smToCompute = sm->GetFirstToCompute();
}
+ if (!ret) return false;
+
+ // JFA for PAL6524: if there are failed sub-meshes, return Standard_False
+ const map < int, SMESH_subMesh * >&subMeshes = sm->DependsOn();
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) {
+ SMESH_subMesh *smi = (*itsub).second;
+ if (smi->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) return false;
+ }
+ if (sm->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) return false;
+
MESSAGE( "VSR - SMESH_Gen::Compute() finished" );
- return ret;
+ return true;
}
//=======================================================================
//function : checkConformIgnoredAlgos
-//purpose :
+//purpose :
//=======================================================================
static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
ASSERT ( algo );
-
+
if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
{
INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
if ( dim < aMaxGlobIgnoDim )
{
// algo is hidden by a global algo
- INFOS( ( isGlobal ? "Global" : "Local" )
+ INFOS( ( isGlobal ? "Global" : "Local" )
<< " <" << algo->GetName() << "> is hidden by global <"
<< aGlobIgnoAlgo->GetName() << ">");
}
}
}
}
-
+
return ret;
}
{
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
return true;
-
+
//MESSAGE("=====checkMissing");
int ret = true;
SMESH_subMesh* sm = aMesh.GetSubMesh(aShape);
const SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Shape mainShape = meshDS->ShapeToMesh();
-
+
// -----------------
// get global algos
// -----------------
-
+
const SMESH_Algo* aGlobAlgoArr[] = {0,0,0,0};
const list<const SMESHDS_Hypothesis*>& listHyp = meshDS->GetHypothesis( mainShape );
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
ASSERT ( algo );
-
+
int dim = algo->GetDim();
aGlobAlgoArr[ dim ] = algo;
hasAlgo = true;
}
-
+
// --------------------------------------------------------
// info on algos that will be ignored because of ones that
// don't NeedDescretBoundary() attached to super-shapes,
// ----------------------------------------------------------------
//MESSAGE( "---info on missing hypothesis and find out if all needed algos are");
-
+
// find max dim of global algo
int aTopAlgoDim = 0;
for (dim = 3; dim > 0; dim--)
const int theAlgoShapeType)
{
list<const SMESHDS_Hypothesis*>::const_iterator it = theHypList.begin();
-
+
int nb_algo = 0;
int algo_id = -1;
-
+
while (it!=theHypList.end())
{
const SMESH_Hypothesis *anHyp = static_cast< const SMESH_Hypothesis *>( *it );
algo_id = anHyp->GetID();
break;
}
-
+
//if (nb_algo > 1) return -1; // more than one algo
it++;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
ASSERT(_mapAlgo.find(algo_id) != _mapAlgo.end());
return _mapAlgo[algo_id];
-
+
// const SMESHDS_Hypothesis *theHyp = NULL;
// SMESH_Algo *algo = NULL;
// const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
// const list<const SMESHDS_Hypothesis*>& listHyp =
// meshDS->GetHypothesis(tryShape);
// list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
-
+
// int nb_algo = 0;
// int shapeDim = GetShapeDim(aShape);
// int typeOfShape = aShape.ShapeType();
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
- */
-//=============================================================================
-
-const char *SMESH_Gen::ComponentDataType()
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-const char *SMESH_Gen::IORToLocalPersistentID(const char *IORString,
- bool & IsAFile)
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-const char *SMESH_Gen::LocalPersistentIDToIOR(const char *aLocalPersistentID)
-{
-}
-
-//=============================================================================
-/*!
- *
+ *
*/
//=============================================================================
#include <TopoDS_Shape.hxx>
#include <map>
-using namespace std;
+
typedef struct studyContextStruct
{
- map < int, SMESH_Hypothesis * >mapHypothesis;
- map < int, SMESH_Mesh * >mapMesh;
+ std::map < int, SMESH_Hypothesis * >mapHypothesis;
+ std::map < int, SMESH_Mesh * >mapMesh;
SMESHDS_Document * myDocument;
} StudyContextStruct;
int GetANewId();
- map < int, SMESH_Algo * >_mapAlgo;
- map < int, SMESH_1D_Algo * >_map1D_Algo;
- map < int, SMESH_2D_Algo * >_map2D_Algo;
- map < int, SMESH_3D_Algo * >_map3D_Algo;
+ std::map < int, SMESH_Algo * >_mapAlgo;
+ std::map < int, SMESH_1D_Algo * >_map1D_Algo;
+ std::map < int, SMESH_2D_Algo * >_map2D_Algo;
+ std::map < int, SMESH_3D_Algo * >_map3D_Algo;
private:
int _localId; // unique Id of created objects, within SMESH_Gen entity
- map < int, StudyContextStruct * >_mapStudyContext;
+ std::map < int, StudyContextStruct * >_mapStudyContext;
// hypotheses managing
int _hypId;
*/
//=============================================================================
-SMESH_Group::SMESH_Group (const SMESH_Mesh* theMesh,
+SMESH_Group::SMESH_Group (int theID,
+ const SMESH_Mesh* theMesh,
const SMDSAbs_ElementType theType,
const char* theName)
: myName(theName)
{
- myGroupDS = new SMESHDS_Group (const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(), theType);
+ myGroupDS = new SMESHDS_Group (theID,
+ const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
+ theType);
}
//=============================================================================
#include <SMDSAbs_ElementType.hxx>
#include <string>
-using namespace std;
+
class SMESHDS_Group;
class SMESH_Mesh;
{
public:
- SMESH_Group (const SMESH_Mesh* theMesh,
+ SMESH_Group (int theID,
+ const SMESH_Mesh* theMesh,
const SMDSAbs_ElementType theType,
const char* theName);
~SMESH_Group ();
// prohibited assign operator
SMESHDS_Group * myGroupDS;
- string myName;
+ std::string myName;
};
int _param_algo_dim;
private:
- string _libName;
+ std::string _libName;
};
#endif
#include "utilities.h"
-#include "Mesh_Writer.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
-#include "DriverDAT_W_SMESHDS_Mesh.h"
-#include "DriverUNV_W_SMESHDS_Mesh.h"
+#include "DriverDAT_W_SMDS_Mesh.h"
+#include "DriverUNV_W_SMDS_Mesh.h"
+#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverMED_R_SMESHDS_Mesh.h"
+#include "DriverUNV_R_SMDS_Mesh.h"
+#include "DriverSTL_R_SMDS_Mesh.h"
#include <TCollection_AsciiString.hxx>
#include <memory>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include "Utils_ExceptHandlers.hxx"
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-SMESH_Mesh::SMESH_Mesh()
-{
- MESSAGE("SMESH_Mesh::SMESH_Mesh");
- _id = -1;
- ASSERT(0);
-}
//=============================================================================
/*!
SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Document * myDocument)
: _groupId( 0 )
{
- MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
+ INFOS("SMESH_Mesh::SMESH_Mesh(int localId)");
_id = localId;
_studyId = studyId;
_gen = gen;
SMESH_Mesh::~SMESH_Mesh()
{
- MESSAGE("SMESH_Mesh::~SMESH_Mesh");
+ INFOS("SMESH_Mesh::~SMESH_Mesh");
// delete groups
map < int, SMESH_Group * >::iterator itg;
//=============================================================================
void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape){
- MESSAGE("SMESH_Mesh::ShapeToMesh");
- if (_isShapeToMesh)
- throw
- SALOME_Exception(LOCALIZED
- ("a shape to mesh as already been defined"));
- _isShapeToMesh = true;
- _myMeshDS->ShapeToMesh(aShape);
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::ShapeToMesh");
+ if (_isShapeToMesh)
+ throw
+ SALOME_Exception(LOCALIZED
+ ("a shape to mesh as already been defined"));
+ _isShapeToMesh = true;
+ _myMeshDS->ShapeToMesh(aShape);
+
+ // NRI : 24/02/03
+ //EAP: 1/9/04 TopExp::MapShapes(aShape, _subShapes); USE the same map of _myMeshDS
+}
+
+//=======================================================================
+//function : UNVToMesh
+//purpose :
+//=======================================================================
- // NRI : 24/02/03
- TopExp::MapShapes(aShape, _subShapes);
+int SMESH_Mesh::UNVToMesh(const char* theFileName)
+{
+ if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
+ if(_isShapeToMesh)
+ throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
+ _isShapeToMesh = true;
+ DriverUNV_R_SMDS_Mesh myReader;
+ myReader.SetMesh(_myMeshDS);
+ myReader.SetFile(theFileName);
+ myReader.SetMeshId(-1);
+ myReader.Perform();
+ if(MYDEBUG){
+ MESSAGE("MEDToMesh - _myMeshDS->NbNodes() = "<<_myMeshDS->NbNodes());
+ MESSAGE("MEDToMesh - _myMeshDS->NbEdges() = "<<_myMeshDS->NbEdges());
+ MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
+ MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
+ }
+ return 1;
}
//=======================================================================
int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
{
- MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
+ if(MYDEBUG) MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
if(_isShapeToMesh)
throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
_isShapeToMesh = true;
- std::auto_ptr<DriverMED_R_SMESHDS_Mesh> myReader(new DriverMED_R_SMESHDS_Mesh);
- myReader->SetMesh(_myMeshDS);
- myReader->SetMeshId(-1);
- myReader->SetFile(theFileName);
- myReader->SetMeshName(theMeshName);
- DriverMED_R_SMESHDS_Mesh::ReadStatus status = myReader->ReadMySelf();
- MESSAGE("MEDToMesh - _myMeshDS->NbNodes() = "<<_myMeshDS->NbNodes());
- MESSAGE("MEDToMesh - _myMeshDS->NbEdges() = "<<_myMeshDS->NbEdges());
- MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
- MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
+ DriverMED_R_SMESHDS_Mesh myReader;
+ myReader.SetMesh(_myMeshDS);
+ myReader.SetMeshId(-1);
+ myReader.SetFile(theFileName);
+ myReader.SetMeshName(theMeshName);
+ Driver_Mesh::Status status = myReader.Perform();
+ if(MYDEBUG){
+ MESSAGE("MEDToMesh - _myMeshDS->NbNodes() = "<<_myMeshDS->NbNodes());
+ MESSAGE("MEDToMesh - _myMeshDS->NbEdges() = "<<_myMeshDS->NbEdges());
+ MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
+ MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
+ }
// Reading groups (sub-meshes are out of scope of MED import functionality)
- list<string> aGroupNames = myReader->GetGroupNames();
- MESSAGE("MEDToMesh - Nb groups = "<<aGroupNames.size());
+ list<string> aGroupNames = myReader.GetGroupNames();
+ if(MYDEBUG) MESSAGE("MEDToMesh - Nb groups = "<<aGroupNames.size());
int anId;
for ( list<string>::iterator it = aGroupNames.begin(); it != aGroupNames.end(); it++ ) {
SMESH_Group* aGroup = AddGroup( SMDSAbs_All, it->c_str(), anId );
if ( aGroup ) {
- MESSAGE("MEDToMesh - group added: "<<it->c_str());
+ if(MYDEBUG) MESSAGE("MEDToMesh - group added: "<<it->c_str());
SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
aGroupDS->SetStoreName( it->c_str() );
- myReader->GetGroup( aGroupDS );
+ myReader.GetGroup( aGroupDS );
}
}
return (int) status;
}
+//=======================================================================
+//function : STLToMesh
+//purpose :
+//=======================================================================
+
+int SMESH_Mesh::STLToMesh(const char* theFileName)
+{
+ if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
+ if(_isShapeToMesh)
+ throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
+ _isShapeToMesh = true;
+ DriverSTL_R_SMDS_Mesh myReader;
+ myReader.SetMesh(_myMeshDS);
+ myReader.SetFile(theFileName);
+ myReader.SetMeshId(-1);
+ myReader.Perform();
+ if(MYDEBUG){
+ MESSAGE("MEDToMesh - _myMeshDS->NbNodes() = "<<_myMeshDS->NbNodes());
+ MESSAGE("MEDToMesh - _myMeshDS->NbEdges() = "<<_myMeshDS->NbEdges());
+ MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
+ MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
+ }
+ return 1;
+}
+
//=============================================================================
/*!
*
SMESH_Hypothesis::Hypothesis_Status
SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
- int anHypId) throw(SALOME_Exception)
+ int anHypId ) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- MESSAGE("SMESH_Mesh::AddHypothesis");
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::AddHypothesis");
+
+ if ( _myMeshDS->IsGroupOfSubShapes( aSubShape ))
+ {
+ // return the worst but not fatal state of all group memebers
+ SMESH_Hypothesis::Hypothesis_Status aBestRet, aWorstNotFatal, ret;
+ aBestRet = SMESH_Hypothesis::HYP_BAD_DIM;
+ aWorstNotFatal = SMESH_Hypothesis::HYP_OK;
+ for ( TopoDS_Iterator itS ( aSubShape ); itS.More(); itS.Next())
+ {
+ ret = AddHypothesis( itS.Value(), anHypId );
+ if ( !SMESH_Hypothesis::IsStatusFatal( ret ) && ret > aWorstNotFatal )
+ aWorstNotFatal = ret;
+ if ( ret < aBestRet )
+ aBestRet = ret;
+ }
+ if ( SMESH_Hypothesis::IsStatusFatal( aBestRet ))
+ return aBestRet;
+ return aWorstNotFatal;
+ }
StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
{
- MESSAGE("Hypothesis ID does not give an hypothesis");
- SCRUTE(_studyId);
- SCRUTE(anHypId);
+ if(MYDEBUG) MESSAGE("Hypothesis ID does not give an hypothesis");
+ if(MYDEBUG) {
+ SCRUTE(_studyId);
+ SCRUTE(anHypId);
+ }
throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
}
SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
- SCRUTE( anHyp->GetName() );
+ if(MYDEBUG) SCRUTE( anHyp->GetName() );
int event;
bool isGlobalHyp = IsMainShape( aSubShape );
string hypName = anHyp->GetName();
if ( hypName == "NotConformAllowed" )
{
- MESSAGE( "Hypotesis <NotConformAllowed> can be only global" );
+ if(MYDEBUG) MESSAGE( "Hypotesis <NotConformAllowed> can be only global" );
return SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
}
}
subMesh->DumpAlgoState(true);
- SCRUTE(ret);
+ if(MYDEBUG) SCRUTE(ret);
return ret;
}
int anHypId)throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- MESSAGE("SMESH_Mesh::RemoveHypothesis");
-
- StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
- if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
- throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
-
- SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
- SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
- int hypType = anHyp->GetType();
- SCRUTE(hypType);
- int event;
-
- // shape
-
- if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
- event = SMESH_subMesh::REMOVE_HYP;
- else
- event = SMESH_subMesh::REMOVE_ALGO;
- SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
-
- // subShapes
- if (!SMESH_Hypothesis::IsStatusFatal(ret) &&
- !subMesh->IsApplicableHypotesis( anHyp )) // is removed from father
- {
- if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
- event = SMESH_subMesh::REMOVE_FATHER_HYP;
- else
- event = SMESH_subMesh::REMOVE_FATHER_ALGO;
- SMESH_Hypothesis::Hypothesis_Status ret2 =
- subMesh->SubMeshesAlgoStateEngine(event, anHyp);
- if (ret2 > ret) // more severe
- ret = ret2;
- }
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis");
+
+ if ( _myMeshDS->IsGroupOfSubShapes( aSubShape ))
+ {
+ // return the worst but not fatal state of all group memebers
+ SMESH_Hypothesis::Hypothesis_Status aBestRet, aWorstNotFatal, ret;
+ aBestRet = SMESH_Hypothesis::HYP_BAD_DIM;
+ aWorstNotFatal = SMESH_Hypothesis::HYP_OK;
+ for ( TopoDS_Iterator itS ( aSubShape ); itS.More(); itS.Next())
+ {
+ ret = RemoveHypothesis( itS.Value(), anHypId );
+ if ( !SMESH_Hypothesis::IsStatusFatal( ret ) && ret > aWorstNotFatal )
+ aWorstNotFatal = ret;
+ if ( ret < aBestRet )
+ aBestRet = ret;
+ }
+ if ( SMESH_Hypothesis::IsStatusFatal( aBestRet ))
+ return aBestRet;
+ return aWorstNotFatal;
+ }
- subMesh->DumpAlgoState(true);
- SCRUTE(ret);
- return ret;
+ StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
+ if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
+ throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
+
+ SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
+ SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
+ int hypType = anHyp->GetType();
+ if(MYDEBUG) SCRUTE(hypType);
+ int event;
+
+ // shape
+
+ if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
+ event = SMESH_subMesh::REMOVE_HYP;
+ else
+ event = SMESH_subMesh::REMOVE_ALGO;
+ SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
+
+ // subShapes
+ if (!SMESH_Hypothesis::IsStatusFatal(ret) &&
+ !subMesh->IsApplicableHypotesis( anHyp )) // is removed from father
+ {
+ if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
+ event = SMESH_subMesh::REMOVE_FATHER_HYP;
+ else
+ event = SMESH_subMesh::REMOVE_FATHER_ALGO;
+ SMESH_Hypothesis::Hypothesis_Status ret2 =
+ subMesh->SubMeshesAlgoStateEngine(event, anHyp);
+ if (ret2 > ret) // more severe
+ ret = ret2;
+ }
+
+ subMesh->DumpAlgoState(true);
+ if(MYDEBUG) SCRUTE(ret);
+ return ret;
}
//=============================================================================
SMESHDS_Mesh * SMESH_Mesh::GetMeshDS()
{
- return _myMeshDS;
+ return _myMeshDS;
}
//=============================================================================
//=============================================================================
const list<const SMESHDS_Hypothesis*>&
- SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
- throw(SALOME_Exception)
+SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
+ throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
-// MESSAGE("SMESH_Mesh::GetHypothesisList");
-// _subShapeHypothesisList.clear();
-// const list<const SMESHDS_Hypothesis*>& listHyp =
-// _myMeshDS->GetHypothesis(aSubShape);
-
-// list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
-// while (it!=listHyp.end())
-// {
-// const SMESHDS_Hypothesis *anHyp = *it;
-// _subShapeHypothesisList.push_back(anHyp);
-// it++;
-// }
-// return _subShapeHypothesisList;
return _myMeshDS->GetHypothesis(aSubShape);
}
const list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- MESSAGE("SMESH_Mesh::GetLog");
- return _myMeshDS->GetScript()->GetCommands();
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog");
+ return _myMeshDS->GetScript()->GetCommands();
}
//=============================================================================
void SMESH_Mesh::ClearLog() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- MESSAGE("SMESH_Mesh::ClearLog");
- _myMeshDS->GetScript()->Clear();
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::ClearLog");
+ _myMeshDS->GetScript()->Clear();
}
//=============================================================================
int SMESH_Mesh::GetId()
{
- MESSAGE("SMESH_Mesh::GetId");
- return _id;
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::GetId");
+ return _id;
}
//=============================================================================
SMESH_Gen *SMESH_Mesh::GetGen()
{
- return _gen;
+ return _gen;
}
//=============================================================================
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- //MESSAGE("SMESH_Mesh::GetSubMesh");
- SMESH_subMesh *aSubMesh;
- int index = _subShapes.FindIndex(aSubShape);
-
- if (_mapSubMesh.find(index) != _mapSubMesh.end())
- {
- aSubMesh = _mapSubMesh[index];
- }
- else
- {
- aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
- _mapSubMesh[index] = aSubMesh;
- }
-
- /* NRI 24/02/2003
- * int index = -1;
- * if (_subShapes.Contains(aSubShape))
- * {
- * index = _subShapes.FindIndex(aSubShape);
- * ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end());
- * aSubMesh = _mapSubMesh[index];
- * //MESSAGE("found submesh " << index);
- * }
- * else
- * {
- * index = _subShapes.Add(aSubShape);
- * aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
- * _mapSubMesh[index] = aSubMesh;
- * //MESSAGE("created submesh " << index);
- * }
- */
- return aSubMesh;
+ SMESH_subMesh *aSubMesh;
+ int index = _myMeshDS->ShapeToIndex(aSubShape);
+
+ if (_mapSubMesh.find(index) != _mapSubMesh.end())
+ {
+ aSubMesh = _mapSubMesh[index];
+ }
+ else
+ {
+ aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
+ _mapSubMesh[index] = aSubMesh;
+ }
+ return aSubMesh;
}
//=============================================================================
* if it does not exist.
*/
//=============================================================================
-//
-// * Given a subShape, find if there is a subMesh associated to this subShape
-// * or to a collection of shapes containing this subShape. Collection =
-// * compsolid, shell, wire.
-// *
-// * WARNING : with arg = compsolid, shell or wire returns always NULL.
-// * with a face inside a shell, and submesh created for both, if arg is face,
-// * returns first created submesh of the two.
-// * subMesh is not created, return may be NULL.
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape)
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- //MESSAGE("SMESH_Mesh::GetSubMeshContaining");
- bool isFound = false;
- SMESH_subMesh *aSubMesh = NULL;
-
- int index = _subShapes.FindIndex(aSubShape);
- if (_mapSubMesh.find(index) != _mapSubMesh.end())
- {
- aSubMesh = _mapSubMesh[index];
- isFound = true;
- }
-
- /* NRI 24/02/2003
- * int index = -1;
- * if (_subShapes.Contains(aSubShape))
- * {
- * index = _subShapes.FindIndex(aSubShape);
- * ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end());
- * aSubMesh = _mapSubMesh[index];
- * isFound = true;
- * //MESSAGE("found submesh " << index);
- * }
- */
-
-// map<int, SMESH_subMesh*>::iterator itsm;
-// for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
-// {
-// aSubMesh = (*itsm).second;
-// isFound = aSubMesh->Contains(aSubShape);
-// if (isFound) break;
-// }
-
- if (!isFound)
- aSubMesh = NULL;
- return aSubMesh;
+ bool isFound = false;
+ SMESH_subMesh *aSubMesh = NULL;
+
+ int index = _myMeshDS->ShapeToIndex(aSubShape);
+ if (_mapSubMesh.find(index) != _mapSubMesh.end())
+ {
+ aSubMesh = _mapSubMesh[index];
+ isFound = true;
+ }
+ if (!isFound)
+ aSubMesh = NULL;
+ return aSubMesh;
}
//=======================================================================
bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const TopoDS_Shape & aSubShape)
{
- //MESSAGE( "SMESH_Mesh::IsUsedHypothesis" );
-
// check if anHyp is applicable to aSubShape
SMESH_subMesh * subMesh = GetSubMeshContaining( aSubShape );
if (!subMesh ||
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
map < int, SMESH_subMesh * >::iterator itsm;
_subMeshesUsingHypothesisList.clear();
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
void SMESH_Mesh::ExportMED(const char *file, const char* theMeshName, bool theAutoGroups) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- std::auto_ptr<DriverMED_W_SMESHDS_Mesh> myWriter(new DriverMED_W_SMESHDS_Mesh);
- myWriter ->SetFile ( file );
- myWriter ->SetMesh ( _myMeshDS );
+ DriverMED_W_SMESHDS_Mesh myWriter;
+ myWriter.SetFile ( file );
+ myWriter.SetMesh ( _myMeshDS );
if ( !theMeshName )
- myWriter->SetMeshId ( _idDoc );
+ myWriter.SetMeshId ( _idDoc );
else {
- myWriter->SetMeshId ( -1 );
- myWriter->SetMeshName( theMeshName );
+ myWriter.SetMeshId ( -1 );
+ myWriter.SetMeshName( theMeshName );
}
if ( theAutoGroups ) {
- myWriter->AddGroupOfNodes();
- myWriter->AddGroupOfEdges();
- myWriter->AddGroupOfFaces();
- myWriter->AddGroupOfVolumes();
+ myWriter.AddGroupOfNodes();
+ myWriter.AddGroupOfEdges();
+ myWriter.AddGroupOfFaces();
+ myWriter.AddGroupOfVolumes();
}
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
SMESH_Group* aGroup = it->second;
SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
aGroupDS->SetStoreName( aGroup->GetName() );
- myWriter->AddGroup( aGroupDS );
+ myWriter.AddGroup( aGroupDS );
}
- myWriter->Add();
+ myWriter.Perform();
}
void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- Mesh_Writer *myWriter = new DriverDAT_W_SMESHDS_Mesh;
- myWriter->SetFile(string(file));
- myWriter->SetMesh(_myMeshDS);
- myWriter->SetMeshId(_idDoc);
- myWriter->Add();
+ DriverDAT_W_SMDS_Mesh myWriter;
+ myWriter.SetFile(string(file));
+ myWriter.SetMesh(_myMeshDS);
+ myWriter.SetMeshId(_idDoc);
+ myWriter.Perform();
}
void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- Mesh_Writer *myWriter = new DriverUNV_W_SMESHDS_Mesh;
- myWriter->SetFile(string(file));
- myWriter->SetMesh(_myMeshDS);
- myWriter->SetMeshId(_idDoc);
- myWriter->Add();
+ DriverUNV_W_SMDS_Mesh myWriter;
+ myWriter.SetFile(string(file));
+ myWriter.SetMesh(_myMeshDS);
+ myWriter.SetMeshId(_idDoc);
+ myWriter.Perform();
+}
+
+void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception)
+{
+ Unexpect aCatch(SalomeException);
+ DriverSTL_W_SMDS_Mesh myWriter;
+ myWriter.SetFile(string(file));
+ myWriter.SetIsAscii( isascii );
+ myWriter.SetMesh(_myMeshDS);
+ myWriter.SetMeshId(_idDoc);
+ myWriter.Perform();
}
//=============================================================================
int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- return _myMeshDS->NbNodes();
+ return _myMeshDS->NbNodes();
}
//=============================================================================
int SMESH_Mesh::NbEdges() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- return _myMeshDS->NbEdges();
+ return _myMeshDS->NbEdges();
}
//=============================================================================
int SMESH_Mesh::NbFaces() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- return _myMeshDS->NbFaces();
+ return _myMeshDS->NbFaces();
}
///////////////////////////////////////////////////////////////////////////////
int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
-
- SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
- while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
- return Nb;
+ int Nb = 0;
+
+ SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
+ while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
+ return Nb;
}
///////////////////////////////////////////////////////////////////////////////
int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
-
- SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
- while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
- return Nb;
+ int Nb = 0;
+
+ SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
+ while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
+ return Nb;
}
//=============================================================================
int SMESH_Mesh::NbVolumes() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- return _myMeshDS->NbVolumes();
+ return _myMeshDS->NbVolumes();
}
int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
- SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
- while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
- return Nb;
+ int Nb = 0;
+ SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
+ while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
+ return Nb;
}
int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
- SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
- while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
- return Nb;
+ int Nb = 0;
+ SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
+ while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
+ return Nb;
}
int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
- SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
- while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
- return Nb;
+ int Nb = 0;
+ SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
+ while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
+ return Nb;
}
int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- int Nb = 0;
- SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
- while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
- return Nb;
+ int Nb = 0;
+ SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
+ while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
+ return Nb;
}
//=============================================================================
int SMESH_Mesh::NbSubMesh() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- return _myMeshDS->NbSubMesh();
+ return _myMeshDS->NbSubMesh();
}
//=======================================================================
bool SMESH_Mesh::IsNotConformAllowed() const
{
- MESSAGE("SMESH_Mesh::IsNotConformAllowed");
+ if(MYDEBUG) MESSAGE("SMESH_Mesh::IsNotConformAllowed");
const list<const SMESHDS_Hypothesis*>& listHyp =
_myMeshDS->GetHypothesis( _myMeshDS->ShapeToMesh() );
{
if (_mapGroup.find(_groupId) != _mapGroup.end())
return NULL;
- SMESH_Group* aGroup = new SMESH_Group (this, theType, theName);
theId = _groupId;
+ SMESH_Group* aGroup = new SMESH_Group (theId, this, theType, theName);
+ GetMeshDS()->AddGroup( aGroup->GetGroupDS() );
_mapGroup[_groupId++] = aGroup;
return aGroup;
}
{
if (_mapGroup.find(theGroupID) == _mapGroup.end())
return;
- delete _mapGroup[theGroupID];
+ GetMeshDS()->RemoveGroup( _mapGroup[theGroupID]->GetGroupDS() );
_mapGroup.erase (theGroupID);
+ delete _mapGroup[theGroupID];
}
//=======================================================================
#include "SMESHDS_Command.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_subMesh.hxx"
-#include <SMDSAbs_ElementType.hxx>
-#include "Utils_SALOME_Exception.hxx"
+#include "SMDSAbs_ElementType.hxx"
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <list>
#include <map>
-#if (__GNUC__>2)
#include <string>
-#include <istream>
-#include <ostream>
-#else
-#include <string>
-#include <istream.h>
-#include <ostream.h>
-#endif
+#include <iostream>
class SMESH_Gen;
class SMESH_Group;
class SMESH_Mesh
{
- public:
- SMESH_Mesh();
- SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen,
- SMESHDS_Document * myDocument);
-
- virtual ~SMESH_Mesh();
-
- void ShapeToMesh(const TopoDS_Shape & aShape);
- /*!
- * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
- */
- int MEDToMesh(const char* theFileName, const char* theMeshName);
-
- SMESH_Hypothesis::Hypothesis_Status
- AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
- throw(SALOME_Exception);
-
- SMESH_Hypothesis::Hypothesis_Status
- RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
- throw(SALOME_Exception);
-
- const list <const SMESHDS_Hypothesis * >&
- GetHypothesisList(const TopoDS_Shape & aSubShape) const
- throw(SALOME_Exception);
-
- const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
-
-// const SMESHDS_ListOfAsciiString& GetLog()
-// throw (SALOME_Exception);
-
- void ClearLog() throw(SALOME_Exception);
-
- int GetId();
-
- SMESHDS_Mesh * GetMeshDS();
-
- SMESH_Gen *GetGen();
-
- SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
- throw(SALOME_Exception);
-
- SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape)
- throw(SALOME_Exception);
-
- const list < SMESH_subMesh * >&
- GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
- throw(SALOME_Exception);
-
- bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
- const TopoDS_Shape & aSubShape);
- // Return True if anHyp is used to mesh aSubShape
-
- bool IsNotConformAllowed() const;
- // check if a hypothesis alowing notconform mesh is present
-
- bool IsMainShape(const TopoDS_Shape& theShape) const;
-
- const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape);
- // return list of ancestors of theSubShape in the order
- // that lower dimention shapes come first.
-
- void ExportDAT(const char *file) throw(SALOME_Exception);
- void ExportMED(const char *file, const char* theMeshName = NULL, bool theAutoGroups = true) throw(SALOME_Exception);
- void ExportUNV(const char *file) throw(SALOME_Exception);
-
- int NbNodes() throw(SALOME_Exception);
-
- int NbEdges() throw(SALOME_Exception);
-
- int NbFaces() throw(SALOME_Exception);
-
- int NbTriangles() throw(SALOME_Exception);
-
- int NbQuadrangles() throw(SALOME_Exception);
-
- int NbVolumes() throw(SALOME_Exception);
-
- int NbTetras() throw(SALOME_Exception);
-
- int NbHexas() throw(SALOME_Exception);
-
- int NbPyramids() throw(SALOME_Exception);
-
- int NbPrisms() throw(SALOME_Exception);
-
- int NbSubMesh() throw(SALOME_Exception);
-
- int NbGroup() const { return _mapGroup.size(); }
+ SMESH_Mesh();
+ SMESH_Mesh(const SMESH_Mesh&);
+public:
+ SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen,
+ SMESHDS_Document * myDocument);
- SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
- const char* theName,
- int& theId);
+ virtual ~SMESH_Mesh();
- SMESH_Group* GetGroup (const int theGroupID);
-
- list<int> GetGroupIds();
+ void ShapeToMesh(const TopoDS_Shape & aShape);
- void RemoveGroup (const int theGroupID);
-
- ostream& Dump(ostream & save);
-
- private:
+ int UNVToMesh(const char* theFileName);
+ /*!
+ * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
+ */
+ int MEDToMesh(const char* theFileName, const char* theMeshName);
+
+ int STLToMesh(const char* theFileName);
- int _id; // id given by creator (unique within the creator instance)
- int _studyId;
- int _idDoc; // id given by SMESHDS_Document
- int _groupId; // id generator for group objects
- bool _isShapeToMesh; // set to true when a shape is given (only once)
- list<const SMESHDS_Hypothesis *> _subShapeHypothesisList;
- list <SMESH_subMesh *> _subMeshesUsingHypothesisList;
- SMESHDS_Document * _myDocument;
- SMESHDS_Mesh * _myMeshDS;
- TopTools_IndexedMapOfShape _subShapes;
- map <int, SMESH_subMesh *> _mapSubMesh;
- map <int, SMESH_Group *> _mapGroup;
- SMESH_Gen *_gen;
+ SMESH_Hypothesis::Hypothesis_Status
+ AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
+ throw(SALOME_Exception);
+
+ SMESH_Hypothesis::Hypothesis_Status
+ RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
+ throw(SALOME_Exception);
+
+ const list <const SMESHDS_Hypothesis * >&
+ GetHypothesisList(const TopoDS_Shape & aSubShape) const
+ throw(SALOME_Exception);
+
+ const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
+
+ void ClearLog() throw(SALOME_Exception);
+
+ int GetId();
+
+ SMESHDS_Mesh * GetMeshDS();
+
+ SMESH_Gen *GetGen();
+
+ SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
+ throw(SALOME_Exception);
+
+ SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape)
+ throw(SALOME_Exception);
+
+ const list < SMESH_subMesh * >&
+ GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
+ throw(SALOME_Exception);
+
+ bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
+ const TopoDS_Shape & aSubShape);
+ // Return True if anHyp is used to mesh aSubShape
+
+ bool IsNotConformAllowed() const;
+ // check if a hypothesis alowing notconform mesh is present
+
+ bool IsMainShape(const TopoDS_Shape& theShape) const;
- TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
+ const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape);
+ // return list of ancestors of theSubShape in the order
+ // that lower dimention shapes come first.
+
+ void ExportDAT(const char *file) throw(SALOME_Exception);
+ void ExportMED(const char *file, const char* theMeshName = NULL, bool theAutoGroups = true) throw(SALOME_Exception);
+ void ExportUNV(const char *file) throw(SALOME_Exception);
+ void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception);
+
+ int NbNodes() throw(SALOME_Exception);
+
+ int NbEdges() throw(SALOME_Exception);
+
+ int NbFaces() throw(SALOME_Exception);
+
+ int NbTriangles() throw(SALOME_Exception);
+
+ int NbQuadrangles() throw(SALOME_Exception);
+
+ int NbVolumes() throw(SALOME_Exception);
+
+ int NbTetras() throw(SALOME_Exception);
+
+ int NbHexas() throw(SALOME_Exception);
+
+ int NbPyramids() throw(SALOME_Exception);
+
+ int NbPrisms() throw(SALOME_Exception);
+
+ int NbSubMesh() throw(SALOME_Exception);
+
+ int NbGroup() const { return _mapGroup.size(); }
+
+ SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
+ const char* theName,
+ int& theId);
+
+ SMESH_Group* GetGroup (const int theGroupID);
+
+ list<int> GetGroupIds();
+
+ void RemoveGroup (const int theGroupID);
+
+ ostream& Dump(ostream & save);
+
+private:
+ int _id; // id given by creator (unique within the creator instance)
+ int _studyId;
+ int _idDoc; // id given by SMESHDS_Document
+ int _groupId; // id generator for group objects
+ bool _isShapeToMesh; // set to true when a shape is given (only once)
+ list<const SMESHDS_Hypothesis *> _subShapeHypothesisList;
+ list <SMESH_subMesh *> _subMeshesUsingHypothesisList;
+ SMESHDS_Document * _myDocument;
+ SMESHDS_Mesh * _myMeshDS;
+ //TopTools_IndexedMapOfShape _subShapes; USE the same map of _myMeshDS
+ map <int, SMESH_subMesh *> _mapSubMesh;
+ map <int, SMESH_Group *> _mapGroup;
+ SMESH_Gen *_gen;
+
+ TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
};
#endif
--- /dev/null
+// SMESH SMESH : idl implementation based on 'SMESH' unit's classes
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_MeshEditor.cxx
+// Created : Mon Apr 12 16:10:22 2004
+// Author : Edward AGAPOV (eap)
+
+
+#include "SMESH_MeshEditor.hxx"
+
+#include "SMDS_FaceOfNodes.hxx"
+#include "SMDS_VolumeTool.hxx"
+#include "SMESHDS_Group.hxx"
+
+#include "utilities.h"
+
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Lin.hxx>
+#include <gp.hxx>
+#include <gp_Pln.hxx>
+
+#include <map>
+
+using namespace std;
+
+typedef map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
+typedef map<const SMDS_MeshNode*, list<const SMDS_MeshNode*> > TNodeOfNodeListMap;
+typedef map<const SMDS_MeshElement*, list<const SMDS_MeshNode*> > TElemOfNodeListMap;
+
+//=======================================================================
+//function : SMESH_MeshEditor
+//purpose :
+//=======================================================================
+
+SMESH_MeshEditor::SMESH_MeshEditor( SMESH_Mesh* theMesh ):
+myMesh( theMesh )
+{
+}
+
+//=======================================================================
+//function : Remove
+//purpose : Remove a node or an element.
+// Modify a compute state of sub-meshes which become empty
+//=======================================================================
+
+bool SMESH_MeshEditor::Remove (const list< int >& theIDs,
+ const bool isNodes )
+{
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+ set< SMESH_subMesh *> smmap;
+
+ list<int>::const_iterator it = theIDs.begin();
+ for ( ; it != theIDs.end(); it++ )
+ {
+ const SMDS_MeshElement * elem;
+ if ( isNodes )
+ elem = aMesh->FindNode( *it );
+ else
+ elem = aMesh->FindElement( *it );
+ if ( !elem )
+ continue;
+
+ // Find sub-meshes to notify about modification
+ SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+ while ( nodeIt->more() )
+ {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ const SMDS_PositionPtr& aPosition = node->GetPosition();
+ if ( aPosition.get() ) {
+ int aShapeID = aPosition->GetShapeId();
+ if ( aShapeID ) {
+ TopoDS_Shape aShape = aMesh->IndexToShape( aShapeID );
+ SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShape );
+ if ( sm )
+ smmap.insert( sm );
+ }
+ }
+ }
+
+ // Do remove
+ if ( isNodes )
+ aMesh->RemoveNode( static_cast< const SMDS_MeshNode* >( elem ));
+ else
+ aMesh->RemoveElement( elem );
+ }
+
+ // Notify sub-meshes about modification
+ if ( !smmap.empty() ) {
+ set< SMESH_subMesh *>::iterator smIt;
+ for ( smIt = smmap.begin(); smIt != smmap.end(); smIt++ )
+ (*smIt)->ComputeStateEngine( SMESH_subMesh::MESH_ENTITY_REMOVED );
+ }
+ return true;
+}
+
+//=======================================================================
+//function : FindShape
+//purpose : Return an index of the shape theElem is on
+// or zero if a shape not found
+//=======================================================================
+
+int SMESH_MeshEditor::FindShape (const SMDS_MeshElement * theElem)
+{
+ SMESHDS_Mesh * aMesh = GetMeshDS();
+ if ( aMesh->ShapeToMesh().IsNull() )
+ return 0;
+
+ if ( theElem->GetType() == SMDSAbs_Node )
+ {
+ const SMDS_PositionPtr& aPosition =
+ static_cast<const SMDS_MeshNode*>( theElem )->GetPosition();
+ if ( aPosition.get() )
+ return aPosition->GetShapeId();
+ else
+ return 0;
+ }
+
+ TopoDS_Shape aShape; // the shape a node is on
+ SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator();
+ while ( nodeIt->more() )
+ {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ const SMDS_PositionPtr& aPosition = node->GetPosition();
+ if ( aPosition.get() ) {
+ int aShapeID = aPosition->GetShapeId();
+ SMESHDS_SubMesh * sm = aMesh->MeshElements( aShapeID );
+ if ( sm )
+ {
+ if ( sm->Contains( theElem ))
+ return aShapeID;
+ if ( aShape.IsNull() )
+ aShape = aMesh->IndexToShape( aShapeID );
+ }
+ else
+ {
+ //MESSAGE ( "::FindShape() No SubShape for aShapeID " << aShapeID );
+ }
+ }
+ }
+
+ // None of nodes is on a proper shape,
+ // find the shape among ancestors of aShape on which a node is
+ if ( aShape.IsNull() ) {
+ //MESSAGE ("::FindShape() - NONE node is on shape")
+ return 0;
+ }
+ TopTools_ListIteratorOfListOfShape ancIt( GetMesh()->GetAncestors( aShape ));
+ for ( ; ancIt.More(); ancIt.Next() )
+ {
+ SMESHDS_SubMesh * sm = aMesh->MeshElements( ancIt.Value() );
+ if ( sm && sm->Contains( theElem ))
+ return aMesh->ShapeToIndex( ancIt.Value() );
+ }
+
+ //MESSAGE ("::FindShape() - SHAPE NOT FOUND")
+ return 0;
+}
+
+//=======================================================================
+//function : InverseDiag
+//purpose : Replace two neighbour triangles with ones built on the same 4 nodes
+// but having other common link.
+// Return False if args are improper
+//=======================================================================
+
+bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshElement * theTria1,
+ const SMDS_MeshElement * theTria2 )
+{
+ if (!theTria1 || !theTria2)
+ return false;
+ const SMDS_FaceOfNodes* F1 = dynamic_cast<const SMDS_FaceOfNodes*>( theTria1 );
+ if (!F1) return false;
+ const SMDS_FaceOfNodes* F2 = dynamic_cast<const SMDS_FaceOfNodes*>( theTria2 );
+ if (!F2) return false;
+
+ // 1 +--+ A theTria1: ( 1 A B ) A->2 ( 1 2 B ) 1 +--+ A
+ // | /| theTria2: ( B A 2 ) B->1 ( 1 A 2 ) |\ |
+ // |/ | | \|
+ // B +--+ 2 B +--+ 2
+
+ // put nodes in array and find out indices of the same ones
+ const SMDS_MeshNode* aNodes [6];
+ int sameInd [] = { 0, 0, 0, 0, 0, 0 };
+ int i = 0;
+ SMDS_ElemIteratorPtr it = theTria1->nodesIterator();
+ while ( it->more() )
+ {
+ aNodes[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
+
+ if ( i > 2 ) // theTria2
+ // find same node of theTria1
+ for ( int j = 0; j < 3; j++ )
+ if ( aNodes[ i ] == aNodes[ j ]) {
+ sameInd[ j ] = i;
+ sameInd[ i ] = j;
+ break;
+ }
+ // next
+ i++;
+ if ( i == 3 ) {
+ if ( it->more() )
+ return false; // theTria1 is not a triangle
+ it = theTria2->nodesIterator();
+ }
+ if ( i == 6 && it->more() )
+ return false; // theTria2 is not a triangle
+ }
+
+ // find indices of 1,2 and of A,B in theTria1
+ int iA = 0, iB = 0, i1 = 0, i2 = 0;
+ for ( i = 0; i < 6; i++ )
+ {
+ if ( sameInd [ i ] == 0 )
+ if ( i < 3 ) i1 = i;
+ else i2 = i;
+ else if (i < 3)
+ if ( iA ) iB = i;
+ else iA = i;
+ }
+ // nodes 1 and 2 should not be the same
+ if ( aNodes[ i1 ] == aNodes[ i2 ] )
+ return false;
+
+
+ // theTria1: A->2
+ aNodes[ iA ] = aNodes[ i2 ];
+ // theTria2: B->1
+ aNodes[ sameInd[ iB ]] = aNodes[ i1 ];
+
+ //MESSAGE( theTria1 << theTria2 );
+
+ GetMeshDS()->ChangeElementNodes( theTria1, aNodes, 3 );
+ GetMeshDS()->ChangeElementNodes( theTria2, &aNodes[ 3 ], 3 );
+
+ //MESSAGE( theTria1 << theTria2 );
+
+ return true;
+}
+
+//=======================================================================
+//function : findTriangles
+//purpose : find triangles sharing theNode1-theNode2 link
+//=======================================================================
+
+static bool findTriangles(const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2,
+ const SMDS_MeshElement*& theTria1,
+ const SMDS_MeshElement*& theTria2)
+{
+ if ( !theNode1 || !theNode2 ) return false;
+
+ theTria1 = theTria2 = 0;
+
+ set< const SMDS_MeshElement* > emap;
+ SMDS_ElemIteratorPtr it = theNode1->GetInverseElementIterator();
+ while (it->more()) {
+ const SMDS_MeshElement* elem = it->next();
+ if ( elem->GetType() == SMDSAbs_Face && elem->NbNodes() == 3 )
+ emap.insert( elem );
+ }
+ it = theNode2->GetInverseElementIterator();
+ while (it->more()) {
+ const SMDS_MeshElement* elem = it->next();
+ if ( elem->GetType() == SMDSAbs_Face &&
+ emap.find( elem ) != emap.end() )
+ if ( theTria1 ) {
+ theTria2 = elem;
+ break;
+ } else {
+ theTria1 = elem;
+ }
+ }
+ return ( theTria1 && theTria2 );
+}
+
+//=======================================================================
+//function : InverseDiag
+//purpose : Replace two neighbour triangles sharing theNode1-theNode2 link
+// with ones built on the same 4 nodes but having other common link.
+// Return false if proper faces not found
+//=======================================================================
+
+bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2)
+{
+ MESSAGE( "::InverseDiag()" );
+
+ const SMDS_MeshElement *tr1, *tr2;
+ if ( !findTriangles( theNode1, theNode2, tr1, tr2 ))
+ return false;
+
+ const SMDS_FaceOfNodes* F1 = dynamic_cast<const SMDS_FaceOfNodes*>( tr1 );
+ if (!F1) return false;
+ const SMDS_FaceOfNodes* F2 = dynamic_cast<const SMDS_FaceOfNodes*>( tr2 );
+ if (!F2) return false;
+
+ // 1 +--+ A tr1: ( 1 A B ) A->2 ( 1 2 B ) 1 +--+ A
+ // | /| tr2: ( B A 2 ) B->1 ( 1 A 2 ) |\ |
+ // |/ | | \|
+ // B +--+ 2 B +--+ 2
+
+ // put nodes in array
+ // and find indices of 1,2 and of A in tr1 and of B in tr2
+ int i, iA1 = 0, i1 = 0;
+ const SMDS_MeshNode* aNodes1 [3];
+ SMDS_ElemIteratorPtr it;
+ for (i = 0, it = tr1->nodesIterator(); it->more(); i++ ) {
+ aNodes1[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
+ if ( aNodes1[ i ] == theNode1 )
+ iA1 = i; // node A in tr1
+ else if ( aNodes1[ i ] != theNode2 )
+ i1 = i; // node 1
+ }
+ int iB2 = 0, i2 = 0;
+ const SMDS_MeshNode* aNodes2 [3];
+ for (i = 0, it = tr2->nodesIterator(); it->more(); i++ ) {
+ aNodes2[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
+ if ( aNodes2[ i ] == theNode2 )
+ iB2 = i; // node B in tr2
+ else if ( aNodes2[ i ] != theNode1 )
+ i2 = i; // node 2
+ }
+
+ // nodes 1 and 2 should not be the same
+ if ( aNodes1[ i1 ] == aNodes2[ i2 ] )
+ return false;
+
+ // tr1: A->2
+ aNodes1[ iA1 ] = aNodes2[ i2 ];
+ // tr2: B->1
+ aNodes2[ iB2 ] = aNodes1[ i1 ];
+
+ //MESSAGE( tr1 << tr2 );
+
+ GetMeshDS()->ChangeElementNodes( tr1, aNodes1, 3 );
+ GetMeshDS()->ChangeElementNodes( tr2, aNodes2, 3 );
+
+ //MESSAGE( tr1 << tr2 );
+
+ return true;
+
+}
+
+//=======================================================================
+//function : getQuadrangleNodes
+//purpose : fill theQuadNodes - nodes of a quadrangle resulting from
+// fusion of triangles tr1 and tr2 having shared link on
+// theNode1 and theNode2
+//=======================================================================
+
+bool getQuadrangleNodes(const SMDS_MeshNode * theQuadNodes [],
+ const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2,
+ const SMDS_MeshElement * tr1,
+ const SMDS_MeshElement * tr2 )
+{
+ // find the 4-th node to insert into tr1
+ const SMDS_MeshNode* n4 = 0;
+ SMDS_ElemIteratorPtr it = tr2->nodesIterator();
+ while ( !n4 && it->more() )
+ {
+ const SMDS_MeshNode * n = static_cast<const SMDS_MeshNode*>( it->next() );
+ bool isDiag = ( n == theNode1 || n == theNode2 );
+ if ( !isDiag )
+ n4 = n;
+ }
+ // Make an array of nodes to be in a quadrangle
+ int iNode = 0, iFirstDiag = -1;
+ it = tr1->nodesIterator();
+ while ( it->more() )
+ {
+ const SMDS_MeshNode * n = static_cast<const SMDS_MeshNode*>( it->next() );
+ bool isDiag = ( n == theNode1 || n == theNode2 );
+ if ( isDiag )
+ {
+ if ( iFirstDiag < 0 )
+ iFirstDiag = iNode;
+ else if ( iNode - iFirstDiag == 1 )
+ theQuadNodes[ iNode++ ] = n4; // insert the 4-th node between diagonal nodes
+ }
+ else if ( n == n4 )
+ {
+ return false; // tr1 and tr2 should not have all the same nodes
+ }
+ theQuadNodes[ iNode++ ] = n;
+ }
+ if ( iNode == 3 ) // diagonal nodes have 0 and 2 indices
+ theQuadNodes[ iNode ] = n4;
+
+ return true;
+}
+
+//=======================================================================
+//function : DeleteDiag
+//purpose : Replace two neighbour triangles sharing theNode1-theNode2 link
+// with a quadrangle built on the same 4 nodes.
+// Return false if proper faces not found
+//=======================================================================
+
+bool SMESH_MeshEditor::DeleteDiag (const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2)
+{
+ MESSAGE( "::DeleteDiag()" );
+
+ const SMDS_MeshElement *tr1, *tr2;
+ if ( !findTriangles( theNode1, theNode2, tr1, tr2 ))
+ return false;
+
+ const SMDS_FaceOfNodes* F1 = dynamic_cast<const SMDS_FaceOfNodes*>( tr1 );
+ if (!F1) return false;
+ const SMDS_FaceOfNodes* F2 = dynamic_cast<const SMDS_FaceOfNodes*>( tr2 );
+ if (!F2) return false;
+
+ const SMDS_MeshNode* aNodes [ 4 ];
+ if ( ! getQuadrangleNodes( aNodes, theNode1, theNode2, tr1, tr2 ))
+ return false;
+
+ //MESSAGE( endl << tr1 << tr2 );
+
+ GetMeshDS()->ChangeElementNodes( tr1, aNodes, 4 );
+ GetMeshDS()->RemoveElement( tr2 );
+
+ //MESSAGE( endl << tr1 );
+
+ return true;
+}
+
+//=======================================================================
+//function : Reorient
+//purpose : Reverse the normal of theFace
+// Return false if theFace is null
+//=======================================================================
+
+bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theFace)
+{
+ if (!theFace) return false;
+ const SMDS_FaceOfNodes* F = dynamic_cast<const SMDS_FaceOfNodes*>( theFace );
+ if (!F) return false;
+
+ const SMDS_MeshNode* aNodes [4], *tmpNode;
+ int i = 0;
+ SMDS_ElemIteratorPtr it = theFace->nodesIterator();
+ while ( it->more() )
+ aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( it->next() );
+
+ // exchange nodes with indeces 0 and 2
+ tmpNode = aNodes[ 0 ];
+ aNodes[ 0 ] = aNodes[ 2 ];
+ aNodes[ 2 ] = tmpNode;
+
+ //MESSAGE( theFace );
+
+ GetMeshDS()->ChangeElementNodes( theFace, aNodes, theFace->NbNodes() );
+
+ //MESSAGE( theFace );
+
+ return true;
+}
+
+//=======================================================================
+//function : getBadRate
+//purpose :
+//=======================================================================
+
+static double getBadRate (const SMDS_MeshElement* theElem,
+ SMESH::Controls::NumericalFunctorPtr& theCrit)
+{
+ TColgp_SequenceOfXYZ P;
+ if ( !theElem || !theCrit->GetPoints( theElem, P ))
+ return 1e100;
+ return theCrit->GetBadRate( theCrit->GetValue( P ), theElem->NbNodes() );
+}
+
+//=======================================================================
+//function : QuadToTri
+//purpose : Cut quadrangles into triangles.
+// theCrit is used to select a diagonal to cut
+//=======================================================================
+
+bool SMESH_MeshEditor::QuadToTri (set<const SMDS_MeshElement*> & theElems,
+ SMESH::Controls::NumericalFunctorPtr theCrit)
+{
+ MESSAGE( "::QuadToTri()" );
+
+ if ( !theCrit.get() )
+ return false;
+
+ SMESHDS_Mesh * aMesh = GetMeshDS();
+
+ set< const SMDS_MeshElement * >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->GetType() != SMDSAbs_Face || elem->NbNodes() != 4 )
+ continue;
+
+ // retrieve element nodes
+ const SMDS_MeshNode* aNodes [4];
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ int i = 0;
+ while ( itN->more() )
+ aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+
+ // compare two sets of possible triangles
+ double aBadRate1, aBadRate2; // to what extent a set is bad
+ SMDS_FaceOfNodes tr1 ( aNodes[0], aNodes[1], aNodes[2] );
+ SMDS_FaceOfNodes tr2 ( aNodes[2], aNodes[3], aNodes[0] );
+ aBadRate1 = getBadRate( &tr1, theCrit ) + getBadRate( &tr2, theCrit );
+
+ SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] );
+ SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] );
+ aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit );
+
+ int aShapeId = FindShape( elem );
+ //MESSAGE( "aBadRate1 = " << aBadRate1 << "; aBadRate2 = " << aBadRate2
+ // << " ShapeID = " << aShapeId << endl << elem );
+
+ if ( aBadRate1 <= aBadRate2 ) {
+ // tr1 + tr2 is better
+ aMesh->ChangeElementNodes( elem, aNodes, 3 );
+ //MESSAGE( endl << elem );
+
+ elem = aMesh->AddFace( aNodes[2], aNodes[3], aNodes[0] );
+ }
+ else {
+ // tr3 + tr4 is better
+ aMesh->ChangeElementNodes( elem, &aNodes[1], 3 );
+ //MESSAGE( endl << elem );
+
+ elem = aMesh->AddFace( aNodes[3], aNodes[0], aNodes[1] );
+ }
+ //MESSAGE( endl << elem );
+
+ // put a new triangle on the same shape
+ if ( aShapeId )
+ aMesh->SetMeshElementOnShape( elem, aShapeId );
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : addToSameGroups
+//purpose : add elemToAdd to the groups the elemInGroups belongs to
+//=======================================================================
+
+static void addToSameGroups (const SMDS_MeshElement* elemToAdd,
+ const SMDS_MeshElement* elemInGroups,
+ SMESHDS_Mesh * aMesh)
+{
+ const set<SMESHDS_Group*>& groups = aMesh->GetGroups();
+ set<SMESHDS_Group*>::const_iterator grIt = groups.begin();
+ for ( ; grIt != groups.end(); grIt++ ) {
+ if ( (*grIt)->SMDS_MeshGroup::Contains( elemInGroups ))
+ (*grIt)->SMDS_MeshGroup::Add( elemToAdd );
+ }
+}
+
+//=======================================================================
+//function : QuadToTri
+//purpose : Cut quadrangles into triangles.
+// theCrit is used to select a diagonal to cut
+//=======================================================================
+
+bool SMESH_MeshEditor::QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
+ const bool the13Diag)
+{
+ MESSAGE( "::QuadToTri()" );
+
+ SMESHDS_Mesh * aMesh = GetMeshDS();
+
+ set< const SMDS_MeshElement * >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->GetType() != SMDSAbs_Face || elem->NbNodes() != 4 )
+ continue;
+
+ // retrieve element nodes
+ const SMDS_MeshNode* aNodes [4];
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ int i = 0;
+ while ( itN->more() )
+ aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+
+ int aShapeId = FindShape( elem );
+ const SMDS_MeshElement* newElem = 0;
+ if ( the13Diag )
+ {
+ aMesh->ChangeElementNodes( elem, aNodes, 3 );
+ newElem = aMesh->AddFace( aNodes[2], aNodes[3], aNodes[0] );
+ }
+ else
+ {
+ aMesh->ChangeElementNodes( elem, &aNodes[1], 3 );
+ newElem = aMesh->AddFace( aNodes[3], aNodes[0], aNodes[1] );
+ }
+
+ // put a new triangle on the same shape and add to the same groups
+
+ if ( aShapeId )
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+
+ addToSameGroups( newElem, elem, aMesh );
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : getAngle
+//purpose :
+//=======================================================================
+
+double getAngle(const SMDS_MeshElement * tr1,
+ const SMDS_MeshElement * tr2,
+ const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2)
+{
+ double angle = 2*PI; // bad angle
+
+ // get normals
+ TColgp_SequenceOfXYZ P1, P2;
+ if ( !SMESH::Controls::NumericalFunctor::GetPoints( tr1, P1 ) ||
+ !SMESH::Controls::NumericalFunctor::GetPoints( tr2, P2 ))
+ return angle;
+ gp_Vec N1 = gp_Vec( P1(2) - P1(1) ) ^ gp_Vec( P1(3) - P1(1) );
+ if ( N1.SquareMagnitude() <= gp::Resolution() )
+ return angle;
+ gp_Vec N2 = gp_Vec( P2(2) - P2(1) ) ^ gp_Vec( P2(3) - P2(1) );
+ if ( N2.SquareMagnitude() <= gp::Resolution() )
+ return angle;
+
+ // find the first diagonal node n1 in the triangles:
+ // take in account a diagonal link orientation
+ const SMDS_MeshElement *nFirst[2], *tr[] = { tr1, tr2 };
+ for ( int t = 0; t < 2; t++ )
+ {
+ SMDS_ElemIteratorPtr it = tr[ t ]->nodesIterator();
+ int i = 0, iDiag = -1;
+ while ( it->more()) {
+ const SMDS_MeshElement *n = it->next();
+ if ( n == n1 || n == n2 )
+ if ( iDiag < 0)
+ iDiag = i;
+ else {
+ if ( i - iDiag == 1 )
+ nFirst[ t ] = ( n == n1 ? n2 : n1 );
+ else
+ nFirst[ t ] = n;
+ break;
+ }
+ i++;
+ }
+ }
+ if ( nFirst[ 0 ] == nFirst[ 1 ] )
+ N2.Reverse();
+
+ angle = N1.Angle( N2 );
+ //SCRUTE( angle );
+ return angle;
+}
+
+// =================================================
+// class generating a unique ID for a pair of nodes
+// and able to return nodes by that ID
+// =================================================
+
+class LinkID_Gen {
+ public:
+
+ LinkID_Gen( const SMESHDS_Mesh* theMesh )
+ :myMesh( theMesh ), myMaxID( theMesh->MaxNodeID() + 1)
+ {}
+
+ long GetLinkID (const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2) const
+ {
+ return ( Min(n1->GetID(),n2->GetID()) * myMaxID + Max(n1->GetID(),n2->GetID()));
+ }
+
+ bool GetNodes (const long theLinkID,
+ const SMDS_MeshNode* & theNode1,
+ const SMDS_MeshNode* & theNode2) const
+ {
+ theNode1 = myMesh->FindNode( theLinkID / myMaxID );
+ if ( !theNode1 ) return false;
+ theNode2 = myMesh->FindNode( theLinkID % myMaxID );
+ if ( !theNode2 ) return false;
+ return true;
+ }
+
+ private:
+ LinkID_Gen();
+ const SMESHDS_Mesh* myMesh;
+ long myMaxID;
+};
+
+//=======================================================================
+//function : TriToQuad
+//purpose : Fuse neighbour triangles into quadrangles.
+// theCrit is used to select a neighbour to fuse with.
+// theMaxAngle is a max angle between element normals at which
+// fusion is still performed.
+//=======================================================================
+
+bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> & theElems,
+ SMESH::Controls::NumericalFunctorPtr theCrit,
+ const double theMaxAngle)
+{
+ MESSAGE( "::TriToQuad()" );
+
+ if ( !theCrit.get() )
+ return false;
+
+ SMESHDS_Mesh * aMesh = GetMeshDS();
+ LinkID_Gen aLinkID_Gen( aMesh );
+
+
+ // Prepare data for algo: build
+ // 1. map of elements with their linkIDs
+ // 2. map of linkIDs with their elements
+
+ map< long, list< const SMDS_MeshElement* > > mapLi_listEl;
+ map< long, list< const SMDS_MeshElement* > >::iterator itLE;
+ map< const SMDS_MeshElement*, set< long > > mapEl_setLi;
+ map< const SMDS_MeshElement*, set< long > >::iterator itEL;
+
+ set<const SMDS_MeshElement*>::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->NbNodes() != 3 )
+ continue;
+
+ // retrieve element nodes
+ const SMDS_MeshNode* aNodes [4];
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ int i = 0;
+ while ( itN->more() )
+ aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+ ASSERT( i == 3 );
+ aNodes[ 3 ] = aNodes[ 0 ];
+
+ // fill maps
+ for ( i = 0; i < 3; i++ )
+ {
+ long linkID = aLinkID_Gen.GetLinkID( aNodes[ i ], aNodes[ i+1 ] );
+ // check if elements sharing a link can be fused
+ itLE = mapLi_listEl.find( linkID );
+ if ( itLE != mapLi_listEl.end() )
+ {
+ if ((*itLE).second.size() > 1 ) // consider only 2 elems adjacent by a link
+ continue;
+ const SMDS_MeshElement* elem2 = (*itLE).second.front();
+// if ( FindShape( elem ) != FindShape( elem2 ))
+// continue; // do not fuse triangles laying on different shapes
+ if ( getAngle( elem, elem2, aNodes[i], aNodes[i+1] ) > theMaxAngle )
+ continue; // avoid making badly shaped quads
+ (*itLE).second.push_back( elem );
+ }
+ else
+ mapLi_listEl[ linkID ].push_back( elem );
+ mapEl_setLi [ elem ].insert( linkID );
+ }
+ }
+ // Clean the maps from the links shared by a sole element, ie
+ // links to which only one element is bound in mapLi_listEl
+
+ for ( itLE = mapLi_listEl.begin(); itLE != mapLi_listEl.end(); itLE++ )
+ {
+ int nbElems = (*itLE).second.size();
+ if ( nbElems < 2 ) {
+ const SMDS_MeshElement* elem = (*itLE).second.front();
+ long link = (*itLE).first;
+ mapEl_setLi[ elem ].erase( link );
+ if ( mapEl_setLi[ elem ].empty() )
+ mapEl_setLi.erase( elem );
+ }
+ }
+
+ // Algo: fuse triangles into quadrangles
+
+ while ( ! mapEl_setLi.empty() )
+ {
+ // Look for the start element:
+ // the element having the least nb of shared links
+
+ const SMDS_MeshElement* startElem = 0;
+ int minNbLinks = 4;
+ for ( itEL = mapEl_setLi.begin(); itEL != mapEl_setLi.end(); itEL++ )
+ {
+ int nbLinks = (*itEL).second.size();
+ if ( nbLinks < minNbLinks )
+ {
+ startElem = (*itEL).first;
+ minNbLinks = nbLinks;
+ if ( minNbLinks == 1 )
+ break;
+ }
+ }
+
+ // search elements to fuse starting from startElem or links of elements
+ // fused earlyer - startLinks
+ list< long > startLinks;
+ while ( startElem || !startLinks.empty() )
+ {
+ while ( !startElem && !startLinks.empty() )
+ {
+ // Get an element to start, by a link
+ long linkId = startLinks.front();
+ startLinks.pop_front();
+ itLE = mapLi_listEl.find( linkId );
+ if ( itLE != mapLi_listEl.end() )
+ {
+ list< const SMDS_MeshElement* > & listElem = (*itLE).second;
+ list< const SMDS_MeshElement* >::iterator itE = listElem.begin();
+ for ( ; itE != listElem.end() ; itE++ )
+ if ( mapEl_setLi.find( (*itE) ) != mapEl_setLi.end() )
+ startElem = (*itE);
+ mapLi_listEl.erase( itLE );
+ }
+ }
+
+ if ( startElem )
+ {
+ // Get candidates to be fused
+
+ const SMDS_MeshElement *tr1 = startElem, *tr2 = 0, *tr3 = 0;
+ long link12, link13;
+ startElem = 0;
+ ASSERT( mapEl_setLi.find( tr1 ) != mapEl_setLi.end() );
+ set< long >& setLi = mapEl_setLi[ tr1 ];
+ ASSERT( !setLi.empty() );
+ set< long >::iterator itLi;
+ for ( itLi = setLi.begin(); itLi != setLi.end(); itLi++ )
+ {
+ long linkID = (*itLi);
+ itLE = mapLi_listEl.find( linkID );
+ if ( itLE == mapLi_listEl.end() )
+ continue;
+ const SMDS_MeshElement* elem = (*itLE).second.front();
+ if ( elem == tr1 )
+ elem = (*itLE).second.back();
+ mapLi_listEl.erase( itLE );
+ if ( mapEl_setLi.find( elem ) == mapEl_setLi.end())
+ continue;
+ if ( tr2 )
+ {
+ tr3 = elem;
+ link13 = linkID;
+ }
+ else
+ {
+ tr2 = elem;
+ link12 = linkID;
+ }
+
+ // add other links of elem to list of links to re-start from
+ set< long >& links = mapEl_setLi[ elem ];
+ set< long >::iterator it;
+ for ( it = links.begin(); it != links.end(); it++ )
+ {
+ long linkID2 = (*it);
+ if ( linkID2 != linkID )
+ startLinks.push_back( linkID2 );
+ }
+ }
+
+ // Get nodes of possible quadrangles
+
+ const SMDS_MeshNode *n12 [4], *n13 [4];
+ bool Ok12 = false, Ok13 = false;
+ const SMDS_MeshNode *linkNode1, *linkNode2;
+ if ( tr2 &&
+ aLinkID_Gen.GetNodes( link12, linkNode1, linkNode2 ) &&
+ getQuadrangleNodes( n12, linkNode1, linkNode2, tr1, tr2 ))
+ Ok12 = true;
+ if ( tr3 &&
+ aLinkID_Gen.GetNodes( link13, linkNode1, linkNode2 ) &&
+ getQuadrangleNodes( n13, linkNode1, linkNode2, tr1, tr3 ))
+ Ok13 = true;
+
+ // Choose a pair to fuse
+
+ if ( Ok12 && Ok13 )
+ {
+ SMDS_FaceOfNodes quad12 ( n12[ 0 ], n12[ 1 ], n12[ 2 ], n12[ 3 ] );
+ SMDS_FaceOfNodes quad13 ( n13[ 0 ], n13[ 1 ], n13[ 2 ], n13[ 3 ] );
+ double aBadRate12 = getBadRate( &quad12, theCrit );
+ double aBadRate13 = getBadRate( &quad13, theCrit );
+ if ( aBadRate13 < aBadRate12 )
+ Ok12 = false;
+ else
+ Ok13 = false;
+ }
+
+
+ // Make quadrangles
+ // and remove fused elems and removed links from the maps
+
+ mapEl_setLi.erase( tr1 );
+ if ( Ok12 )
+ {
+ mapEl_setLi.erase( tr2 );
+ mapLi_listEl.erase( link12 );
+ aMesh->ChangeElementNodes( tr1, n12, 4 );
+ aMesh->RemoveElement( tr2 );
+ }
+ else if ( Ok13 )
+ {
+ mapEl_setLi.erase( tr3 );
+ mapLi_listEl.erase( link13 );
+ aMesh->ChangeElementNodes( tr1, n13, 4 );
+ aMesh->RemoveElement( tr3 );
+ }
+
+ // Next element to fuse: the rejected one
+ if ( tr3 )
+ startElem = Ok12 ? tr3 : tr2;
+
+ } // if ( startElem )
+ } // while ( startElem || !startLinks.empty() )
+ } // while ( ! mapEl_setLi.empty() )
+
+ return true;
+}
+
+
+#define DUMPSO(txt) \
+// cout << txt << endl;
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+static void swap( int i1, int i2, int idNodes[], gp_Pnt P[] )
+{
+ if ( i1 == i2 )
+ return;
+ int tmp = idNodes[ i1 ];
+ idNodes[ i1 ] = idNodes[ i2 ];
+ idNodes[ i2 ] = tmp;
+ gp_Pnt Ptmp = P[ i1 ];
+ P[ i1 ] = P[ i2 ];
+ P[ i2 ] = Ptmp;
+ DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << ")");
+}
+
+//=======================================================================
+//function : SortQuadNodes
+//purpose : Set 4 nodes of a quadrangle face in a good order.
+// Swap 1<->2 or 2<->3 nodes and correspondingly return
+// 1 or 2 else 0.
+//=======================================================================
+
+int SMESH_MeshEditor::SortQuadNodes (const SMDS_Mesh * theMesh,
+ int idNodes[] )
+{
+ gp_Pnt P[4];
+ int i;
+ for ( i = 0; i < 4; i++ ) {
+ const SMDS_MeshNode *n = theMesh->FindNode( idNodes[i] );
+ if ( !n ) return 0;
+ P[ i ].SetCoord( n->X(), n->Y(), n->Z() );
+ }
+
+ gp_Vec V1(P[0], P[1]);
+ gp_Vec V2(P[0], P[2]);
+ gp_Vec V3(P[0], P[3]);
+
+ gp_Vec Cross1 = V1 ^ V2;
+ gp_Vec Cross2 = V2 ^ V3;
+
+ i = 0;
+ if (Cross1.Dot(Cross2) < 0)
+ {
+ Cross1 = V2 ^ V1;
+ Cross2 = V1 ^ V3;
+
+ if (Cross1.Dot(Cross2) < 0)
+ i = 2;
+ else
+ i = 1;
+ swap ( i, i + 1, idNodes, P );
+
+// for ( int ii = 0; ii < 4; ii++ ) {
+// const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
+// DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
+// }
+ }
+ return i;
+}
+
+//=======================================================================
+//function : SortHexaNodes
+//purpose : Set 8 nodes of a hexahedron in a good order.
+// Return success status
+//=======================================================================
+
+bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
+ int idNodes[] )
+{
+ gp_Pnt P[8];
+ int i;
+ DUMPSO( "INPUT: ========================================");
+ for ( i = 0; i < 8; i++ ) {
+ const SMDS_MeshNode *n = theMesh->FindNode( idNodes[i] );
+ if ( !n ) return false;
+ P[ i ].SetCoord( n->X(), n->Y(), n->Z() );
+ DUMPSO( i << "(" << idNodes[i] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
+ }
+ DUMPSO( "========================================");
+
+
+ set<int> faceNodes; // ids of bottom face nodes, to be found
+ set<int> checkedId1; // ids of tried 2-nd nodes
+ Standard_Real leastDist = DBL_MAX; // dist of the 4-th node from 123 plane
+ const Standard_Real tol = 1.e-6; // tolerance to find nodes in plane
+ int iMin, iMax, iLoop1 = 0;
+
+ // Loop to try the 2-nd nodes
+
+ while ( leastDist > DBL_MIN && ++iLoop1 < 8 )
+ {
+ // Find not checked 2-nd node
+ for ( i = 1; i < 8; i++ )
+ if ( checkedId1.find( idNodes[i] ) == checkedId1.end() ) {
+ int id1 = idNodes[i];
+ swap ( 1, i, idNodes, P );
+ checkedId1.insert ( id1 );
+ break;
+ }
+
+ // Find the 3-d node so that 1-2-3 triangle to be on a hexa face,
+ // ie that all but meybe one (id3 which is on the same face) nodes
+ // lay on the same side from the triangle plane.
+
+ bool manyInPlane = false; // more than 4 nodes lay in plane
+ int iLoop2 = 0;
+ while ( ++iLoop2 < 6 ) {
+
+ // get 1-2-3 plane coeffs
+ Standard_Real A, B, C, D;
+ gp_Vec N = gp_Vec (P[0], P[1]).Crossed( gp_Vec (P[0], P[2]) );
+ if ( N.SquareMagnitude() > gp::Resolution() )
+ {
+ gp_Pln pln ( P[0], N );
+ pln.Coefficients( A, B, C, D );
+
+ // find the node (iMin) closest to pln
+ Standard_Real dist[ 8 ], minDist = DBL_MAX;
+ set<int> idInPln;
+ for ( i = 3; i < 8; i++ ) {
+ dist[i] = A * P[i].X() + B * P[i].Y() + C * P[i].Z() + D;
+ if ( fabs( dist[i] ) < minDist ) {
+ minDist = fabs( dist[i] );
+ iMin = i;
+ }
+ if ( fabs( dist[i] ) <= tol )
+ idInPln.insert( idNodes[i] );
+ }
+
+ // there should not be more than 4 nodes in bottom plane
+ if ( idInPln.size() > 1 )
+ {
+ DUMPSO( "### idInPln.size() = " << idInPln.size());
+ // idInPlane does not contain the first 3 nodes
+ if ( manyInPlane || idInPln.size() == 5)
+ return false; // all nodes in one plane
+ manyInPlane = true;
+
+ // set the 1-st node to be not in plane
+ for ( i = 3; i < 8; i++ ) {
+ if ( idInPln.find( idNodes[ i ] ) == idInPln.end() ) {
+ DUMPSO( "### Reset 0-th node");
+ swap( 0, i, idNodes, P );
+ break;
+ }
+ }
+
+ // reset to re-check second nodes
+ leastDist = DBL_MAX;
+ faceNodes.clear();
+ checkedId1.clear();
+ iLoop1 = 0;
+ break; // from iLoop2;
+ }
+
+ // check that the other 4 nodes are on the same side
+ bool sameSide = true;
+ bool isNeg = dist[ iMin == 3 ? 4 : 3 ] <= 0.;
+ for ( i = 3; sameSide && i < 8; i++ ) {
+ if ( i != iMin )
+ sameSide = ( isNeg == dist[i] <= 0.);
+ }
+
+ // keep best solution
+ if ( sameSide && minDist < leastDist ) {
+ leastDist = minDist;
+ faceNodes.clear();
+ faceNodes.insert( idNodes[ 1 ] );
+ faceNodes.insert( idNodes[ 2 ] );
+ faceNodes.insert( idNodes[ iMin ] );
+ DUMPSO( "loop " << iLoop2 << " id2 " << idNodes[ 1 ] << " id3 " << idNodes[ 2 ]
+ << " leastDist = " << leastDist);
+ if ( leastDist <= DBL_MIN )
+ break;
+ }
+ }
+
+ // set next 3-d node to check
+ int iNext = 2 + iLoop2;
+ if ( iNext < 8 ) {
+ DUMPSO( "Try 2-nd");
+ swap ( 2, iNext, idNodes, P );
+ }
+ } // while ( iLoop2 < 6 )
+ } // iLoop1
+
+ if ( faceNodes.empty() ) return false;
+
+ // Put the faceNodes in proper places
+ for ( i = 4; i < 8; i++ ) {
+ if ( faceNodes.find( idNodes[ i ] ) != faceNodes.end() ) {
+ // find a place to put
+ int iTo = 1;
+ while ( faceNodes.find( idNodes[ iTo ] ) != faceNodes.end() )
+ iTo++;
+ DUMPSO( "Set faceNodes");
+ swap ( iTo, i, idNodes, P );
+ }
+ }
+
+
+ // Set nodes of the found bottom face in good order
+ DUMPSO( " Found bottom face: ");
+ i = SortQuadNodes( theMesh, idNodes );
+ if ( i ) {
+ gp_Pnt Ptmp = P[ i ];
+ P[ i ] = P[ i+1 ];
+ P[ i+1 ] = Ptmp;
+ }
+// else
+// for ( int ii = 0; ii < 4; ii++ ) {
+// const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
+// DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
+// }
+
+ // Gravity center of the top and bottom faces
+ gp_Pnt aGCb = ( P[0].XYZ() + P[1].XYZ() + P[2].XYZ() + P[3].XYZ() ) / 4.;
+ gp_Pnt aGCt = ( P[4].XYZ() + P[5].XYZ() + P[6].XYZ() + P[7].XYZ() ) / 4.;
+
+ // Get direction from the bottom to the top face
+ gp_Vec upDir ( aGCb, aGCt );
+ Standard_Real upDirSize = upDir.Magnitude();
+ if ( upDirSize <= gp::Resolution() ) return false;
+ upDir / upDirSize;
+
+ // Assure that the bottom face normal points up
+ gp_Vec Nb = gp_Vec (P[0], P[1]).Crossed( gp_Vec (P[0], P[2]) );
+ Nb += gp_Vec (P[0], P[2]).Crossed( gp_Vec (P[0], P[3]) );
+ if ( Nb.Dot( upDir ) < 0 ) {
+ DUMPSO( "Reverse bottom face");
+ swap( 1, 3, idNodes, P );
+ }
+
+ // Find 5-th node - the one closest to the 1-st among the last 4 nodes.
+ Standard_Real minDist = DBL_MAX;
+ for ( i = 4; i < 8; i++ ) {
+ // projection of P[i] to the plane defined by P[0] and upDir
+ gp_Pnt Pp = P[i].Translated( upDir * ( upDir.Dot( gp_Vec( P[i], P[0] ))));
+ Standard_Real sqDist = P[0].SquareDistance( Pp );
+ if ( sqDist < minDist ) {
+ minDist = sqDist;
+ iMin = i;
+ }
+ }
+ DUMPSO( "Set 4-th");
+ swap ( 4, iMin, idNodes, P );
+
+ // Set nodes of the top face in good order
+ DUMPSO( "Sort top face");
+ i = SortQuadNodes( theMesh, &idNodes[4] );
+ if ( i ) {
+ i += 4;
+ gp_Pnt Ptmp = P[ i ];
+ P[ i ] = P[ i+1 ];
+ P[ i+1 ] = Ptmp;
+ }
+
+ // Assure that direction of the top face normal is from the bottom face
+ gp_Vec Nt = gp_Vec (P[4], P[5]).Crossed( gp_Vec (P[4], P[6]) );
+ Nt += gp_Vec (P[4], P[6]).Crossed( gp_Vec (P[4], P[7]) );
+ if ( Nt.Dot( upDir ) < 0 ) {
+ DUMPSO( "Reverse top face");
+ swap( 5, 7, idNodes, P );
+ }
+
+// DUMPSO( "OUTPUT: ========================================");
+// for ( i = 0; i < 8; i++ ) {
+// float *p = ugrid->GetPoint(idNodes[i]);
+// DUMPSO( i << "(" << idNodes[i] << ") : " << p[0] << " " << p[1] << " " << p[2]);
+// }
+
+ return true;
+}
+
+//=======================================================================
+//function : laplacianSmooth
+//purpose : pulls theNode toward the center of surrounding nodes directly
+// connected to that node along an element edge
+//=======================================================================
+
+void laplacianSmooth(SMESHDS_Mesh * theMesh,
+ const SMDS_MeshNode* theNode,
+ const set<const SMDS_MeshElement*> & theElems,
+ const set<const SMDS_MeshNode*> & theFixedNodes)
+{
+ // find surrounding nodes
+ set< const SMDS_MeshNode* > nodeSet;
+ SMDS_ElemIteratorPtr elemIt = theNode->GetInverseElementIterator();
+ while ( elemIt->more() )
+ {
+ const SMDS_MeshElement* elem = elemIt->next();
+ if ( theElems.find( elem ) == theElems.end() )
+ continue;
+
+ int i = 0, iNode = 0;
+ const SMDS_MeshNode* aNodes [4];
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
+ {
+ aNodes[ i ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+ if ( aNodes[ i ] == theNode )
+ iNode = i;
+ else
+ nodeSet.insert( aNodes[ i ] );
+ i++;
+ }
+ if ( elem->NbNodes() == 4 ) { // remove an opposite node
+ iNode += ( iNode < 2 ) ? 2 : -2;
+ nodeSet.erase( aNodes[ iNode ]);
+ }
+ }
+
+ // compute new coodrs
+ double coord[] = { 0., 0., 0. };
+ set< const SMDS_MeshNode* >::iterator nodeSetIt = nodeSet.begin();
+ for ( ; nodeSetIt != nodeSet.end(); nodeSetIt++ ) {
+ const SMDS_MeshNode* node = (*nodeSetIt);
+ coord[0] += node->X();
+ coord[1] += node->Y();
+ coord[2] += node->Z();
+ }
+ double nbNodes = nodeSet.size();
+ theMesh->MoveNode (theNode,
+ coord[0]/nbNodes,
+ coord[1]/nbNodes,
+ coord[2]/nbNodes);
+}
+
+//=======================================================================
+//function : centroidalSmooth
+//purpose : pulls theNode toward the element-area-weighted centroid of the
+// surrounding elements
+//=======================================================================
+
+void centroidalSmooth(SMESHDS_Mesh * theMesh,
+ const SMDS_MeshNode* theNode,
+ const set<const SMDS_MeshElement*> & theElems,
+ const set<const SMDS_MeshNode*> & theFixedNodes)
+{
+ gp_XYZ aNewXYZ(0.,0.,0.);
+ SMESH::Controls::Area anAreaFunc;
+ double totalArea = 0.;
+ int nbElems = 0;
+
+ SMDS_ElemIteratorPtr elemIt = theNode->GetInverseElementIterator();
+ while ( elemIt->more() )
+ {
+ const SMDS_MeshElement* elem = elemIt->next();
+ if ( theElems.find( elem ) == theElems.end() )
+ continue;
+
+ nbElems++;
+
+ gp_XYZ elemCenter(0.,0.,0.);
+ TColgp_SequenceOfXYZ aNodePoints;
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
+ {
+ const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( itN->next() );
+ gp_XYZ aP( aNode->X(), aNode->Y(), aNode->Z() );
+ aNodePoints.Append( aP );
+ elemCenter += aP;
+ }
+ double elemArea = anAreaFunc.GetValue( aNodePoints );
+ totalArea += elemArea;
+ elemCenter /= elem->NbNodes();
+ aNewXYZ += elemCenter * elemArea;
+ }
+ aNewXYZ /= totalArea;
+ theMesh->MoveNode (theNode,
+ aNewXYZ.X(),
+ aNewXYZ.Y(),
+ aNewXYZ.Z());
+}
+
+//=======================================================================
+//function : Smooth
+//purpose : Smooth theElements during theNbIterations or until a worst
+// element has aspect ratio <= theTgtAspectRatio.
+// Aspect Ratio varies in range [1.0, inf].
+// If theElements is empty, the whole mesh is smoothed.
+// theFixedNodes contains additionally fixed nodes. Nodes built
+// on edges and boundary nodes are always fixed.
+//=======================================================================
+
+void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
+ set<const SMDS_MeshNode*> & theFixedNodes,
+ const SmoothMethod theSmoothMethod,
+ const int theNbIterations,
+ double theTgtAspectRatio)
+{
+ MESSAGE((theSmoothMethod==LAPLACIAN ? "LAPLACIAN" : "CENTROIDAL") << "--::Smooth()");
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+ if ( theElems.empty() ) {
+ // add all faces
+ SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
+ while ( fIt->more() )
+ theElems.insert( fIt->next() );
+ }
+
+ set<const SMDS_MeshNode*> setMovableNodes;
+
+ // Fill setMovableNodes
+
+ map< const SMDS_MeshNode*, int > mapNodeNbFaces;
+ set< const SMDS_MeshElement* >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->GetType() != SMDSAbs_Face )
+ continue;
+
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() ) {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+
+ if ( theFixedNodes.find( node ) != theFixedNodes.end() )
+ continue;
+
+ // if node is on edge => it is fixed
+ SMDS_PositionPtr aPositionPtr = node->GetPosition();
+ if ( aPositionPtr.get() &&
+ (aPositionPtr->GetTypeOfPosition() == SMDS_TOP_EDGE ||
+ aPositionPtr->GetTypeOfPosition() == SMDS_TOP_VERTEX)) {
+ theFixedNodes.insert( node );
+ continue;
+ }
+ // fill mapNodeNbFaces in order to detect fixed boundary nodes
+ map<const SMDS_MeshNode*,int>::iterator nodeNbFacesIt =
+ mapNodeNbFaces.find ( node );
+ if ( nodeNbFacesIt == mapNodeNbFaces.end() )
+ mapNodeNbFaces.insert( map<const SMDS_MeshNode*,int>::value_type( node, 1 ));
+ else
+ (*nodeNbFacesIt).second++;
+ }
+ }
+ // put not fixed nodes in setMovableNodes
+ map<const SMDS_MeshNode*,int>::iterator nodeNbFacesIt =
+ mapNodeNbFaces.begin();
+ for ( ; nodeNbFacesIt != mapNodeNbFaces.end(); nodeNbFacesIt++ ) {
+ const SMDS_MeshNode* node = (*nodeNbFacesIt).first;
+ // a node is on free boundary if it is shared by 1-2 faces
+ if ( (*nodeNbFacesIt).second > 2 )
+ setMovableNodes.insert( node );
+ else
+ theFixedNodes.insert( node );
+ }
+
+ // SMOOTHING //
+
+ if ( theTgtAspectRatio < 1.0 )
+ theTgtAspectRatio = 1.0;
+
+ SMESH::Controls::AspectRatio aQualityFunc;
+
+ for ( int it = 0; it < theNbIterations; it++ )
+ {
+ Standard_Real maxDisplacement = 0.;
+ set<const SMDS_MeshNode*>::iterator movableNodesIt
+ = setMovableNodes.begin();
+ for ( ; movableNodesIt != setMovableNodes.end(); movableNodesIt++ )
+ {
+ const SMDS_MeshNode* node = (*movableNodesIt);
+ gp_XYZ aPrevPos ( node->X(), node->Y(), node->Z() );
+
+ // smooth
+ if ( theSmoothMethod == LAPLACIAN )
+ laplacianSmooth( aMesh, node, theElems, theFixedNodes );
+ else
+ centroidalSmooth( aMesh, node, theElems, theFixedNodes );
+
+ // displacement
+ gp_XYZ aNewPos ( node->X(), node->Y(), node->Z() );
+ Standard_Real aDispl = (aPrevPos - aNewPos).SquareModulus();
+ if ( aDispl > maxDisplacement )
+ maxDisplacement = aDispl;
+ }
+ // no node movement => exit
+ if ( maxDisplacement < 1.e-16 ) {
+ MESSAGE("-- no node movement -- maxDisplacement: " << maxDisplacement << " it "<< it);
+ break;
+ }
+
+ // check elements quality
+ double maxRatio = 0;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->GetType() != SMDSAbs_Face )
+ continue;
+ TColgp_SequenceOfXYZ aPoints;
+ if ( aQualityFunc.GetPoints( elem, aPoints )) {
+ double aValue = aQualityFunc.GetValue( aPoints );
+ if ( aValue > maxRatio )
+ maxRatio = aValue;
+ }
+ }
+ if ( maxRatio <= theTgtAspectRatio ) {
+ MESSAGE("-- quality achived -- maxRatio " << maxRatio << " it "<< it);
+ break;
+ }
+ if (it+1 == theNbIterations) {
+ MESSAGE("-- Iteration limit exceeded --");
+ }
+ }
+}
+
+//=======================================================================
+//function : isReverse
+//purpose :
+//=======================================================================
+
+static bool isReverse(const SMDS_MeshNode* prevNodes[],
+ const SMDS_MeshNode* nextNodes[],
+ const int nbNodes,
+ const int iNotSame)
+{
+ int iBeforeNotSame = ( iNotSame == 0 ? nbNodes - 1 : iNotSame - 1 );
+ int iAfterNotSame = ( iNotSame + 1 == nbNodes ? 0 : iNotSame + 1 );
+
+ const SMDS_MeshNode* nB = prevNodes[ iBeforeNotSame ];
+ const SMDS_MeshNode* nA = prevNodes[ iAfterNotSame ];
+ const SMDS_MeshNode* nP = prevNodes[ iNotSame ];
+ const SMDS_MeshNode* nN = nextNodes[ iNotSame ];
+
+ gp_Pnt pB ( nB->X(), nB->Y(), nB->Z() );
+ gp_Pnt pA ( nA->X(), nA->Y(), nA->Z() );
+ gp_Pnt pP ( nP->X(), nP->Y(), nP->Z() );
+ gp_Pnt pN ( nN->X(), nN->Y(), nN->Z() );
+
+ gp_Vec vB ( pP, pB ), vA ( pP, pA ), vN ( pP, pN );
+
+ return (vA ^ vB) * vN < 0.0;
+}
+
+//=======================================================================
+//function : sweepElement
+//purpose :
+//=======================================================================
+
+static void sweepElement(SMESHDS_Mesh* aMesh,
+ const SMDS_MeshElement* elem,
+ const TNodeOfNodeListMap& mapNewNodes )
+{
+ // Loop on elem nodes:
+ // find new nodes and detect same nodes indices
+ list<const SMDS_MeshNode*>::const_iterator itNN[ 4 ];
+ const SMDS_MeshNode* prevNod[ 4 ], *nextNod[ 4 ];
+ int nbSame = 0, iNotSameNode = 0, iSameNode = 0;
+
+ TNodeOfNodeListMap::const_iterator mapIt;
+ int iNode = 0;
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+ mapIt = mapNewNodes.find( node );
+ if ( mapIt == mapNewNodes.end() )
+ return; // not duplicated node
+
+ itNN[ iNode ] = (*mapIt).second.begin();
+ prevNod[ iNode ] = node;
+ nextNod[ iNode ] = (*mapIt).second.front();
+ if ( prevNod[ iNode ] != nextNod [ iNode ])
+ iNotSameNode = iNode;
+ else {
+ iSameNode = iNode;
+ nbSame++;
+ }
+ iNode++;
+ }
+ int nbNodes = iNode;
+ if ( nbSame == nbNodes || nbSame > 2) {
+ MESSAGE( " Too many same nodes of element " << elem->GetID() );
+ return;
+ }
+
+ int iBeforeSame = 0, iAfterSame = 0, iOpposSame = 0;
+ if ( nbSame > 0 ) {
+ iBeforeSame = ( iSameNode == 0 ? nbNodes - 1 : iSameNode - 1 );
+ iAfterSame = ( iSameNode + 1 == nbNodes ? 0 : iSameNode + 1 );
+ iOpposSame = ( iSameNode - 2 < 0 ? iSameNode + 2 : iSameNode - 2 );
+ }
+
+ // check element orientation
+ int i0 = 0, i2 = 2;
+ if ( nbNodes > 2 && isReverse( prevNod, nextNod, nbNodes, iNotSameNode )) {
+// MESSAGE("Reversed elem " << elem->GetID() );
+ i0 = 2;
+ i2 = 0;
+ if ( nbSame > 0 ) {
+ int iAB = iAfterSame + iBeforeSame;
+ iBeforeSame = iAB - iBeforeSame;
+ iAfterSame = iAB - iAfterSame;
+ }
+ }
+
+ // make new elements
+ int iStep, nbSteps = (*mapIt).second.size();
+ for (iStep = 0; iStep < nbSteps; iStep++ )
+ {
+ // get next nodes
+ for ( iNode = 0; iNode < nbNodes; iNode++ ) {
+ nextNod[ iNode ] = *itNN[ iNode ];
+ itNN[ iNode ]++;
+ }
+ switch ( nbNodes )
+ {
+ case 2: { // EDGE
+
+ if ( nbSame == 0 )
+ aMesh->AddFace( prevNod[ 0 ], prevNod[ 1 ], nextNod[ 1 ], nextNod[ 0 ] );
+ else
+ aMesh->AddFace( prevNod[ 0 ], prevNod[ 1 ], nextNod[ iNotSameNode ] );
+ break;
+ }
+ case 3: { // TRIANGLE
+
+ if ( nbSame == 0 ) // --- 1 pentahedron
+ {
+ aMesh->AddVolume (prevNod[ i2 ], prevNod[ 1 ], prevNod[ i0 ],
+ nextNod[ i2 ], nextNod[ 1 ], nextNod[ i0 ] );
+ }
+ else if ( nbSame == 1 ) // --- 2 tetrahedrons
+ {
+ aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
+ nextNod[ iBeforeSame ]);
+ aMesh->AddVolume (nextNod[ i2 ], nextNod[ 1 ], nextNod[ i0 ],
+ prevNod[ iAfterSame ]);
+ }
+ else // 2 same nodes: --- 1 tetrahedron
+ {
+ aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ],
+ nextNod[ iNotSameNode ]);
+ }
+ break;
+ }
+ case 4: { // QUADRANGLE
+
+ if ( nbSame == 0 ) // --- 1 hexahedron
+ {
+ aMesh->AddVolume (prevNod[ i0 ], prevNod[ 1 ], prevNod[ i2 ], prevNod[ 3 ],
+ nextNod[ i0 ], nextNod[ 1 ], nextNod[ i2 ], nextNod[ 3 ]);
+ }
+ else if ( nbSame == 1 ) // --- 2 tetrahedrons + 1 pentahedron
+ {
+ aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iSameNode ],
+ prevNod[ iAfterSame ], nextNod[ iBeforeSame ]);
+ aMesh->AddVolume (nextNod[ iAfterSame ], nextNod[ iSameNode ],
+ nextNod[ iBeforeSame ], prevNod[ iAfterSame ]);
+ aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iOpposSame ], prevNod[ iAfterSame ],
+ nextNod[ iBeforeSame ], nextNod[ iOpposSame ], nextNod[ iAfterSame ] );
+ }
+ else if ( nbSame == 2 ) // 1 pentahedron
+ {
+ if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] )
+ // iBeforeSame is same too
+ aMesh->AddVolume (prevNod[ iOpposSame ], prevNod[ iBeforeSame ], nextNod[ iOpposSame ],
+ prevNod[ iAfterSame ], prevNod[ iSameNode ], nextNod[ iAfterSame ]);
+ else
+ // iAfterSame is same too
+ aMesh->AddVolume (prevNod[ iBeforeSame ], prevNod[ iSameNode ], nextNod[ iBeforeSame ],
+ prevNod[ iOpposSame ], prevNod[ iAfterSame ], nextNod[ iOpposSame ]);
+ }
+ break;
+ }
+ default:
+ return;
+ }
+
+ // set new prev nodes
+ for ( iNode = 0; iNode < nbNodes; iNode++ )
+ prevNod[ iNode ] = nextNod[ iNode ];
+
+ } // for steps
+}
+
+//=======================================================================
+//function : RotationSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
+ const gp_Ax1& theAxis,
+ const double theAngle,
+ const int theNbSteps,
+ const double theTol)
+{
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation( theAxis, theAngle );
+
+ gp_Lin aLine( theAxis );
+ double aSqTol = theTol * theTol;
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ TNodeOfNodeListMap mapNewNodes;
+
+ // loop on theElems
+ set< const SMDS_MeshElement* >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ // check element type
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem ||
+ (elem->GetType() != SMDSAbs_Face &&
+ elem->GetType() != SMDSAbs_Edge ))
+ continue;
+
+ // loop on elem nodes
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() ) {
+
+ // check if a node has been already sweeped
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+ if (mapNewNodes.find( node ) != mapNewNodes.end() )
+ continue;
+
+ list<const SMDS_MeshNode*>& listNewNodes = mapNewNodes[ node ];
+
+ // make new nodes
+ gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
+ double coord[3];
+ aXYZ.Coord( coord[0], coord[1], coord[2] );
+ bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
+ const SMDS_MeshNode * newNode = node;
+ for ( int i = 0; i < theNbSteps; i++ ) {
+ if ( !isOnAxis ) {
+ aTrsf.Transforms( coord[0], coord[1], coord[2] );
+ newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+ }
+ listNewNodes.push_back( newNode );
+ }
+ }
+ // make new elements
+ sweepElement( aMesh, elem, mapNewNodes );
+ }
+}
+//=======================================================================
+//function : ExtrusionSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
+ const gp_Vec& theStep,
+ const int theNbSteps)
+{
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslation( theStep );
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ TNodeOfNodeListMap mapNewNodes;
+
+ // loop on theElems
+ set< const SMDS_MeshElement* >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ // check element type
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem ||
+ (elem->GetType() != SMDSAbs_Face &&
+ elem->GetType() != SMDSAbs_Edge))
+ continue;
+
+ // loop on elem nodes
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() ) {
+
+ // check if a node has been already sweeped
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+ if (mapNewNodes.find( node ) != mapNewNodes.end() )
+ continue;
+
+ list<const SMDS_MeshNode*>& listNewNodes = mapNewNodes[ node ];
+
+ // make new nodes
+ double coord[3];
+ coord[0] = node->X();
+ coord[1] = node->Y();
+ coord[2] = node->Z();
+ for ( int i = 0; i < theNbSteps; i++ ) {
+ aTrsf.Transforms( coord[0], coord[1], coord[2] );
+ const SMDS_MeshNode * newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+ listNewNodes.push_back( newNode );
+ }
+ }
+ // make new elements
+ sweepElement( aMesh, elem, mapNewNodes );
+ }
+}
+
+//=======================================================================
+//function : Transform
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
+ const gp_Trsf& theTrsf,
+ const bool theCopy)
+{
+ bool needReverse;
+ switch ( theTrsf.Form() ) {
+ case gp_PntMirror:
+ case gp_Ax2Mirror:
+ needReverse = true;
+ break;
+ default:
+ needReverse = false;
+ }
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ // map old node to new one
+ TNodeNodeMap nodeMap;
+
+ // elements sharing moved nodes; those of them which have all
+ // nodes mirrored but are not in theElems are to be reversed
+ set<const SMDS_MeshElement*> inverseElemSet;
+
+ // loop on theElems
+ set< const SMDS_MeshElement* >::iterator itElem;
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem )
+ continue;
+
+ // loop on elem nodes
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() ) {
+
+ // check if a node has been already transormed
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+ if (nodeMap.find( node ) != nodeMap.end() )
+ continue;
+
+ double coord[3];
+ coord[0] = node->X();
+ coord[1] = node->Y();
+ coord[2] = node->Z();
+ theTrsf.Transforms( coord[0], coord[1], coord[2] );
+ const SMDS_MeshNode * newNode = node;
+ if ( theCopy )
+ newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+ else
+ aMesh->MoveNode( node, coord[0], coord[1], coord[2] );
+ nodeMap.insert( TNodeNodeMap::value_type( node, newNode ));
+
+ // keep inverse elements
+ if ( !theCopy && needReverse ) {
+ SMDS_ElemIteratorPtr invElemIt = node->GetInverseElementIterator();
+ while ( invElemIt->more() )
+ inverseElemSet.insert( invElemIt->next() );
+ }
+ }
+ }
+
+ // either new elements are to be created
+ // or a mirrored element are to be reversed
+ if ( !theCopy && !needReverse)
+ return;
+
+ if ( !inverseElemSet.empty()) {
+ set<const SMDS_MeshElement*>::iterator invElemIt = inverseElemSet.begin();
+ for ( ; invElemIt != inverseElemSet.end(); invElemIt++ )
+ theElems.insert( *invElemIt );
+ }
+
+ // replicate or reverse elements
+
+ enum {
+ REV_TETRA = 0, // = nbNodes - 4
+ REV_PYRAMID = 1, // = nbNodes - 4
+ REV_PENTA = 2, // = nbNodes - 4
+ REV_FACE = 3,
+ REV_HEXA = 4, // = nbNodes - 4
+ FORWARD = 5
+ };
+ int index[][8] = {
+ { 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_TETRA
+ { 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_PYRAMID
+ { 2, 1, 0, 5, 4, 3, 0, 0 }, // REV_PENTA
+ { 2, 1, 0, 3, 0, 0, 0, 0 }, // REV_FACE
+ { 2, 1, 0, 3, 6, 5, 4, 7 }, // REV_HEXA
+ { 0, 1, 2, 3, 4, 5, 6, 7 } // FORWARD
+ };
+
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ const SMDS_MeshElement* elem = (*itElem);
+ if ( !elem || elem->GetType() == SMDSAbs_Node )
+ continue;
+
+ int nbNodes = elem->NbNodes();
+ int elemType = elem->GetType();
+
+ int* i = index[ FORWARD ];
+ if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
+ if ( elemType == SMDSAbs_Face )
+ i = index[ REV_FACE ];
+ else
+ i = index[ nbNodes - 4 ];
+
+ // find transformed nodes
+ const SMDS_MeshNode* nodes[8];
+ int iNode = 0;
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+ TNodeNodeMap::iterator nodeMapIt = nodeMap.find( node );
+ if ( nodeMapIt == nodeMap.end() )
+ break; // not all nodes transformed
+ nodes[ i [ iNode++ ]] = (*nodeMapIt).second;
+ }
+ if ( iNode != nbNodes )
+ continue; // not all nodes transformed
+
+ if ( theCopy )
+ {
+ // add a new element
+ switch ( elemType ) {
+ case SMDSAbs_Edge:
+ aMesh->AddEdge( nodes[ 0 ], nodes[ 1 ] );
+ break;
+ case SMDSAbs_Face:
+ if ( nbNodes == 3 )
+ aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] );
+ else
+ aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] , nodes[ 3 ]);
+ break;
+ case SMDSAbs_Volume:
+ if ( nbNodes == 4 )
+ aMesh->AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] , nodes[ 3 ] );
+ else if ( nbNodes == 8 )
+ aMesh->AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] , nodes[ 3 ],
+ nodes[ 4 ], nodes[ 5 ], nodes[ 6 ] , nodes[ 7 ]);
+ else if ( nbNodes == 6 )
+ aMesh->AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] , nodes[ 3 ],
+ nodes[ 4 ], nodes[ 5 ]);
+ else if ( nbNodes == 5 )
+ aMesh->AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] , nodes[ 3 ],
+ nodes[ 4 ]);
+ break;
+ default:;
+ }
+ }
+ else
+ {
+ // reverse element as it was reversed by transformation
+ if ( nbNodes > 2 )
+ aMesh->ChangeElementNodes( elem, nodes, nbNodes );
+ }
+ }
+}
+
+//=======================================================================
+//function : FindCoincidentNodes
+//purpose : Return list of group of nodes close to each other within theTolerance
+//=======================================================================
+
+void SMESH_MeshEditor::FindCoincidentNodes (const double theTolerance,
+ TListOfListOfNodes & theGroupsOfNodes)
+{
+ double tol2 = theTolerance * theTolerance;
+
+ list<const SMDS_MeshNode*> nodes;
+ SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator();
+ while ( nIt->more() )
+ nodes.push_back( nIt->next() );
+
+ list<const SMDS_MeshNode*>::iterator it2, it1 = nodes.begin();
+ for ( ; it1 != nodes.end(); it1++ )
+ {
+ const SMDS_MeshNode* n1 = *it1;
+ gp_Pnt p1( n1->X(), n1->Y(), n1->Z() );
+
+ list<const SMDS_MeshNode*> * groupPtr = 0;
+ it2 = it1;
+ for ( it2++; it2 != nodes.end(); it2++ )
+ {
+ const SMDS_MeshNode* n2 = *it2;
+ gp_Pnt p2( n2->X(), n2->Y(), n2->Z() );
+ if ( p1.SquareDistance( p2 ) <= tol2 )
+ {
+ if ( !groupPtr ) {
+ theGroupsOfNodes.push_back( list<const SMDS_MeshNode*>() );
+ groupPtr = & theGroupsOfNodes.back();
+ groupPtr->push_back( n1 );
+ }
+ groupPtr->push_back( n2 );
+ it2 = nodes.erase( it2 );
+ it2--;
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : isOppFaceInd
+//purpose :
+//=======================================================================
+
+static bool isOppFaceInd(int iMin, int iMax)
+{
+ return ( iMax - iMin == 1 && iMax % 2 );
+}
+
+//=======================================================================
+//function : MergeNodes
+//purpose : In each group, the cdr of nodes are substituted by the first one
+// in all elements.
+//=======================================================================
+
+void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ TNodeNodeMap nodeNodeMap; // node to replace - new node
+ set<const SMDS_MeshElement*> elems; // all elements with changed nodes
+ list< int > rmElemIds, rmNodeIds;
+
+ // Fill nodeNodeMap and elems
+
+ TListOfListOfNodes::iterator grIt = theGroupsOfNodes.begin();
+ for ( ; grIt != theGroupsOfNodes.end(); grIt++ )
+ {
+ list<const SMDS_MeshNode*>& nodes = *grIt;
+ list<const SMDS_MeshNode*>::iterator nIt = nodes.begin();
+ const SMDS_MeshNode* nToKeep = *nIt;
+ for ( ; nIt != nodes.end(); nIt++ )
+ {
+ const SMDS_MeshNode* nToRemove = *nIt;
+ nodeNodeMap.insert( TNodeNodeMap::value_type( nToRemove, nToKeep ));
+ if ( nToRemove != nToKeep ) {
+ rmNodeIds.push_back( nToRemove->GetID() );
+ addToSameGroups( nToKeep, nToRemove, aMesh );
+ }
+
+ SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
+ while ( invElemIt->more() )
+ elems.insert( invElemIt->next() );
+ }
+ }
+ // Change element nodes or remove an element
+
+ set<const SMDS_MeshElement*>::iterator eIt = elems.begin();
+ for ( ; eIt != elems.end(); eIt++ )
+ {
+ const SMDS_MeshElement* elem = *eIt;
+ int nbNodes = elem->NbNodes();
+ int aShapeId = FindShape( elem );
+
+ set<const SMDS_MeshNode*> nodeSet;
+ const SMDS_MeshNode* curNodes[ nbNodes ], *uniqueNodes[ nbNodes ];
+ int iUnique = 0, iCur = 0, nbRepl = 0, iRepl [ nbNodes ];
+
+ // get new seq of nodes
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
+ {
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( itN->next() );
+
+ TNodeNodeMap::iterator nnIt = nodeNodeMap.find( n );
+ if ( nnIt != nodeNodeMap.end() ) { // n sticks
+ n = (*nnIt).second;
+ iRepl[ nbRepl++ ] = iCur;
+ }
+ curNodes[ iCur ] = n;
+ bool isUnique = nodeSet.insert( n ).second;
+ if ( isUnique )
+ uniqueNodes[ iUnique++ ] = n;
+ iCur++;
+ }
+
+ // Analyse element topology after replacement
+
+ bool isOk = true;
+ int nbUniqueNodes = nodeSet.size();
+ if ( nbNodes != nbUniqueNodes ) // some nodes stick
+ {
+ switch ( nbNodes ) {
+ case 2: ///////////////////////////////////// EDGE
+ isOk = false; break;
+ case 3: ///////////////////////////////////// TRIANGLE
+ isOk = false; break;
+ case 4:
+ if ( elem->GetType() == SMDSAbs_Volume ) // TETRAHEDRON
+ isOk = false;
+ else { //////////////////////////////////// QUADRANGLE
+ if ( nbUniqueNodes < 3 )
+ isOk = false;
+ else if ( nbRepl == 2 && iRepl[ 1 ] - iRepl[ 0 ] == 2 )
+ isOk = false; // opposite nodes stick
+ }
+ break;
+ case 6: ///////////////////////////////////// PENTAHEDRON
+ if ( nbUniqueNodes == 4 ) {
+ // ---------------------------------> tetrahedron
+ if (nbRepl == 3 &&
+ iRepl[ 0 ] > 2 && iRepl[ 1 ] > 2 && iRepl[ 2 ] > 2 ) {
+ // all top nodes stick: reverse a bottom
+ uniqueNodes[ 0 ] = curNodes [ 1 ];
+ uniqueNodes[ 1 ] = curNodes [ 0 ];
+ }
+ else if (nbRepl == 3 &&
+ iRepl[ 0 ] < 3 && iRepl[ 1 ] < 3 && iRepl[ 2 ] < 3 ) {
+ // all bottom nodes stick: set a top before
+ uniqueNodes[ 3 ] = uniqueNodes [ 0 ];
+ uniqueNodes[ 0 ] = curNodes [ 3 ];
+ uniqueNodes[ 1 ] = curNodes [ 4 ];
+ uniqueNodes[ 2 ] = curNodes [ 5 ];
+ }
+ else if (nbRepl == 4 &&
+ iRepl[ 2 ] - iRepl [ 0 ] == 3 && iRepl[ 3 ] - iRepl [ 1 ] == 3 ) {
+ // a lateral face turns into a line: reverse a bottom
+ uniqueNodes[ 0 ] = curNodes [ 1 ];
+ uniqueNodes[ 1 ] = curNodes [ 0 ];
+ }
+ else
+ isOk = false;
+ }
+ else if ( nbUniqueNodes == 5 ) {
+ // PENTAHEDRON --------------------> 2 tetrahedrons
+ if ( nbRepl == 2 && iRepl[ 1 ] - iRepl [ 0 ] == 3 ) {
+ // a bottom node sticks with a linked top one
+ // 1.
+ SMDS_MeshElement* newElem =
+ aMesh->AddVolume(curNodes[ 3 ],
+ curNodes[ 4 ],
+ curNodes[ 5 ],
+ curNodes[ iRepl[ 0 ] == 2 ? 1 : 2 ]);
+ if ( aShapeId )
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ // 2. : reverse a bottom
+ uniqueNodes[ 0 ] = curNodes [ 1 ];
+ uniqueNodes[ 1 ] = curNodes [ 0 ];
+ nbUniqueNodes = 4;
+ }
+ else
+ isOk = false;
+ }
+ else
+ isOk = false;
+ break;
+ case 8: { //////////////////////////////////// HEXAHEDRON
+ isOk = false;
+ SMDS_VolumeTool hexa (elem);
+ hexa.SetExternalNormal();
+ if ( nbUniqueNodes == 4 && nbRepl == 6 ) {
+ //////////////////////// ---> tetrahedron
+ for ( int iFace = 0; iFace < 6; iFace++ ) {
+ const int *ind = hexa.GetFaceNodesIndices( iFace ); // indices of face nodes
+ if (curNodes[ind[ 0 ]] == curNodes[ind[ 1 ]] &&
+ curNodes[ind[ 0 ]] == curNodes[ind[ 2 ]] &&
+ curNodes[ind[ 0 ]] == curNodes[ind[ 3 ]] ) {
+ // one face turns into a point ...
+ int iOppFace = hexa.GetOppFaceIndex( iFace );
+ ind = hexa.GetFaceNodesIndices( iOppFace );
+ int nbStick = 0;
+ iUnique = 2; // reverse a tetrahedron bottom
+ for ( iCur = 0; iCur < 4 && nbStick < 2; iCur++ ) {
+ if ( curNodes[ind[ iCur ]] == curNodes[ind[ iCur + 1 ]] )
+ nbStick++;
+ else if ( iUnique >= 0 )
+ uniqueNodes[ iUnique-- ] = curNodes[ind[ iCur ]];
+ }
+ if ( nbStick == 1 ) {
+ // ... and the opposite one - into a triangle.
+ // set a top node
+ ind = hexa.GetFaceNodesIndices( iFace );
+ uniqueNodes[ 3 ] = curNodes[ind[ 0 ]];
+ isOk = true;
+ }
+ break;
+ }
+ }
+ }
+ else if (nbUniqueNodes == 5 && nbRepl == 4 ) {
+ //////////////////// HEXAHEDRON ---> 2 tetrahedrons
+ for ( int iFace = 0; iFace < 6; iFace++ ) {
+ const int *ind = hexa.GetFaceNodesIndices( iFace ); // indices of face nodes
+ if (curNodes[ind[ 0 ]] == curNodes[ind[ 1 ]] &&
+ curNodes[ind[ 0 ]] == curNodes[ind[ 2 ]] &&
+ curNodes[ind[ 0 ]] == curNodes[ind[ 3 ]] ) {
+ // one face turns into a point ...
+ int iOppFace = hexa.GetOppFaceIndex( iFace );
+ ind = hexa.GetFaceNodesIndices( iOppFace );
+ int nbStick = 0;
+ iUnique = 2; // reverse a tetrahedron 1 bottom
+ for ( iCur = 0; iCur < 4 && nbStick == 0; iCur++ ) {
+ if ( curNodes[ind[ iCur ]] == curNodes[ind[ iCur + 1 ]] )
+ nbStick++;
+ else if ( iUnique >= 0 )
+ uniqueNodes[ iUnique-- ] = curNodes[ind[ iCur ]];
+ }
+ if ( nbStick == 0 ) {
+ // ... and the opposite one is a quadrangle
+ // set a top node
+ const int* indTop = hexa.GetFaceNodesIndices( iFace );
+ uniqueNodes[ 3 ] = curNodes[indTop[ 0 ]];
+ nbUniqueNodes = 4;
+ // tetrahedron 2
+ SMDS_MeshElement* newElem =
+ aMesh->AddVolume(curNodes[ind[ 0 ]],
+ curNodes[ind[ 3 ]],
+ curNodes[ind[ 2 ]],
+ curNodes[indTop[ 0 ]]);
+ if ( aShapeId )
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ isOk = true;
+ }
+ break;
+ }
+ }
+ }
+ else if ( nbUniqueNodes == 6 && nbRepl == 4 ) {
+ ////////////////// HEXAHEDRON ---> 2 tetrahedrons or 1 prism
+ // find indices of quad and tri faces
+ int iQuadFace[ 6 ], iTriFace[ 6 ], nbQuad = 0, nbTri = 0, iFace;
+ for ( iFace = 0; iFace < 6; iFace++ ) {
+ const int *ind = hexa.GetFaceNodesIndices( iFace ); // indices of face nodes
+ nodeSet.clear();
+ for ( iCur = 0; iCur < 4; iCur++ )
+ nodeSet.insert( curNodes[ind[ iCur ]] );
+ nbUniqueNodes = nodeSet.size();
+ if ( nbUniqueNodes == 3 )
+ iTriFace[ nbTri++ ] = iFace;
+ else if ( nbUniqueNodes == 4 )
+ iQuadFace[ nbQuad++ ] = iFace;
+ }
+ if (nbQuad == 2 && nbTri == 4 &&
+ hexa.GetOppFaceIndex( iQuadFace[ 0 ] ) == iQuadFace[ 1 ]) {
+ // 2 opposite quadrangles stuck with a diagonal;
+ // sample groups of merged indices: (0-4)(2-6)
+ // --------------------------------------------> 2 tetrahedrons
+ const int *ind1 = hexa.GetFaceNodesIndices( iQuadFace[ 0 ]); // indices of quad1 nodes
+ const int *ind2 = hexa.GetFaceNodesIndices( iQuadFace[ 1 ]);
+ int i0, i1d, i2, i3d, i0t, i2t; // d-daigonal, t-top
+ if (curNodes[ind1[ 0 ]] == curNodes[ind2[ 0 ]] &&
+ curNodes[ind1[ 2 ]] == curNodes[ind2[ 2 ]]) {
+ // stuck with 0-2 diagonal
+ i0 = ind1[ 3 ];
+ i1d = ind1[ 0 ];
+ i2 = ind1[ 1 ];
+ i3d = ind1[ 2 ];
+ i0t = ind2[ 1 ];
+ i2t = ind2[ 3 ];
+ }
+ else if (curNodes[ind1[ 1 ]] == curNodes[ind2[ 3 ]] &&
+ curNodes[ind1[ 3 ]] == curNodes[ind2[ 1 ]]) {
+ // stuck with 1-3 diagonal
+ i0 = ind1[ 0 ];
+ i1d = ind1[ 1 ];
+ i2 = ind1[ 2 ];
+ i3d = ind1[ 3 ];
+ i0t = ind2[ 0 ];
+ i2t = ind2[ 1 ];
+ }
+ else {
+ ASSERT(0);
+ }
+ // tetrahedron 1
+ uniqueNodes[ 0 ] = curNodes [ i0 ];
+ uniqueNodes[ 1 ] = curNodes [ i1d ];
+ uniqueNodes[ 2 ] = curNodes [ i3d ];
+ uniqueNodes[ 3 ] = curNodes [ i0t ];
+ nbUniqueNodes = 4;
+ // tetrahedron 2
+ SMDS_MeshElement* newElem = aMesh->AddVolume(curNodes[ i1d ],
+ curNodes[ i2 ],
+ curNodes[ i3d ],
+ curNodes[ i2t ]);
+ if ( aShapeId )
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ isOk = true;
+ }
+ else if (( nbTri == 2 && nbQuad == 3 ) || // merged (0-4)(1-5)
+ ( nbTri == 4 && nbQuad == 2 )) { // merged (7-4)(1-5)
+ // --------------------------------------------> prism
+ // find 2 opposite triangles
+ nbUniqueNodes = 6;
+ for ( iFace = 0; iFace + 1 < nbTri; iFace++ ) {
+ if ( hexa.GetOppFaceIndex( iTriFace[ iFace ] ) == iTriFace[ iFace + 1 ]) {
+ // find indices of kept and replaced nodes
+ // and fill unique nodes of 2 opposite triangles
+ const int *ind1 = hexa.GetFaceNodesIndices( iTriFace[ iFace ]);
+ const int *ind2 = hexa.GetFaceNodesIndices( iTriFace[ iFace + 1 ]);
+ const SMDS_MeshNode** hexanodes = hexa.GetNodes();
+ // fill unique nodes
+ iUnique = 0;
+ isOk = true;
+ for ( iCur = 0; iCur < 4 && isOk; iCur++ ) {
+ const SMDS_MeshNode* n = curNodes[ind1[ iCur ]];
+ const SMDS_MeshNode* nInit = hexanodes[ind1[ iCur ]];
+ if ( n == nInit ) {
+ // iCur of a linked node of the opposite face (make normals co-directed):
+ int iCurOpp = ( iCur == 1 || iCur == 3 ) ? 4 - iCur : iCur;
+ // check that correspondent corners of triangles are linked
+ if ( !hexa.IsLinked( ind1[ iCur ], ind2[ iCurOpp ] ))
+ isOk = false;
+ else {
+ uniqueNodes[ iUnique ] = n;
+ uniqueNodes[ iUnique + 3 ] = curNodes[ind2[ iCurOpp ]];
+ iUnique++;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ } // if ( nbUniqueNodes == 6 && nbRepl == 4 )
+ break;
+ } // HEXAHEDRON
+
+ default:
+ isOk = false;
+ } // switch ( nbNodes )
+
+ } // if ( nbNodes != nbUniqueNodes ) // some nodes stick
+
+ if ( isOk )
+ aMesh->ChangeElementNodes( elem, uniqueNodes, nbUniqueNodes );
+ else
+ rmElemIds.push_back( elem->GetID() );
+
+ } // loop on elements
+
+ // Remove equal nodes and bad elements
+
+ Remove( rmNodeIds, true );
+ Remove( rmElemIds, false );
+
+}
+
+//=======================================================================
+//function : MergeEqualElements
+//purpose : Remove all but one of elements built on the same nodes.
+//=======================================================================
+
+void SMESH_MeshEditor::MergeEqualElements()
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ SMDS_EdgeIteratorPtr eIt = aMesh->edgesIterator();
+ SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
+ SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator();
+
+ list< int > rmElemIds; // IDs of elems to remove
+
+ for ( int iDim = 1; iDim <= 3; iDim++ ) {
+
+ set< set <const SMDS_MeshElement*> > setOfNodeSet;
+
+ while ( 1 ) {
+ // get next element
+ const SMDS_MeshElement* elem = 0;
+ if ( iDim == 1 ) {
+ if ( eIt->more() ) elem = eIt->next();
+ } else if ( iDim == 2 ) {
+ if ( fIt->more() ) elem = fIt->next();
+ } else {
+ if ( vIt->more() ) elem = vIt->next();
+ }
+ if ( !elem ) break;
+
+ // get elem nodes
+ set <const SMDS_MeshElement*> nodeSet;
+ SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+ while ( nodeIt->more() )
+ nodeSet.insert( nodeIt->next() );
+
+ // check uniqueness
+ bool isUnique = setOfNodeSet.insert( nodeSet ).second;
+ if ( !isUnique )
+ rmElemIds.push_back( elem->GetID() );
+ }
+ }
+
+ Remove( rmElemIds, false );
+}
+
+//=======================================================================
+//function : findAdjacentFace
+//purpose :
+//=======================================================================
+#define CHECKIND(max,val) {if ( (val) >= (max) ) \
+
+static const SMDS_MeshElement* findAdjacentFace(const SMDS_MeshNode* n1,
+ const SMDS_MeshNode* n2,
+ const SMDS_MeshElement* elem)
+{
+ SMDS_ElemIteratorPtr invElemIt = n1->facesIterator();
+ while ( invElemIt->more() ) { // loop on inverse elements of n1
+ const SMDS_MeshElement* adjElem = invElemIt->next();
+ if ( elem != adjElem ) {
+ // get face nodes and find index of n1
+ int i1, nbN = adjElem->NbNodes(), iNode = 0;
+ const SMDS_MeshNode* faceNodes[ nbN ], *n;
+ SMDS_ElemIteratorPtr nIt = adjElem->nodesIterator();
+ while ( nIt->more() ) {
+ faceNodes[ iNode ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ if ( faceNodes[ iNode++ ] == n1 )
+ i1 = iNode - 1;
+ }
+ // find a n2 linked to n1
+ for ( iNode = 0; iNode < 2; iNode++ ) {
+ if ( iNode ) // node before n1
+ n = faceNodes[ i1 == 0 ? nbN - 1 : i1 - 1 ];
+ else // node after n1
+ n = faceNodes[ i1 + 1 == nbN ? 0 : i1 + 1 ];
+ if ( n == n2 )
+ return adjElem;
+ }
+ }
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : findFreeBorder
+//purpose :
+//=======================================================================
+
+#define ControlFreeBorder SMESH::Controls::FreeEdges::IsFreeEdge
+
+static bool findFreeBorder (const SMDS_MeshNode* theFirstNode,
+ const SMDS_MeshNode* theSecondNode,
+ const SMDS_MeshNode* theLastNode,
+ list< const SMDS_MeshNode* > & theNodes,
+ list< const SMDS_MeshElement* > & theFaces)
+{
+ if ( !theFirstNode || !theSecondNode )
+ return false;
+ // find border face between theFirstNode and theSecondNode
+ const SMDS_MeshElement* curElem = findAdjacentFace( theFirstNode, theSecondNode, 0 );
+ if ( !curElem )
+ return false;
+
+ theFaces.push_back( curElem );
+ theNodes.push_back( theFirstNode );
+ theNodes.push_back( theSecondNode );
+
+ const SMDS_MeshNode* nodes [5], *nIgnore = theFirstNode, * nStart = theSecondNode;
+ set < const SMDS_MeshElement* > foundElems;
+ bool needTheLast = ( theLastNode != 0 );
+
+ while ( nStart != theLastNode )
+ {
+ if ( nStart == theFirstNode )
+ return !needTheLast;
+
+ // find all free border faces sharing form nStart
+
+ list< const SMDS_MeshElement* > curElemList;
+ list< const SMDS_MeshNode* > nStartList;
+ SMDS_ElemIteratorPtr invElemIt = nStart->facesIterator();
+ while ( invElemIt->more() ) {
+ const SMDS_MeshElement* e = invElemIt->next();
+ if ( e == curElem || foundElems.insert( e ).second )
+ {
+ // get nodes
+ SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+ int iNode = 0, nbNodes = e->NbNodes();
+ while ( nIt->more() )
+ nodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ nodes[ iNode ] = nodes[ 0 ];
+ // check 2 links
+ for ( iNode = 0; iNode < nbNodes; iNode++ )
+ if (((nodes[ iNode ] == nStart && nodes[ iNode + 1] != nIgnore ) ||
+ (nodes[ iNode + 1] == nStart && nodes[ iNode ] != nIgnore )) &&
+ ControlFreeBorder( &nodes[ iNode ], e->GetID() ))
+ {
+ nStartList.push_back( nodes[ iNode + ( nodes[ iNode ] == nStart ? 1 : 0 )]);
+ curElemList.push_back( e );
+ }
+ }
+ }
+ // analyse the found
+
+ int nbNewBorders = curElemList.size();
+ if ( nbNewBorders == 0 ) {
+ // no free border furthermore
+ return !needTheLast;
+ }
+ else if ( nbNewBorders == 1 ) {
+ // one more element found
+ nIgnore = nStart;
+ nStart = nStartList.front();
+ curElem = curElemList.front();
+ theFaces.push_back( curElem );
+ theNodes.push_back( nStart );
+ }
+ else {
+ // several continuations found
+ list< const SMDS_MeshElement* >::iterator curElemIt;
+ list< const SMDS_MeshNode* >::iterator nStartIt;
+ // check if one of them reached the last node
+ if ( needTheLast ) {
+ for (curElemIt = curElemList.begin(), nStartIt = nStartList.begin();
+ curElemIt!= curElemList.end();
+ curElemIt++, nStartIt++ )
+ if ( *nStartIt == theLastNode ) {
+ theFaces.push_back( *curElemIt );
+ theNodes.push_back( *nStartIt );
+ return true;
+ }
+ }
+ // find the best free border by the continuations
+ list<const SMDS_MeshNode*> contNodes[ 2 ], *cNL;
+ list<const SMDS_MeshElement*> contFaces[ 2 ], *cFL;
+ for (curElemIt = curElemList.begin(), nStartIt = nStartList.begin();
+ curElemIt!= curElemList.end();
+ curElemIt++, nStartIt++ )
+ {
+ cNL = & contNodes[ contNodes[0].empty() ? 0 : 1 ];
+ cFL = & contFaces[ contFaces[0].empty() ? 0 : 1 ];
+ // find one more free border
+ if ( ! findFreeBorder( nIgnore, nStart, theLastNode, *cNL, *cFL )) {
+ cNL->clear();
+ cFL->clear();
+ }
+ else if ( !contNodes[0].empty() && !contNodes[1].empty() ) {
+ // choice: clear a worse one
+ int iLongest = ( contNodes[0].size() < contNodes[1].size() ? 1 : 0 );
+ int iWorse = ( needTheLast ? 1 - iLongest : iLongest );
+ contNodes[ iWorse ].clear();
+ contFaces[ iWorse ].clear();
+ }
+ }
+ if ( contNodes[0].empty() && contNodes[1].empty() )
+ return false;
+
+ // append the best free border
+ cNL = & contNodes[ contNodes[0].empty() ? 1 : 0 ];
+ cFL = & contFaces[ contFaces[0].empty() ? 1 : 0 ];
+ theNodes.pop_back(); // remove nIgnore
+ theNodes.pop_back(); // remove nStart
+ theFaces.pop_back(); // remove curElem
+ list< const SMDS_MeshNode* >::iterator nIt = cNL->begin();
+ list< const SMDS_MeshElement* >::iterator fIt = cFL->begin();
+ for ( ; nIt != cNL->end(); nIt++ ) theNodes.push_back( *nIt );
+ for ( ; fIt != cFL->end(); fIt++ ) theFaces.push_back( *fIt );
+ return true;
+
+ } // several continuations found
+ } // while ( nStart != theLastNode )
+
+ return true;
+}
+
+//=======================================================================
+//function : SewFreeBorder
+//purpose :
+//=======================================================================
+
+bool SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
+ const SMDS_MeshNode* theBordSecondNode,
+ const SMDS_MeshNode* theBordLastNode,
+ const SMDS_MeshNode* theSideFirstNode,
+ const SMDS_MeshNode* theSideSecondNode,
+ const SMDS_MeshNode* theSideThirdNode,
+ bool theSideIsFreeBorder)
+{
+ MESSAGE("::SewFreeBorder()");
+
+ // ====================================
+ // find side nodes and elements
+ // ====================================
+
+ list< const SMDS_MeshNode* > nSide[ 2 ];
+ list< const SMDS_MeshElement* > eSide[ 2 ];
+ list< const SMDS_MeshNode* >::iterator nIt[ 2 ];
+ list< const SMDS_MeshElement* >::iterator eIt[ 2 ];
+ SMDS_ElemIteratorPtr invElemIt;
+
+ // Free border 1
+ // --------------
+ if (!findFreeBorder(theBordFirstNode,theBordSecondNode,theBordLastNode,
+ nSide[0], eSide[0])) {
+ MESSAGE(" Free Border 1 not found " );
+ return false;
+ }
+ if (theSideIsFreeBorder)
+ {
+ // Free border 2
+ // --------------
+ if (!findFreeBorder(theSideFirstNode, theSideSecondNode, theSideThirdNode,
+ nSide[1], eSide[1])) {
+ MESSAGE(" Free Border 2 not found " );
+ return false;
+ }
+ }
+ else
+ {
+ // Side 2
+ // --------------
+
+ // -------------------------------------------------------------------------
+ // Algo:
+ // 1. If nodes to merge are not coincident, move nodes of the free border
+ // from the coord sys defined by the direction from the first to last
+ // nodes of the border to the correspondent sys of the side 2
+ // 2. On the side 2, find the links most co-directed with the correspondent
+ // links of the free border
+ // -------------------------------------------------------------------------
+
+ // 1. Since sewing may brake if there are volumes to split on the side 2,
+ // we wont move nodes but just compute new coordinates for them
+ typedef map<const SMDS_MeshNode*, gp_XYZ> TNodeXYZMap;
+ TNodeXYZMap nBordXYZ;
+ list< const SMDS_MeshNode* >& bordNodes = nSide[ 0 ];
+ list< const SMDS_MeshNode* >::iterator nBordIt;
+
+ gp_XYZ Pb1( theBordFirstNode->X(), theBordFirstNode->Y(), theBordFirstNode->Z() );
+ gp_XYZ Pb2( theBordLastNode->X(), theBordLastNode->Y(), theBordLastNode->Z() );
+ gp_XYZ Ps1( theSideFirstNode->X(), theSideFirstNode->Y(), theSideFirstNode->Z() );
+ gp_XYZ Ps2( theSideSecondNode->X(), theSideSecondNode->Y(), theSideSecondNode->Z() );
+ double tol2 = 1.e-8;
+ gp_Vec Vbs1( Pb1 - Ps1 ),Vbs2( Pb2 - Ps2 );
+ if ( Vbs1.SquareMagnitude() > tol2 || Vbs2.SquareMagnitude() > tol2 )
+ {
+ // Need node movement.
+
+ // find X and Z axes to create trsf
+ gp_Vec Zb( Pb1 - Pb2 ), Zs( Ps1 - Ps2 );
+ gp_Vec X = Zs ^ Zb;
+ if ( X.SquareMagnitude() <= gp::Resolution() * gp::Resolution() )
+ // Zb || Zs
+ X = gp_Ax2( gp::Origin(), Zb ).XDirection();
+
+ // coord systems
+ gp_Ax3 toBordAx( Pb1, Zb, X );
+ gp_Ax3 fromSideAx( Ps1, Zs, X );
+ gp_Ax3 toGlobalAx( gp::Origin(), gp::DZ(), gp::DX() );
+ // set trsf
+ gp_Trsf toBordSys, fromSide2Sys;
+ toBordSys.SetTransformation( toBordAx );
+ fromSide2Sys.SetTransformation( fromSideAx, toGlobalAx );
+ fromSide2Sys.SetScaleFactor( Zs.Magnitude() / Zb.Magnitude() );
+
+ // move
+ for ( nBordIt = bordNodes.begin(); nBordIt != bordNodes.end(); nBordIt++ ) {
+ const SMDS_MeshNode* n = *nBordIt;
+ gp_XYZ xyz( n->X(),n->Y(),n->Z() );
+ toBordSys.Transforms( xyz );
+ fromSide2Sys.Transforms( xyz );
+ nBordXYZ.insert( TNodeXYZMap::value_type( n, xyz ));
+ }
+ }
+ else
+ {
+ // just insert nodes XYZ in the nBordXYZ map
+ for ( nBordIt = bordNodes.begin(); nBordIt != bordNodes.end(); nBordIt++ ) {
+ const SMDS_MeshNode* n = *nBordIt;
+ nBordXYZ.insert( TNodeXYZMap::value_type( n, gp_XYZ( n->X(),n->Y(),n->Z() )));
+ }
+ }
+
+ // 2. On the side 2, find the links most co-directed with the correspondent
+ // links of the free border
+
+ list< const SMDS_MeshElement* >& sideElems = eSide[ 1 ];
+ list< const SMDS_MeshNode* >& sideNodes = nSide[ 1 ];
+ sideNodes.push_back( theSideFirstNode );
+
+ bool hasVolumes = false;
+ LinkID_Gen aLinkID_Gen( GetMeshDS() );
+ set<long> foundSideLinkIDs, checkedLinkIDs;
+ SMDS_VolumeTool volume;
+ const SMDS_MeshNode* faceNodes[ 4 ];
+
+ const SMDS_MeshNode* sideNode;
+ const SMDS_MeshElement* sideElem;
+ const SMDS_MeshNode* prevSideNode = theSideFirstNode;
+ const SMDS_MeshNode* prevBordNode = theBordFirstNode;
+ nBordIt = bordNodes.begin();
+ nBordIt++;
+ // border node position and border link direction to compare with
+ gp_XYZ bordPos = nBordXYZ[ *nBordIt ];
+ gp_XYZ bordDir = bordPos - nBordXYZ[ prevBordNode ];
+ // choose next side node by link direction or by closeness to
+ // the current border node:
+ bool searchByDir = ( *nBordIt != theBordLastNode );
+ do {
+ // find the next node on the Side 2
+ sideNode = 0;
+ double maxDot = -DBL_MAX, minDist = DBL_MAX;
+ long linkID;
+ checkedLinkIDs.clear();
+ gp_XYZ prevXYZ( prevSideNode->X(), prevSideNode->Y(), prevSideNode->Z() );
+
+ invElemIt = prevSideNode->GetInverseElementIterator();
+ while ( invElemIt->more() ) { // loop on inverse elements on the Side 2
+ const SMDS_MeshElement* elem = invElemIt->next();
+ // prepare data for a loop on links, of a face or a volume
+ int iPrevNode, iNode = 0, nbNodes = elem->NbNodes();
+ bool isVolume = volume.Set( elem );
+ const SMDS_MeshNode** nodes = isVolume ? volume.GetNodes() : faceNodes;
+ if ( isVolume ) // --volume
+ hasVolumes = true;
+ else if ( nbNodes > 2 ) { // --face
+ // retrieve all face nodes and find iPrevNode - an index of the prevSideNode
+ SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
+ while ( nIt->more() ) {
+ nodes[ iNode ] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ if ( nodes[ iNode++ ] == prevSideNode )
+ iPrevNode = iNode - 1;
+ }
+ // there are 2 links to check
+ nbNodes = 2;
+ }
+ else // --edge
+ continue;
+ // loop on links, to be precise, on the second node of links
+ for ( iNode = 0; iNode < nbNodes; iNode++ ) {
+ const SMDS_MeshNode* n = nodes[ iNode ];
+ if ( isVolume ) {
+ if ( !volume.IsLinked( n, prevSideNode ))
+ continue;
+ } else {
+ if ( iNode ) // a node before prevSideNode
+ n = nodes[ iPrevNode == 0 ? elem->NbNodes() - 1 : iPrevNode - 1 ];
+ else // a node after prevSideNode
+ n = nodes[ iPrevNode + 1 == elem->NbNodes() ? 0 : iPrevNode + 1 ];
+ }
+ // check if this link was already used
+ long iLink = aLinkID_Gen.GetLinkID( prevSideNode, n );
+ bool isJustChecked = !checkedLinkIDs.insert( iLink ).second;
+ if (!isJustChecked &&
+ foundSideLinkIDs.find( iLink ) == foundSideLinkIDs.end() ) {
+ // test a link geometrically
+ gp_XYZ nextXYZ ( n->X(), n->Y(), n->Z() );
+ bool linkIsBetter = false;
+ double dot, dist;
+ if ( searchByDir ) { // choose most co-directed link
+ dot = bordDir * ( nextXYZ - prevXYZ ).Normalized();
+ linkIsBetter = ( dot > maxDot );
+ }
+ else { // choose link with the node closest to bordPos
+ dist = ( nextXYZ - bordPos ).SquareModulus();
+ linkIsBetter = ( dist < minDist );
+ }
+ if ( linkIsBetter ) {
+ maxDot = dot;
+ minDist = dist;
+ linkID = iLink;
+ sideNode = n;
+ sideElem = elem;
+ }
+ }
+ }
+ } // loop on inverse elements of prevSideNode
+
+ if ( !sideNode ) {
+ MESSAGE(" Cant find path by links of the Side 2 ");
+ return false;
+ }
+ sideNodes.push_back( sideNode );
+ sideElems.push_back( sideElem );
+ foundSideLinkIDs.insert ( linkID );
+ prevSideNode = sideNode;
+
+ if ( *nBordIt == theBordLastNode )
+ searchByDir = false;
+ else {
+ // find the next border link to compare with
+ gp_XYZ sidePos( sideNode->X(), sideNode->Y(), sideNode->Z() );
+ searchByDir = ( bordDir * ( sidePos - bordPos ) <= 0 );
+ while ( *nBordIt != theBordLastNode && !searchByDir ) {
+ prevBordNode = *nBordIt;
+ nBordIt++;
+ bordPos = nBordXYZ[ *nBordIt ];
+ bordDir = bordPos - nBordXYZ[ prevBordNode ];
+ searchByDir = ( bordDir * ( sidePos - bordPos ) <= 0 );
+ }
+ }
+ }
+ while ( sideNode != theSideSecondNode );
+
+ if ( hasVolumes && sideNodes.size () != bordNodes.size() ) {
+ MESSAGE("VOLUME SPLITTING IS FORBIDDEN");
+ return false; // volume splitting is forbidden
+ }
+ } // end nodes search on the side 2
+
+ // ============================
+ // sew the border to the side 2
+ // ============================
+
+ int nbNodes[] = { nSide[0].size(), nSide[1].size() };
+ int maxNbNodes = Max( nbNodes[0], nbNodes[1] );
+
+ TListOfListOfNodes nodeGroupsToMerge;
+ if ( nbNodes[0] == nbNodes[1] ||
+ ( theSideIsFreeBorder && !theSideThirdNode)) {
+
+ // all nodes are to be merged
+
+ for (nIt[0] = nSide[0].begin(), nIt[1] = nSide[1].begin();
+ nIt[0] != nSide[0].end() && nIt[1] != nSide[1].end();
+ nIt[0]++, nIt[1]++ )
+ {
+ nodeGroupsToMerge.push_back( list<const SMDS_MeshNode*>() );
+ nodeGroupsToMerge.back().push_back( *nIt[1] ); // to keep
+ nodeGroupsToMerge.back().push_back( *nIt[0] ); // tp remove
+ }
+ }
+ else {
+
+ // insert new nodes into the border and the side to get equal nb of segments
+
+ // get normalized parameters of nodes on the borders
+ double param[ 2 ][ maxNbNodes ];
+ int iNode, iBord;
+ for ( iBord = 0; iBord < 2; iBord++ ) { // loop on 2 borders
+ list< const SMDS_MeshNode* >& nodes = nSide[ iBord ];
+ list< const SMDS_MeshNode* >::iterator nIt = nodes.begin();
+ const SMDS_MeshNode* nPrev = *nIt;
+ double bordLength = 0;
+ for ( iNode = 0; nIt != nodes.end(); nIt++, iNode++ ) { // loop on border nodes
+ const SMDS_MeshNode* nCur = *nIt;
+ gp_XYZ segment (nCur->X() - nPrev->X(),
+ nCur->Y() - nPrev->Y(),
+ nCur->Z() - nPrev->Z());
+ double segmentLen = segment.SquareModulus();
+ bordLength += segmentLen;
+ param[ iBord ][ iNode ] = bordLength;
+ nPrev = nCur;
+ }
+ // normalize within [0,1]
+ for ( iNode = 0; iNode < nbNodes[ iBord ]; iNode++ ) {
+ param[ iBord ][ iNode ] /= bordLength;
+ }
+ }
+
+ // loop on border segments
+ const SMDS_MeshNode *nPrev[ 2 ] = { 0, 0 };
+ int i[ 2 ] = { 0, 0 };
+ nIt[0] = nSide[0].begin(); eIt[0] = eSide[0].begin();
+ nIt[1] = nSide[1].begin(); eIt[1] = eSide[1].begin();
+
+ TElemOfNodeListMap insertMap;
+ TElemOfNodeListMap::iterator insertMapIt;
+ // insertMap is
+ // key: elem to insert nodes into
+ // value: 2 nodes to insert between + nodes to be inserted
+ do {
+ bool next[ 2 ] = { false, false };
+
+ // find min adjacent segment length after sewing
+ double nextParam = 10., prevParam = 0;
+ for ( iBord = 0; iBord < 2; iBord++ ) { // loop on 2 borders
+ if ( i[ iBord ] + 1 < nbNodes[ iBord ])
+ nextParam = Min( nextParam, param[iBord][ i[iBord] + 1 ]);
+ if ( i[ iBord ] > 0 )
+ prevParam = Max( prevParam, param[iBord][ i[iBord] - 1 ]);
+ }
+ double minParam = Min( param[ 0 ][ i[0] ], param[ 1 ][ i[1] ]);
+ double maxParam = Max( param[ 0 ][ i[0] ], param[ 1 ][ i[1] ]);
+ double minSegLen = Min( nextParam - minParam, maxParam - prevParam );
+
+ // choose to insert or to merge nodes
+ double du = param[ 1 ][ i[1] ] - param[ 0 ][ i[0] ];
+ if ( Abs( du ) <= minSegLen * 0.2 ) {
+ // merge
+ // ------
+ nodeGroupsToMerge.push_back( list<const SMDS_MeshNode*>() );
+ const SMDS_MeshNode* n0 = *nIt[0];
+ const SMDS_MeshNode* n1 = *nIt[1];
+ nodeGroupsToMerge.back().push_back( n1 );
+ nodeGroupsToMerge.back().push_back( n0 );
+ // position of node of the border changes due to merge
+ param[ 0 ][ i[0] ] += du;
+ // move n1 for the sake of elem shape evaluation during insertion.
+ // n1 will be removed by MergeNodes() anyway
+ const_cast<SMDS_MeshNode*>( n0 )->setXYZ( n1->X(), n1->Y(), n1->Z() );
+ next[0] = next[1] = true;
+ }
+ else {
+ // insert
+ // ------
+ int intoBord = ( du < 0 ) ? 0 : 1;
+ const SMDS_MeshElement* elem = *eIt[ intoBord ];
+ const SMDS_MeshNode* n1 = nPrev[ intoBord ];
+ const SMDS_MeshNode* n2 = *nIt[ intoBord ];
+ const SMDS_MeshNode* nIns = *nIt[ 1 - intoBord ];
+ if ( intoBord == 1 ) {
+ // move node of the border to be on a link of elem of the side
+ gp_XYZ p1 (n1->X(), n1->Y(), n1->Z());
+ gp_XYZ p2 (n2->X(), n2->Y(), n2->Z());
+ double ratio = du / ( param[ 1 ][ i[1] ] - param[ 1 ][ i[1]-1 ]);
+ gp_XYZ p = p2 * ( 1 - ratio ) + p1 * ratio;
+ GetMeshDS()->MoveNode( nIns, p.X(), p.Y(), p.Z() );
+ }
+ insertMapIt = insertMap.find( elem );
+ bool notFound = ( insertMapIt == insertMap.end() );
+ bool otherLink = ( !notFound && (*insertMapIt).second.front() != n1 );
+ if ( otherLink ) {
+ // insert into another link of the same element:
+ // 1. perform insertion into the other link of the elem
+ list<const SMDS_MeshNode*> & nodeList = (*insertMapIt).second;
+ const SMDS_MeshNode* n12 = nodeList.front(); nodeList.pop_front();
+ const SMDS_MeshNode* n22 = nodeList.front(); nodeList.pop_front();
+ InsertNodesIntoLink( elem, n12, n22, nodeList );
+ // 2. perform insertion into the link of adjacent faces
+ while (true) {
+ const SMDS_MeshElement* adjElem = findAdjacentFace( n12, n22, elem );
+ if ( adjElem )
+ InsertNodesIntoLink( adjElem, n12, n22, nodeList );
+ else
+ break;
+ }
+ // 3. find an element appeared on n1 and n2 after the insertion
+ insertMap.erase( elem );
+ elem = findAdjacentFace( n1, n2, 0 );
+ }
+ if ( notFound || otherLink ) {
+ // add element and nodes of the side into the insertMap
+ insertMapIt = insertMap.insert
+ ( TElemOfNodeListMap::value_type( elem, list<const SMDS_MeshNode*>() )).first;
+ (*insertMapIt).second.push_back( n1 );
+ (*insertMapIt).second.push_back( n2 );
+ }
+ // add node to be inserted into elem
+ (*insertMapIt).second.push_back( nIns );
+ next[ 1 - intoBord ] = true;
+ }
+
+ // go to the next segment
+ for ( iBord = 0; iBord < 2; iBord++ ) { // loop on 2 borders
+ if ( next[ iBord ] ) {
+ if ( i[ iBord ] != 0 && eIt[ iBord ] != eSide[ iBord ].end())
+ eIt[ iBord ]++;
+ nPrev[ iBord ] = *nIt[ iBord ];
+ nIt[ iBord ]++; i[ iBord ]++;
+ }
+ }
+ }
+ while ( nIt[0] != nSide[0].end() && nIt[1] != nSide[1].end());
+
+ // perform insertion of nodes into elements
+
+ for (insertMapIt = insertMap.begin();
+ insertMapIt != insertMap.end();
+ insertMapIt++ )
+ {
+ const SMDS_MeshElement* elem = (*insertMapIt).first;
+ list<const SMDS_MeshNode*> & nodeList = (*insertMapIt).second;
+ const SMDS_MeshNode* n1 = nodeList.front(); nodeList.pop_front();
+ const SMDS_MeshNode* n2 = nodeList.front(); nodeList.pop_front();
+
+ InsertNodesIntoLink( elem, n1, n2, nodeList );
+
+ if ( !theSideIsFreeBorder ) {
+ // look for and insert nodes into the faces adjacent to elem
+ while (true) {
+ const SMDS_MeshElement* adjElem = findAdjacentFace( n1, n2, elem );
+ if ( adjElem )
+ InsertNodesIntoLink( adjElem, n1, n2, nodeList );
+ else
+ break;
+ }
+ }
+ }
+
+ } // end: insert new nodes
+
+ MergeNodes ( nodeGroupsToMerge );
+
+ return true;
+}
+
+//=======================================================================
+//function : InsertNodesIntoLink
+//purpose : insert theNodesToInsert into theFace between theBetweenNode1
+// and theBetweenNode2 and split theElement
+//=======================================================================
+
+void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theFace,
+ const SMDS_MeshNode* theBetweenNode1,
+ const SMDS_MeshNode* theBetweenNode2,
+ list<const SMDS_MeshNode*>& theNodesToInsert)
+{
+ if ( theFace->GetType() != SMDSAbs_Face ) return;
+
+ // find indices of 2 link nodes and of the rest nodes
+ int iNode = 0, il1, il2, i3, i4;
+ il1 = il2 = i3 = i4 = -1;
+ const SMDS_MeshNode* nodes[ 8 ];
+ SMDS_ElemIteratorPtr nodeIt = theFace->nodesIterator();
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ if ( n == theBetweenNode1 )
+ il1 = iNode;
+ else if ( n == theBetweenNode2 )
+ il2 = iNode;
+ else if ( i3 < 0 )
+ i3 = iNode;
+ else
+ i4 = iNode;
+ nodes[ iNode++ ] = n;
+ }
+ if ( il1 < 0 || il2 < 0 || i3 < 0 )
+ return ;
+
+ // arrange link nodes to go one after another regarding the face orientation
+ bool reverse = ( Abs( il2 - il1 ) == 1 ? il2 < il1 : il1 < il2 );
+ if ( reverse ) {
+ iNode = il1;
+ il1 = il2;
+ il2 = iNode;
+ theNodesToInsert.reverse();
+ }
+ // check that not link nodes of a quadrangles are in good order
+ int nbFaceNodes = theFace->NbNodes();
+ if ( nbFaceNodes == 4 && i4 - i3 != 1 ) {
+ iNode = i3;
+ i3 = i4;
+ i4 = iNode;
+ }
+
+ // put theNodesToInsert between theBetweenNode1 and theBetweenNode2
+ int nbLinkNodes = 2 + theNodesToInsert.size();
+ const SMDS_MeshNode* linkNodes[ nbLinkNodes ];
+ linkNodes[ 0 ] = nodes[ il1 ];
+ linkNodes[ nbLinkNodes - 1 ] = nodes[ il2 ];
+ list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
+ for ( iNode = 1; nIt != theNodesToInsert.end(); nIt++ ) {
+ linkNodes[ iNode++ ] = *nIt;
+ }
+ // decide how to split a quadrangle: compare possible variants
+ // and choose which of splits to be a quadrangle
+ int i1, i2, iSplit, nbSplits = nbLinkNodes - 1, iBestQuad;
+ if ( nbFaceNodes == 3 )
+ {
+ iBestQuad = nbSplits;
+ i4 = i3;
+ }
+ else if ( nbFaceNodes == 4 )
+ {
+ SMESH::Controls::NumericalFunctorPtr aCrit( new SMESH::Controls::AspectRatio);
+ double aBestRate = DBL_MAX;
+ for ( int iQuad = 0; iQuad < nbSplits; iQuad++ ) {
+ i1 = 0; i2 = 1;
+ double aBadRate = 0;
+ // evaluate elements quality
+ for ( iSplit = 0; iSplit < nbSplits; iSplit++ ) {
+ if ( iSplit == iQuad ) {
+ SMDS_FaceOfNodes quad (linkNodes[ i1++ ],
+ linkNodes[ i2++ ],
+ nodes[ i3 ],
+ nodes[ i4 ]);
+ aBadRate += getBadRate( &quad, aCrit );
+ }
+ else {
+ SMDS_FaceOfNodes tria (linkNodes[ i1++ ],
+ linkNodes[ i2++ ],
+ nodes[ iSplit < iQuad ? i4 : i3 ]);
+ aBadRate += getBadRate( &tria, aCrit );
+ }
+ }
+ // choice
+ if ( aBadRate < aBestRate ) {
+ iBestQuad = iQuad;
+ aBestRate = aBadRate;
+ }
+ }
+ }
+
+ // create new elements
+ SMESHDS_Mesh *aMesh = GetMeshDS();
+ int aShapeId = FindShape( theFace );
+
+ i1 = 0; i2 = 1;
+ for ( iSplit = 0; iSplit < nbSplits - 1; iSplit++ ) {
+ SMDS_MeshElement* newElem = 0;
+ if ( iSplit == iBestQuad )
+ newElem = aMesh->AddFace (linkNodes[ i1++ ],
+ linkNodes[ i2++ ],
+ nodes[ i3 ],
+ nodes[ i4 ]);
+ else
+ newElem = aMesh->AddFace (linkNodes[ i1++ ],
+ linkNodes[ i2++ ],
+ nodes[ iSplit < iBestQuad ? i4 : i3 ]);
+ if ( aShapeId && newElem )
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
+
+ // change nodes of theFace
+ const SMDS_MeshNode* newNodes[ 4 ];
+ newNodes[ 0 ] = linkNodes[ i1 ];
+ newNodes[ 1 ] = linkNodes[ i2 ];
+ newNodes[ 2 ] = nodes[ iSplit >= iBestQuad ? i3 : i4 ];
+ newNodes[ 3 ] = nodes[ i4 ];
+ aMesh->ChangeElementNodes( theFace, newNodes, iSplit == iBestQuad ? 4 : 3 );
+}
+
+//=======================================================================
+//function : SewSideElements
+//purpose :
+//=======================================================================
+
+bool SMESH_MeshEditor::SewSideElements (set<const SMDS_MeshElement*>& theSide1,
+ set<const SMDS_MeshElement*>& theSide2,
+ const SMDS_MeshNode* theFirstNode1,
+ const SMDS_MeshNode* theFirstNode2,
+ const SMDS_MeshNode* theSecondNode1,
+ const SMDS_MeshNode* theSecondNode2)
+{
+ MESSAGE ("::::SewSideElements()");
+ // Algo:
+ // 1. Build set of faces representing each side
+ // 2. Find which nodes of the side 1 to merge with ones on the side 2
+ // 3. Replace nodes in elements of the side 1 and remove replaced nodes
+
+ // =======================================================================
+ // 1. Build set of faces representing each side:
+ // =======================================================================
+ // a. build set of nodes belonging to faces
+ // b. complete set of faces: find missing fices whose nodes are in set of nodes
+ // c. create temporary faces representing side of volumes if correspondent
+ // face does not exist
+
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+ SMDS_Mesh aTmpFacesMesh;
+ set<const SMDS_MeshElement*> faceSet1, faceSet2;
+ set<const SMDS_MeshElement*> volSet1, volSet2;
+ set<const SMDS_MeshNode*> nodeSet1, nodeSet2;
+ set<const SMDS_MeshElement*> * faceSetPtr[] = { &faceSet1, &faceSet2 };
+ set<const SMDS_MeshElement*> * volSetPtr[] = { &volSet1, &volSet2 };
+ set<const SMDS_MeshNode*> * nodeSetPtr[] = { &nodeSet1, &nodeSet2 };
+ set<const SMDS_MeshElement*> * elemSetPtr[] = { &theSide1, &theSide2 };
+ int iSide, iFace, iNode;
+
+ for ( iSide = 0; iSide < 2; iSide++ ) {
+ set<const SMDS_MeshNode*> * nodeSet = nodeSetPtr[ iSide ];
+ set<const SMDS_MeshElement*> * elemSet = elemSetPtr[ iSide ];
+ set<const SMDS_MeshElement*> * faceSet = faceSetPtr[ iSide ];
+ set<const SMDS_MeshElement*> * volSet = volSetPtr [ iSide ];
+ set<const SMDS_MeshElement*>::iterator vIt, eIt;
+ set<const SMDS_MeshNode*>::iterator nIt;
+
+ // -----------------------------------------------------------
+ // 1a. Collect nodes of existing faces
+ // and build set of face nodes in order to detect missing
+ // faces corresponing to sides of volumes
+ // -----------------------------------------------------------
+
+ set< set <const SMDS_MeshNode*> > setOfFaceNodeSet;
+
+ // loop on the given element of a side
+ for (eIt = elemSet->begin(); eIt != elemSet->end(); eIt++ ) {
+ const SMDS_MeshElement* elem = *eIt;
+ if ( elem->GetType() == SMDSAbs_Face ) {
+ faceSet->insert( elem );
+ set <const SMDS_MeshNode*> faceNodeSet;
+ SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ nodeSet->insert( n );
+ faceNodeSet.insert( n );
+ }
+ setOfFaceNodeSet.insert( faceNodeSet );
+ }
+ else if ( elem->GetType() == SMDSAbs_Volume )
+ volSet->insert( elem );
+ }
+ // ------------------------------------------------------------------------------
+ // 1b. Complete set of faces: find missing fices whose nodes are in set of nodes
+ // ------------------------------------------------------------------------------
+
+ for ( nIt = nodeSet->begin(); nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide
+ SMDS_ElemIteratorPtr fIt = (*nIt)->facesIterator();
+ while ( fIt->more() ) { // loop on faces sharing a node
+ const SMDS_MeshElement* f = fIt->next();
+ if ( faceSet->find( f ) == faceSet->end() ) {
+ // check if all nodes are in nodeSet and
+ // complete setOfFaceNodeSet if they are
+ set <const SMDS_MeshNode*> faceNodeSet;
+ SMDS_ElemIteratorPtr nodeIt = f->nodesIterator();
+ bool allInSet = true;
+ while ( nodeIt->more() && allInSet ) { // loop on nodes of a face
+ const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ if ( nodeSet->find( n ) == nodeSet->end() )
+ allInSet = false;
+ else
+ faceNodeSet.insert( n );
+ }
+ if ( allInSet ) {
+ faceSet->insert( f );
+ setOfFaceNodeSet.insert( faceNodeSet );
+ }
+ }
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // 1c. Create temporary faces representing sides of volumes if correspondent
+ // face does not exist
+ // -------------------------------------------------------------------------
+
+ if ( !volSet->empty() )
+ {
+ //int nodeSetSize = nodeSet->size();
+
+ // loop on given volumes
+ for ( vIt = volSet->begin(); vIt != volSet->end(); vIt++ ) {
+ SMDS_VolumeTool vol (*vIt);
+ // loop on volume faces: find free faces
+ // --------------------------------------
+ list<const SMDS_MeshElement* > freeFaceList;
+ for ( iFace = 0; iFace < vol.NbFaces(); iFace++ ) {
+ if ( !vol.IsFreeFace( iFace ))
+ continue;
+ // check if there is already a face with same nodes in a face set
+ const SMDS_MeshElement* aFreeFace = 0;
+ const SMDS_MeshNode** fNodes = vol.GetFaceNodes( iFace );
+ int nbNodes = vol.NbFaceNodes( iFace );
+ set <const SMDS_MeshNode*> faceNodeSet;
+ vol.GetFaceNodes( iFace, faceNodeSet );
+ bool isNewFace = setOfFaceNodeSet.insert( faceNodeSet ).second;
+ if ( isNewFace ) {
+ // no such a face is given but it still can exist, check it
+ if ( nbNodes == 3 )
+ aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2] );
+ else
+ aFreeFace = aMesh->FindFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
+ }
+ if ( !aFreeFace ) {
+ // create a temporary face
+ if ( nbNodes == 3 )
+ aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2] );
+ else
+ aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
+ }
+ if ( aFreeFace )
+ freeFaceList.push_back( aFreeFace );
+
+ } // loop on faces of a volume
+
+ // choose one of several free faces
+ // --------------------------------------
+ if ( freeFaceList.size() > 1 ) {
+ // choose a face having max nb of nodes shared by other elems of a side
+ int maxNbNodes = -1/*, nbExcludedFaces = 0*/;
+ list<const SMDS_MeshElement* >::iterator fIt = freeFaceList.begin();
+ while ( fIt != freeFaceList.end() ) { // loop on free faces
+ int nbSharedNodes = 0;
+ SMDS_ElemIteratorPtr nodeIt = (*fIt)->nodesIterator();
+ while ( nodeIt->more() ) { // loop on free face nodes
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ SMDS_ElemIteratorPtr invElemIt = n->GetInverseElementIterator();
+ while ( invElemIt->more() ) {
+ const SMDS_MeshElement* e = invElemIt->next();
+ if ( faceSet->find( e ) != faceSet->end() )
+ nbSharedNodes++;
+ if ( elemSet->find( e ) != elemSet->end() )
+ nbSharedNodes++;
+ }
+ }
+ if ( nbSharedNodes >= maxNbNodes ) {
+ maxNbNodes = nbSharedNodes;
+ fIt++;
+ }
+ else
+ freeFaceList.erase( fIt++ ); // here fIt++ occures before erase
+ }
+ if ( freeFaceList.size() > 1 )
+ {
+ // could not choose one face, use another way
+ // choose a face most close to the bary center of the opposite side
+ gp_XYZ aBC( 0., 0., 0. );
+ set <const SMDS_MeshNode*> addedNodes;
+ set<const SMDS_MeshElement*> * elemSet2 = elemSetPtr[ 1 - iSide ];
+ eIt = elemSet2->begin();
+ for ( eIt = elemSet2->begin(); eIt != elemSet2->end(); eIt++ ) {
+ SMDS_ElemIteratorPtr nodeIt = (*eIt)->nodesIterator();
+ while ( nodeIt->more() ) { // loop on free face nodes
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ if ( addedNodes.insert( n ).second )
+ aBC += gp_XYZ( n->X(),n->Y(),n->Z() );
+ }
+ }
+ aBC /= addedNodes.size();
+ double minDist = DBL_MAX;
+ fIt = freeFaceList.begin();
+ while ( fIt != freeFaceList.end() ) { // loop on free faces
+ double dist = 0;
+ SMDS_ElemIteratorPtr nodeIt = (*fIt)->nodesIterator();
+ while ( nodeIt->more() ) { // loop on free face nodes
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ gp_XYZ p( n->X(),n->Y(),n->Z() );
+ dist += ( aBC - p ).SquareModulus();
+ }
+ if ( dist < minDist ) {
+ minDist = dist;
+ freeFaceList.erase( freeFaceList.begin(), fIt++ );
+ }
+ else
+ fIt = freeFaceList.erase( fIt++ );
+ }
+ }
+ } // choose one of several free faces of a volume
+
+ if ( freeFaceList.size() == 1 ) {
+ const SMDS_MeshElement* aFreeFace = freeFaceList.front();
+ faceSet->insert( aFreeFace );
+ // complete a node set with nodes of a found free face
+// for ( iNode = 0; iNode < ; iNode++ )
+// nodeSet->insert( fNodes[ iNode ] );
+ }
+
+ } // loop on volumes of a side
+
+// // complete a set of faces if new nodes in a nodeSet appeared
+// // ----------------------------------------------------------
+// if ( nodeSetSize != nodeSet->size() ) {
+// for ( ; nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide
+// SMDS_ElemIteratorPtr fIt = (*nIt)->facesIterator();
+// while ( fIt->more() ) { // loop on faces sharing a node
+// const SMDS_MeshElement* f = fIt->next();
+// if ( faceSet->find( f ) == faceSet->end() ) {
+// // check if all nodes are in nodeSet and
+// // complete setOfFaceNodeSet if they are
+// set <const SMDS_MeshNode*> faceNodeSet;
+// SMDS_ElemIteratorPtr nodeIt = f->nodesIterator();
+// bool allInSet = true;
+// while ( nodeIt->more() && allInSet ) { // loop on nodes of a face
+// const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+// if ( nodeSet->find( n ) == nodeSet->end() )
+// allInSet = false;
+// else
+// faceNodeSet.insert( n );
+// }
+// if ( allInSet ) {
+// faceSet->insert( f );
+// setOfFaceNodeSet.insert( faceNodeSet );
+// }
+// }
+// }
+// }
+// }
+ } // Create temporary faces, if there are volumes given
+ } // loop on sides
+
+ if ( faceSet1.size() != faceSet2.size() ) {
+ // delete temporary faces: they are in reverseElements of actual nodes
+ SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
+ while ( tmpFaceIt->more() )
+ aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
+ MESSAGE("Diff nb of faces");
+ return false;
+ }
+
+ // ============================================================
+ // 2. Find nodes to merge:
+ // bind a node to remove to a node to put instead
+ // ============================================================
+
+ TNodeNodeMap nReplaceMap; // bind a node to remove to a node to put instead
+ if ( theFirstNode1 != theFirstNode2 )
+ nReplaceMap.insert( TNodeNodeMap::value_type( theFirstNode1, theFirstNode2 ));
+ if ( theSecondNode1 != theSecondNode2 )
+ nReplaceMap.insert( TNodeNodeMap::value_type( theSecondNode1, theSecondNode2 ));
+
+ LinkID_Gen aLinkID_Gen( GetMeshDS() );
+ set< long > linkIdSet; // links to process
+ linkIdSet.insert( aLinkID_Gen.GetLinkID( theFirstNode1, theSecondNode1 ));
+
+ typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > TPairOfNodes;
+ list< TPairOfNodes > linkList[2];
+ linkList[0].push_back( TPairOfNodes( theFirstNode1, theSecondNode1 ));
+ linkList[1].push_back( TPairOfNodes( theFirstNode2, theSecondNode2 ));
+ // loop on links in linkList; find faces by links and append links
+ // of the found faces to linkList
+ list< TPairOfNodes >::iterator linkIt[] = { linkList[0].begin(), linkList[1].begin() } ;
+ for ( ; linkIt[0] != linkList[0].end(); linkIt[0]++, linkIt[1]++ )
+ {
+ TPairOfNodes link[] = { *linkIt[0], *linkIt[1] };
+ long linkID = aLinkID_Gen.GetLinkID( link[0].first, link[0].second );
+ if ( linkIdSet.find( linkID ) == linkIdSet.end() )
+ continue;
+
+ // by links, find faces in the face sets,
+ // and find indices of link nodes in the found faces;
+ // in a face set, there is only one or no face sharing a link
+ // ---------------------------------------------------------------
+
+ const SMDS_MeshElement* face[] = { 0, 0 };
+ const SMDS_MeshNode* faceNodes[ 2 ][ 5 ];
+ const SMDS_MeshNode* notLinkNodes[ 2 ][ 2 ] = {{ 0, 0 },{ 0, 0 }} ;
+ int iLinkNode[2][2];
+ for ( iSide = 0; iSide < 2; iSide++ ) { // loop on 2 sides
+ const SMDS_MeshNode* n1 = link[iSide].first;
+ const SMDS_MeshNode* n2 = link[iSide].second;
+ set<const SMDS_MeshElement*> * faceSet = faceSetPtr[ iSide ];
+ set< const SMDS_MeshElement* > fMap;
+ for ( int i = 0; i < 2; i++ ) { // loop on 2 nodes of a link
+ const SMDS_MeshNode* n = i ? n1 : n2; // a node of a link
+ SMDS_ElemIteratorPtr fIt = n->facesIterator();
+ while ( fIt->more() ) { // loop on faces sharing a node
+ const SMDS_MeshElement* f = fIt->next();
+ if (faceSet->find( f ) != faceSet->end() && // f is in face set
+ ! fMap.insert( f ).second ) // f encounters twice
+ {
+ face[ iSide ] = f;
+ faceSet->erase( f );
+ // get face nodes and find ones of a link
+ iNode = 0;
+ SMDS_ElemIteratorPtr nIt = f->nodesIterator();
+ while ( nIt->more() ) {
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( nIt->next() );
+ if ( n == n1 )
+ iLinkNode[ iSide ][ 0 ] = iNode;
+ else if ( n == n2 )
+ iLinkNode[ iSide ][ 1 ] = iNode;
+ else if ( notLinkNodes[ iSide ][ 0 ] )
+ notLinkNodes[ iSide ][ 1 ] = n;
+ else
+ notLinkNodes[ iSide ][ 0 ] = n;
+ faceNodes[ iSide ][ iNode++ ] = n;
+ }
+ faceNodes[ iSide ][ iNode ] = faceNodes[ iSide ][ 0 ];
+ break;
+ }
+ }
+ }
+ }
+ // check similarity of elements of the sides
+ if (( face[0] && !face[1] ) || ( !face[0] && face[1] )) {
+ MESSAGE("Correspondent face not found on side " << ( face[0] ? 1 : 0 ));
+ break; // do not return because it s necessary to remove tmp faces
+ }
+
+ // set nodes to merge
+ // -------------------
+
+ if ( face[0] && face[1] )
+ {
+ int nbNodes = face[0]->NbNodes();
+ if ( nbNodes != face[1]->NbNodes() ) {
+ MESSAGE("Diff nb of face nodes");
+ break; // do not return because it s necessary to remove tmp faces
+ }
+ bool reverse[] = { false, false }; // order of notLinkNodes of quadrangle
+ if ( nbNodes == 3 )
+ nReplaceMap.insert( TNodeNodeMap::value_type
+ ( notLinkNodes[0][0], notLinkNodes[1][0] ));
+ else {
+ for ( iSide = 0; iSide < 2; iSide++ ) { // loop on 2 sides
+ // analyse link orientation in faces
+ int i1 = iLinkNode[ iSide ][ 0 ];
+ int i2 = iLinkNode[ iSide ][ 1 ];
+ reverse[ iSide ] = Abs( i1 - i2 ) == 1 ? i1 > i2 : i2 > i1;
+ // if notLinkNodes are the first and the last ones, then
+ // their order does not correspond to the link orientation
+ if (( i1 == 1 && i2 == 2 ) ||
+ ( i1 == 2 && i2 == 1 ))
+ reverse[ iSide ] = !reverse[ iSide ];
+ }
+ if ( reverse[0] == reverse[1] ) {
+ nReplaceMap.insert( TNodeNodeMap::value_type
+ ( notLinkNodes[0][0], notLinkNodes[1][0] ));
+ nReplaceMap.insert( TNodeNodeMap::value_type
+ ( notLinkNodes[0][1], notLinkNodes[1][1] ));
+ }
+ else {
+ nReplaceMap.insert( TNodeNodeMap::value_type
+ ( notLinkNodes[0][0], notLinkNodes[1][1] ));
+ nReplaceMap.insert( TNodeNodeMap::value_type
+ ( notLinkNodes[0][1], notLinkNodes[1][0] ));
+ }
+ }
+
+ // add other links of the faces to linkList
+ // -----------------------------------------
+
+ const SMDS_MeshNode** nodes = faceNodes[ 0 ];
+ for ( iNode = 0; iNode < nbNodes; iNode++ )
+ {
+ linkID = aLinkID_Gen.GetLinkID( nodes[iNode], nodes[iNode+1] );
+ pair< set<long>::iterator, bool > iter_isnew = linkIdSet.insert( linkID );
+ if ( !iter_isnew.second ) { // already in a set: no need to process
+ linkIdSet.erase( iter_isnew.first );
+ }
+ else // new in set == encountered for the first time: add
+ {
+ const SMDS_MeshNode* n1 = nodes[ iNode ];
+ const SMDS_MeshNode* n2 = nodes[ iNode + 1];
+ linkList[0].push_back ( TPairOfNodes( n1, n2 ));
+ linkList[1].push_back ( TPairOfNodes( nReplaceMap[n1], nReplaceMap[n2] ));
+ }
+ }
+ } // 2 faces found
+ } // loop on link lists
+
+ bool Ok = ( linkIt[0] == linkList[0].end() ); // all links preocessed
+
+ // ====================================================================
+ // 3. Replace nodes in elements of the side 1 and remove replaced nodes
+ // ====================================================================
+
+ // delete temporary faces: they are in reverseElements of actual nodes
+ SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
+ while ( tmpFaceIt->more() )
+ aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
+
+ if ( !Ok || nReplaceMap.size() == 2 ) {
+ MESSAGE(( Ok ? "No similar faces found" : " " ));
+ return false;
+ }
+ list< int > nodeIDsToRemove/*, elemIDsToRemove*/;
+ // loop on nodes replacement map
+ TNodeNodeMap::iterator nReplaceMapIt = nReplaceMap.begin(), nnIt;
+ for ( ; nReplaceMapIt != nReplaceMap.end(); nReplaceMapIt++ )
+ if ( (*nReplaceMapIt).first != (*nReplaceMapIt).second )
+ {
+ const SMDS_MeshNode* nToRemove = (*nReplaceMapIt).first;
+ nodeIDsToRemove.push_back( nToRemove->GetID() );
+ // loop on elements sharing nToRemove
+ SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
+ while ( invElemIt->more() ) {
+ const SMDS_MeshElement* e = invElemIt->next();
+ // get a new suite of nodes: make replacement
+ int nbReplaced = 0, i = 0, nbNodes = e->NbNodes();
+ const SMDS_MeshNode* nodes[ 8 ];
+ SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+ while ( nIt->more() ) {
+ const SMDS_MeshNode* n =
+ static_cast<const SMDS_MeshNode*>( nIt->next() );
+ nnIt = nReplaceMap.find( n );
+ if ( nnIt != nReplaceMap.end() ) {
+ nbReplaced++;
+ n = (*nnIt).second;
+ }
+ nodes[ i++ ] = n;
+ }
+ // if ( nbReplaced == nbNodes && e->GetType() == SMDSAbs_Face )
+ // elemIDsToRemove.push_back( e->GetID() );
+ // else
+ if ( nbReplaced )
+ aMesh->ChangeElementNodes( e, nodes, nbNodes );
+ }
+ }
+
+ Remove( nodeIDsToRemove, true );
+
+ return true;
+}
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_MeshEditor.hxx
+// Created : Mon Apr 12 14:56:19 2004
+// Author : Edward AGAPOV (eap)
+// Module : SMESH
+
+
+#ifndef SMESH_MeshEditor_HeaderFile
+#define SMESH_MeshEditor_HeaderFile
+
+#include "SMESH_Mesh.hxx"
+#include "SMESH_Controls.hxx"
+
+#include <list>
+#include <map>
+
+class SMDS_MeshElement;
+class SMDS_MeshFace;
+class SMDS_MeshNode;
+class gp_Ax1;
+class gp_Vec;
+
+class SMESH_MeshEditor {
+ public:
+
+ SMESH_MeshEditor( SMESH_Mesh* theMesh );
+
+ bool Remove (const std::list< int >& theElemIDs, const bool isNodes);
+ // Remove a node or an element.
+ // Modify a compute state of sub-meshes which become empty
+
+ bool InverseDiag (const SMDS_MeshElement * theTria1,
+ const SMDS_MeshElement * theTria2 );
+ // Replace two neighbour triangles with ones built on the same 4 nodes
+ // but having other common link.
+ // Return False if args are improper
+
+ bool InverseDiag (const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2 );
+ // Replace two neighbour triangles sharing theNode1-theNode2 link
+ // with ones built on the same 4 nodes but having other common link.
+ // Return false if proper faces not found
+
+ bool DeleteDiag (const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2 );
+ // Replace two neighbour triangles sharing theNode1-theNode2 link
+ // with a quadrangle built on the same 4 nodes.
+ // Return false if proper faces not found
+
+ bool Reorient (const SMDS_MeshElement * theFace);
+ // Reverse the normal of theFace
+ // Return false if theFace is null
+
+
+ bool TriToQuad (std::set<const SMDS_MeshElement*> & theElems,
+ SMESH::Controls::NumericalFunctorPtr theCriterion,
+ const double theMaxAngle);
+ // Fuse neighbour triangles into quadrangles.
+ // theCriterion is used to choose a neighbour to fuse with.
+ // theMaxAngle is a max angle between element normals at which
+ // fusion is still performed; theMaxAngle is mesured in radians.
+
+ bool QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
+ SMESH::Controls::NumericalFunctorPtr theCriterion);
+ // Cut quadrangles into triangles.
+ // theCriterion is used to choose a diagonal to cut
+
+ bool QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
+ const bool the13Diag);
+ // Cut quadrangles into triangles
+
+
+ enum SmoothMethod { LAPLACIAN = 0, CENTROIDAL };
+
+ void Smooth (std::set<const SMDS_MeshElement*> & theElements,
+ std::set<const SMDS_MeshNode*> & theFixedNodes,
+ const SmoothMethod theSmoothMethod,
+ const int theNbIterations,
+ double theTgtAspectRatio = 1.0);
+ // Smooth theElements using theSmoothMethod during theNbIterations
+ // or until a worst element has aspect ratio <= theTgtAspectRatio.
+ // Aspect Ratio varies in range [1.0, inf].
+ // If theElements is empty, the whole mesh is smoothed.
+ // theFixedNodes contains additionally fixed nodes. Nodes built
+ // on edges and boundary nodes are always fixed.
+
+
+ void RotationSweep (std::set<const SMDS_MeshElement*> & theElements,
+ const gp_Ax1& theAxis,
+ const double theAngle,
+ const int theNbSteps,
+ const double theToler);
+ // Generate new elements by rotation of theElements around theAxis
+ // by theAngle by theNbSteps
+
+ void ExtrusionSweep (std::set<const SMDS_MeshElement*> & theElements,
+ const gp_Vec& theStep,
+ const int theNbSteps);
+ // Generate new elements by extrusion of theElements
+ // by theStep by theNbSteps
+
+
+ void Transform (std::set<const SMDS_MeshElement*> & theElements,
+ const gp_Trsf& theTrsf,
+ const bool theCopy);
+ // Move or copy theElements applying theTrsf to their nodes
+
+
+ typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
+
+ void FindCoincidentNodes (const double theTolerance,
+ TListOfListOfNodes & theGroupsOfNodes);
+ // Return list of group of nodes close to each other within theTolerance
+
+ void MergeNodes (TListOfListOfNodes & theNodeGroups);
+ // In each group, the cdr of nodes are substituted by the first one
+ // in all elements.
+
+ void MergeEqualElements();
+ // Remove all but one of elements built on the same nodes.
+ // Return nb of successfully merged groups.
+
+ bool SewFreeBorder (const SMDS_MeshNode* theBorderFirstNode,
+ const SMDS_MeshNode* theBorderSecondNode,
+ const SMDS_MeshNode* theBorderLastNode,
+ const SMDS_MeshNode* theSide2FirstNode,
+ const SMDS_MeshNode* theSide2SecondNode,
+ const SMDS_MeshNode* theSide2ThirdNode = 0,
+ bool theSide2IsFreeBorder = true);
+ // Sew the free border to the side2 by replacing nodes in
+ // elements on the free border with nodes of the elements
+ // of the side 2. If nb of links in the free border and
+ // between theSide2FirstNode and theSide2LastNode are different,
+ // additional nodes are inserted on a link provided that no
+ // volume elements share the splitted link.
+ // The side 2 is a free border if theSide2IsFreeBorder == true.
+ // Sewing is peformed between the given first, second and last
+ // nodes on the sides.
+ // theBorderFirstNode is merged with theSide2FirstNode.
+ // if (!theSide2IsFreeBorder) then theSide2SecondNode gives
+ // the last node on the side 2, which will be merged with
+ // theBorderLastNode.
+ // if (theSide2IsFreeBorder) then theSide2SecondNode will
+ // be merged with theBorderSecondNode.
+ // if (theSide2IsFreeBorder && theSide2ThirdNode == 0) then
+ // the 2 free borders are sewn link by link and no additional
+ // nodes are inserted.
+ // Return false, if sewing failed.
+
+ bool SewSideElements (std::set<const SMDS_MeshElement*>& theSide1,
+ std::set<const SMDS_MeshElement*>& theSide2,
+ const SMDS_MeshNode* theFirstNode1ToMerge,
+ const SMDS_MeshNode* theFirstNode2ToMerge,
+ const SMDS_MeshNode* theSecondNode1ToMerge,
+ const SMDS_MeshNode* theSecondNode2ToMerge);
+ // Sew two sides of a mesh. Nodes belonging to theSide1 are
+ // merged with nodes of elements of theSide2.
+ // Number of elements in theSide1 and in theSide2 must be
+ // equal and they should have similar node connectivity.
+ // The nodes to merge should belong to side s borders and
+ // the first node should be linked to the second.
+
+ void InsertNodesIntoLink(const SMDS_MeshElement* theFace,
+ const SMDS_MeshNode* theBetweenNode1,
+ const SMDS_MeshNode* theBetweenNode2,
+ std::list<const SMDS_MeshNode*>& theNodesToInsert);
+ // insert theNodesToInsert into theFace between theBetweenNode1
+ // and theBetweenNode2 and split theElement.
+
+ static int SortQuadNodes (const SMDS_Mesh * theMesh,
+ int theNodeIds[] );
+ // Set 4 nodes of a quadrangle face in a good order.
+ // Swap 1<->2 or 2<->3 nodes and correspondingly return
+ // 1 or 2 else 0.
+
+ static bool SortHexaNodes (const SMDS_Mesh * theMesh,
+ int theNodeIds[] );
+ // Set 8 nodes of a hexahedron in a good order.
+ // Return success status
+
+
+ int FindShape (const SMDS_MeshElement * theElem);
+ // Return an index of the shape theElem is on
+ // or zero if a shape not found
+
+
+ SMESH_Mesh * GetMesh() { return myMesh; }
+
+ SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
+
+
+ private:
+
+ SMESH_Mesh * myMesh;
+
+};
+
+#endif
--- /dev/null
+// File : SMESH_Pattern.cxx
+// Created : Thu Aug 5 11:09:29 2004
+// Author : Edward AGAPOV (eap)
+// Copyright : Open CASCADE
+
+
+#include "SMESH_Pattern.hxx"
+
+#include <Bnd_Box2d.hxx>
+#include <BRepTools.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <BRep_Tool.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <IntAna2d_AnaIntersection.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopExp.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <gp_Lin2d.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_XY.hxx>
+#include <gp_XYZ.hxx>
+#include <math_FunctionSetRoot.hxx>
+#include <math_FunctionSetWithDerivatives.hxx>
+#include <math_Matrix.hxx>
+#include <math_Vector.hxx>
+#include <Extrema_GenExtPS.hxx>
+#include <Extrema_POnSurf.hxx>
+#include <GeomAdaptor_Surface.hxx>
+
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMESHDS_Mesh.hxx"
+#include "SMESHDS_SubMesh.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "utilities.h"
+
+using namespace std;
+
+typedef map< const SMDS_MeshElement*, int > TNodePointIDMap;
+
+#define SQRT_FUNC 1
+
+//=======================================================================
+//function : SMESH_Pattern
+//purpose :
+//=======================================================================
+
+SMESH_Pattern::SMESH_Pattern ()
+{
+}
+//=======================================================================
+//function : getInt
+//purpose :
+//=======================================================================
+
+static inline int getInt( const char * theSring )
+{
+ if ( *theSring < '0' || *theSring > '9' )
+ return -1;
+
+ char *ptr;
+ int val = strtol( theSring, &ptr, 10 );
+ if ( ptr == theSring ||
+ // there must not be neither '.' nor ',' nor 'E' ...
+ (*ptr != ' ' && *ptr != '\n' && *ptr != '\0'))
+ return -1;
+
+ return val;
+}
+
+//=======================================================================
+//function : getDouble
+//purpose :
+//=======================================================================
+
+static inline double getDouble( const char * theSring )
+{
+ char *ptr;
+ return strtod( theSring, &ptr );
+}
+
+//=======================================================================
+//function : readLine
+//purpose : Put token starting positions in theFields until '\n' or '\0'
+// Return the number of the found tokens
+//=======================================================================
+
+static int readLine (list <const char*> & theFields,
+ const char* & theLineBeg,
+ const bool theClearFields )
+{
+ if ( theClearFields )
+ theFields.clear();
+
+ // algo:
+ /* loop */
+ /* switch ( symbol ) { */
+ /* case white-space: */
+ /* look for a non-space symbol; */
+ /* case string-end: */
+ /* case line-end: */
+ /* exit; */
+ /* case comment beginning: */
+ /* skip all till a line-end; */
+ /* case a number */
+ /* put its position in theFields, skip till a white-space;*/
+ /* default: */
+ /* abort; */
+ /* till line-end */
+
+ int nbRead = 0;
+ bool stopReading = false;
+ do {
+ bool goOn = true;
+ bool isNumber = false;
+ switch ( *theLineBeg )
+ {
+ case ' ': // white space
+ case '\t': // tab
+ case 13: // ^M
+ break;
+
+ case '\n': // a line ends
+ stopReading = ( nbRead > 0 );
+ break;
+
+ case '!': // comment
+ do theLineBeg++;
+ while ( *theLineBeg != '\n' && *theLineBeg != '\0' );
+ goOn = false;
+ break;
+
+ case '\0': // file ends
+ return nbRead;
+
+ case '-': // real number
+ case '+':
+ case '.':
+ isNumber = true;
+ default: // data
+ isNumber = isNumber || ( *theLineBeg >= '0' && *theLineBeg <= '9' );
+ if ( isNumber ) {
+ theFields.push_back( theLineBeg );
+ nbRead++;
+ do theLineBeg++;
+ while (*theLineBeg != ' ' &&
+ *theLineBeg != '\n' &&
+ *theLineBeg != '\0');
+ goOn = false;
+ }
+ else
+ return 0; // incorrect file format
+ }
+
+ if ( goOn )
+ theLineBeg++;
+
+ } while ( !stopReading );
+
+ return nbRead;
+}
+
+//=======================================================================
+//function : Load
+//purpose : Load a pattern from <theFile>
+//=======================================================================
+
+bool SMESH_Pattern::Load (const char* theFileContents)
+{
+ MESSAGE("Load( file ) ");
+
+ // file structure:
+
+ // ! This is a comment
+ // NB_POINTS ! 1 integer - the number of points in the pattern.
+ // X1 Y1 [Z1] ! 2 or 3 reals - nodes coordinates within 2D or 3D domain:
+ // X2 Y2 [Z2] ! the pattern dimention is defined by the number of coordinates
+ // ...
+ // [ ID1 ID2 ... IDn ] ! Indices of key-points for a 2D pattern (only).
+ // ! elements description goes after all
+ // ID1 ID2 ... IDn ! 2-4 or 4-8 integers - nodal connectivity of a 2D or 3D element.
+ // ...
+
+ Clear();
+
+ const char* lineBeg = theFileContents;
+ list <const char*> fields;
+ const bool clearFields = true;
+
+ // NB_POINTS ! 1 integer - the number of points in the pattern.
+
+ if ( readLine( fields, lineBeg, clearFields ) != 1 ) {
+ MESSAGE("Error reading NB_POINTS");
+ return setErrorCode( ERR_READ_NB_POINTS );
+ }
+ int nbPoints = getInt( fields.front() );
+
+ // X1 Y1 [Z1] ! 2 or 3 reals - nodes coordinates within 2D or 3D domain:
+
+ // read the first point coordinates to define pattern dimention
+ int dim = readLine( fields, lineBeg, clearFields );
+ if ( dim == 2 )
+ myIs2D = true;
+ else if ( dim == 3 )
+ myIs2D = false;
+ else {
+ MESSAGE("Error reading points: wrong nb of coordinates");
+ return setErrorCode( ERR_READ_POINT_COORDS );
+ }
+ if ( nbPoints <= dim ) {
+ MESSAGE(" Too few points ");
+ return setErrorCode( ERR_READ_TOO_FEW_POINTS );
+ }
+
+ // read the rest points
+ int iPoint;
+ for ( iPoint = 1; iPoint < nbPoints; iPoint++ )
+ if ( readLine( fields, lineBeg, !clearFields ) != dim ) {
+ MESSAGE("Error reading points : wrong nb of coordinates ");
+ return setErrorCode( ERR_READ_POINT_COORDS );
+ }
+ // store point coordinates
+ myPoints.resize( nbPoints );
+ list <const char*>::iterator fIt = fields.begin();
+ for ( iPoint = 0; iPoint < nbPoints; iPoint++ )
+ {
+ TPoint & p = myPoints[ iPoint ];
+ for ( int iCoord = 1; iCoord <= dim; iCoord++, fIt++ )
+ {
+ double coord = getDouble( *fIt );
+ if ( !myIs2D && ( coord < 0.0 || coord > 1.0 )) {
+ MESSAGE("Error reading 3D points, value should be in [0,1]: " << coord);
+ Clear();
+ return setErrorCode( ERR_READ_3D_COORD );
+ }
+ p.myInitXYZ.SetCoord( iCoord, coord );
+ if ( myIs2D )
+ p.myInitUV.SetCoord( iCoord, coord );
+ }
+ }
+
+ // [ ID1 ID2 ... IDn ] ! Indices of key-points for a 2D pattern (only).
+ if ( myIs2D )
+ {
+ if ( readLine( fields, lineBeg, clearFields ) == 0 ) {
+ MESSAGE("Error: missing key-points");
+ Clear();
+ return setErrorCode( ERR_READ_NO_KEYPOINT );
+ }
+ set<int> idSet;
+ for ( fIt = fields.begin(); fIt != fields.end(); fIt++ )
+ {
+ int pointIndex = getInt( *fIt );
+ if ( pointIndex >= nbPoints || pointIndex < 0 ) {
+ MESSAGE("Error: invalid point index " << pointIndex );
+ Clear();
+ return setErrorCode( ERR_READ_BAD_INDEX );
+ }
+ if ( idSet.insert( pointIndex ).second ) // unique?
+ myKeyPointIDs.push_back( pointIndex );
+ }
+ }
+
+ // ID1 ID2 ... IDn ! 2-4 or 4-8 integers - nodal connectivity of a 2D or 3D element.
+
+ while ( readLine( fields, lineBeg, clearFields ))
+ {
+ myElemPointIDs.push_back( list< int >() );
+ list< int >& elemPoints = myElemPointIDs.back();
+ for ( fIt = fields.begin(); fIt != fields.end(); fIt++ )
+ {
+ int pointIndex = getInt( *fIt );
+ if ( pointIndex >= nbPoints || pointIndex < 0 ) {
+ MESSAGE("Error: invalid point index " << pointIndex );
+ Clear();
+ return setErrorCode( ERR_READ_BAD_INDEX );
+ }
+ elemPoints.push_back( pointIndex );
+ }
+ // check the nb of nodes in element
+ bool Ok = true;
+ switch ( elemPoints.size() ) {
+ case 3: if ( !myIs2D ) Ok = false; break;
+ case 4: break;
+ case 5:
+ case 6:
+ case 8: if ( myIs2D ) Ok = false; break;
+ default: Ok = false;
+ }
+ if ( !Ok ) {
+ MESSAGE("Error: wrong nb of nodes in element " << elemPoints.size() );
+ Clear();
+ return setErrorCode( ERR_READ_ELEM_POINTS );
+ }
+ }
+ if ( myElemPointIDs.empty() ) {
+ MESSAGE("Error: no elements");
+ Clear();
+ return setErrorCode( ERR_READ_NO_ELEMS );
+ }
+
+ findBoundaryPoints(); // sort key-points
+
+ return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : Save
+//purpose : Save the loaded pattern into the file <theFileName>
+//=======================================================================
+
+bool SMESH_Pattern::Save (ostream& theFile)
+{
+ MESSAGE(" ::Save(file) " );
+ if ( !IsLoaded() ) {
+ MESSAGE(" Pattern not loaded ");
+ return setErrorCode( ERR_SAVE_NOT_LOADED );
+ }
+
+ theFile << "!!! SALOME Mesh Pattern file" << endl;
+ theFile << "!!!" << endl;
+ theFile << "!!! Nb of points:" << endl;
+ theFile << myPoints.size() << endl;
+
+ // point coordinates
+ const int width = 8;
+// theFile.width( 8 );
+// theFile.setf(ios::fixed);// use 123.45 floating notation
+// theFile.setf(ios::right);
+// theFile.flags( theFile.flags() & ~ios::showpoint); // do not show trailing zeros
+// theFile.setf(ios::showpoint); // do not show trailing zeros
+ vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+ for ( int i = 0; pVecIt != myPoints.end(); pVecIt++, i++ ) {
+ const gp_XYZ & xyz = (*pVecIt).myInitXYZ;
+ theFile << " " << setw( width ) << xyz.X() << " " << setw( width ) << xyz.Y();
+ if ( !myIs2D ) theFile << " " << setw( width ) << xyz.Z();
+ theFile << " !- " << i << endl; // point id to ease reading by a human being
+ }
+ // key-points
+ if ( myIs2D ) {
+ theFile << "!!! Indices of " << myKeyPointIDs.size() << " key-points:" << endl;
+ list< int >::const_iterator kpIt = myKeyPointIDs.begin();
+ for ( ; kpIt != myKeyPointIDs.end(); kpIt++ )
+ theFile << " " << *kpIt;
+ if ( !myKeyPointIDs.empty() )
+ theFile << endl;
+ }
+ // elements
+ theFile << "!!! Indices of points of " << myElemPointIDs.size() << " elements:" << endl;
+ list<list< int > >::const_iterator epIt = myElemPointIDs.begin();
+ for ( ; epIt != myElemPointIDs.end(); epIt++ )
+ {
+ const list< int > & elemPoints = *epIt;
+ list< int >::const_iterator iIt = elemPoints.begin();
+ for ( ; iIt != elemPoints.end(); iIt++ )
+ theFile << " " << *iIt;
+ theFile << endl;
+ }
+
+ theFile << endl;
+
+ return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : sortBySize
+//purpose : sort theListOfList by size
+//=======================================================================
+
+template<typename T> struct TSizeCmp {
+ bool operator ()( const list < T > & l1, const list < T > & l2 )
+ const { return l1.size() < l2.size(); }
+};
+
+template<typename T> void sortBySize( list< list < T > > & theListOfList )
+{
+ if ( theListOfList.size() > 2 ) {
+ // keep the car
+ list < T > & aFront = theListOfList.front();
+ // sort the whole list
+ TSizeCmp< T > SizeCmp;
+ theListOfList.sort( SizeCmp );
+ }
+}
+
+//=======================================================================
+//function : getOrderedEdges
+//purpose : return nb wires and a list of oredered edges
+//=======================================================================
+
+static int getOrderedEdges (const TopoDS_Face& theFace,
+ const TopoDS_Vertex& theFirstVertex,
+ list< TopoDS_Edge >& theEdges,
+ list< int > & theNbVertexInWires)
+{
+ // put wires in a list, so that an outer wire comes first
+ list<TopoDS_Wire> aWireList;
+ TopoDS_Wire anOuterWire = BRepTools::OuterWire( theFace );
+ aWireList.push_back( anOuterWire );
+ for ( TopoDS_Iterator wIt (theFace); wIt.More(); wIt.Next() )
+ if ( !anOuterWire.IsSame( wIt.Value() ))
+ aWireList.push_back( TopoDS::Wire( wIt.Value() ));
+
+ // loop on edges of wires
+ theNbVertexInWires.clear();
+ list<TopoDS_Wire>::iterator wlIt = aWireList.begin();
+ for ( ; wlIt != aWireList.end(); wlIt++ )
+ {
+ int iE;
+ BRepTools_WireExplorer wExp( *wlIt, theFace );
+ for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
+ {
+ TopoDS_Edge edge = wExp.Current();
+ edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
+ theEdges.push_back( edge );
+ }
+ theNbVertexInWires.push_back( iE );
+ iE = 0;
+ if ( wlIt == aWireList.begin() && theEdges.size() > 1 ) { // the outer wire
+ // orient closed edges
+ list< TopoDS_Edge >::iterator eIt, eIt2;
+ for ( eIt = theEdges.begin(); eIt != theEdges.end(); eIt++ )
+ {
+ TopoDS_Edge& edge = *eIt;
+ if ( TopExp::FirstVertex( edge ).IsSame( TopExp::LastVertex( edge ) ))
+ {
+ eIt2 = eIt;
+ bool isNext = ( eIt2 == theEdges.begin() );
+ TopoDS_Edge edge2 = isNext ? *(++eIt2) : *(--eIt2);
+ double f1,l1,f2,l2;
+ Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface( edge, theFace, f1,l1 );
+ Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface( edge2, theFace, f2,l2 );
+ gp_Pnt2d pf = c1->Value( edge.Orientation() == TopAbs_FORWARD ? f1 : l1 );
+ gp_Pnt2d pl = c1->Value( edge.Orientation() == TopAbs_FORWARD ? l1 : f1 );
+ bool isFirst = ( edge2.Orientation() == TopAbs_FORWARD ? isNext : !isNext );
+ gp_Pnt2d p2 = c2->Value( isFirst ? f2 : l2 );
+ isFirst = ( p2.SquareDistance( pf ) < p2.SquareDistance( pl ));
+ if ( isNext ? isFirst : !isFirst )
+ edge.Reverse();
+ }
+ }
+ // rotate theEdges until it begins from theFirstVertex
+ if ( ! theFirstVertex.IsNull() )
+ while ( !theFirstVertex.IsSame( TopExp::FirstVertex( theEdges.front(), true )))
+ {
+ theEdges.splice(theEdges.end(), theEdges,
+ theEdges.begin(), ++ theEdges.begin());
+ if ( iE++ > theNbVertexInWires.back() )
+ break; // break infinite loop
+ }
+ }
+ }
+
+ return aWireList.size();
+}
+
+//=======================================================================
+//function : project
+//purpose :
+//=======================================================================
+
+static gp_XY project (const SMDS_MeshNode* theNode,
+ Extrema_GenExtPS & theProjectorPS)
+{
+ gp_Pnt P( theNode->X(), theNode->Y(), theNode->Z() );
+ theProjectorPS.Perform( P );
+ if ( !theProjectorPS.IsDone() ) {
+ MESSAGE( "SMESH_Pattern: point projection FAILED");
+ return gp_XY(0.,0.);
+ }
+ double u, v, minVal = DBL_MAX;
+ for ( int i = theProjectorPS.NbExt(); i > 0; i-- )
+ if ( theProjectorPS.Value( i ) < minVal ) {
+ minVal = theProjectorPS.Value( i );
+ theProjectorPS.Point( i ).Parameter( u, v );
+ }
+ return gp_XY( u, v );
+}
+
+//=======================================================================
+//function : isMeshBoundToShape
+//purpose : return true if all 2d elements are bound to shape
+//=======================================================================
+
+static bool isMeshBoundToShape(SMESH_Mesh* theMesh)
+{
+ // check faces binding
+ SMESHDS_Mesh * aMeshDS = theMesh->GetMeshDS();
+ SMESHDS_SubMesh * aMainSubMesh = aMeshDS->MeshElements( aMeshDS->ShapeToMesh() );
+ if ( aMeshDS->NbFaces() != aMainSubMesh->NbElements() )
+ return false;
+
+ // check face nodes binding
+ SMDS_FaceIteratorPtr fIt = aMeshDS->facesIterator();
+ while ( fIt->more() )
+ {
+ SMDS_ElemIteratorPtr nIt = fIt->next()->nodesIterator();
+ while ( nIt->more() )
+ {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ SMDS_PositionPtr pos = node->GetPosition();
+ if ( !pos || !pos->GetShapeId() )
+ return false;
+ }
+ }
+ return true;
+}
+
+//=======================================================================
+//function : Load
+//purpose : Create a pattern from the mesh built on <theFace>.
+// <theProject>==true makes override nodes positions
+// on <theFace> computed by mesher
+//=======================================================================
+
+bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
+ const TopoDS_Face& theFace,
+ bool theProject)
+{
+ MESSAGE(" ::Load(face) " );
+ Clear();
+ myIs2D = true;
+
+ SMESHDS_Mesh * aMeshDS = theMesh->GetMeshDS();
+ SMESHDS_SubMesh * fSubMesh = aMeshDS->MeshElements( theFace );
+
+ int nbNodes = ( !fSubMesh ? 0 : fSubMesh->NbNodes() );
+ int nbElems = ( !fSubMesh ? 0 : fSubMesh->NbElements() );
+ if ( nbElems == 0 && aMeshDS->NbFaces() == 0 )
+ {
+ MESSAGE( "No elements bound to the face");
+ return setErrorCode( ERR_LOAD_EMPTY_SUBMESH );
+ }
+
+ // check that face is not closed
+ TopoDS_Vertex bidon;
+ list<TopoDS_Edge> eList;
+ getOrderedEdges( theFace, bidon, eList, myNbKeyPntInBoundary );
+ list<TopoDS_Edge>::iterator elIt = eList.begin();
+ for ( ; elIt != eList.end() ; elIt++ )
+ if ( BRep_Tool::IsClosed( *elIt , theFace ))
+ return setErrorCode( ERR_LOADF_CLOSED_FACE );
+
+
+ Extrema_GenExtPS projector;
+ GeomAdaptor_Surface aSurface( BRep_Tool::Surface( theFace ));
+ if ( theProject || nbElems == 0 )
+ projector.Initialize( aSurface, 20,20, 1e-5,1e-5 );
+
+ int iPoint = 0;
+ TNodePointIDMap nodePointIDMap;
+
+ if ( nbElems == 0 || (theProject &&
+ theMesh->IsMainShape( theFace ) &&
+ !isMeshBoundToShape( theMesh )))
+ {
+ MESSAGE("Project the whole mesh");
+ // ---------------------------------------------------------------
+ // The case where the whole mesh is projected to theFace
+ // ---------------------------------------------------------------
+
+ // put nodes of all faces in the nodePointIDMap and fill myElemPointIDs
+ SMDS_FaceIteratorPtr fIt = aMeshDS->facesIterator();
+ while ( fIt->more() )
+ {
+ myElemPointIDs.push_back( list< int >() );
+ list< int >& elemPoints = myElemPointIDs.back();
+ SMDS_ElemIteratorPtr nIt = fIt->next()->nodesIterator();
+ while ( nIt->more() )
+ {
+ const SMDS_MeshElement* node = nIt->next();
+ TNodePointIDMap::iterator nIdIt = nodePointIDMap.find( node );
+ if ( nIdIt == nodePointIDMap.end() )
+ {
+ elemPoints.push_back( iPoint );
+ nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint++ ));
+ }
+ else
+ elemPoints.push_back( (*nIdIt).second );
+ }
+ }
+ myPoints.resize( iPoint );
+
+ // project all nodes of 2d elements to theFace
+ TNodePointIDMap::iterator nIdIt = nodePointIDMap.begin();
+ for ( ; nIdIt != nodePointIDMap.end(); nIdIt++ )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( (*nIdIt).first );
+ TPoint * p = & myPoints[ (*nIdIt).second ];
+ p->myInitUV = project( node, projector );
+ p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
+ }
+ // find key-points: the points most close to UV of vertices
+ TopExp_Explorer vExp( theFace, TopAbs_VERTEX );
+ set<int> foundIndices;
+ for ( ; vExp.More(); vExp.Next() ) {
+ const TopoDS_Vertex v = TopoDS::Vertex( vExp.Current() );
+ gp_Pnt2d uv = BRep_Tool::Parameters( v, theFace );
+ double minDist = DBL_MAX;
+ int index;
+ vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+ for ( iPoint = 0; pVecIt != myPoints.end(); pVecIt++, iPoint++ ) {
+ double dist = uv.SquareDistance( (*pVecIt).myInitUV );
+ if ( dist < minDist ) {
+ minDist = dist;
+ index = iPoint;
+ }
+ }
+ if ( foundIndices.insert( index ).second ) // unique?
+ myKeyPointIDs.push_back( index );
+ }
+ myIsBoundaryPointsFound = false;
+
+ }
+ else
+ {
+ // ---------------------------------------------------------------------
+ // The case where a pattern is being made from the mesh built by mesher
+ // ---------------------------------------------------------------------
+
+ // Load shapes in the consequent order and count nb of points
+
+ // vertices
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ ) {
+ myShapeIDMap.Add( TopExp::FirstVertex( *elIt, true ));
+ SMESHDS_SubMesh * eSubMesh = aMeshDS->MeshElements( *elIt );
+ if ( eSubMesh )
+ nbNodes += eSubMesh->NbNodes() + 1;
+ }
+ // edges
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ myShapeIDMap.Add( *elIt );
+ // the face
+ myShapeIDMap.Add( theFace );
+
+ myPoints.resize( nbNodes );
+
+ // Load U of points on edges
+
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ {
+ TopoDS_Edge & edge = *elIt;
+ list< TPoint* > & ePoints = getShapePoints( edge );
+ double f, l;
+ Handle(Geom2d_Curve) C2d;
+ if ( !theProject )
+ C2d = BRep_Tool::CurveOnSurface( edge, theFace, f, l );
+ bool isForward = ( edge.Orientation() == TopAbs_FORWARD );
+
+ // the forward key-point
+ TopoDS_Shape v = TopExp::FirstVertex( edge, true );
+ list< TPoint* > & vPoint = getShapePoints( v );
+ if ( vPoint.empty() )
+ {
+ SMESHDS_SubMesh * vSubMesh = aMeshDS->MeshElements( v );
+ if ( vSubMesh && vSubMesh->NbNodes() ) {
+ myKeyPointIDs.push_back( iPoint );
+ SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
+ const SMDS_MeshNode* node = nIt->next();
+ nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+
+ TPoint* keyPoint = &myPoints[ iPoint++ ];
+ vPoint.push_back( keyPoint );
+ if ( theProject )
+ keyPoint->myInitUV = project( node, projector );
+ else
+ keyPoint->myInitUV = C2d->Value( isForward ? f : l ).XY();
+ keyPoint->myInitXYZ.SetCoord (keyPoint->myInitUV.X(), keyPoint->myInitUV.Y(), 0);
+ }
+ }
+ if ( !vPoint.empty() )
+ ePoints.push_back( vPoint.front() );
+
+ // on-edge points
+ SMESHDS_SubMesh * eSubMesh = aMeshDS->MeshElements( edge );
+ if ( eSubMesh && eSubMesh->NbNodes() )
+ {
+ // loop on nodes of an edge: sort them by param on edge
+ typedef map < double, const SMDS_MeshNode* > TParamNodeMap;
+ TParamNodeMap paramNodeMap;
+ SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
+ while ( nIt->more() )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( nIt->next() );
+ const SMDS_EdgePosition* epos =
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ double u = epos->GetUParameter();
+ paramNodeMap.insert( TParamNodeMap::value_type( u, node ));
+ }
+ // put U in [0,1] so that the first key-point has U==0
+ double du = l - f;
+ TParamNodeMap::iterator unIt = paramNodeMap.begin();
+ TParamNodeMap::reverse_iterator unRIt = paramNodeMap.rbegin();
+ while ( unIt != paramNodeMap.end() )
+ {
+ TPoint* p = & myPoints[ iPoint ];
+ ePoints.push_back( p );
+ const SMDS_MeshNode* node = isForward ? (*unIt).second : (*unRIt).second;
+ nodePointIDMap.insert ( TNodePointIDMap::value_type( node, iPoint ));
+
+ if ( theProject )
+ p->myInitUV = project( node, projector );
+ else {
+ double u = isForward ? (*unIt).first : (*unRIt).first;
+ p->myInitU = isForward ? (( u - f ) / du ) : ( 1.0 - ( u - f ) / du );
+ p->myInitUV = C2d->Value( u ).XY();
+ }
+ p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
+ unIt++; unRIt++;
+ iPoint++;
+ }
+ }
+ // the reverse key-point
+ v = TopExp::LastVertex( edge, true ).Reversed();
+ list< TPoint* > & vPoint2 = getShapePoints( v );
+ if ( vPoint2.empty() )
+ {
+ SMESHDS_SubMesh * vSubMesh = aMeshDS->MeshElements( v );
+ if ( vSubMesh && vSubMesh->NbNodes() ) {
+ myKeyPointIDs.push_back( iPoint );
+ SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
+ const SMDS_MeshNode* node = nIt->next();
+ nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+
+ TPoint* keyPoint = &myPoints[ iPoint++ ];
+ vPoint2.push_back( keyPoint );
+ if ( theProject )
+ keyPoint->myInitUV = project( node, projector );
+ else
+ keyPoint->myInitUV = C2d->Value( isForward ? l : f ).XY();
+ keyPoint->myInitXYZ.SetCoord( keyPoint->myInitUV.X(), keyPoint->myInitUV.Y(), 0 );
+ }
+ }
+ if ( !vPoint2.empty() )
+ ePoints.push_back( vPoint2.front() );
+
+ // compute U of edge-points
+ if ( theProject )
+ {
+ double totalDist = 0;
+ list< TPoint* >::iterator pIt = ePoints.begin();
+ TPoint* prevP = *pIt;
+ prevP->myInitU = totalDist;
+ for ( pIt++; pIt != ePoints.end(); pIt++ ) {
+ TPoint* p = *pIt;
+ totalDist += ( p->myInitUV - prevP->myInitUV ).SquareModulus();
+ p->myInitU = totalDist;
+ prevP = p;
+ }
+ if ( totalDist > DBL_MIN)
+ for ( pIt = ePoints.begin(); pIt != ePoints.end(); pIt++ ) {
+ TPoint* p = *pIt;
+ p->myInitU /= totalDist;
+ }
+ }
+ } // loop on edges of a wire
+
+ // Load in-face points and elements
+
+ if ( fSubMesh && fSubMesh->NbElements() )
+ {
+ list< TPoint* > & fPoints = getShapePoints( theFace );
+ SMDS_NodeIteratorPtr nIt = fSubMesh->GetNodes();
+ while ( nIt->more() )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( nIt->next() );
+ nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+ TPoint* p = &myPoints[ iPoint++ ];
+ fPoints.push_back( p );
+ if ( theProject )
+ p->myInitUV = project( node, projector );
+ else {
+ const SMDS_FacePosition* pos =
+ static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+ p->myInitUV.SetCoord( pos->GetUParameter(), pos->GetVParameter() );
+ }
+ p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
+ }
+ // load elements
+ SMDS_ElemIteratorPtr elemIt = fSubMesh->GetElements();
+ while ( elemIt->more() ) {
+ SMDS_ElemIteratorPtr nIt = elemIt->next()->nodesIterator();
+ myElemPointIDs.push_back( list< int >() );
+ list< int >& elemPoints = myElemPointIDs.back();
+ while ( nIt->more() )
+ elemPoints.push_back( nodePointIDMap[ nIt->next() ]);
+ }
+ }
+
+ myIsBoundaryPointsFound = true;
+ }
+
+ // Assure that U range is proportional to V range
+
+ Bnd_Box2d bndBox;
+ vector< TPoint >::iterator pVecIt = myPoints.begin();
+ for ( ; pVecIt != myPoints.end(); pVecIt++ )
+ bndBox.Add( gp_Pnt2d( (*pVecIt).myInitUV ));
+ double minU, minV, maxU, maxV;
+ bndBox.Get( minU, minV, maxU, maxV );
+ double dU = maxU - minU, dV = maxV - minV;
+ if ( dU <= DBL_MIN || dV <= DBL_MIN ) {
+ Clear();
+ return setErrorCode( ERR_LOADF_NARROW_FACE );
+ }
+ double ratio = dU / dV, maxratio = 3, scale;
+ int iCoord = 0;
+ if ( ratio > maxratio ) {
+ scale = ratio / maxratio;
+ iCoord = 2;
+ }
+ else if ( ratio < 1./maxratio ) {
+ scale = maxratio / ratio;
+ iCoord = 1;
+ }
+ if ( iCoord ) {
+ SCRUTE( scale );
+ for ( pVecIt = myPoints.begin(); pVecIt != myPoints.end(); pVecIt++ ) {
+ TPoint & p = *pVecIt;
+ p.myInitUV.SetCoord( iCoord, p.myInitUV.Coord( iCoord ) * scale );
+ p.myInitXYZ.SetCoord( p.myInitUV.X(), p.myInitUV.Y(), 0 );
+ }
+ }
+ if ( myElemPointIDs.empty() ) {
+ MESSAGE( "No elements bound to the face");
+ return setErrorCode( ERR_LOAD_EMPTY_SUBMESH );
+ }
+
+ return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : computeUVOnEdge
+//purpose : compute coordinates of points on theEdge
+//=======================================================================
+
+void SMESH_Pattern::computeUVOnEdge (const TopoDS_Edge& theEdge,
+ const list< TPoint* > & ePoints )
+{
+ bool isForward = ( theEdge.Orientation() == TopAbs_FORWARD );
+ double f, l;
+ Handle(Geom2d_Curve) C2d =
+ BRep_Tool::CurveOnSurface( theEdge, TopoDS::Face( myShape ), f, l );
+
+ ePoints.back()->myInitU = 1.0;
+ list< TPoint* >::const_iterator pIt = ePoints.begin();
+ for ( pIt++; pIt != ePoints.end(); pIt++ )
+ {
+ TPoint* point = *pIt;
+ // U
+ double du = ( isForward ? point->myInitU : 1 - point->myInitU );
+ point->myU = ( f * ( 1 - du ) + l * du );
+ // UV
+ point->myUV = C2d->Value( point->myU ).XY();
+ }
+}
+
+//=======================================================================
+//function : intersectIsolines
+//purpose :
+//=======================================================================
+
+static bool intersectIsolines(const gp_XY& uv11, const gp_XY& uv12, const double r1,
+ const gp_XY& uv21, const gp_XY& uv22, const double r2,
+ gp_XY& resUV)
+{
+ gp_XY loc1 = uv11 * ( 1 - r1 ) + uv12 * r1;
+ gp_XY loc2 = uv21 * ( 1 - r2 ) + uv22 * r2;
+// resUV = 0.5 * ( loc1 + loc2 );
+ double len1 = ( uv11 - uv12 ).SquareModulus();
+ double len2 = ( uv21 - uv22 ).SquareModulus();
+ resUV = loc1 * len2 / ( len1 + len2 ) + loc2 * len1 / ( len1 + len2 );
+// return true;
+
+
+// gp_Lin2d line1( uv11, uv12 - uv11 );
+// gp_Lin2d line2( uv21, uv22 - uv21 );
+// double angle = Abs( line1.Angle( line2 ) );
+
+// IntAna2d_AnaIntersection inter;
+// inter.Perform( line1.Normal( loc1 ), line2.Normal( loc2 ) );
+// if ( inter.IsDone() && inter.NbPoints() == 1 )
+// {
+// gp_Pnt2d interUV = inter.Point(1).Value();
+// resUV += interUV.XY();
+// inter.Perform( line1, line2 );
+// interUV = inter.Point(1).Value();
+// resUV += interUV.XY();
+
+// resUV /= 2.;
+// }
+ return true;
+}
+
+//=======================================================================
+//function : compUVByIsoIntersection
+//purpose :
+//=======================================================================
+
+bool SMESH_Pattern::compUVByIsoIntersection (const list< list< TPoint* > >& theBndPoints,
+ const gp_XY& theInitUV,
+ gp_XY& theUV )
+{
+ // compute UV by intersection of 2 iso lines
+ //gp_Lin2d isoLine[2];
+ gp_XY uv1[2], uv2[2];
+ double ratio[2];
+ const double zero = DBL_MIN;
+ for ( int iIso = 0; iIso < 2; iIso++ )
+ {
+ // to build an iso line:
+ // find 2 pairs of consequent edge-points such that the range of their
+ // initial parameters encloses the in-face point initial parameter
+ gp_XY UV[2], initUV[2];
+ int nbUV = 0, iCoord = iIso + 1;
+ double initParam = theInitUV.Coord( iCoord );
+
+ list< list< TPoint* > >::const_iterator bndIt = theBndPoints.begin();
+ for ( ; bndIt != theBndPoints.end(); bndIt++ )
+ {
+ const list< TPoint* > & bndPoints = * bndIt;
+ TPoint* prevP = bndPoints.back(); // this is the first point
+ list< TPoint* >::const_iterator pIt = bndPoints.begin();
+ bool coincPrev = false;
+ // loop on the edge-points
+ for ( ; pIt != bndPoints.end(); pIt++ )
+ {
+ double paramDiff = initParam - (*pIt)->myInitUV.Coord( iCoord );
+ double prevParamDiff = initParam - prevP->myInitUV.Coord( iCoord );
+ double sumOfDiff = Abs(prevParamDiff) + Abs(paramDiff);
+ if (!coincPrev && // ignore if initParam coincides with prev point param
+ sumOfDiff > zero && // ignore if both points coincide with initParam
+ prevParamDiff * paramDiff <= zero )
+ {
+ // find UV in parametric space of theFace
+ double r = Abs(prevParamDiff) / sumOfDiff;
+ gp_XY uvInit = (*pIt)->myInitUV * r + prevP->myInitUV * ( 1 - r );
+ int i = nbUV++;
+ if ( i >= 2 ) {
+ // throw away uv most distant from <theInitUV>
+ gp_XY vec0 = initUV[0] - theInitUV;
+ gp_XY vec1 = initUV[1] - theInitUV;
+ gp_XY vec = uvInit - theInitUV;
+ bool isBetween = ( vec0 * vec1 < 0 ); // is theInitUV between initUV[0] and initUV[1]
+ double dist0 = vec0.SquareModulus();
+ double dist1 = vec1.SquareModulus();
+ double dist = vec .SquareModulus();
+ if ( !isBetween || dist < dist0 || dist < dist1 ) {
+ i = ( dist0 < dist1 ? 1 : 0 );
+ if ( isBetween && vec.Dot( i ? vec1 : vec0 ) < 0 )
+ i = 3; // theInitUV must remain between
+ }
+ }
+ if ( i < 2 ) {
+ initUV[ i ] = uvInit;
+ UV[ i ] = (*pIt)->myUV * r + prevP->myUV * ( 1 - r );
+ }
+ coincPrev = ( Abs(paramDiff) <= zero );
+ }
+ else
+ coincPrev = false;
+ prevP = *pIt;
+ }
+ }
+ if ( nbUV < 2 || (UV[0]-UV[1]).SquareModulus() <= DBL_MIN*DBL_MIN ) {
+ MESSAGE(" consequent edge-points not found, nb UV found: " << nbUV <<
+ ", for point: " << theInitUV.X() <<" " << theInitUV.Y() );
+ return setErrorCode( ERR_APPLF_BAD_TOPOLOGY );
+ }
+ // an iso line should be normal to UV[0] - UV[1] direction
+ // and be located at the same relative distance as from initial ends
+ //gp_Lin2d iso( UV[0], UV[0] - UV[1] );
+ double r =
+ (initUV[0]-theInitUV).Modulus() / (initUV[0]-initUV[1]).Modulus();
+ gp_Pnt2d isoLoc = UV[0] * ( 1 - r ) + UV[1] * r;
+ //isoLine[ iIso ] = iso.Normal( isoLoc );
+ uv1[ iIso ] = UV[0];
+ uv2[ iIso ] = UV[1];
+ ratio[ iIso ] = r;
+ }
+ if ( !intersectIsolines( uv1[0], uv2[0], ratio[0],
+ uv1[1], uv2[1], ratio[1], theUV )) {
+ MESSAGE(" Cant intersect isolines for a point "<<theInitUV.X()<<", "<<theInitUV.Y());
+ return setErrorCode( ERR_APPLF_BAD_TOPOLOGY );
+ }
+
+ return true;
+}
+
+// ==========================================================
+// structure representing a node of a grid of iso-poly-lines
+// ==========================================================
+
+struct TIsoNode {
+ gp_XY myInitUV;
+ gp_XY myUV;
+ gp_XY* myPrevUV[2];
+ gp_XY* myNextUV[2];
+ double myRatio[2];
+ TIsoNode(double initU, double initV): myInitUV( initU, initV ), myUV( 1e100, 1e100 )
+ { myPrevUV[0] = myPrevUV[1] = myNextUV[0] = myNextUV[1] = 0; }
+ bool IsUVComputed() const
+ { return myUV.X() != 1e100; }
+ bool IsMovable() const
+ { return myPrevUV[0] && myPrevUV[1] && myNextUV[0] && myNextUV[1]; }
+ void SetNotMovable()
+ { myPrevUV[0] = 0; }
+};
+
+//=======================================================================
+//function : compUVByElasticIsolines
+//purpose : compute UV as nodes of iso-poly-lines consisting of
+// segments keeping relative size as in the pattern
+//=======================================================================
+
+bool SMESH_Pattern::
+ compUVByElasticIsolines(const list< list< TPoint* > >& theBndPoints,
+ const list< TPoint* >& thePntToCompute)
+{
+ // Define parameters of iso-grid nodes in U and V dir
+
+ set< double > paramSet[ 2 ];
+ list< list< TPoint* > >::const_iterator pListIt;
+ list< TPoint* >::const_iterator pIt;
+// for ( pListIt = theBndPoints.begin(); pListIt != theBndPoints.end(); pListIt++ ) {
+// const list< TPoint* > & pList = * pListIt;
+// for ( pIt = pList.begin(); pIt != pList.end(); pIt++ ) {
+// paramSet[0].insert( (*pIt)->myInitUV.X() );
+// paramSet[1].insert( (*pIt)->myInitUV.Y() );
+// }
+// }
+ for ( pIt = thePntToCompute.begin(); pIt != thePntToCompute.end(); pIt++ ) {
+ paramSet[0].insert( (*pIt)->myInitUV.X() );
+ paramSet[1].insert( (*pIt)->myInitUV.Y() );
+ }
+ // unite close parameters and split too long segments
+ int iDir;
+ double tol[ 2 ];
+ for ( iDir = 0; iDir < 2; iDir++ )
+ {
+ set< double > & params = paramSet[ iDir ];
+ double range = ( *params.rbegin() - *params.begin() );
+ double toler = range / 1e6;
+ double maxSegment = range / params.size() / 2.;
+ tol[ iDir ] = toler;
+
+// set< double >::iterator parIt = params.begin();
+// double prevPar = *parIt;
+// for ( parIt++; parIt != params.end(); parIt++ )
+// {
+// double segLen = (*parIt) - prevPar;
+// if ( segLen < toler )
+// params.erase( prevPar ); // unite
+// else if ( segLen > maxSegment )
+// params.insert( prevPar + 0.5 * segLen ); // split
+// prevPar = (*parIt);
+// }
+ }
+
+ // Make nodes of a grid of iso-poly-lines
+
+ list < TIsoNode > nodes;
+ typedef list < TIsoNode *> TIsoLine;
+ map < double, TIsoLine > isoMap[ 2 ];
+
+ set< double > & params0 = paramSet[ 0 ];
+ set< double >::iterator par0It = params0.begin();
+ for ( ; par0It != params0.end(); par0It++ )
+ {
+ TIsoLine & isoLine0 = isoMap[0][ *par0It ]; // isoline with const U
+ set< double > & params1 = paramSet[ 1 ];
+ set< double >::iterator par1It = params1.begin();
+ for ( ; par1It != params1.end(); par1It++ )
+ {
+ nodes.push_back( TIsoNode( *par0It, *par1It ) );
+ isoLine0.push_back( & nodes.back() );
+ isoMap[1][ *par1It ].push_back( & nodes.back() );
+ }
+ }
+
+ // Compute intersections of boundaries with iso-lines
+
+ Bnd_Box2d uvBox;
+ list< list< TPoint* > >::const_iterator bndIt = theBndPoints.begin();
+ for ( ; bndIt != theBndPoints.end(); bndIt++ )
+ {
+ const list< TPoint* > & bndPoints = * bndIt;
+ TPoint* prevP = bndPoints.back(); // this is the first point
+ list< TPoint* >::const_iterator pIt = bndPoints.begin();
+ // loop on the edge-points
+ for ( ; pIt != bndPoints.end(); pIt++ )
+ {
+ TPoint* point = *pIt;
+ uvBox.Add( gp_Pnt2d( point->myUV ));
+ for ( iDir = 0; iDir < 2; iDir++ )
+ {
+ const int iCoord = iDir + 1;
+ const int iOtherCoord = 2 - iDir;
+ double par1 = prevP->myInitUV.Coord( iCoord );
+ double par2 = point->myInitUV.Coord( iCoord );
+ double parDif = par2 - par1;
+ if ( Abs( parDif ) <= DBL_MIN )
+ continue;
+ // find iso-lines intersecting a bounadry
+ double toler = tol[ 1 - iDir ];
+ double minPar = Min ( par1, par2 );
+ double maxPar = Max ( par1, par2 );
+ map < double, TIsoLine >& isos = isoMap[ iDir ];
+ map < double, TIsoLine >::iterator isoIt = isos.begin();
+ for ( ; isoIt != isos.end(); isoIt++ )
+ {
+ double isoParam = (*isoIt).first;
+ if ( isoParam < minPar || isoParam > maxPar )
+ continue;
+ double r = ( isoParam - par1 ) / parDif;
+ gp_XY uv = ( 1 - r ) * prevP->myUV + r * point->myUV;
+ gp_XY initUV = ( 1 - r ) * prevP->myInitUV + r * point->myInitUV;
+ double otherPar = initUV.Coord( iOtherCoord ); // along isoline
+ // find existing node with otherPar or insert a new one
+ TIsoLine & isoLine = (*isoIt).second;
+ double nodePar;
+ TIsoLine::iterator nIt = isoLine.begin();
+ for ( ; nIt != isoLine.end(); nIt++ ) {
+ nodePar = (*nIt)->myInitUV.Coord( iOtherCoord );
+ if ( nodePar >= otherPar )
+ break;
+ }
+ TIsoNode * node;
+ if ( Abs( nodePar - otherPar ) <= toler )
+ node = (*nIt);
+ else {
+ nodes.push_back( TIsoNode( initUV.X(), initUV.Y() ) );
+ node = & nodes.back();
+ isoLine.insert( nIt, node );
+ }
+ node->myUV = uv;
+ }
+ }
+ prevP = point;
+ } // loop on boundary points
+ } // loop on boundaries
+
+ // Connect XY of nodes and mark not movable nodes out of the boundary
+
+ for ( iDir = 0; iDir < 2; iDir++ )
+ {
+ const int iCoord = 2 - iDir;
+ map < double, TIsoLine >& isos = isoMap[ iDir ];
+ map < double, TIsoLine >::iterator isoIt = isos.begin();
+ for ( ; isoIt != isos.end(); isoIt++ )
+ {
+ TIsoLine & isoLine = (*isoIt).second;
+ bool firstCompNodeFound = false;
+ TIsoLine::iterator lastCompNodePos, nPrevIt, nIt, nNextIt;
+ nPrevIt = nIt = nNextIt = isoLine.begin();
+ nIt++;
+ nNextIt++; nNextIt++;
+ while ( nIt != isoLine.end() )
+ {
+ // connect prev - cur for internal nodes
+ TIsoNode* node = *nIt, * prevNode = *nPrevIt;
+ if ( !node->IsUVComputed() )
+ node->myPrevUV[ iDir ] = & prevNode->myUV;
+ if ( !prevNode->IsUVComputed() )
+ prevNode->myNextUV[ iDir ] = & node->myUV;
+ // compute ratio
+ if ( nNextIt != isoLine.end() ) {
+ double par1 = prevNode->myInitUV.Coord( iCoord );
+ double par2 = node->myInitUV.Coord( iCoord );
+ double par3 = (*nNextIt)->myInitUV.Coord( iCoord );
+ node->myRatio[ iDir ] = ( par2 - par1 ) / ( par3 - par1 );
+ nNextIt++;
+ }
+ // mark not movable before the boundary
+ if ( !firstCompNodeFound ) {
+ if ( !prevNode->IsUVComputed() )
+ prevNode->SetNotMovable();
+ else
+ firstCompNodeFound = true;
+ }
+ if ( node->IsUVComputed() )
+ lastCompNodePos = nIt;
+ nIt++; nPrevIt++;
+ }
+ // mark not movable after the boundary
+ for ( nIt = ++lastCompNodePos; nIt != isoLine.end(); nIt++ )
+ (*nIt)->SetNotMovable();
+ }
+ }
+
+ // Compute starting UV of internal nodes by iso intersection
+
+ map < double, TIsoLine >& isos = isoMap[ 0 ];
+ map < double, TIsoLine >::iterator isoIt = isos.begin();
+ for ( ; isoIt != isos.end(); isoIt++ )
+ {
+ TIsoLine & isoLine = (*isoIt).second;
+ TIsoLine::iterator nIt = isoLine.begin();
+ for ( ; nIt != isoLine.end(); nIt++ )
+ {
+ TIsoNode* node = *nIt;
+ if ( !node->IsUVComputed() && node->IsMovable() )
+ if ( !compUVByIsoIntersection( theBndPoints, node->myInitUV, node->myUV ))
+ node->myUV = node->myInitUV;
+ }
+ }
+
+ // Move nodes
+
+ static int maxNbIter = 100; // -1
+ //maxNbIter++;
+ maxNbIter = ( maxNbIter < 0 ) ? 100 : -1;
+
+ double maxMove;
+ int nbIter = 0;
+ do {
+ if ( nbIter >= maxNbIter ) break;
+ maxMove = 0.0;
+ list < TIsoNode >::iterator nIt = nodes.begin();
+ for ( ; nIt != nodes.end(); nIt++ ) {
+ TIsoNode & node = *nIt;
+ if ( node.IsMovable() )
+ {
+ gp_Lin2d line[2];
+ gp_XY location[2];
+ bool lineFound = true;
+ for ( iDir = 0; iDir < 2; iDir++ )
+ {
+ // make a line
+ gp_XY uv1( *node.myPrevUV[ iDir ] ), uv2( *node.myNextUV[ iDir ] );
+ gp_XY dUV( uv2 - uv1 );
+ if ( dUV.SquareModulus() <= DBL_MIN * DBL_MIN ) {
+ lineFound = false;
+ break;
+ }
+ double r = node.myRatio[ iDir ];
+ gp_Lin2d l( uv1, dUV );
+ gp_XY loc = uv1 * ( 1 - r ) + uv2 * r;
+ location[ iDir ] = loc;
+ line[ iDir ] = l/*.Normal( loc )*/;
+ }
+ // intersect the 2 lines and move a node
+ gp_XY newUV;
+ if (lineFound &&
+ intersectIsolines (*node.myPrevUV[0], *node.myNextUV[0], node.myRatio[0],
+ *node.myPrevUV[0], *node.myNextUV[0], node.myRatio[0],
+ newUV ) &&
+ !uvBox.IsOut( newUV ) )
+ {
+ maxMove = Max( maxMove, ( newUV - node.myUV ).SquareModulus());
+ node.myUV = newUV;
+ }
+ }
+ }
+ } while ( maxMove > 1e-8 && nbIter++ < maxNbIter );
+
+ MESSAGE( "compUVByElasticIsolines(): Nb iterations " << nbIter << " dist: " << sqrt( maxMove ));
+
+ // Set computed UV to points
+
+ for ( pIt = thePntToCompute.begin(); pIt != thePntToCompute.end(); pIt++ ) {
+ TPoint* point = *pIt;
+ gp_XY oldUV = point->myUV;
+ double minDist = DBL_MAX;
+ list < TIsoNode >::iterator nIt = nodes.begin();
+ for ( ; nIt != nodes.end(); nIt++ ) {
+ double dist = ( (*nIt).myInitUV - point->myInitUV ).SquareModulus();
+ if ( dist < minDist ) {
+ minDist = dist;
+ point->myUV = (*nIt).myUV;
+ }
+ }
+ }
+
+
+ return true;
+}
+
+
+//=======================================================================
+//function : setFirstEdge
+//purpose : choose the best first edge of theWire; return the summary distance
+// between point UV computed by isolines intersection and
+// eventual UV got from edge p-curves
+//=======================================================================
+
+//#define DBG_SETFIRSTEDGE
+double SMESH_Pattern::setFirstEdge (list< TopoDS_Edge > & theWire, int theFirstEdgeID)
+{
+ int iE, nbEdges = theWire.size();
+ if ( nbEdges == 1 )
+ return 0;
+
+ // Transform UVs computed by iso to fit bnd box of a wire
+
+ // max nb of points on an edge
+ int maxNbPnt = 0;
+ int eID = theFirstEdgeID;
+ for ( iE = 0; iE < nbEdges; iE++ )
+ maxNbPnt = Max ( maxNbPnt, getShapePoints( eID++ ).size() );
+
+ // compute bnd boxes
+ TopoDS_Face face = TopoDS::Face( myShape );
+ Bnd_Box2d bndBox, eBndBox;
+ eID = theFirstEdgeID;
+ list< TopoDS_Edge >::iterator eIt;
+ list< TPoint* >::iterator pIt;
+ for ( eIt = theWire.begin(); eIt != theWire.end(); eIt++ )
+ {
+ // UV by isos stored in TPoint.myXYZ
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ for ( pIt = ePoints.begin(); pIt != ePoints.end(); pIt++ ) {
+ TPoint* p = (*pIt);
+ bndBox.Add( gp_Pnt2d( p->myXYZ.X(), p->myXYZ.Y() ));
+ }
+ // UV by an edge p-curve
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface( *eIt, face, f, l );
+ double dU = ( l - f ) / ( maxNbPnt - 1 );
+ for ( int i = 0; i < maxNbPnt; i++ )
+ eBndBox.Add( C2d->Value( f + i * dU ));
+ }
+
+ // transform UVs by isos
+ double minPar[2], maxPar[2], eMinPar[2], eMaxPar[2];
+ bndBox.Get( minPar[0], minPar[1], maxPar[0], maxPar[1] );
+ eBndBox.Get( eMinPar[0], eMinPar[1], eMaxPar[0], eMaxPar[1] );
+#ifdef DBG_SETFIRSTEDGE
+ cout << "EDGES: X: " << eMinPar[0] << " - " << eMaxPar[0] << " Y: "
+ << eMinPar[1] << " - " << eMaxPar[1] << endl;
+#endif
+ for ( int iC = 1, i = 0; i < 2; iC++, i++ ) // loop on 2 coordinates
+ {
+ double dMin = eMinPar[i] - minPar[i];
+ double dMax = eMaxPar[i] - maxPar[i];
+ double dPar = maxPar[i] - minPar[i];
+ eID = theFirstEdgeID;
+ for ( iE = 0; iE < nbEdges; iE++ ) // loop on edges of a boundary
+ {
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ for ( pIt = ++ePoints.begin(); pIt != ePoints.end(); pIt++ ) // loop on edge points
+ {
+ double par = (*pIt)->myXYZ.Coord( iC );
+ double r = ( par - minPar[i] ) / dPar;
+ par += ( 1 - r ) * dMin + r * dMax;
+ (*pIt)->myXYZ.SetCoord( iC, par );
+ }
+ }
+ }
+
+ TopoDS_Edge eBest;
+ double minDist = DBL_MAX;
+ for ( iE = 0 ; iE < nbEdges; iE++ )
+ {
+#ifdef DBG_SETFIRSTEDGE
+ cout << " VARIANT " << iE << endl;
+#endif
+ // evaluate the distance between UV computed by the 2 methods:
+ // by isos intersection ( myXYZ ) and by edge p-curves ( myUV )
+ double dist = 0;
+ int eID = theFirstEdgeID;
+ for ( eIt = theWire.begin(); eIt != theWire.end(); eIt++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ computeUVOnEdge( *eIt, ePoints );
+ for ( pIt = ++ePoints.begin(); pIt != ePoints.end(); pIt++ ) {
+ TPoint* p = (*pIt);
+ dist += ( p->myUV - gp_XY( p->myXYZ.X(), p->myXYZ.Y() )).SquareModulus();
+#ifdef DBG_SETFIRSTEDGE
+ cout << " ISO : ( " << p->myXYZ.X() << ", "<< p->myXYZ.Y() << " ) PCURVE : ( " <<
+ p->myUV.X() << ", " << p->myUV.Y() << ") " << endl;
+#endif
+ }
+ }
+#ifdef DBG_SETFIRSTEDGE
+ cout << "dist -- " << dist << endl;
+#endif
+ if ( dist < minDist ) {
+ minDist = dist;
+ eBest = theWire.front();
+ }
+ // check variant with another first edge
+ theWire.splice( theWire.begin(), theWire, --theWire.end(), theWire.end() );
+ }
+ // put the best first edge to the theWire front
+ if ( eBest != theWire.front() ) {
+ eIt = find ( theWire.begin(), theWire.end(), eBest );
+ theWire.splice( theWire.begin(), theWire, eIt, theWire.end() );
+ }
+
+ return minDist;
+}
+
+//=======================================================================
+//function : sortSameSizeWires
+//purpose : sort wires in theWireList from theFromWire until theToWire,
+// the wires are set in the order to correspond to the order
+// of boundaries; after sorting, edges in the wires are put
+// in a good order, point UVs on edges are computed and points
+// are appended to theEdgesPointsList
+//=======================================================================
+
+bool SMESH_Pattern::sortSameSizeWires (TListOfEdgesList & theWireList,
+ const TListOfEdgesList::iterator& theFromWire,
+ const TListOfEdgesList::iterator& theToWire,
+ const int theFirstEdgeID,
+ list< list< TPoint* > >& theEdgesPointsList )
+{
+ TopoDS_Face F = TopoDS::Face( myShape );
+ int iE, nbEdgeInWire = (*theFromWire).size();
+ int iW, nbWires = 0;
+ TListOfEdgesList::iterator wlIt = theFromWire;
+ while ( wlIt++ != theToWire )
+ nbWires++;
+
+ // Recompute key-point UVs by isolines intersection,
+ // compute CG of key-points for each wire and bnd boxes of GCs
+
+ gp_XY orig( gp::Origin2d().XY() );
+ vector< gp_XY > vGcVec( nbWires, orig ), gcVec( nbWires, orig );
+ Bnd_Box2d bndBox, vBndBox;
+ int eID = theFirstEdgeID;
+ list< TopoDS_Edge >::iterator eIt;
+ for ( iW = 0, wlIt = theFromWire; wlIt != theToWire; wlIt++, iW++ )
+ {
+ list< TopoDS_Edge > & wire = *wlIt;
+ for ( eIt = wire.begin(); eIt != wire.end(); eIt++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ TPoint* p = ePoints.front();
+ if ( !compUVByIsoIntersection( theEdgesPointsList, p->myInitUV, p->myUV )) {
+ MESSAGE("cant sortSameSizeWires()");
+ return false;
+ }
+ gcVec[iW] += p->myUV;
+ bndBox.Add( gp_Pnt2d( p->myUV ));
+ TopoDS_Vertex V = TopExp::FirstVertex( *eIt, true );
+ gp_Pnt2d vXY = BRep_Tool::Parameters( V, F );
+ vGcVec[iW] += vXY.XY();
+ vBndBox.Add( vXY );
+ // keep the computed UV to compare against by setFirstEdge()
+ p->myXYZ.SetCoord( p->myUV.X(), p->myUV.Y(), 0. );
+ }
+ gcVec[iW] /= nbWires;
+ vGcVec[iW] /= nbWires;
+// cout << " Wire " << iW << " iso: " << gcVec[iW].X() << " " << gcVec[iW].Y() << endl <<
+// " \t vertex: " << vGcVec[iW].X() << " " << vGcVec[iW].Y() << endl;
+ }
+
+ // Transform GCs computed by isos to fit in bnd box of GCs by vertices
+
+ double minPar[2], maxPar[2], vMinPar[2], vMaxPar[2];
+ bndBox.Get( minPar[0], minPar[1], maxPar[0], maxPar[1] );
+ vBndBox.Get( vMinPar[0], vMinPar[1], vMaxPar[0], vMaxPar[1] );
+ for ( int iC = 1, i = 0; i < 2; iC++, i++ ) // loop on 2 coordinates
+ {
+ double dMin = vMinPar[i] - minPar[i];
+ double dMax = vMaxPar[i] - maxPar[i];
+ double dPar = maxPar[i] - minPar[i];
+ if ( Abs( dPar ) <= DBL_MIN )
+ continue;
+ for ( iW = 0; iW < nbWires; iW++ ) { // loop on GCs of wires
+ double par = gcVec[iW].Coord( iC );
+ double r = ( par - minPar[i] ) / dPar;
+ par += ( 1 - r ) * dMin + r * dMax;
+ gcVec[iW].SetCoord( iC, par );
+ }
+ }
+
+ // Define boundary - wire correspondence by GC closeness
+
+ TListOfEdgesList tmpWList;
+ tmpWList.splice( tmpWList.end(), theWireList, theFromWire, theToWire );
+ typedef map< int, TListOfEdgesList::iterator > TIntWirePosMap;
+ TIntWirePosMap bndIndWirePosMap;
+ vector< bool > bndFound( nbWires, false );
+ for ( iW = 0, wlIt = tmpWList.begin(); iW < nbWires; iW++, wlIt++ )
+ {
+// cout << " TRSF Wire " << iW << " iso: " << gcVec[iW].X() << " " << gcVec[iW].Y() << endl <<
+// " \t vertex: " << vGcVec[iW].X() << " " << vGcVec[iW].Y() << endl;
+ double minDist = DBL_MAX;
+ gp_XY & wGc = vGcVec[ iW ];
+ int bIndex;
+ for ( int iB = 0; iB < nbWires; iB++ ) {
+ if ( bndFound[ iB ] ) continue;
+ double dist = ( wGc - gcVec[ iB ] ).SquareModulus();
+ if ( dist < minDist ) {
+ minDist = dist;
+ bIndex = iB;
+ }
+ }
+ bndFound[ bIndex ] = true;
+ bndIndWirePosMap.insert( TIntWirePosMap::value_type( bIndex, wlIt ));
+ }
+
+ // Treat each wire
+
+ TIntWirePosMap::iterator bIndWPosIt = bndIndWirePosMap.begin();
+ eID = theFirstEdgeID;
+ for ( ; bIndWPosIt != bndIndWirePosMap.end(); bIndWPosIt++ )
+ {
+ TListOfEdgesList::iterator wirePos = (*bIndWPosIt).second;
+ list < TopoDS_Edge > & wire = ( *wirePos );
+
+ // choose the best first edge of a wire
+ setFirstEdge( wire, eID );
+
+ // compute eventual UV and fill theEdgesPointsList
+ theEdgesPointsList.push_back( list< TPoint* >() );
+ list< TPoint* > & edgesPoints = theEdgesPointsList.back();
+ for ( eIt = wire.begin(); eIt != wire.end(); eIt++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ computeUVOnEdge( *eIt, ePoints );
+ }
+ // put wire back to theWireList
+ wlIt = wirePos++;
+ theWireList.splice( theToWire, tmpWList, wlIt, wirePos );
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : Apply
+//purpose : Compute nodes coordinates applying
+// the loaded pattern to <theFace>. The first key-point
+// will be mapped into <theVertexOnKeyPoint1>
+//=======================================================================
+
+bool SMESH_Pattern::Apply (const TopoDS_Face& theFace,
+ const TopoDS_Vertex& theVertexOnKeyPoint1,
+ const bool theReverse)
+{
+ MESSAGE(" ::Apply(face) " );
+ TopoDS_Face face = theReverse ? TopoDS::Face( theFace.Reversed() ) : theFace;
+ if ( !setShapeToMesh( face ))
+ return false;
+
+ // find points on edges, it fills myNbKeyPntInBoundary
+ if ( !findBoundaryPoints() )
+ return false;
+
+ // Define the edges order so that the first edge starts at
+ // theVertexOnKeyPoint1
+
+ list< TopoDS_Edge > eList;
+ list< int > nbVertexInWires;
+ int nbWires = getOrderedEdges( face, theVertexOnKeyPoint1, eList, nbVertexInWires);
+ if ( !theVertexOnKeyPoint1.IsSame( TopExp::FirstVertex( eList.front(), true )))
+ {
+ MESSAGE( " theVertexOnKeyPoint1 not found in the outer wire ");
+ return setErrorCode( ERR_APPLF_BAD_VERTEX );
+ }
+ // check nb wires and edges
+ list< int > l1 = myNbKeyPntInBoundary, l2 = nbVertexInWires;
+ l1.sort(); l2.sort();
+ if ( l1 != l2 )
+ {
+ MESSAGE( "Wrong nb vertices in wires" );
+ return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+ }
+
+ // here shapes get IDs, for the outer wire IDs are OK
+ list<TopoDS_Edge>::iterator elIt = eList.begin();
+ for ( ; elIt != eList.end(); elIt++ ) {
+ myShapeIDMap.Add( TopExp::FirstVertex( *elIt, true ));
+ if ( BRep_Tool::IsClosed( *elIt, theFace ) )
+ myShapeIDMap.Add( TopExp::LastVertex( *elIt, true ));
+ }
+ int nbVertices = myShapeIDMap.Extent();
+
+ //int nbSeamShapes = 0; // count twice seam edge and its vertices
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ myShapeIDMap.Add( *elIt );
+
+ myShapeIDMap.Add( face );
+
+ if ( myShapeIDToPointsMap.size() != myShapeIDMap.Extent()/* + nbSeamShapes*/ ) {
+ MESSAGE( myShapeIDToPointsMap.size() <<" != " << myShapeIDMap.Extent());
+ return setErrorCode( ERR_APPLF_INTERNAL_EEROR );
+ }
+
+ // points on edges to be used for UV computation of in-face points
+ list< list< TPoint* > > edgesPointsList;
+ edgesPointsList.push_back( list< TPoint* >() );
+ list< TPoint* > * edgesPoints = & edgesPointsList.back();
+ list< TPoint* >::iterator pIt;
+
+ // compute UV of points on the outer wire
+ int iE, nbEdgesInOuterWire = nbVertexInWires.front();
+ for (iE = 0, elIt = eList.begin();
+ iE < nbEdgesInOuterWire && elIt != eList.end();
+ iE++, elIt++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( *elIt );
+ // compute UV
+ computeUVOnEdge( *elIt, ePoints );
+ // collect on-edge points (excluding the last one)
+ edgesPoints->insert( edgesPoints->end(), ePoints.begin(), --ePoints.end());
+ }
+
+ // If there are several wires, define the order of edges of inner wires:
+ // compute UV of inner edge-points using 2 methods: the one for in-face points
+ // and the one for on-edge points and then choose the best edge order
+ // by the best correspondance of the 2 results
+ if ( nbWires > 1 )
+ {
+ // compute UV of inner edge-points using the method for in-face points
+ // and devide eList into a list of separate wires
+ list< list< TopoDS_Edge > > wireList;
+ list<TopoDS_Edge>::iterator eIt = elIt;
+ list<int>::iterator nbEIt = nbVertexInWires.begin();
+ for ( nbEIt++; nbEIt != nbVertexInWires.end(); nbEIt++ )
+ {
+ int nbEdges = *nbEIt;
+ wireList.push_back( list< TopoDS_Edge >() );
+ list< TopoDS_Edge > & wire = wireList.back();
+ for ( iE = 0 ; iE < nbEdges; eIt++, iE++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( *eIt );
+ pIt = ePoints.begin();
+ for ( pIt++; pIt != ePoints.end(); pIt++ ) {
+ TPoint* p = (*pIt);
+ if ( !compUVByIsoIntersection( edgesPointsList, p->myInitUV, p->myUV )) {
+ MESSAGE("cant Apply(face)");
+ return false;
+ }
+ // keep the computed UV to compare against by setFirstEdge()
+ p->myXYZ.SetCoord( p->myUV.X(), p->myUV.Y(), 0. );
+ }
+ wire.push_back( *eIt );
+ }
+ }
+ // remove inner edges from eList
+ eList.erase( elIt, eList.end() );
+
+ // sort wireList by nb edges in a wire
+ sortBySize< TopoDS_Edge > ( wireList );
+
+ // an ID of the first edge of a boundary
+ int id1 = nbVertices + nbEdgesInOuterWire + 1;
+// if ( nbSeamShapes > 0 )
+// id1 += 2; // 2 vertices more
+
+ // find points - edge correspondence for wires of unique size,
+ // edge order within a wire should be defined only
+
+ list< list< TopoDS_Edge > >::iterator wlIt = wireList.begin();
+ while ( wlIt != wireList.end() )
+ {
+ list< TopoDS_Edge >& wire = (*wlIt);
+ int nbEdges = wire.size();
+ wlIt++;
+ if ( wlIt == wireList.end() || (*wlIt).size() != nbEdges ) // a unique size wire
+ {
+ // choose the best first edge of a wire
+ setFirstEdge( wire, id1 );
+
+ // compute eventual UV and collect on-edge points
+ edgesPointsList.push_back( list< TPoint* >() );
+ edgesPoints = & edgesPointsList.back();
+ int eID = id1;
+ for ( eIt = wire.begin(); eIt != wire.end(); eIt++ )
+ {
+ list< TPoint* > & ePoints = getShapePoints( eID++ );
+ computeUVOnEdge( *eIt, ePoints );
+ edgesPoints->insert( edgesPoints->end(), ePoints.begin(), (--ePoints.end()));
+ }
+ }
+ id1 += nbEdges;
+ }
+
+ // find boundary - wire correspondence for several wires of same size
+
+ id1 = nbVertices + nbEdgesInOuterWire + 1;
+ wlIt = wireList.begin();
+ while ( wlIt != wireList.end() )
+ {
+ int nbSameSize = 0, nbEdges = (*wlIt).size();
+ list< list< TopoDS_Edge > >::iterator wlIt2 = wlIt;
+ wlIt2++;
+ while ( wlIt2 != wireList.end() && (*wlIt2).size() == nbEdges ) { // a same size wire
+ nbSameSize++;
+ wlIt2++;
+ }
+ if ( nbSameSize > 0 )
+ if (!sortSameSizeWires(wireList, wlIt, wlIt2, id1, edgesPointsList))
+ return false;
+ wlIt = wlIt2;
+ id1 += nbEdges * ( nbSameSize + 1 );
+ }
+
+ // add well-ordered edges to eList
+
+ for ( wlIt = wireList.begin(); wlIt != wireList.end(); wlIt++ )
+ {
+ list< TopoDS_Edge >& wire = (*wlIt);
+ eList.splice( eList.end(), wire, wire.begin(), wire.end() );
+ }
+
+ // re-fill myShapeIDMap - all shapes get good IDs
+
+ myShapeIDMap.Clear();
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ myShapeIDMap.Add( TopExp::FirstVertex( *elIt, true ));
+ for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ myShapeIDMap.Add( *elIt );
+ myShapeIDMap.Add( face );
+
+ } // there are inner wires
+
+ // Compute XYZ of on-edge points
+
+ TopLoc_Location loc;
+ for ( iE = nbVertices + 1, elIt = eList.begin(); elIt != eList.end(); elIt++ )
+ {
+ double f,l;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve( *elIt, loc, f, l );
+ const gp_Trsf & aTrsf = loc.Transformation();
+ list< TPoint* > & ePoints = getShapePoints( iE++ );
+ pIt = ePoints.begin();
+ for ( pIt++; pIt != ePoints.end(); pIt++ )
+ {
+ TPoint* point = *pIt;
+ point->myXYZ = C3d->Value( point->myU );
+ if ( !loc.IsIdentity() )
+ aTrsf.Transforms( point->myXYZ.ChangeCoord() );
+ }
+ }
+
+ // Compute UV and XYZ of in-face points by intersection of 2 iso lines
+
+ list< TPoint* > & fPoints = getShapePoints( face );
+ for ( pIt = fPoints.begin(); pIt != fPoints.end(); pIt++ )
+ {
+ TPoint * point = *pIt;
+ if ( !compUVByIsoIntersection( edgesPointsList, point->myInitUV, point->myUV )) {
+ MESSAGE("cant Apply(face)");
+ return false;
+ }
+ }
+
+// compUVByElasticIsolines( edgesPointsList, fPoints );
+
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface( face, loc );
+ const gp_Trsf & aTrsf = loc.Transformation();
+ for ( pIt = fPoints.begin(); pIt != fPoints.end(); pIt++ )
+ {
+ TPoint * point = *pIt;
+ point->myXYZ = aSurface->Value( point->myUV.X(), point->myUV.Y() );
+ if ( !loc.IsIdentity() )
+ aTrsf.Transforms( point->myXYZ.ChangeCoord() );
+ }
+
+ myIsComputed = true;
+
+ return setErrorCode( ERR_OK );
+}
+
+// =========================================================
+// class calculating coordinates of 3D points by normalized
+// parameters inside the block and vice versa
+// =========================================================
+
+class TBlock: public math_FunctionSetWithDerivatives
+{
+ public:
+ enum TBlockShapeID { // ids of the block sub-shapes
+ ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111,
+
+ ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11,
+ ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1,
+ ID_E00z, ID_E10z, ID_E01z, ID_E11z,
+
+ ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz,
+
+ ID_Shell
+ };
+ static inline
+bool IsVertexID( int theShapeID )
+ { return ( theShapeID >= ID_V000 && theShapeID <= ID_V111 ); }
+ static inline bool IsEdgeID( int theShapeID )
+ { return ( theShapeID >= ID_Ex00 && theShapeID <= ID_E11z ); }
+ static inline bool IsFaceID( int theShapeID )
+ { return ( theShapeID >= ID_Fxy0 && theShapeID <= ID_F1yz ); }
+
+
+ TBlock (const TopoDS_Shell& theBlock):
+ myShell( theBlock ), myNbIterations(0), mySumDist(0.) {}
+
+ bool LoadBlockShapes(const TopoDS_Vertex& theVertex000,
+ const TopoDS_Vertex& theVertex001,
+// TopTools_IndexedMapOfShape& theShapeIDMap
+ TopTools_IndexedMapOfOrientedShape& theShapeIDMap );
+ // add sub-shapes of theBlock to theShapeIDMap so that they get
+ // IDs acoording to enum TBlockShapeID
+
+ static int GetShapeIDByParams ( const gp_XYZ& theParams );
+ // define an id of the block sub-shape by point parameters
+
+ bool VertexPoint( const int theVertexID, gp_XYZ& thePoint ) const {
+ if ( !IsVertexID( theVertexID )) return false;
+ thePoint = myPnt[ theVertexID - ID_V000 ]; return true;
+ }
+ // return vertex coordinates
+
+ bool EdgePoint( const int theEdgeID, const gp_XYZ& theParams, gp_XYZ& thePoint ) const {
+ if ( !IsEdgeID( theEdgeID )) return false;
+ thePoint = myEdge[ theEdgeID - ID_Ex00 ].Point( theParams ); return true;
+ }
+ // return coordinates of a point on edge
+
+ bool FacePoint( const int theFaceID, const gp_XYZ& theParams, gp_XYZ& thePoint ) const {
+ if ( !IsFaceID ( theFaceID )) return false;
+ thePoint = myFace[ theFaceID - ID_Fxy0 ].Point( theParams ); return true;
+ }
+ // return coordinates of a point on face
+
+ bool ShellPoint( const gp_XYZ& theParams, gp_XYZ& thePoint ) const;
+ // return coordinates of a point in shell
+
+ bool ComputeParameters (const gp_Pnt& thePoint,
+ gp_XYZ& theParams,
+ const int theShapeID = ID_Shell);
+ // compute point parameters in the block
+
+ static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec );
+ // return edges IDs of a face in the order u0, u1, 0v, 1v
+
+ static int GetCoordIndOnEdge (const int theEdgeID)
+ { return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; }
+ // return an index of a coordinate which varies along the edge
+
+ static double* GetShapeCoef (const int theShapeID);
+ // for theShapeID( TBlockShapeID ), returns 3 coefficients used
+ // to compute an addition of an on-theShape point to coordinates
+ // of an in-shell point. If an in-shell point has parameters (Px,Py,Pz),
+ // then the addition of a point P is computed as P*kx*ky*kz and ki is
+ // defined by the returned coef like this:
+ // ki = (coef[i] == 0) ? 1 : (coef[i] < 0) ? 1 - Pi : Pi
+
+ static bool IsForwardEdge (const TopoDS_Edge & theEdge,
+ //TopTools_IndexedMapOfShape& theShapeIDMap
+ TopTools_IndexedMapOfOrientedShape& theShapeIDMap) {
+ int v1ID = theShapeIDMap.FindIndex( TopExp::FirstVertex( theEdge ).Oriented( TopAbs_FORWARD ));
+ int v2ID = theShapeIDMap.FindIndex( TopExp::LastVertex( theEdge ).Oriented( TopAbs_FORWARD ));
+ return ( v1ID < v2ID );
+ }
+ // Return true if an in-block parameter increases along theEdge curve
+
+ static void Swap(double& a, double& b) { double tmp = a; a = b; b = tmp; }
+
+ // methods of math_FunctionSetWithDerivatives
+ Standard_Integer NbVariables() const;
+ Standard_Integer NbEquations() const;
+ Standard_Boolean Value(const math_Vector& X,math_Vector& F) ;
+ Standard_Boolean Derivatives(const math_Vector& X,math_Matrix& D) ;
+ Standard_Boolean Values(const math_Vector& X,math_Vector& F,math_Matrix& D) ;
+ Standard_Integer GetStateNumber ();
+
+ static ostream& DumpShapeID (const int theBlockShapeID, ostream& stream);
+ // DEBUG: dump an id of a block sub-shape
+
+ private:
+
+ struct TEdge {
+ int myCoordInd;
+ double myFirst;
+ double myLast;
+ Handle(Geom_Curve) myC3d;
+ gp_Trsf myTrsf;
+ double GetU( const gp_XYZ& theParams ) const;
+ gp_XYZ Point( const gp_XYZ& theParams ) const;
+ };
+
+ struct TFace {
+ // 4 edges in the order u0, u1, 0v, 1v
+ int myCoordInd[ 4 ];
+ double myFirst [ 4 ];
+ double myLast [ 4 ];
+ Handle(Geom2d_Curve) myC2d [ 4 ];
+ // 4 corner points in the order 00, 10, 11, 01
+ gp_XY myCorner [ 4 ];
+ // surface
+ Handle(Geom_Surface) myS;
+ gp_Trsf myTrsf;
+ gp_XY GetUV( const gp_XYZ& theParams ) const;
+ gp_XYZ Point( const gp_XYZ& theParams ) const;
+ int GetUInd() const { return myCoordInd[ 0 ]; }
+ int GetVInd() const { return myCoordInd[ 2 ]; }
+ };
+
+ TopoDS_Shell myShell;
+ // geometry:
+ // 8 vertices
+ gp_XYZ myPnt[ 8 ];
+ // 12 edges
+ TEdge myEdge[ 12 ];
+ // 6 faces
+ TFace myFace[ 6 ];
+
+ // for param computation
+
+ int myFaceIndex;
+ double myFaceParam;
+ int myNbIterations;
+ double mySumDist;
+
+ gp_XYZ myPoint; // the given point
+ gp_XYZ myParam; // the best parameters guess
+ double myValues[ 4 ]; // values computed at myParam
+
+ typedef pair<gp_XYZ,gp_XYZ> TxyzPair;
+ TxyzPair my3x3x3GridNodes[ 27 ];
+ bool myGridComputed;
+};
+
+//=======================================================================
+//function : Load
+//purpose : Create a pattern from the mesh built on <theBlock>
+//=======================================================================
+
+bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
+ const TopoDS_Shell& theBlock)
+{
+ MESSAGE(" ::Load(volume) " );
+ Clear();
+ myIs2D = false;
+ SMESHDS_Mesh * aMeshDS = theMesh->GetMeshDS();
+
+ // load shapes in myShapeIDMap
+ TBlock block( theBlock );
+ TopoDS_Vertex v1, v2;
+ if ( !block.LoadBlockShapes( v1, v2, myShapeIDMap ))
+ return setErrorCode( ERR_LOADV_BAD_SHAPE );
+
+ // count nodes
+ int nbNodes = 0, shapeID;
+ for ( shapeID = 1; shapeID <= myShapeIDMap.Extent(); shapeID++ )
+ {
+ const TopoDS_Shape& S = myShapeIDMap( shapeID );
+ SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( S );
+ if ( aSubMesh )
+ nbNodes += aSubMesh->NbNodes();
+ }
+ myPoints.resize( nbNodes );
+
+ // load U of points on edges
+ TNodePointIDMap nodePointIDMap;
+ int iPoint = 0;
+ for ( shapeID = 1; shapeID <= myShapeIDMap.Extent(); shapeID++ )
+ {
+ const TopoDS_Shape& S = myShapeIDMap( shapeID );
+ list< TPoint* > & shapePoints = getShapePoints( shapeID );
+ SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( S );
+ if ( ! aSubMesh ) continue;
+ SMDS_NodeIteratorPtr nIt = aSubMesh->GetNodes();
+ if ( !nIt->more() ) continue;
+
+ // store a node and a point
+ while ( nIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint ));
+ if ( block.IsVertexID( shapeID ))
+ myKeyPointIDs.push_back( iPoint );
+ TPoint* p = & myPoints[ iPoint++ ];
+ shapePoints.push_back( p );
+ p->myXYZ.SetCoord( node->X(), node->Y(), node->Z() );
+ p->myInitXYZ.SetCoord( 0,0,0 );
+ }
+ list< TPoint* >::iterator pIt = shapePoints.begin();
+
+ // compute init XYZ
+ switch ( S.ShapeType() )
+ {
+ case TopAbs_VERTEX:
+ case TopAbs_EDGE: {
+
+ for ( ; pIt != shapePoints.end(); pIt++ ) {
+ double * coef = block.GetShapeCoef( shapeID );
+ for ( int iCoord = 1; iCoord <= 3; iCoord++ )
+ if ( coef[ iCoord - 1] > 0 )
+ (*pIt)->myInitXYZ.SetCoord( iCoord, 1. );
+ }
+ if ( S.ShapeType() == TopAbs_VERTEX )
+ break;
+
+ const TopoDS_Edge& edge = TopoDS::Edge( S );
+ double f,l;
+ BRep_Tool::Range( edge, f, l );
+ int iCoord = TBlock::GetCoordIndOnEdge( shapeID );
+ bool isForward = TBlock::IsForwardEdge( edge, myShapeIDMap );
+ pIt = shapePoints.begin();
+ nIt = aSubMesh->GetNodes();
+ for ( ; nIt->more(); pIt++ )
+ {
+ const SMDS_MeshNode* node =
+ static_cast<const SMDS_MeshNode*>( nIt->next() );
+ const SMDS_EdgePosition* epos =
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ double u = ( epos->GetUParameter() - f ) / ( l - f );
+ (*pIt)->myInitXYZ.SetCoord( iCoord, isForward ? u : 1 - u );
+ }
+ break;
+ }
+ default:
+ for ( ; pIt != shapePoints.end(); pIt++ )
+ {
+ if ( !block.ComputeParameters( (*pIt)->myXYZ, (*pIt)->myInitXYZ, shapeID )) {
+ MESSAGE( "!block.ComputeParameters()" );
+ return setErrorCode( ERR_LOADV_COMPUTE_PARAMS );
+ }
+ }
+ }
+ } // loop on block sub-shapes
+
+ // load elements
+
+ SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( theBlock );
+ if ( aSubMesh )
+ {
+ SMDS_ElemIteratorPtr elemIt = aSubMesh->GetElements();
+ while ( elemIt->more() ) {
+ SMDS_ElemIteratorPtr nIt = elemIt->next()->nodesIterator();
+ myElemPointIDs.push_back( list< int >() );
+ list< int >& elemPoints = myElemPointIDs.back();
+ while ( nIt->more() )
+ elemPoints.push_back( nodePointIDMap[ nIt->next() ]);
+ }
+ }
+
+ myIsBoundaryPointsFound = true;
+
+ return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : Apply
+//purpose : Compute nodes coordinates applying
+// the loaded pattern to <theBlock>. The (0,0,0) key-point
+// will be mapped into <theVertex000>. The (0,0,1)
+// fifth key-point will be mapped into <theVertex001>.
+//=======================================================================
+
+bool SMESH_Pattern::Apply (const TopoDS_Shell& theBlock,
+ const TopoDS_Vertex& theVertex000,
+ const TopoDS_Vertex& theVertex001)
+{
+ MESSAGE(" ::Apply(volume) " );
+
+ TBlock block( theBlock );
+
+ if (!findBoundaryPoints() || // bind ID to points
+ !setShapeToMesh( theBlock )) // check theBlock is a suitable shape
+ return false;
+
+ if (!block.LoadBlockShapes( theVertex000, theVertex001, myShapeIDMap )) // bind ID to shape
+ return setErrorCode( ERR_APPLV_BAD_SHAPE );
+
+ // compute XYZ of points on shapes
+
+ for ( int shapeID = 1; shapeID <= myShapeIDMap.Extent(); shapeID++ )
+ {
+ list< TPoint* > & shapePoints = getShapePoints( shapeID );
+ list< TPoint* >::iterator pIt = shapePoints.begin();
+ const TopoDS_Shape& S = myShapeIDMap( shapeID );
+ switch ( S.ShapeType() )
+ {
+ case TopAbs_VERTEX: {
+
+ for ( ; pIt != shapePoints.end(); pIt++ )
+ block.VertexPoint( shapeID, (*pIt)->myXYZ.ChangeCoord() );
+ break;
+ }
+ case TopAbs_EDGE: {
+
+ for ( ; pIt != shapePoints.end(); pIt++ )
+ block.EdgePoint( shapeID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+ break;
+ }
+ case TopAbs_FACE: {
+
+ for ( ; pIt != shapePoints.end(); pIt++ )
+ block.FacePoint( shapeID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+ break;
+ }
+ default:
+ for ( ; pIt != shapePoints.end(); pIt++ )
+ block.ShellPoint( (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
+ }
+ } // loop on block sub-shapes
+
+ myIsComputed = true;
+
+ return setErrorCode( ERR_OK );
+}
+
+//=======================================================================
+//function : MakeMesh
+//purpose : Create nodes and elements in <theMesh> using nodes
+// coordinates computed by either of Apply...() methods
+//=======================================================================
+
+bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
+{
+ MESSAGE(" ::MakeMesh() " );
+ if ( !myIsComputed )
+ return setErrorCode( ERR_MAKEM_NOT_COMPUTED );
+
+ SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
+
+ // clear elements and nodes existing on myShape
+ SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape );
+ SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape );
+ if ( aSubMesh )
+ aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
+ else if ( aSubMeshDS )
+ {
+ SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
+ while ( eIt->more() )
+ aMeshDS->RemoveElement( eIt->next() );
+ SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
+ while ( nIt->more() )
+ aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
+ }
+
+ // loop on sub-shapes of myShape: create nodes and build point-node map
+ typedef map< TPoint*, const SMDS_MeshNode* > TPointNodeMap;
+ TPointNodeMap pointNodeMap;
+ map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
+ for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
+ {
+ const TopoDS_Shape & S = myShapeIDMap( (*idPointIt).first );
+ list< TPoint* > & points = (*idPointIt).second;
+ SMESHDS_SubMesh * subMeshDS = aMeshDS->MeshElements( S );
+ SMESH_subMesh * subMesh = theMesh->GetSubMeshContaining( myShape );
+ list< TPoint* >::iterator pIt = points.begin();
+ for ( ; pIt != points.end(); pIt++ )
+ {
+ TPoint* point = *pIt;
+ if ( pointNodeMap.find( point ) != pointNodeMap.end() )
+ continue;
+ SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
+ point->myXYZ.Y(),
+ point->myXYZ.Z());
+ pointNodeMap.insert( TPointNodeMap::value_type( point, node ));
+ if ( subMeshDS ) {
+ switch ( S.ShapeType() ) {
+ case TopAbs_VERTEX: {
+ aMeshDS->SetNodeOnVertex( node, TopoDS::Vertex( S ));
+ break;
+ }
+ case TopAbs_EDGE: {
+ aMeshDS->SetNodeOnEdge( node, TopoDS::Edge( S ));
+ SMDS_EdgePosition* epos =
+ dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
+ epos->SetUParameter( point->myU );
+ break;
+ }
+ case TopAbs_FACE: {
+ aMeshDS->SetNodeOnFace( node, TopoDS::Face( S ));
+ SMDS_FacePosition* pos =
+ dynamic_cast<SMDS_FacePosition *>(node->GetPosition().get());
+ pos->SetUParameter( point->myUV.X() );
+ pos->SetVParameter( point->myUV.Y() );
+ break;
+ }
+ default:
+ aMeshDS->SetNodeInVolume( node, TopoDS::Shell( S ));
+ }
+ }
+ }
+ // make that SMESH_subMesh::_computeState = COMPUTE_OK
+ // so that operations with hypotheses will erase the mesh
+ // being built
+ if ( subMesh )
+ subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+ }
+
+ // create elements
+ list<list< int > >::iterator epIt = myElemPointIDs.begin();
+ for ( ; epIt != myElemPointIDs.end(); epIt++ )
+ {
+ list< int > & elemPoints = *epIt;
+ // retrieve nodes
+ const SMDS_MeshNode* nodes[ 8 ];
+ list< int >::iterator iIt = elemPoints.begin();
+ int nbNodes;
+ for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) {
+ nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]];
+ }
+ // add an element
+ const SMDS_MeshElement* elem = 0;
+ if ( myIs2D ) {
+ switch ( nbNodes ) {
+ case 3:
+ elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
+ case 4:
+ elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
+ default:;
+ }
+ }
+ else {
+ switch ( nbNodes ) {
+ case 4:
+ elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3] ); break;
+ case 5:
+ elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
+ nodes[4] ); break;
+ case 6:
+ elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
+ nodes[4], nodes[5] ); break;
+ case 8:
+ elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
+ nodes[4], nodes[5], nodes[6], nodes[7] ); break;
+ default:;
+ }
+ }
+ if ( elem )
+ aMeshDS->SetMeshElementOnShape( elem, myShape );
+ }
+
+ return setErrorCode( ERR_OK );
+}
+
+
+//=======================================================================
+//function : arrangeBoundaries
+//purpose : if there are several wires, arrange boundaryPoints so that
+// the outer wire goes first and fix inner wires orientation
+// update myKeyPointIDs to correspond to the order of key-points
+// in boundaries; sort internal boundaries by the nb of key-points
+//=======================================================================
+
+void SMESH_Pattern::arrangeBoundaries (list< list< TPoint* > >& boundaryList)
+{
+ int nbBoundaries = boundaryList.size();
+ if ( nbBoundaries < 2 ) return;
+
+ typedef list< list< TPoint* > >::iterator TListOfListIt;
+ TListOfListIt bndIt;
+
+ // sort boundaries by nb of key-points
+ if ( nbBoundaries > 2 )
+ {
+ // move boundaries in tmp list
+ list< list< TPoint* > > tmpList;
+ tmpList.splice( tmpList.begin(), boundaryList, boundaryList.begin(), boundaryList.end());
+ // make a map nb-key-points to boundary-position-in-tmpList,
+ // boundary-positions get ordered in it
+ typedef map< int, TListOfListIt > TNbKpBndPosMap;
+ TNbKpBndPosMap nbKpBndPosMap;
+ bndIt = tmpList.begin();
+ list< int >::iterator nbKpIt = myNbKeyPntInBoundary.begin();
+ for ( ; nbKpIt != myNbKeyPntInBoundary.end(); nbKpIt++, bndIt++ ) {
+ int nb = *nbKpIt * nbBoundaries;
+ while ( nbKpBndPosMap.find ( nb ) != nbKpBndPosMap.end() )
+ nb++;
+ nbKpBndPosMap.insert( TNbKpBndPosMap::value_type( nb, bndIt ));
+ }
+ // move boundaries back to boundaryList
+ TNbKpBndPosMap::iterator nbKpBndPosIt = nbKpBndPosMap.begin();
+ for ( ; nbKpBndPosIt != nbKpBndPosMap.end(); nbKpBndPosIt++ ) {
+ TListOfListIt & bndPos2 = (*nbKpBndPosIt).second;
+ TListOfListIt bndPos1 = bndPos2++;
+ boundaryList.splice( boundaryList.end(), tmpList, bndPos1, bndPos2 );
+ }
+ }
+
+ // Look for the outer boundary: the one with the point with the least X
+ double leastX = DBL_MAX;
+ list< TPoint* >::iterator pIt;
+ TListOfListIt outerBndPos;
+ for ( bndIt = boundaryList.begin(); bndIt != boundaryList.end(); bndIt++ )
+ {
+ list< TPoint* >& boundary = (*bndIt);
+ for ( pIt = boundary.begin(); pIt != boundary.end(); pIt++)
+ {
+ TPoint* point = *pIt;
+ if ( point->myInitXYZ.X() < leastX ) {
+ leastX = point->myInitXYZ.X();
+ outerBndPos = bndIt;
+ }
+ }
+ }
+
+ if ( outerBndPos != boundaryList.begin() )
+ boundaryList.splice( boundaryList.begin(), boundaryList, outerBndPos, ++outerBndPos );
+
+
+ // Check boundaries orientation and re-fill myKeyPointIDs
+
+ set< TPoint* > keyPointSet;
+ list< int >::iterator kpIt = myKeyPointIDs.begin();
+ for ( ; kpIt != myKeyPointIDs.end(); kpIt++ )
+ keyPointSet.insert( & myPoints[ *kpIt ]);
+ myKeyPointIDs.clear();
+
+ // update myNbKeyPntInBoundary also
+ list< int >::iterator nbKpIt = myNbKeyPntInBoundary.begin();
+
+ for ( bndIt = boundaryList.begin(); bndIt != boundaryList.end(); bndIt++, nbKpIt++ )
+ {
+ // find the point with the least X
+ double leastX = DBL_MAX;
+ list< TPoint* >::iterator xpIt;
+ list< TPoint* >& boundary = (*bndIt);
+ for ( pIt = boundary.begin(); pIt != boundary.end(); pIt++)
+ {
+ TPoint* point = *pIt;
+ if ( point->myInitXYZ.X() < leastX ) {
+ leastX = point->myInitXYZ.X();
+ xpIt = pIt;
+ }
+ }
+ // find points next to the point with the least X
+ TPoint* p = *xpIt, *pPrev, *pNext;
+ if ( p == boundary.front() )
+ pPrev = boundary.back();
+ else {
+ xpIt--;
+ pPrev = *xpIt;
+ xpIt++;
+ }
+ if ( p == boundary.back() )
+ pNext = boundary.front();
+ else {
+ xpIt++;
+ pNext = *xpIt;
+ }
+ // vectors of boundary direction near <p>
+ gp_Vec2d v1( pPrev->myInitUV, p->myInitUV ), v2( p->myInitUV, pNext->myInitUV );
+ // rotate vectors counterclockwise
+ v1.SetCoord( -v1.Y(), v1.X() );
+ v2.SetCoord( -v2.Y(), v2.X() );
+ // in-face direction
+ gp_Vec2d dirInFace = v1 + v2;
+ // for the outer boundary dirInFace should go to the right
+ bool reverse;
+ if ( bndIt == boundaryList.begin() ) // outer boundary
+ reverse = dirInFace.X() < 0;
+ else
+ reverse = dirInFace.X() > 0;
+ if ( reverse )
+ boundary.reverse();
+
+ // Put key-point IDs of a well-oriented boundary in myKeyPointIDs
+ (*nbKpIt) = 0; // count nb of key-points again
+ pIt = boundary.begin();
+ for ( ; pIt != boundary.end(); pIt++)
+ {
+ TPoint* point = *pIt;
+ if ( keyPointSet.find( point ) == keyPointSet.end() )
+ continue;
+ // find an index of a keypoint
+ int index = 0;
+ vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+ for ( ; pVecIt != myPoints.end(); pVecIt++, index++ )
+ if ( &(*pVecIt) == point )
+ break;
+ myKeyPointIDs.push_back( index );
+ (*nbKpIt)++;
+ }
+ myKeyPointIDs.pop_back(); // remove the first key-point from the back
+ (*nbKpIt)--;
+
+ } // loop on a list of boundaries
+
+ ASSERT( myKeyPointIDs.size() == keyPointSet.size() );
+}
+
+//=======================================================================
+//function : findBoundaryPoints
+//purpose : if loaded from file, find points to map on edges and faces and
+// compute their parameters
+//=======================================================================
+
+bool SMESH_Pattern::findBoundaryPoints()
+{
+ if ( myIsBoundaryPointsFound ) return true;
+
+ MESSAGE(" findBoundaryPoints() ");
+
+ if ( myIs2D )
+ {
+ set< TPoint* > pointsInElems;
+
+ // Find free links of elements:
+ // put links of all elements in a set and remove links encountered twice
+
+ typedef pair< TPoint*, TPoint*> TLink;
+ set< TLink > linkSet;
+ list<list< int > >::iterator epIt = myElemPointIDs.begin();
+ for ( ; epIt != myElemPointIDs.end(); epIt++ )
+ {
+ list< int > & elemPoints = *epIt;
+ list< int >::iterator pIt = elemPoints.begin();
+ int prevP = elemPoints.back();
+ for ( ; pIt != elemPoints.end(); pIt++ ) {
+ TPoint* p1 = & myPoints[ prevP ];
+ TPoint* p2 = & myPoints[ *pIt ];
+ TLink link(( p1 < p2 ? p1 : p2 ), ( p1 < p2 ? p2 : p1 ));
+ ASSERT( link.first != link.second );
+ pair<set< TLink >::iterator,bool> itUniq = linkSet.insert( link );
+ if ( !itUniq.second )
+ linkSet.erase( itUniq.first );
+ prevP = *pIt;
+
+ pointsInElems.insert( p1 );
+ }
+ }
+ // Now linkSet contains only free links,
+ // find the points order that they have in boundaries
+
+ // 1. make a map of key-points
+ set< TPoint* > keyPointSet;
+ list< int >::iterator kpIt = myKeyPointIDs.begin();
+ for ( ; kpIt != myKeyPointIDs.end(); kpIt++ )
+ keyPointSet.insert( & myPoints[ *kpIt ]);
+
+ // 2. chain up boundary points
+ list< list< TPoint* > > boundaryList;
+ boundaryList.push_back( list< TPoint* >() );
+ list< TPoint* > * boundary = & boundaryList.back();
+
+ TPoint *point1, *point2, *keypoint1;
+ kpIt = myKeyPointIDs.begin();
+ point1 = keypoint1 = & myPoints[ *kpIt++ ];
+ // loop on free links: look for the next point
+ int iKeyPoint = 0;
+ set< TLink >::iterator lIt = linkSet.begin();
+ while ( lIt != linkSet.end() )
+ {
+ if ( (*lIt).first == point1 )
+ point2 = (*lIt).second;
+ else if ( (*lIt).second == point1 )
+ point2 = (*lIt).first;
+ else {
+ lIt++;
+ continue;
+ }
+ linkSet.erase( lIt );
+ lIt = linkSet.begin();
+
+ if ( keyPointSet.find( point2 ) == keyPointSet.end() ) // not a key-point
+ {
+ boundary->push_back( point2 );
+ }
+ else // a key-point found
+ {
+ keyPointSet.erase( point2 ); // keyPointSet contains not found key-points only
+ iKeyPoint++;
+ if ( point2 != keypoint1 ) // its not the boundary end
+ {
+ boundary->push_back( point2 );
+ }
+ else // the boundary end reached
+ {
+ boundary->push_front( keypoint1 );
+ boundary->push_back( keypoint1 );
+ myNbKeyPntInBoundary.push_back( iKeyPoint );
+ if ( keyPointSet.empty() )
+ break; // all boundaries containing key-points are found
+
+ // prepare to search for the next boundary
+ boundaryList.push_back( list< TPoint* >() );
+ boundary = & boundaryList.back();
+ point2 = keypoint1 = (*keyPointSet.begin());
+ }
+ }
+ point1 = point2;
+ } // loop on the free links set
+
+ if ( boundary->empty() ) {
+ MESSAGE(" a separate key-point");
+ return setErrorCode( ERR_READ_BAD_KEY_POINT );
+ }
+
+ // if there are several wires, arrange boundaryPoints so that
+ // the outer wire goes first and fix inner wires orientation;
+ // sort myKeyPointIDs to correspond to the order of key-points
+ // in boundaries
+ arrangeBoundaries( boundaryList );
+
+ // Find correspondence shape ID - points,
+ // compute points parameter on edge
+
+ keyPointSet.clear();
+ for ( kpIt = myKeyPointIDs.begin(); kpIt != myKeyPointIDs.end(); kpIt++ )
+ keyPointSet.insert( & myPoints[ *kpIt ]);
+
+ set< TPoint* > edgePointSet; // to find in-face points
+ int vertexID = 1; // the first index in TopTools_IndexedMapOfShape
+ int edgeID = myKeyPointIDs.size() + 1;
+
+ list< list< TPoint* > >::iterator bndIt = boundaryList.begin();
+ for ( ; bndIt != boundaryList.end(); bndIt++ )
+ {
+ boundary = & (*bndIt);
+ double edgeLength = 0;
+ list< TPoint* >::iterator pIt = boundary->begin();
+ getShapePoints( edgeID ).push_back( *pIt );
+ for ( pIt++; pIt != boundary->end(); pIt++)
+ {
+ list< TPoint* > & edgePoints = getShapePoints( edgeID );
+ TPoint* prevP = edgePoints.empty() ? 0 : edgePoints.back();
+ TPoint* point = *pIt;
+ edgePointSet.insert( point );
+ if ( keyPointSet.find( point ) == keyPointSet.end() ) // inside-edge point
+ {
+ edgePoints.push_back( point );
+ edgeLength += ( point->myInitUV - prevP->myInitUV ).SquareModulus();
+ point->myInitU = edgeLength;
+ }
+ else // a key-point
+ {
+ // treat points on the edge which ends up: compute U [0,1]
+ edgePoints.push_back( point );
+ if ( edgePoints.size() > 2 ) {
+ edgeLength += ( point->myInitUV - prevP->myInitUV ).SquareModulus();
+ list< TPoint* >::iterator epIt = edgePoints.begin();
+ for ( ; epIt != edgePoints.end(); epIt++ )
+ (*epIt)->myInitU /= edgeLength;
+ }
+ // begin the next edge treatment
+ edgeLength = 0;
+ getShapePoints( vertexID++ ).push_back( point );
+ edgeID++;
+ if ( point != boundary->front() )
+ getShapePoints( edgeID ).push_back( point );
+ }
+ }
+ }
+
+ // find in-face points
+ list< TPoint* > & facePoints = getShapePoints( edgeID );
+ vector< TPoint >::iterator pVecIt = myPoints.begin();
+ for ( ; pVecIt != myPoints.end(); pVecIt++ ) {
+ TPoint* point = &(*pVecIt);
+ if ( edgePointSet.find( point ) == edgePointSet.end() &&
+ pointsInElems.find( point ) != pointsInElems.end())
+ facePoints.push_back( point );
+ }
+
+ } // 2D case
+
+ else // 3D case
+ {
+ // bind points to shapes according to point parameters
+ vector< TPoint >::iterator pVecIt = myPoints.begin();
+ for ( int i = 0; pVecIt != myPoints.end(); pVecIt++, i++ ) {
+ TPoint* point = &(*pVecIt);
+ int shapeID = TBlock::GetShapeIDByParams( point->myInitXYZ );
+ getShapePoints( shapeID ).push_back( point );
+ // detect key-points
+ if ( TBlock::IsVertexID( shapeID ))
+ myKeyPointIDs.push_back( i );
+ }
+ }
+
+ myIsBoundaryPointsFound = true;
+ return myIsBoundaryPointsFound;
+}
+
+//=======================================================================
+//function : Clear
+//purpose : clear fields
+//=======================================================================
+
+void SMESH_Pattern::Clear()
+{
+ myIsComputed = myIsBoundaryPointsFound = false;
+
+ myPoints.clear();
+ myKeyPointIDs.clear();
+ myElemPointIDs.clear();
+ myShapeIDToPointsMap.clear();
+ myShapeIDMap.Clear();
+ myShape.Nullify();
+ myNbKeyPntInBoundary.clear();
+}
+
+//=======================================================================
+//function : setShapeToMesh
+//purpose : set a shape to be meshed. Return True if meshing is possible
+//=======================================================================
+
+bool SMESH_Pattern::setShapeToMesh(const TopoDS_Shape& theShape)
+{
+ if ( !IsLoaded() ) {
+ MESSAGE( "Pattern not loaded" );
+ return setErrorCode( ERR_APPL_NOT_LOADED );
+ }
+
+ TopAbs_ShapeEnum aType = theShape.ShapeType();
+ bool dimOk = ( myIs2D ? aType == TopAbs_FACE : aType == TopAbs_SHELL );
+ if ( !dimOk ) {
+ MESSAGE( "Pattern dimention mismatch" );
+ return setErrorCode( ERR_APPL_BAD_DIMENTION );
+ }
+
+ // check if a face is closed
+ int nbNodeOnSeamEdge = 0;
+ if ( myIs2D ) {
+ TopoDS_Face face = TopoDS::Face( theShape );
+ TopExp_Explorer eExp( theShape, TopAbs_EDGE );
+ for ( ; eExp.More() && nbNodeOnSeamEdge == 0; eExp.Next() )
+ if ( BRep_Tool::IsClosed( TopoDS::Edge( eExp.Current() ), face ))
+ nbNodeOnSeamEdge = 2;
+ }
+
+ // check nb of vertices
+ TopTools_IndexedMapOfShape vMap;
+ TopExp::MapShapes( theShape, TopAbs_VERTEX, vMap );
+ if ( vMap.Extent() + nbNodeOnSeamEdge != myKeyPointIDs.size() ) {
+ MESSAGE( myKeyPointIDs.size() << " != " << vMap.Extent() );
+ return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
+ }
+
+ myShapeIDMap.Clear();
+ myShape = theShape;
+ return true;
+}
+
+//=======================================================================
+//function : GetMappedPoints
+//purpose : Return nodes coordinates computed by Apply() method
+//=======================================================================
+
+bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints )
+{
+ thePoints.clear();
+ if ( !myIsComputed )
+ return false;
+
+ vector< TPoint >::iterator pVecIt = myPoints.begin();
+ for ( ; pVecIt != myPoints.end(); pVecIt++ )
+ thePoints.push_back( & (*pVecIt).myXYZ.XYZ() );
+
+ return ( thePoints.size() > 0 );
+}
+
+
+//=======================================================================
+//function : GetPoints
+//purpose : Return nodes coordinates of the pattern
+//=======================================================================
+
+bool SMESH_Pattern::GetPoints ( list< const gp_XYZ * > & thePoints ) const
+{
+ thePoints.clear();
+
+ if ( !IsLoaded() )
+ return false;
+
+ vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+ for ( ; pVecIt != myPoints.end(); pVecIt++ )
+ thePoints.push_back( & (*pVecIt).myInitXYZ );
+
+ return ( thePoints.size() > 0 );
+}
+
+//=======================================================================
+//function : getShapePoints
+//purpose : return list of points located on theShape
+//=======================================================================
+
+list< SMESH_Pattern::TPoint* > &
+ SMESH_Pattern::getShapePoints(const TopoDS_Shape& theShape)
+{
+ int aShapeID;
+ if ( !myShapeIDMap.Contains( theShape ))
+ aShapeID = myShapeIDMap.Add( theShape );
+ else
+ aShapeID = myShapeIDMap.FindIndex( theShape );
+
+ return myShapeIDToPointsMap[ aShapeID ];
+}
+
+//=======================================================================
+//function : getShapePoints
+//purpose : return list of points located on the shape
+//=======================================================================
+
+list< SMESH_Pattern::TPoint* > & SMESH_Pattern::getShapePoints(const int theShapeID)
+{
+ return myShapeIDToPointsMap[ theShapeID ];
+}
+
+//=======================================================================
+//function : DumpPoints
+//purpose : Debug
+//=======================================================================
+
+void SMESH_Pattern::DumpPoints() const
+{
+#ifdef _DEBUG_
+ vector< TPoint >::const_iterator pVecIt = myPoints.begin();
+ for ( int i = 0; pVecIt != myPoints.end(); pVecIt++, i++ )
+ cout << i << ": " << *pVecIt;
+#endif
+}
+
+//=======================================================================
+//function : TPoint()
+//purpose :
+//=======================================================================
+
+SMESH_Pattern::TPoint::TPoint()
+{
+#ifdef _DEBUG_
+ myInitXYZ.SetCoord(0,0,0);
+ myInitUV.SetCoord(0.,0.);
+ myInitU = 0;
+ myXYZ.SetCoord(0,0,0);
+ myUV.SetCoord(0.,0.);
+ myU = 0;
+#endif
+}
+
+//=======================================================================
+//function : operator <<
+//purpose :
+//=======================================================================
+
+ostream & operator <<(ostream & OS, const SMESH_Pattern::TPoint& p)
+{
+ gp_XYZ xyz = p.myInitXYZ;
+ OS << "\tinit( xyz( " << xyz.X() << " " << xyz.Y() << " " << xyz.Z() << " )";
+ gp_XY xy = p.myInitUV;
+ OS << " uv( " << xy.X() << " " << xy.Y() << " )";
+ double u = p.myInitU;
+ OS << " u( " << u << " )) " << &p << endl;
+ xyz = p.myXYZ.XYZ();
+ OS << "\t ( xyz( " << xyz.X() << " " << xyz.Y() << " " << xyz.Z() << " )";
+ xy = p.myUV;
+ OS << " uv( " << xy.X() << " " << xy.Y() << " )";
+ u = p.myU;
+ OS << " u( " << u << " ))" << endl;
+
+ return OS;
+}
+
+//=======================================================================
+//function : TBlock::TEdge::GetU
+//purpose :
+//=======================================================================
+
+double TBlock::TEdge::GetU( const gp_XYZ& theParams ) const
+{
+ double u = theParams.Coord( myCoordInd );
+ return ( 1 - u ) * myFirst + u * myLast;
+}
+
+//=======================================================================
+//function : TBlock::TEdge::Point
+//purpose :
+//=======================================================================
+
+gp_XYZ TBlock::TEdge::Point( const gp_XYZ& theParams ) const
+{
+ gp_XYZ p = myC3d->Value( GetU( theParams )).XYZ();
+ if ( myTrsf.Form() != gp_Identity )
+ myTrsf.Transforms( p );
+ return p;
+}
+
+//=======================================================================
+//function : TBlock::TFace::GetUV
+//purpose :
+//=======================================================================
+
+gp_XY TBlock::TFace::GetUV( const gp_XYZ& theParams ) const
+{
+ gp_XY uv(0.,0.);
+ double dU = theParams.Coord( GetUInd() );
+ double dV = theParams.Coord( GetVInd() );
+ for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
+ {
+ double Ecoef = 0, Vcoef = 0;
+ switch ( iE ) {
+ case 0:
+ Ecoef = ( 1 - dV ); // u0
+ Vcoef = ( 1 - dU ) * ( 1 - dV ); break; // 00
+ case 1:
+ Ecoef = dV; // u1
+ Vcoef = dU * ( 1 - dV ); break; // 10
+ case 2:
+ Ecoef = ( 1 - dU ); // 0v
+ Vcoef = dU * dV ; break; // 11
+ case 3:
+ Ecoef = dU ; // 1v
+ Vcoef = ( 1 - dU ) * dV ; break; // 01
+ default:;
+ }
+ // edge addition
+ double u = theParams.Coord( myCoordInd[ iE ] );
+ u = ( 1 - u ) * myFirst[ iE ] + u * myLast[ iE ];
+ uv += Ecoef * myC2d[ iE ]->Value( u ).XY();
+ // corner addition
+ uv -= Vcoef * myCorner[ iE ];
+ }
+ return uv;
+}
+
+//=======================================================================
+//function : TBlock::TFace::Point
+//purpose :
+//=======================================================================
+
+gp_XYZ TBlock::TFace::Point( const gp_XYZ& theParams ) const
+{
+ gp_XY uv = GetUV( theParams );
+ gp_XYZ p = myS->Value( uv.X(), uv.Y() ).XYZ();
+ if ( myTrsf.Form() != gp_Identity )
+ myTrsf.Transforms( p );
+ return p;
+}
+
+//=======================================================================
+//function : GetShapeCoef
+//purpose :
+//=======================================================================
+
+double* TBlock::GetShapeCoef (const int theShapeID)
+{
+ static double shapeCoef[][3] = {
+ // V000, V100, V010, V110
+ { -1,-1,-1 }, { 1,-1,-1 }, { -1, 1,-1 }, { 1, 1,-1 },
+ // V001, V101, V011, V111,
+ { -1,-1, 1 }, { 1,-1, 1 }, { -1, 1, 1 }, { 1, 1, 1 },
+ // Ex00, Ex10, Ex01, Ex11,
+ { 0,-1,-1 }, { 0, 1,-1 }, { 0,-1, 1 }, { 0, 1, 1 },
+ // E0y0, E1y0, E0y1, E1y1,
+ { -1, 0,-1 }, { 1, 0,-1 }, { -1, 0, 1 }, { 1, 0, 1 },
+ // E00z, E10z, E01z, E11z,
+ { -1,-1, 0 }, { 1,-1, 0 }, { -1, 1, 0 }, { 1, 1, 0 },
+ // Fxy0, Fxy1, Fx0z, Fx1z, F0yz, F1yz,
+ { 0, 0,-1 }, { 0, 0, 1 }, { 0,-1, 0 }, { 0, 1, 0 }, { -1, 0, 0 }, { 1, 0, 0 },
+ // ID_Shell
+ { 0, 0, 0 }
+ };
+ if ( theShapeID < ID_V000 || theShapeID > ID_F1yz )
+ return shapeCoef[ ID_Shell - 1 ];
+
+ return shapeCoef[ theShapeID - 1 ];
+}
+
+//=======================================================================
+//function : ShellPoint
+//purpose : return coordinates of a point in shell
+//=======================================================================
+
+bool TBlock::ShellPoint( const gp_XYZ& theParams, gp_XYZ& thePoint ) const
+{
+ thePoint.SetCoord( 0., 0., 0. );
+ for ( int shapeID = ID_V000; shapeID < ID_Shell; shapeID++ )
+ {
+ // coef
+ double* coefs = GetShapeCoef( shapeID );
+ double k = 1;
+ for ( int iCoef = 0; iCoef < 3; iCoef++ ) {
+ if ( coefs[ iCoef ] != 0 ) {
+ if ( coefs[ iCoef ] < 0 )
+ k *= ( 1. - theParams.Coord( iCoef + 1 ));
+ else
+ k *= theParams.Coord( iCoef + 1 );
+ }
+ }
+ // point on a shape
+ gp_XYZ Ps;
+ if ( shapeID < ID_Ex00 ) // vertex
+ VertexPoint( shapeID, Ps );
+ else if ( shapeID < ID_Fxy0 ) { // edge
+ EdgePoint( shapeID, theParams, Ps );
+ k = -k;
+ } else // face
+ FacePoint( shapeID, theParams, Ps );
+
+ thePoint += k * Ps;
+ }
+ return true;
+}
+
+//=======================================================================
+//function : NbVariables
+//purpose :
+//=======================================================================
+
+Standard_Integer TBlock::NbVariables() const
+{
+ return 3;
+}
+
+//=======================================================================
+//function : NbEquations
+//purpose :
+//=======================================================================
+
+Standard_Integer TBlock::NbEquations() const
+{
+ return 1;
+}
+
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+
+Standard_Boolean TBlock::Value(const math_Vector& theXYZ, math_Vector& theFxyz)
+{
+ gp_XYZ P, params( theXYZ(1), theXYZ(2), theXYZ(3) );
+ if ( params.IsEqual( myParam, DBL_MIN )) { // same param
+ theFxyz( 1 ) = myValues[ 0 ];
+ }
+ else {
+ ShellPoint( params, P );
+ gp_Vec dP( P - myPoint );
+ theFxyz(1) = SQRT_FUNC ? dP.SquareMagnitude() : dP.Magnitude();
+ }
+ return true;
+}
+
+//=======================================================================
+//function : Derivatives
+//purpose :
+//=======================================================================
+
+Standard_Boolean TBlock::Derivatives(const math_Vector& XYZ,math_Matrix& Df)
+{
+ MESSAGE( "TBlock::Derivatives()");
+ math_Vector F(1,3);
+ return Values(XYZ,F,Df);
+}
+
+//=======================================================================
+//function : Values
+//purpose :
+//=======================================================================
+
+Standard_Boolean TBlock::Values(const math_Vector& theXYZ,
+ math_Vector& theFxyz,
+ math_Matrix& theDf)
+{
+// MESSAGE( endl<<"TBlock::Values( "<<theXYZ(1)<<", "<<theXYZ(2)<<", "<<theXYZ(3)<<")");
+
+ gp_XYZ P, params( theXYZ(1), theXYZ(2), theXYZ(3) );
+ if ( params.IsEqual( myParam, DBL_MIN )) { // same param
+ theFxyz( 1 ) = myValues[ 0 ];
+ theDf( 1,1 ) = myValues[ 1 ];
+ theDf( 1,2 ) = myValues[ 2 ];
+ theDf( 1,3 ) = myValues[ 3 ];
+ return true;
+ }
+
+ ShellPoint( params, P );
+ //myNbIterations++; // how many time call ShellPoint()
+
+ gp_Vec dP( P - myPoint );
+ theFxyz(1) = SQRT_FUNC ? dP.SquareMagnitude() : dP.Magnitude();
+ if ( theFxyz(1) < 1e-6 ) {
+ myParam = params;
+ myValues[ 0 ]= 0;
+ theDf( 1,1 ) = 0;
+ theDf( 1,2 ) = 0;
+ theDf( 1,3 ) = 0;
+ return true;
+ }
+
+ if ( theFxyz(1) < myValues[0] )
+ {
+ // 3 partial derivatives
+ gp_Vec drv[ 3 ];
+ for ( int iP = 1; iP <= 3; iP++ ) {
+ gp_XYZ Pi;
+ params.SetCoord( iP, theXYZ( iP ) + 0.001 );
+ ShellPoint( params, Pi );
+ params.SetCoord( iP, theXYZ( iP ) ); // restore params
+ gp_Vec dPi ( P, Pi );
+ double mag = dPi.Magnitude();
+ if ( mag > DBL_MIN )
+ dPi /= mag;
+ drv[ iP - 1 ] = dPi;
+ }
+ for ( int iP = 0; iP < 3; iP++ ) {
+ if ( iP == myFaceIndex )
+ theDf( 1, iP + 1 ) = myFaceParam;
+ else {
+ // like IntAna_IntConicQuad::Perform (const gp_Lin& L, const gp_Pln& P)
+ // where L is (P -> myPoint), P is defined by the 2 other derivative direction
+ int iPrev = ( iP ? iP - 1 : 2 );
+ int iNext = ( iP == 2 ? 0 : iP + 1 );
+ gp_Vec plnNorm = drv[ iPrev ].Crossed( drv [ iNext ] );
+ double Direc = plnNorm * drv[ iP ];
+ if ( Abs(Direc) <= DBL_MIN )
+ theDf( 1, iP + 1 ) = dP * drv[ iP ];
+ else {
+ double Dis = plnNorm * P - plnNorm * myPoint;
+ theDf( 1, iP + 1 ) = Dis/Direc;
+ }
+ }
+ }
+ //myNbIterations +=3; // how many time call ShellPoint()
+
+ // store better values
+ myParam = params;
+ myValues[0]= theFxyz(1);
+ myValues[1]= theDf(1,1);
+ myValues[2]= theDf(1,2);
+ myValues[3]= theDf(1,3);
+
+// SCRUTE( theFxyz(1) );
+// SCRUTE( theDf( 1,1 ));
+// SCRUTE( theDf( 1,2 ));
+// SCRUTE( theDf( 1,3 ));
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : ComputeParameters
+//purpose : compute point parameters in the block
+//=======================================================================
+
+bool TBlock::ComputeParameters(const gp_Pnt& thePoint,
+ gp_XYZ& theParams,
+ const int theShapeID)
+{
+// MESSAGE( endl<<"TBlock::ComputeParameters( "
+// <<thePoint.X()<<", "<<thePoint.Y()<<", "<<thePoint.Z()<<")");
+
+ myPoint = thePoint.XYZ();
+
+ myParam.SetCoord( -1,-1,-1 );
+ myValues[0] = 1e100;
+
+ const bool isOnFace = IsFaceID( theShapeID );
+ double * coef = GetShapeCoef( theShapeID );
+
+ // the first guess
+ math_Vector start( 1, 3, 0.0 );
+ if ( !myGridComputed )
+ {
+ // define the first guess by thePoint projection on lines
+ // connecting vertices
+ bool needGrid = false;
+ gp_XYZ par000( 0, 0, 0 ), par111( 1, 1, 1 );
+ double zero = DBL_MIN * DBL_MIN;
+ for ( int iEdge = 0, iParam = 1; iParam <= 3 && !needGrid; iParam++ )
+ {
+ if ( isOnFace && coef[ iParam - 1 ] != 0 ) {
+ iEdge += 4;
+ continue;
+ }
+ for ( int iE = 0; iE < 4; iE++, iEdge++ ) { // loop on 4 parallel edges
+ gp_Pnt p0 = myEdge[ iEdge ].Point( par000 );
+ gp_Pnt p1 = myEdge[ iEdge ].Point( par111 );
+ gp_Vec v01( p0, p1 ), v0P( p0, thePoint );
+ double len2 = v01.SquareMagnitude();
+ double par = 0;
+ if ( len2 > zero ) {
+ par = v0P.Dot( v01 ) / len2;
+ if ( par < 0 || par > 1 ) {
+ needGrid = true;
+ break;
+ }
+ }
+ start( iParam ) += par;
+ }
+ start( iParam ) /= 4.;
+ }
+ if ( needGrid ) {
+ // compute nodes of 3 x 3 x 3 grid
+ int iNode = 0;
+ for ( double x = 0.25; x < 0.9; x += 0.25 )
+ for ( double y = 0.25; y < 0.9; y += 0.25 )
+ for ( double z = 0.25; z < 0.9; z += 0.25 ) {
+ TxyzPair & prmPtn = my3x3x3GridNodes[ iNode++ ];
+ prmPtn.first.SetCoord( x, y, z );
+ ShellPoint( prmPtn.first, prmPtn.second );
+ }
+ myGridComputed = true;
+ }
+ }
+ if ( myGridComputed ) {
+ double minDist = DBL_MAX;
+ gp_XYZ* bestParam = 0;
+ for ( int iNode = 0; iNode < 27; iNode++ ) {
+ TxyzPair & prmPtn = my3x3x3GridNodes[ iNode ];
+ double dist = ( thePoint.XYZ() - prmPtn.second ).SquareModulus();
+ if ( dist < minDist ) {
+ minDist = dist;
+ bestParam = & prmPtn.first;
+ }
+ }
+ start( 1 ) = bestParam->X();
+ start( 2 ) = bestParam->Y();
+ start( 3 ) = bestParam->Z();
+ }
+
+ int myFaceIndex = -1;
+ if ( isOnFace ) {
+ // put a point on the face
+ for ( int iCoord = 0; iCoord < 3; iCoord++ )
+ if ( coef[ iCoord ] ) {
+ myFaceIndex = iCoord;
+ myFaceParam = ( coef[ myFaceIndex ] < 0.5 ) ? 0.0 : 1.0;
+ start( iCoord + 1 ) = myFaceParam;
+ }
+ }
+ math_Vector low ( 1, 3, 0.0 );
+ math_Vector up ( 1, 3, 1.0 );
+ math_Vector tol ( 1, 3, 1e-4 );
+ math_FunctionSetRoot paramSearch( *this, tol );
+
+ int nbLoops = 0;
+ while ( myValues[0] > 1e-1 && nbLoops++ < 10 ) {
+ paramSearch.Perform ( *this, start, low, up );
+ if ( !paramSearch.IsDone() ) {
+ //MESSAGE( " !paramSearch.IsDone() " );
+ }
+ else {
+ //MESSAGE( " NB ITERATIONS: " << paramSearch.NbIterations() );
+ }
+ start( 1 ) = myParam.X();
+ start( 2 ) = myParam.Y();
+ start( 3 ) = myParam.Z();
+ //MESSAGE( "Distance: " << ( SQRT_FUNC ? sqrt(myValues[0]) : myValues[0] ));
+ }
+// MESSAGE( endl << myParam.X() << " " << myParam.Y() << " " << myParam.Z() << endl);
+// mySumDist += myValues[0];
+// MESSAGE( " TOTAL NB ITERATIONS: " << myNbIterations <<
+// " DIST: " << ( SQRT_FUNC ? sqrt(mySumDist) : mySumDist ));
+
+
+ theParams = myParam;
+
+ return true;
+}
+
+//=======================================================================
+//function : GetStateNumber
+//purpose :
+//=======================================================================
+
+Standard_Integer TBlock::GetStateNumber ()
+{
+// MESSAGE( endl<<"TBlock::GetStateNumber( "<<myParam.X()<<", "<<
+// myParam.Y()<<", "<<myParam.Z()<<") DISTANCE: " << myValues[0]);
+ return myValues[0] < 1e-1;
+}
+
+//=======================================================================
+//function : DumpShapeID
+//purpose : debug an id of a block sub-shape
+//=======================================================================
+
+#define CASEDUMP(id,strm) case id: strm << #id; break;
+
+ostream& TBlock::DumpShapeID (const int id, ostream& stream)
+{
+ switch ( id ) {
+ CASEDUMP( ID_V000, stream );
+ CASEDUMP( ID_V100, stream );
+ CASEDUMP( ID_V010, stream );
+ CASEDUMP( ID_V110, stream );
+ CASEDUMP( ID_V001, stream );
+ CASEDUMP( ID_V101, stream );
+ CASEDUMP( ID_V011, stream );
+ CASEDUMP( ID_V111, stream );
+ CASEDUMP( ID_Ex00, stream );
+ CASEDUMP( ID_Ex10, stream );
+ CASEDUMP( ID_Ex01, stream );
+ CASEDUMP( ID_Ex11, stream );
+ CASEDUMP( ID_E0y0, stream );
+ CASEDUMP( ID_E1y0, stream );
+ CASEDUMP( ID_E0y1, stream );
+ CASEDUMP( ID_E1y1, stream );
+ CASEDUMP( ID_E00z, stream );
+ CASEDUMP( ID_E10z, stream );
+ CASEDUMP( ID_E01z, stream );
+ CASEDUMP( ID_E11z, stream );
+ CASEDUMP( ID_Fxy0, stream );
+ CASEDUMP( ID_Fxy1, stream );
+ CASEDUMP( ID_Fx0z, stream );
+ CASEDUMP( ID_Fx1z, stream );
+ CASEDUMP( ID_F0yz, stream );
+ CASEDUMP( ID_F1yz, stream );
+ CASEDUMP( ID_Shell, stream );
+ default: stream << "ID_INVALID";
+ }
+ return stream;
+}
+
+//=======================================================================
+//function : GetShapeIDByParams
+//purpose : define an id of the block sub-shape by normlized point coord
+//=======================================================================
+
+int TBlock::GetShapeIDByParams ( const gp_XYZ& theCoord )
+{
+ // id ( 0 - 26 ) computation:
+
+ // vertex ( 0 - 7 ) : id = 1*x + 2*y + 4*z
+
+ // edge || X ( 8 - 11 ) : id = 8 + 1*y + 2*z
+ // edge || Y ( 12 - 15 ): id = 1*x + 12 + 2*z
+ // edge || Z ( 16 - 19 ): id = 1*x + 2*y + 16
+
+ // face || XY ( 20 - 21 ): id = 8 + 12 + 1*z - 0
+ // face || XZ ( 22 - 23 ): id = 8 + 1*y + 16 - 2
+ // face || YZ ( 24 - 25 ): id = 1*x + 12 + 16 - 4
+
+ static int iAddBnd[] = { 1, 2, 4 };
+ static int iAddNotBnd[] = { 8, 12, 16 };
+ static int iFaceSubst[] = { 0, 2, 4 };
+
+ int id = 0;
+ int iOnBoundary = 0;
+ for ( int iCoord = 0; iCoord < 3; iCoord++ )
+ {
+ double val = theCoord.Coord( iCoord + 1 );
+ if ( val == 0.0 )
+ iOnBoundary++;
+ else if ( val == 1.0 )
+ id += iAddBnd[ iOnBoundary++ ];
+ else
+ id += iAddNotBnd[ iCoord ];
+ }
+ if ( iOnBoundary == 1 ) // face
+ id -= iFaceSubst[ (id - 20) / 4 ];
+ else if ( iOnBoundary == 0 ) // shell
+ id = 26;
+
+ if ( id > 26 || id < 0 ) {
+ MESSAGE( "GetShapeIDByParams() = " << id
+ <<" "<< theCoord.X() <<" "<< theCoord.Y() <<" "<< theCoord.Z() );
+ }
+
+ return id + 1; // shape ids start at 1
+}
+
+//=======================================================================
+//function : LoadBlockShapes
+//purpose : add sub-shapes of theBlock to theShapeIDMap so that they get
+// IDs acoording to enum TBlockShapeID
+//=======================================================================
+
+bool TBlock::LoadBlockShapes(const TopoDS_Vertex& theVertex000,
+ const TopoDS_Vertex& theVertex001,
+// TopTools_IndexedMapOfShape& theShapeIDMap
+ TopTools_IndexedMapOfOrientedShape& theShapeIDMap )
+{
+ MESSAGE(" ::LoadBlockShapes()");
+ myGridComputed = false;
+
+ // 6 vertices
+ TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111;
+ // 12 edges
+ TopoDS_Shape Ex00, Ex10, Ex01, Ex11;
+ TopoDS_Shape E0y0, E1y0, E0y1, E1y1;
+ TopoDS_Shape E00z, E10z, E01z, E11z;
+ // 6 faces
+ TopoDS_Shape Fxy0, Fx0z, F0yz, Fxy1, Fx1z, F1yz;
+
+ // nb of faces bound to a vertex in TopTools_IndexedDataMapOfShapeListOfShape
+ // filled by TopExp::MapShapesAndAncestors()
+ const int NB_FACES_BY_VERTEX = 6;
+
+ TopTools_IndexedDataMapOfShapeListOfShape vfMap;
+ TopExp::MapShapesAndAncestors( myShell, TopAbs_VERTEX, TopAbs_FACE, vfMap );
+ if ( vfMap.Extent() != 8 ) {
+ MESSAGE(" Wrong nb of vertices in the block: " << vfMap.Extent() );
+ return false;
+ }
+
+ V000 = theVertex000;
+ V001 = theVertex001;
+
+ if ( V000.IsNull() ) {
+ // find vertex 000 - the one with smallest coordinates
+ double minVal = DBL_MAX, minX, val;
+ for ( int i = 1; i <= 8; i++ ) {
+ const TopoDS_Vertex& v = TopoDS::Vertex( vfMap.FindKey( i ));
+ gp_Pnt P = BRep_Tool::Pnt( v );
+ val = P.X() + P.Y() + P.Z();
+ if ( val < minVal || ( val == minVal && P.X() < minX )) {
+ V000 = v;
+ minVal = val;
+ minX = P.X();
+ }
+ }
+ // find vertex 001 - the one on the most vertical edge passing through V000
+ TopTools_IndexedDataMapOfShapeListOfShape veMap;
+ TopExp::MapShapesAndAncestors( myShell, TopAbs_VERTEX, TopAbs_EDGE, veMap );
+ gp_Vec dir001 = gp::DZ();
+ gp_Pnt p000 = BRep_Tool::Pnt( TopoDS::Vertex( V000 ));
+ double maxVal = -DBL_MAX;
+ TopTools_ListIteratorOfListOfShape eIt ( veMap.FindFromKey( V000 ));
+ for ( ; eIt.More(); eIt.Next() ) {
+ const TopoDS_Edge& e = TopoDS::Edge( eIt.Value() );
+ TopoDS_Vertex v = TopExp::FirstVertex( e );
+ if ( v.IsSame( V000 ))
+ v = TopExp::LastVertex( e );
+ val = dir001 * gp_Vec( p000, BRep_Tool::Pnt( v )).Normalized();
+ if ( val > maxVal ) {
+ V001 = v;
+ maxVal = val;
+ }
+ }
+ }
+
+ // find the bottom (Fxy0), Fx0z and F0yz faces
+
+ const TopTools_ListOfShape& f000List = vfMap.FindFromKey( V000 );
+ const TopTools_ListOfShape& f001List = vfMap.FindFromKey( V001 );
+ if (f000List.Extent() != NB_FACES_BY_VERTEX ||
+ f001List.Extent() != NB_FACES_BY_VERTEX ) {
+ MESSAGE(" LoadBlockShapes() " << f000List.Extent() << " " << f001List.Extent());
+ return false;
+ }
+ TopTools_ListIteratorOfListOfShape f001It, f000It ( f000List );
+ int i, j, iFound1, iFound2;
+ for ( j = 0; f000It.More(); f000It.Next(), j++ )
+ {
+ if ( NB_FACES_BY_VERTEX == 6 && j % 2 ) continue; // each face encounters twice
+ const TopoDS_Shape& F = f000It.Value();
+ for ( i = 0, f001It.Initialize( f001List ); f001It.More(); f001It.Next(), i++ ) {
+ if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
+ if ( F.IsSame( f001It.Value() ))
+ break;
+ }
+ if ( f001It.More() ) // Fx0z or F0yz found
+ if ( Fx0z.IsNull() ) {
+ Fx0z = F;
+ iFound1 = i;
+ } else {
+ F0yz = F;
+ iFound2 = i;
+ }
+ else // F is the bottom face
+ Fxy0 = F;
+ }
+ if ( Fxy0.IsNull() || Fx0z.IsNull() || F0yz.IsNull() ) {
+ MESSAGE( Fxy0.IsNull() <<" "<< Fx0z.IsNull() <<" "<< F0yz.IsNull() );
+ return false;
+ }
+
+ // choose the top face (Fxy1)
+ for ( i = 0, f001It.Initialize( f001List ); f001It.More(); f001It.Next(), i++ ) {
+ if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
+ if ( i != iFound1 && i != iFound2 )
+ break;
+ }
+ Fxy1 = f001It.Value();
+ if ( Fxy1.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+
+ // find bottom edges and veritices
+ list< TopoDS_Edge > eList;
+ list< int > nbVertexInWires;
+ getOrderedEdges( TopoDS::Face( Fxy0 ), TopoDS::Vertex( V000 ), eList, nbVertexInWires );
+ if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+ list< TopoDS_Edge >::iterator elIt = eList.begin();
+ for ( i = 0; elIt != eList.end(); elIt++, i++ )
+ switch ( i ) {
+ case 0: E0y0 = *elIt; V010 = TopExp::LastVertex( *elIt, true ); break;
+ case 1: Ex10 = *elIt; V110 = TopExp::LastVertex( *elIt, true ); break;
+ case 2: E1y0 = *elIt; V100 = TopExp::LastVertex( *elIt, true ); break;
+ case 3: Ex00 = *elIt; break;
+ default:;
+ }
+ if ( i != 4 || E0y0.IsNull() || Ex10.IsNull() || E1y0.IsNull() || Ex00.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error, eList.size()=" << eList.size());
+ return false;
+ }
+
+
+ // find top edges and veritices
+ eList.clear();
+ getOrderedEdges( TopoDS::Face( Fxy1 ), TopoDS::Vertex( V001 ), eList, nbVertexInWires );
+ if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+ for ( i = 0, elIt = eList.begin(); elIt != eList.end(); elIt++, i++ )
+ switch ( i ) {
+ case 0: Ex01 = *elIt; V101 = TopExp::LastVertex( *elIt, true ); break;
+ case 1: E1y1 = *elIt; V111 = TopExp::LastVertex( *elIt, true ); break;
+ case 2: Ex11 = *elIt; V011 = TopExp::LastVertex( *elIt, true ); break;
+ case 3: E0y1 = *elIt; break;
+ default:;
+ }
+ if ( i != 4 || Ex01.IsNull() || E1y1.IsNull() || Ex11.IsNull() || E0y1.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error, eList.size()=" << eList.size());
+ return false;
+ }
+
+ // swap Fx0z and F0yz if necessary
+ TopExp_Explorer exp( Fx0z, TopAbs_VERTEX );
+ for ( ; exp.More(); exp.Next() ) // Fx0z shares V101 and V100
+ if ( V101.IsSame( exp.Current() ) || V100.IsSame( exp.Current() ))
+ break; // V101 or V100 found
+ if ( !exp.More() ) { // not found
+ TopoDS_Shape f = Fx0z; Fx0z = F0yz; F0yz = f;
+ }
+
+ // find Fx1z and F1yz faces
+ const TopTools_ListOfShape& f111List = vfMap.FindFromKey( V111 );
+ const TopTools_ListOfShape& f110List = vfMap.FindFromKey( V110 );
+ if (f111List.Extent() != NB_FACES_BY_VERTEX ||
+ f110List.Extent() != NB_FACES_BY_VERTEX ) {
+ MESSAGE(" LoadBlockShapes() " << f111List.Extent() << " " << f110List.Extent());
+ return false;
+ }
+ TopTools_ListIteratorOfListOfShape f111It, f110It ( f110List);
+ for ( j = 0 ; f110It.More(); f110It.Next(), j++ ) {
+ if ( NB_FACES_BY_VERTEX == 6 && j % 2 ) continue; // each face encounters twice
+ const TopoDS_Shape& F = f110It.Value();
+ for ( i = 0, f111It.Initialize( f111List ); f111It.More(); f111It.Next(), i++ ) {
+ if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
+ if ( F.IsSame( f111It.Value() )) { // Fx1z or F1yz found
+ if ( Fx1z.IsNull() )
+ Fx1z = F;
+ else
+ F1yz = F;
+ }
+ }
+ }
+ if ( Fx1z.IsNull() || F1yz.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+
+ // swap Fx1z and F1yz if necessary
+ for ( exp.Init( Fx1z, TopAbs_VERTEX ); exp.More(); exp.Next() )
+ if ( V010.IsSame( exp.Current() ) || V011.IsSame( exp.Current() ))
+ break;
+ if ( !exp.More() ) {
+ TopoDS_Shape f = Fx1z; Fx1z = F1yz; F1yz = f;
+ }
+
+ // find vertical edges
+ for ( exp.Init( Fx0z, TopAbs_EDGE ); exp.More(); exp.Next() ) {
+ const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() );
+ const TopoDS_Shape& vFirst = TopExp::FirstVertex( edge, true );
+ if ( vFirst.IsSame( V001 ))
+ E00z = edge;
+ else if ( vFirst.IsSame( V100 ))
+ E10z = edge;
+ }
+ if ( E00z.IsNull() || E10z.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+ for ( exp.Init( Fx1z, TopAbs_EDGE ); exp.More(); exp.Next() ) {
+ const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() );
+ const TopoDS_Shape& vFirst = TopExp::FirstVertex( edge, true );
+ if ( vFirst.IsSame( V111 ))
+ E11z = edge;
+ else if ( vFirst.IsSame( V010 ))
+ E01z = edge;
+ }
+ if ( E01z.IsNull() || E11z.IsNull() ) {
+ MESSAGE(" LoadBlockShapes() error ");
+ return false;
+ }
+
+ // load shapes in theShapeIDMap
+
+ theShapeIDMap.Clear();
+
+ theShapeIDMap.Add(V000.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V100.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V010.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V110.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V001.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V101.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V011.Oriented( TopAbs_FORWARD ));
+ theShapeIDMap.Add(V111.Oriented( TopAbs_FORWARD ));
+
+ theShapeIDMap.Add(Ex00);
+ theShapeIDMap.Add(Ex10);
+ theShapeIDMap.Add(Ex01);
+ theShapeIDMap.Add(Ex11);
+
+ theShapeIDMap.Add(E0y0);
+ theShapeIDMap.Add(E1y0);
+ theShapeIDMap.Add(E0y1);
+ theShapeIDMap.Add(E1y1);
+
+ theShapeIDMap.Add(E00z);
+ theShapeIDMap.Add(E10z);
+ theShapeIDMap.Add(E01z);
+ theShapeIDMap.Add(E11z);
+
+ theShapeIDMap.Add(Fxy0);
+ theShapeIDMap.Add(Fxy1);
+ theShapeIDMap.Add(Fx0z);
+ theShapeIDMap.Add(Fx1z);
+ theShapeIDMap.Add(F0yz);
+ theShapeIDMap.Add(F1yz);
+
+ theShapeIDMap.Add(myShell);
+
+ if ( theShapeIDMap.Extent() != 27 ) {
+ MESSAGE("LoadBlockShapes() " << theShapeIDMap.Extent() );
+ return false;
+ }
+
+ // store shapes geometry
+ for ( int shapeID = 1; shapeID < theShapeIDMap.Extent(); shapeID++ )
+ {
+ const TopoDS_Shape& S = theShapeIDMap( shapeID );
+ switch ( S.ShapeType() )
+ {
+ case TopAbs_VERTEX: {
+
+ if ( shapeID > ID_V111 ) {
+ MESSAGE(" shapeID =" << shapeID );
+ return false;
+ }
+ myPnt[ shapeID - ID_V000 ] =
+ BRep_Tool::Pnt( TopoDS::Vertex( S )).XYZ();
+ break;
+ }
+ case TopAbs_EDGE: {
+
+ const TopoDS_Edge& edge = TopoDS::Edge( S );
+ if ( shapeID < ID_Ex00 || shapeID > ID_E11z || edge.IsNull() ) {
+ MESSAGE(" shapeID =" << shapeID );
+ return false;
+ }
+ TEdge& tEdge = myEdge[ shapeID - ID_Ex00 ];
+ tEdge.myCoordInd = GetCoordIndOnEdge( shapeID );
+ TopLoc_Location loc;
+ tEdge.myC3d = BRep_Tool::Curve( edge, loc, tEdge.myFirst, tEdge.myLast );
+ if ( !IsForwardEdge( edge, theShapeIDMap ))
+ Swap( tEdge.myFirst, tEdge.myLast );
+ tEdge.myTrsf = loc;
+ break;
+ }
+ case TopAbs_FACE: {
+
+ const TopoDS_Face& face = TopoDS::Face( S );
+ if ( shapeID < ID_Fxy0 || shapeID > ID_F1yz || face.IsNull() ) {
+ MESSAGE(" shapeID =" << shapeID );
+ return false;
+ }
+ TFace& tFace = myFace[ shapeID - ID_Fxy0 ];
+ // pcurves
+ vector< int > edgeIdVec(4, -1);
+ GetFaceEdgesIDs( shapeID, edgeIdVec );
+ for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
+ {
+ const TopoDS_Edge& edge = TopoDS::Edge( theShapeIDMap( edgeIdVec[ iE ]));
+ tFace.myCoordInd[ iE ] = GetCoordIndOnEdge( edgeIdVec[ iE ] );
+ tFace.myC2d[ iE ] =
+ BRep_Tool::CurveOnSurface( edge, face, tFace.myFirst[iE], tFace.myLast[iE] );
+ if ( !IsForwardEdge( edge, theShapeIDMap ))
+ Swap( tFace.myFirst[ iE ], tFace.myLast[ iE ] );
+ }
+ // 2d corners
+ tFace.myCorner[ 0 ] = tFace.myC2d[ 0 ]->Value( tFace.myFirst[0] ).XY();
+ tFace.myCorner[ 1 ] = tFace.myC2d[ 0 ]->Value( tFace.myLast[0] ).XY();
+ tFace.myCorner[ 2 ] = tFace.myC2d[ 1 ]->Value( tFace.myLast[1] ).XY();
+ tFace.myCorner[ 3 ] = tFace.myC2d[ 1 ]->Value( tFace.myFirst[1] ).XY();
+ // sufrace
+ TopLoc_Location loc;
+ tFace.myS = BRep_Tool::Surface( face, loc );
+ tFace.myTrsf = loc;
+ break;
+ }
+ default: break;
+ }
+ } // loop on shapes in theShapeIDMap
+
+ return true;
+}
+
+//=======================================================================
+//function : GetFaceEdgesIDs
+//purpose : return edges IDs in the order u0, u1, 0v, 1v
+// u0 means "|| u, v == 0"
+//=======================================================================
+
+void TBlock::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
+{
+ switch ( faceID ) {
+ case ID_Fxy0:
+ edgeVec[ 0 ] = ID_Ex00;
+ edgeVec[ 1 ] = ID_Ex10;
+ edgeVec[ 2 ] = ID_E0y0;
+ edgeVec[ 3 ] = ID_E1y0;
+ break;
+ case ID_Fxy1:
+ edgeVec[ 0 ] = ID_Ex01;
+ edgeVec[ 1 ] = ID_Ex11;
+ edgeVec[ 2 ] = ID_E0y1;
+ edgeVec[ 3 ] = ID_E1y1;
+ break;
+ case ID_Fx0z:
+ edgeVec[ 0 ] = ID_Ex00;
+ edgeVec[ 1 ] = ID_Ex01;
+ edgeVec[ 2 ] = ID_E00z;
+ edgeVec[ 3 ] = ID_E10z;
+ break;
+ case ID_Fx1z:
+ edgeVec[ 0 ] = ID_Ex10;
+ edgeVec[ 1 ] = ID_Ex11;
+ edgeVec[ 2 ] = ID_E01z;
+ edgeVec[ 3 ] = ID_E11z;
+ break;
+ case ID_F0yz:
+ edgeVec[ 0 ] = ID_E0y0;
+ edgeVec[ 1 ] = ID_E0y1;
+ edgeVec[ 2 ] = ID_E00z;
+ edgeVec[ 3 ] = ID_E01z;
+ break;
+ case ID_F1yz:
+ edgeVec[ 0 ] = ID_E1y0;
+ edgeVec[ 1 ] = ID_E1y1;
+ edgeVec[ 2 ] = ID_E10z;
+ edgeVec[ 3 ] = ID_E11z;
+ break;
+ default:
+ MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID );
+ }
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+// File : SMESH_Pattern.hxx
+// Created : Mon Aug 2 10:30:00 2004
+// Author : Edward AGAPOV (eap)
+
+#ifndef SMESH_Pattern_HeaderFile
+#define SMESH_Pattern_HeaderFile
+
+#include <vector>
+#include <list>
+#include <map>
+#include <iostream>
+
+#include <TopoDS_Shape.hxx>
+//#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_IndexedMapOfOrientedShape.hxx>
+#include <gp_XYZ.hxx>
+#include <gp_XY.hxx>
+#include <gp_Pnt.hxx>
+
+class SMESH_Mesh;
+class TopoDS_Shell;
+class TopoDS_Vertex;
+class TopoDS_Face;
+class TopoDS_Edge;
+
+//
+// Class allowing meshing by mapping of pre-defined patterns: it generates
+// a 2D mesh on a geometrical face or a 3D mesh inside a geometrical block
+// of 6 faces.
+//
+
+class SMESH_Pattern {
+ public:
+
+ SMESH_Pattern ();
+
+ void Clear();
+ // clear fields
+
+ bool Load (const char* theFileContents);
+ // Load a pattern from <theFile>
+
+ bool Load (SMESH_Mesh* theMesh,
+ const TopoDS_Face& theFace,
+ bool theProject);
+ // Create a pattern from the mesh built on <theFace>.
+ // <theProject>==true makes override nodes positions
+ // on <theFace> computed by mesher
+
+ bool Load (SMESH_Mesh* theMesh,
+ const TopoDS_Shell& theBlock);
+ // Create a pattern from the mesh built on <theBlock>
+
+ bool Save (std::ostream& theFile);
+ // Save the loaded pattern into theFile
+
+ bool Apply (const TopoDS_Face& theFace,
+ const TopoDS_Vertex& theVertexOnKeyPoint1,
+ const bool theReverse);
+ // Compute nodes coordinates applying
+ // the loaded pattern to <theFace>. The first key-point
+ // will be mapped into <theVertexOnKeyPoint1>, which must
+ // be in the outer wire of theFace
+
+ bool Apply (const TopoDS_Shell& theBlock,
+ const TopoDS_Vertex& theVertex000,
+ const TopoDS_Vertex& theVertex001);
+ // Compute nodes coordinates applying
+ // the loaded pattern to <theBlock>. The (0,0,0) key-point
+ // will be mapped into <theVertex000>. The
+ // (0,0,1) key-point will be mapped into <theVertex001>.
+
+ bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints );
+ // Return nodes coordinates computed by Apply() method
+
+ bool MakeMesh(SMESH_Mesh* theMesh);
+ // Create nodes and elements in <theMesh> using nodes
+ // coordinates computed by either of Apply...() methods
+
+
+ // Inquiries
+
+ enum ErrorCode {
+ ERR_OK,
+ // Load(file)
+ ERR_READ_NB_POINTS, // couldn't read nb of points
+ ERR_READ_POINT_COORDS, // invalid nb of point coordinates
+ ERR_READ_TOO_FEW_POINTS, // too few points in a pattern
+ ERR_READ_3D_COORD, // coordinate of 3D point out of [0,1] range
+ ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
+ ERR_READ_BAD_INDEX, // invalid point index
+ ERR_READ_ELEM_POINTS, // invalid nb of points in element
+ ERR_READ_NO_ELEMS, // no elements in a pattern
+ ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
+ // Save(file)
+ ERR_SAVE_NOT_LOADED, // pattern was not loaded
+ // Load(shape)
+ ERR_LOAD_EMPTY_SUBMESH, // no elements to load
+ // Load(face)
+ ERR_LOADF_NARROW_FACE, // too narrow face
+ ERR_LOADF_CLOSED_FACE, // closed face
+ // Load(volume)
+ ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
+ ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
+ // Apply(shape)
+ ERR_APPL_NOT_COMPUTED, // mapping failed
+ ERR_APPL_NOT_LOADED, // pattern was not loaded
+ ERR_APPL_BAD_DIMENTION, // wrong shape dimention
+ ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
+ // Apply(face)
+ ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
+ ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
+ ERR_APPLF_INTERNAL_EEROR, // program error
+ // Apply(volume)
+ ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
+ // MakeMesh
+ ERR_MAKEM_NOT_COMPUTED // mapping failed
+ };
+
+ ErrorCode GetErrorCode() const { return myErrorCode; }
+ // return ErrorCode of the last operation
+
+ bool IsLoaded() const { return !myPoints.empty() && !myElemPointIDs.empty(); }
+ // Return true if a pattern was successfully loaded
+
+ bool Is2D() const { return myIs2D; }
+ // Return true if the loaded pattern is a 2D one
+
+ bool GetPoints ( std::list<const gp_XYZ *> & thePoints ) const;
+ // Return nodes coordinates of the pattern
+
+ const std::list< int > & GetKeyPointIDs () const { return myKeyPointIDs; }
+ // Return indices of key-points within the sequences returned by
+ // GetPoints() and GetMappedPoints()
+
+ const std::list< std::list< int > >& GetElementPointIDs () const
+ { return myElemPointIDs; }
+ // Return nodal connectivity of the elements of the pattern
+
+ void DumpPoints() const;
+ // Debug
+
+
+ private:
+ // private methods
+
+ struct TPoint {
+ gp_XYZ myInitXYZ; // loaded postion
+ gp_XY myInitUV;
+ double myInitU; // [0,1]
+ gp_Pnt myXYZ; // position to compute
+ gp_XY myUV;
+ double myU;
+ TPoint();
+ };
+ friend std::ostream & operator <<(std::ostream & OS, const TPoint& p);
+
+ bool setErrorCode( const ErrorCode theErrorCode )
+ { myErrorCode = theErrorCode; return myErrorCode == ERR_OK; }
+ // set ErrorCode and return true if it is Ok
+
+ bool setShapeToMesh(const TopoDS_Shape& theShape);
+ // Set a shape to be meshed. Return True if meshing is possible
+
+ list< TPoint* > & getShapePoints(const TopoDS_Shape& theShape);
+ // Return list of points located on theShape.
+ // A list of edge-points include vertex-points (for 2D pattern only).
+ // A list of face-points doesnt include edge-points.
+ // A list of volume-points doesnt include face-points.
+
+ list< TPoint* > & getShapePoints(const int theShapeID);
+ // Return list of points located on the shape
+
+ bool findBoundaryPoints();
+ // If loaded from file, find points to map on edges and faces and
+ // compute their parameters
+
+ void arrangeBoundaries (list< list< TPoint* > >& boundaryPoints);
+ // if there are several wires, arrange boundaryPoints so that
+ // the outer wire goes first and fix inner wires orientation;
+ // update myKeyPointIDs to correspond to the order of key-points
+ // in boundaries; sort internal boundaries by the nb of key-points
+
+ void computeUVOnEdge( const TopoDS_Edge& theEdge, const list< TPoint* > & ePoints );
+ // compute coordinates of points on theEdge
+
+ bool compUVByIsoIntersection (const list< list< TPoint* > >& boundaryPoints,
+ const gp_XY& theInitUV,
+ gp_XY& theUV );
+ // compute UV by intersection of iso-lines found by points on edges
+
+ bool compUVByElasticIsolines(const list< list< TPoint* > >& boundaryPoints,
+ const list< TPoint* >& pointsToCompute);
+ // compute UV as nodes of iso-poly-lines consisting of
+ // segments keeping relative size as in the pattern
+
+ double setFirstEdge (list< TopoDS_Edge > & theWire, int theFirstEdgeID);
+ // choose the best first edge of theWire; return the summary distance
+ // between point UV computed by isolines intersection and
+ // eventual UV got from edge p-curves
+
+ typedef list< list< TopoDS_Edge > > TListOfEdgesList;
+
+ bool sortSameSizeWires (TListOfEdgesList & theWireList,
+ const TListOfEdgesList::iterator& theFromWire,
+ const TListOfEdgesList::iterator& theToWire,
+ const int theFirstEdgeID,
+ list< list< TPoint* > >& theEdgesPointsList );
+ // sort wires in theWireList from theFromWire until theToWire,
+ // the wires are set in the order to correspond to the order
+ // of boundaries; after sorting, edges in the wires are put
+ // in a good order, point UVs on edges are computed and points
+ // are appended to theEdgesPointsList
+
+ private:
+ // fields
+
+ bool myIs2D;
+ std::vector< TPoint > myPoints;
+ std::list< int > myKeyPointIDs;
+ std::list< std::list< int > > myElemPointIDs;
+
+ ErrorCode myErrorCode;
+ bool myIsComputed;
+ bool myIsBoundaryPointsFound;
+
+ TopoDS_Shape myShape;
+ // all functions assure that shapes are indexed so that first go
+ // ordered vertices, then ordered edge, then faces and a shell
+ TopTools_IndexedMapOfOrientedShape myShapeIDMap;
+ //TopTools_IndexedMapOfShape myShapeIDMap;
+ std::map< int, list< TPoint* > > myShapeIDToPointsMap;
+
+ std::list< int > myNbKeyPntInBoundary; //for the 2d case
+};
+
+
+#endif
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
+#ifdef _DEBUG_
+#include <gp_Pnt.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#endif
+
//=============================================================================
/*!
* default constructor:
_subMeshDS = meshDS->MeshElements(_subShape); // may be null ...
_father = father;
_Id = Id;
- _vertexSet = false; // only for Vertex subMesh
_dependenceAnalysed = false;
if (_subShape.ShapeType() == TopAbs_VERTEX)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
SMESH_subMesh *SMESH_subMesh::GetFirstToCompute()
{
- //MESSAGE("SMESH_subMesh::GetFirstToCompute");
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
- SMESH_subMesh *firstToCompute = 0;
+ //MESSAGE("SMESH_subMesh::GetFirstToCompute");
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+ SMESH_subMesh *firstToCompute = 0;
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
-// SCRUTE(sm->GetId());
-// SCRUTE(sm->GetComputeState());
- bool readyToCompute = (sm->GetComputeState() == READY_TO_COMPUTE);
- if (readyToCompute)
- {
- firstToCompute = sm;
- //SCRUTE(sm->GetId());
- break;
- }
- }
- if (firstToCompute)
- {
- //MESSAGE("--- submesh to compute");
- return firstToCompute; // a subMesh of this
- }
- if (_computeState == READY_TO_COMPUTE)
- {
- //MESSAGE("--- this to compute");
- return this; // this
- }
- //MESSAGE("--- nothing to compute");
- return 0; // nothing to compute
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+ // SCRUTE(sm->GetId());
+ // SCRUTE(sm->GetComputeState());
+ bool readyToCompute = (sm->GetComputeState() == READY_TO_COMPUTE);
+ if (readyToCompute)
+ {
+ firstToCompute = sm;
+ //SCRUTE(sm->GetId());
+ break;
+ }
+ }
+ if (firstToCompute)
+ {
+ return firstToCompute; // a subMesh of this
+ }
+ if (_computeState == READY_TO_COMPUTE)
+ {
+ return this; // this
+ }
+ return 0; // nothing to compute
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool SMESH_subMesh::SubMeshesComputed()
{
- //MESSAGE("SMESH_subMesh::SubMeshesComputed");
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+ //MESSAGE("SMESH_subMesh::SubMeshesComputed");
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
- bool subMeshesComputed = true;
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
-
- const TopoDS_Shape & ss = sm->GetSubShape();
- int type = ss.ShapeType();
-// SCRUTE(sm->GetId());
-// SCRUTE(sm->GetComputeState());
- bool computeOk = (sm->GetComputeState() == COMPUTE_OK);
- if (!computeOk)
- {
- subMeshesComputed = false;
-
- switch (type)
- {
- case TopAbs_COMPOUND:
- {
- MESSAGE("The not computed sub mesh is a COMPOUND");
- break;
- }
- case TopAbs_COMPSOLID:
- {
- MESSAGE("The not computed sub mesh is a COMPSOLID");
- break;
- }
- case TopAbs_SHELL:
- {
- MESSAGE("The not computed sub mesh is a SHEL");
- break;
- }
- case TopAbs_WIRE:
- {
- MESSAGE("The not computed sub mesh is a WIRE");
- break;
- }
- case TopAbs_SOLID:
- {
- MESSAGE("The not computed sub mesh is a SOLID");
- break;
- }
- case TopAbs_FACE:
- {
- MESSAGE("The not computed sub mesh is a FACE");
- break;
- }
- case TopAbs_EDGE:
- {
- MESSAGE("The not computed sub mesh is a EDGE");
- break;
- }
- default:
- {
- MESSAGE("The not computed sub mesh is of unknown type");
- break;
- }
- }
-
- SCRUTE(sm->GetId());
- break;
- }
- }
- return subMeshesComputed;
+ bool subMeshesComputed = true;
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+
+ const TopoDS_Shape & ss = sm->GetSubShape();
+ int type = ss.ShapeType();
+ bool computeOk = (sm->GetComputeState() == COMPUTE_OK);
+ if (!computeOk)
+ {
+ subMeshesComputed = false;
+
+ switch (type)
+ {
+ case TopAbs_COMPOUND:
+ {
+ MESSAGE("The not computed sub mesh is a COMPOUND");
+ break;
+ }
+ case TopAbs_COMPSOLID:
+ {
+ MESSAGE("The not computed sub mesh is a COMPSOLID");
+ break;
+ }
+ case TopAbs_SHELL:
+ {
+ MESSAGE("The not computed sub mesh is a SHEL");
+ break;
+ }
+ case TopAbs_WIRE:
+ {
+ MESSAGE("The not computed sub mesh is a WIRE");
+ break;
+ }
+ case TopAbs_SOLID:
+ {
+ MESSAGE("The not computed sub mesh is a SOLID");
+ break;
+ }
+ case TopAbs_FACE:
+ {
+ MESSAGE("The not computed sub mesh is a FACE");
+ break;
+ }
+ case TopAbs_EDGE:
+ {
+ MESSAGE("The not computed sub mesh is a EDGE");
+ break;
+ }
+ default:
+ {
+ MESSAGE("The not computed sub mesh is of unknown type");
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+ return subMeshesComputed;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool SMESH_subMesh::SubMeshesReady()
{
- MESSAGE("SMESH_subMesh::SubMeshesReady");
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+ MESSAGE("SMESH_subMesh::SubMeshesReady");
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
- bool subMeshesReady = true;
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
-// SCRUTE(sm->GetId());
-// SCRUTE(sm->GetComputeState());
- bool computeOk = ((sm->GetComputeState() == COMPUTE_OK)
- || (sm->GetComputeState() == READY_TO_COMPUTE));
- if (!computeOk)
- {
- subMeshesReady = false;
- SCRUTE(sm->GetId());
- break;
- }
- }
- return subMeshesReady;
+ bool subMeshesReady = true;
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+ bool computeOk = ((sm->GetComputeState() == COMPUTE_OK)
+ || (sm->GetComputeState() == READY_TO_COMPUTE));
+ if (!computeOk)
+ {
+ subMeshesReady = false;
+ SCRUTE(sm->GetId());
+ break;
+ }
+ }
+ return subMeshesReady;
}
//=============================================================================
/*!
- * Construct dependence on first level subMeshes. complex shapes (compsolid,
+ * Construct dependence on first level subMeshes. complex shapes (compsolid,
* shell, wire) are not analysed the same way as simple shapes (solid, face,
- * edge).
+ * edge).
* For collection shapes (compsolid, shell, wire) prepare a list of submeshes
* with possible multiples occurences. Multiples occurences corresponds to
* internal frontiers within shapes of the collection and must not be keeped.
const map < int, SMESH_subMesh * >&SMESH_subMesh::DependsOn()
{
- if (_dependenceAnalysed)
- return _mapDepend;
+ if (_dependenceAnalysed)
+ return _mapDepend;
- //MESSAGE("SMESH_subMesh::DependsOn");
+ //MESSAGE("SMESH_subMesh::DependsOn");
- int type = _subShape.ShapeType();
- //SCRUTE(type);
- switch (type)
- {
- case TopAbs_COMPOUND:
- {
- //MESSAGE("compound");
- list < TopoDS_Shape > shellInSolid;
- for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- for (TopExp_Explorer
- exp2(exp.Current(), TopAbs_SHELL); exp2.More(); exp2.Next())
- {
- shellInSolid.push_back(exp2.Current());
- }
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_SHELL); exp.More();
- exp.Next())
- {
- list < TopoDS_Shape >::iterator it1;
- bool isInSolid = false;
- for (it1 = shellInSolid.begin(); it1 != shellInSolid.end(); it1++)
- {
- TopoDS_Shape aShape = (*it1);
- if (aShape.IsSame(exp.Current()))
- {
- isInSolid = true;
- break;
- }
- }
- if (!isInSolid)
- InsertDependence(exp.Current()); //only shell not in solid
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_COMPSOLID:
- {
+ int type = _subShape.ShapeType();
+ //SCRUTE(type);
+ switch (type)
+ {
+ case TopAbs_COMPOUND:
+ {
+ //MESSAGE("compound");
+ for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ for (TopExp_Explorer exp(_subShape, TopAbs_SHELL, TopAbs_SOLID); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current()); //only shell not in solid
+ }
+ for (TopExp_Explorer exp(_subShape, TopAbs_FACE, TopAbs_SHELL); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ for (TopExp_Explorer exp(_subShape, TopAbs_EDGE, TopAbs_FACE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_COMPSOLID:
+ {
//MESSAGE("compsolid");
- for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
-// list<TopoDS_Shape> shapeList;
-// for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next())
-// {
-// for (TopExp_Explorer
-// exp2(exp.Current(),TopAbs_FACE);exp2.More();exp2.Next())
-// {
-// shapeList.push_back(exp2.Current());
-// }
-// }
-// FinalizeDependence(shapeList);
- break;
- }
- case TopAbs_SHELL:
- {
- //MESSAGE("shell");
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
-// list<TopoDS_Shape> shapeList;
-// for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next())
-// {
-// for (TopExp_Explorer
-// exp2(exp.Current(),TopAbs_EDGE);exp2.More();exp2.Next())
-// {
-// shapeList.push_back(exp2.Current());
-// }
-// }
-// FinalizeDependence(shapeList);
- break;
- }
- case TopAbs_WIRE:
- {
- //MESSAGE("wire");
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
-// list<TopoDS_Shape> shapeList;
-// for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next())
-// {
-// for (TopExp_Explorer
-// exp2(exp.Current(),TopAbs_VERTEX);exp2.More();exp2.Next())
-// {
-// shapeList.push_back(exp2.Current());
-// }
-// }
-// FinalizeDependence(shapeList);
- break;
- }
- case TopAbs_SOLID:
- {
- //MESSAGE("solid");
-// for (TopExp_Explorer exp(_subShape,TopAbs_SHELL);exp.More();exp.Next())
-// {
-// InsertDependence(exp.Current());
-// }
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_FACE:
- {
- //MESSAGE("face");
-// for (TopExp_Explorer exp(_subShape,TopAbs_WIRE);exp.More();exp.Next())
-// {
-// InsertDependence(exp.Current());
-// }
- for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_EDGE:
- {
- //MESSAGE("edge");
- for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More();
- exp.Next())
- {
+ for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_SHELL:
+ {
+ //MESSAGE("shell");
+ for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_WIRE:
+ {
+ //MESSAGE("wire");
+ for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_SOLID:
+ {
+ //MESSAGE("solid");
+ for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_FACE:
+ {
+ //MESSAGE("face");
+ for (TopExp_Explorer exp(_subShape, TopAbs_EDGE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
+ break;
+ }
+ case TopAbs_EDGE:
+ {
+ //MESSAGE("edge");
+ for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More();
+ exp.Next())
+ {
InsertDependence(exp.Current());
- }
- break;
- }
- case TopAbs_VERTEX:
- {
- break;
- }
- default:
- {
- break;
- }
- }
- _dependenceAnalysed = true;
- return _mapDepend;
+ }
+ break;
+ }
+ case TopAbs_VERTEX:
+ {
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ _dependenceAnalysed = true;
+ return _mapDepend;
}
//=============================================================================
void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape)
{
- //MESSAGE("SMESH_subMesh::InsertDependence");
- SMESH_subMesh *aSubMesh = _father->GetSubMesh(aSubShape);
- int type = aSubShape.ShapeType();
- int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid
- int cle = aSubMesh->GetId();
- cle += 10000000 * ordType; // sort map by ordType then index
- if (_mapDepend.find(cle) == _mapDepend.end())
- {
- _mapDepend[cle] = aSubMesh;
- const map < int, SMESH_subMesh * >&subMap = aSubMesh->DependsOn();
- map < int, SMESH_subMesh * >::const_iterator im;
- for (im = subMap.begin(); im != subMap.end(); im++)
- {
- int clesub = (*im).first;
- SMESH_subMesh *sm = (*im).second;
- if (_mapDepend.find(clesub) == _mapDepend.end())
- _mapDepend[clesub] = sm;
- }
- }
+ //MESSAGE("SMESH_subMesh::InsertDependence");
+ SMESH_subMesh *aSubMesh = _father->GetSubMesh(aSubShape);
+ int type = aSubShape.ShapeType();
+ int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid
+ int cle = aSubMesh->GetId();
+ cle += 10000000 * ordType; // sort map by ordType then index
+ if (_mapDepend.find(cle) == _mapDepend.end())
+ {
+ _mapDepend[cle] = aSubMesh;
+ const map < int, SMESH_subMesh * >&subMap = aSubMesh->DependsOn();
+ map < int, SMESH_subMesh * >::const_iterator im;
+ for (im = subMap.begin(); im != subMap.end(); im++)
+ {
+ int clesub = (*im).first;
+ SMESH_subMesh *sm = (*im).second;
+ if (_mapDepend.find(clesub) == _mapDepend.end())
+ _mapDepend[clesub] = sm;
+ }
+ }
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
return true;
// if ( aHypDim < aShapeDim )
// return ( _father->IsMainShape( _subShape ));
-
+
return false;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//SCRUTE(_algoState);
//SCRUTE(event);
+ SMESH_Hypothesis::Hypothesis_Status aux_ret, ret = SMESH_Hypothesis::HYP_OK;
+
// **** les retour des evenement shape sont significatifs
// (add ou remove fait ou non)
// le retour des evenement father n'indiquent pas que add ou remove fait
int dim = SMESH_Gen::GetShapeDim(_subShape);
- SMESH_Hypothesis::Hypothesis_Status aux_ret, ret = SMESH_Hypothesis::HYP_OK;
if (dim < 1)
- {
- _algoState = HYP_OK;
- return ret;
- }
+ {
+ _algoState = HYP_OK;
+ if (event == ADD_HYP || event == ADD_ALGO)
+ return SMESH_Hypothesis::HYP_BAD_DIM; // do not allow to assign any hyp
+ else
+ return SMESH_Hypothesis::HYP_OK;
+ }
SMESH_Gen* gen =_father->GetGen();
// bool ret = false;
!IsConform( static_cast< SMESH_Algo* >( anHyp )))
return SMESH_Hypothesis::HYP_NOTCONFORM;
}
-
+
// ----------------------------------
// add a hypothesis to DS if possible
// ----------------------------------
if ( ! CanAddHypothesis( anHyp ))
return SMESH_Hypothesis::HYP_BAD_DIM;
- if ( GetNbAttached( _subShape, anHyp ) > 0 )
+ if ( GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
if ( !_meshDS->AddHypothesis(_subShape, anHyp))
case ADD_ALGO: {
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
ASSERT(algo);
- if (algo->CheckHypothesis((*_father),_subShape, ret))
+ if (algo->CheckHypothesis((*_father),_subShape, aux_ret))
SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
break;
// ----------------------------------------------------------------------
-
+
case HYP_OK:
switch (event)
{
{
MESSAGE("two applying algo on the same shape not allowed");
_meshDS->RemoveHypothesis(_subShape, anHyp);
- //ret = SMESH_Hypothesis::HYP_ALREADY_EXIST;
+ if ( !SMESH_Hypothesis::IsStatusFatal( ret ))
+ // ret should be fatal: anHyp was not added
+ ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
else if (SMESH_Hypothesis::IsStatusFatal( ret ))
+ {
_meshDS->RemoveHypothesis(_subShape, anHyp);
+ }
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
{
_meshDS->RemoveHypothesis(_subShape, anHyp);
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
- modifiedHyp = _father->IsUsedHypothesis( anHyp, _subShape ); // new Hyp?
+ else
+ {
+ modifiedHyp = true;
+ }
break;
}
case ADD_ALGO: { //already existing algo : on father ?
else
SetAlgoState(MISSING_HYP);
modifiedHyp = true;
- // report only severe errors
- if ( SMESH_Hypothesis::IsStatusFatal( aux_ret ))
- ret = aux_ret;
break;
}
case REMOVE_ALGO: { // perhaps a father algo applies ?
SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
- modifiedHyp = true;
- // report only severe errors
- if ( SMESH_Hypothesis::IsStatusFatal( aux_ret ))
- ret = aux_ret;
+ // check if same algo remains
+ if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
+ modifiedHyp = true;
}
break;
}
SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
- modifiedHyp = true;
+ // is there the same local hyp or maybe a new father algo applied?
+ if ( !GetSimilarAttached( _subShape, anHyp ) )
+ modifiedHyp = true;
break;
}
case REMOVE_FATHER_ALGO: {
SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
- modifiedHyp = true;
+ // is there the same local algo or maybe a new father algo applied?
+ if ( !GetSimilarAttached( _subShape, anHyp ))
+ modifiedHyp = true;
}
break;
}
break;
}
break;
-
+
// ----------------------------------------------------------------------
-
+
default:
ASSERT(0);
break;
bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
{
- MESSAGE( "SMESH_subMesh::IsConform" );
+// MESSAGE( "SMESH_subMesh::IsConform" );
if ( !theAlgo ) return false;
return true;
SMESH_Gen* gen =_father->GetGen();
-
+
// only local algo is to be checked
if ( gen->IsGlobalAlgo( theAlgo, *_father ))
return true;
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
-SMESH_Hypothesis::Hypothesis_Status
- SMESH_subMesh::SubMeshesAlgoStateEngine(int event,
- SMESH_Hypothesis * anHyp)
+SMESH_Hypothesis::Hypothesis_Status
+ SMESH_subMesh::SubMeshesAlgoStateEngine(int event,
+ SMESH_Hypothesis * anHyp)
{
- //MESSAGE("SMESH_subMesh::SubMeshesAlgoStateEngine");
+ //MESSAGE("SMESH_subMesh::SubMeshesAlgoStateEngine");
SMESH_Hypothesis::Hypothesis_Status ret = SMESH_Hypothesis::HYP_OK;
- //EAP: a wire (dim==1) should notify edges (dim==1)
- //EAP: int dim = SMESH_Gen::GetShapeDim(_subShape);
- if (/*EAP:dim > 1*/ _subShape.ShapeType() < TopAbs_EDGE )
- {
- const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+ //EAP: a wire (dim==1) should notify edges (dim==1)
+ //EAP: int dim = SMESH_Gen::GetShapeDim(_subShape);
+ if (/*EAP:dim > 1*/ _subShape.ShapeType() < TopAbs_EDGE )
+ {
+ const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
- map < int, SMESH_subMesh * >::const_iterator itsub;
- for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
- {
- SMESH_subMesh *sm = (*itsub).second;
- SMESH_Hypothesis::Hypothesis_Status ret2 =
- sm->AlgoStateEngine(event, anHyp);
- if ( ret2 > ret )
- ret = ret2;
- }
- }
+ map < int, SMESH_subMesh * >::const_iterator itsub;
+ for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+ {
+ SMESH_subMesh *sm = (*itsub).second;
+ SMESH_Hypothesis::Hypothesis_Status ret2 =
+ sm->AlgoStateEngine(event, anHyp);
+ if ( ret2 > ret )
+ ret = ret2;
+ }
+ }
return ret;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
if (dim < 1)
{
- if (_vertexSet)
+ if ( IsMeshComputed() )
_computeState = COMPUTE_OK;
else
_computeState = READY_TO_COMPUTE;
- //SCRUTE(_computeState);
return true;
}
SMESH_Gen *gen = _father->GetGen();
SMESH_Algo *algo = 0;
- bool ret;
+ bool ret = true;
SMESH_Hypothesis::Hypothesis_Status hyp_status;
switch (_computeState)
case SUBMESH_COMPUTED: // nothing to do
break;
case SUBMESH_RESTORED:
- ComputeSubMeshStateEngine( SUBMESH_RESTORED );
+ ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
+ break;
+ case MESH_ENTITY_REMOVED:
+ break;
+ case CHECK_COMPUTE_STATE:
+ if ( IsMeshComputed() )
+ _computeState = COMPUTE_OK;
break;
default:
ASSERT(0);
_computeState = FAILED_TO_COMPUTE;
break;
}
+ RemoveSubMeshElementsAndNodes();
// compute
if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput())
ret = ApplyToCollection( algo, GetCollection( gen, algo ) );
else
ret = algo->Compute((*_father), _subShape);
-
+
if (!ret)
{
MESSAGE("problem in algo execution: failed to compute");
_computeState = FAILED_TO_COMPUTE;
if (!algo->NeedDescretBoundary())
UpdateSubMeshState( FAILED_TO_COMPUTE );
+
+#ifdef _DEBUG_
+ // Show vertices location of a failed shape
+ TopExp_Explorer exp( _subShape, TopAbs_VERTEX);
+ for ( ; exp.More(); exp.Next() ) {
+ gp_Pnt P( BRep_Tool::Pnt( TopoDS::Vertex( exp.Current() )));
+ cout << P.X() << " " << P.Y() << " " << P.Z() << " " << endl;
+ }
+#endif
break;
}
else
case SUBMESH_RESTORED:
// check if a mesh is already computed that may
// happen after retrieval from a file
- if ( IsMeshComputed() ) {
+ ComputeStateEngine( CHECK_COMPUTE_STATE );
+ ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
+ break;
+ case MESH_ENTITY_REMOVED:
+ break;
+ case CHECK_COMPUTE_STATE:
+ if ( IsMeshComputed() )
_computeState = COMPUTE_OK;
- }
- ComputeSubMeshStateEngine( SUBMESH_RESTORED );
break;
default:
ASSERT(0);
case SUBMESH_COMPUTED: // nothing to do
break;
case SUBMESH_RESTORED:
- ComputeSubMeshStateEngine( SUBMESH_RESTORED );
+ ComputeStateEngine( CHECK_COMPUTE_STATE );
+ ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
+ break;
+ case MESH_ENTITY_REMOVED:
+ UpdateDependantsState( CHECK_COMPUTE_STATE );
+ ComputeStateEngine( CHECK_COMPUTE_STATE );
+ ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
+ break;
+ case CHECK_COMPUTE_STATE:
+ if ( !IsMeshComputed() )
+ if (_algoState == HYP_OK)
+ _computeState = READY_TO_COMPUTE;
+ else
+ _computeState = NOT_READY;
break;
default:
ASSERT(0);
else
_computeState = NOT_READY;
break;
- case COMPUTE: // nothing to do
+ case COMPUTE: // nothing to do
break;
case CLEAN:
RemoveSubMeshElementsAndNodes();
_computeState = NOT_READY;
break;
case SUBMESH_RESTORED:
- ComputeSubMeshStateEngine( SUBMESH_RESTORED );
+ ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
+ break;
+ case MESH_ENTITY_REMOVED:
+ break;
+ case CHECK_COMPUTE_STATE:
+ if ( IsMeshComputed() )
+ _computeState = COMPUTE_OK;
+ else
+ if (_algoState == HYP_OK)
+ _computeState = READY_TO_COMPUTE;
+ else
+ _computeState = NOT_READY;
break;
default:
ASSERT(0);
//=======================================================================
//function : UpdateSubMeshState
-//purpose :
+//purpose :
//=======================================================================
void SMESH_subMesh::UpdateSubMeshState(const compute_state theState)
//=======================================================================
//function : ComputeSubMeshStateEngine
-//purpose :
+//purpose :
//=======================================================================
void SMESH_subMesh::ComputeSubMeshStateEngine(int event)
//=======================================================================
//function : UpdateDependantsState
-//purpose :
+//purpose :
//=======================================================================
void SMESH_subMesh::UpdateDependantsState(const compute_event theEvent)
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
while(itn->more())
{
const SMDS_MeshNode * node = itn->next();
+ //MESSAGE( " RM node: "<<node->GetID());
meshDS->RemoveNode(node);
}
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
{
MESSAGE("SMESH_subMesh::GetCollection");
ASSERT (!theAlgo->NeedDescretBoundary());
-
+
TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh();
if ( mainShape.IsSame( _subShape ))
list<const SMESHDS_Hypothesis*> aUsedHyp =
theAlgo->GetUsedHypothesis( *_father, _subShape ); // copy
-
+
// put in a compound all shapes with the same hypothesis assigned
// and a good ComputState
}
//=======================================================================
-//function : GetNbAttached
+//function : GetSimilarAttached
//purpose : return nb of hypotheses attached to theShape.
// If theHyp is provided, similar but not same hypotheses
-// are countered; else only applicable ones are countered
-// depending on theAlgos flag
+// are countered; else only applicable ones having theHypType
+// are countered
//=======================================================================
-int SMESH_subMesh::GetNbAttached(const TopoDS_Shape& theShape,
- const SMESH_Hypothesis * theHyp,
- const bool theAlgos)
+const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached(const TopoDS_Shape& theShape,
+ const SMESH_Hypothesis * theHyp,
+ const int theHypType)
{
- int nb = 0;
-
const list<const SMESHDS_Hypothesis*>& aHypList =
_father->GetHypothesisList( theShape );
list<const SMESHDS_Hypothesis*>::const_iterator it = aHypList.begin();
- while (it!=aHypList.end())
+ for ( ; it != aHypList.end(); it++ )
{
const SMESH_Hypothesis* hyp = static_cast< const SMESH_Hypothesis *>( *it );
- it++;
-
if ( theHyp )
{
- // count similar
+ // find similar
if (hyp != theHyp &&
hyp->GetType() == theHyp->GetType() &&
hyp->GetDim() == theHyp->GetDim())
- nb++;
+ return hyp;
}
else
{
- bool isAlgo = ( hyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO );
- if ( theAlgos == isAlgo && IsApplicableHypotesis( hyp ))
- nb++;
+ if ( hyp->GetType() == theHypType && IsApplicableHypotesis( hyp ))
+ return hyp;
}
}
- return nb;
+ return 0;
}
//=======================================================================
//function : CheckConcurentHypothesis
-//purpose : check if there are several applicable hypothesis on fathers
+//purpose : check if there are several applicable hypothesis attached to
+// ansestors
//=======================================================================
SMESH_Hypothesis::Hypothesis_Status
MESSAGE ("SMESH_subMesh::CheckConcurentHypothesis");
// is there local hypothesis on me?
- if ( GetNbAttached( _subShape, 0, theHypType > SMESHDS_Hypothesis::PARAM_ALGO ) > 0 )
+ if ( GetSimilarAttached( _subShape, 0, theHypType ) )
return SMESH_Hypothesis::HYP_OK;
-
+
TopoDS_Shape aPrevWithHyp;
+ const SMESH_Hypothesis* aPrevHyp = 0;
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
for (; it.More(); it.Next())
{
const TopoDS_Shape& ancestor = it.Value();
- if ( GetNbAttached( ancestor, 0, theHypType > SMESHDS_Hypothesis::PARAM_ALGO ) > 0 )
+ const SMESH_Hypothesis* hyp = GetSimilarAttached( ancestor, 0, theHypType );
+ if ( hyp )
{
if ( aPrevWithHyp.IsNull() || aPrevWithHyp.IsSame( ancestor ))
+ {
aPrevWithHyp = ancestor;
- else if ( aPrevWithHyp.ShapeType() == ancestor.ShapeType() )
+ aPrevHyp = hyp;
+ }
+ else if ( aPrevWithHyp.ShapeType() == ancestor.ShapeType() && aPrevHyp != hyp )
return SMESH_Hypothesis::HYP_CONCURENT;
else
return SMESH_Hypothesis::HYP_OK;
const TopoDS_Shape & GetSubShape();
- bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
+// bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
enum compute_state
{
enum compute_event
{
MODIF_HYP, MODIF_ALGO_STATE, COMPUTE,
- CLEAN, CLEANDEP, SUBMESH_COMPUTED, SUBMESH_RESTORED
+ CLEAN, CLEANDEP, SUBMESH_COMPUTED, SUBMESH_RESTORED,
+ MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
};
SMESH_Hypothesis::Hypothesis_Status
SMESH_Hypothesis::Hypothesis_Status CheckConcurentHypothesis (const int theHypType);
// check if there are several applicable hypothesis on fathers
- int GetNbAttached(const TopoDS_Shape& theShape,
- const SMESH_Hypothesis * theHyp,
- const bool theAlgos = false);
- // return nb of hypotheses attached to theShape.
+ const SMESH_Hypothesis* GetSimilarAttached(const TopoDS_Shape& theShape,
+ const SMESH_Hypothesis * theHyp,
+ const int theHypType = 0);
+ // return a hypothesis attached to theShape.
// If theHyp is provided, similar but not same hypotheses
- // are countered; else only applicable ones are countered
- // depending on theAlgos flag
+ // is returned; else an applicable ones having theHypType
+ // is returned
TopoDS_Shape _subShape;
SMESHDS_Mesh * _meshDS;
int _Id;
SMESH_Mesh *_father;
map < int, SMESH_subMesh * >_mapDepend;
- //map < int, SMESH_subMesh * >_mapDependants;
bool _dependenceAnalysed;
- //bool _dependantsFound;
int _algoState;
- //int _oldAlgoState;
int _computeState;
};
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(OCC_KERNEL_LIBS)
+LDFLAGS += $(OCC_KERNEL_LIBS) -lSMDS
# additional file to be cleaned
// Module : SMESH
// $Header:
-using namespace std;
#include "SMESHDS_Command.hxx"
+
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function :
//purpose :
myNumber++;
}
+//=======================================================================
+//function : ChangeElementNodes
+//purpose :
+//=======================================================================
+
+void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
+{
+ if (!myType == SMESHDS_ChangeElementNodes)
+ {
+ MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
+ return;
+ }
+ myIntegers.push_back(ElementID);
+ myIntegers.push_back(nbnodes);
+ for ( int i = 0; i < nbnodes; i++ )
+ myIntegers.push_back( nodes[ i ] );
+
+ myNumber++;
+}
+
+//=======================================================================
+//function : Renumber
+//purpose :
+//=======================================================================
+
+void SMESHDS_Command::Renumber (const bool isNodes, const int startID, const int deltaID)
+{
+ if (!myType == SMESHDS_Renumber)
+ {
+ MESSAGE("SMESHDS_Command::Renumber : Bad Type");
+ return;
+ }
+ myIntegers.push_back(isNodes);
+ myIntegers.push_back(startID);
+ myIntegers.push_back(deltaID);
+ myNumber++;
+}
+
//=======================================================================
//function :
//purpose :
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);
+ void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+ void Renumber (const bool isNodes, const int startID, const int deltaID);
SMESHDS_CommandType GetType();
int GetNumber();
- const list<int> & GetIndexes();
- const list<double> & GetCoords();
+ const std::list<int> & GetIndexes();
+ const std::list<double> & GetCoords();
~SMESHDS_Command();
private:
SMESHDS_CommandType myType;
int myNumber;
- list<double> myReals;
- list<int> myIntegers;
+ std::list<double> myReals;
+ std::list<int> myIntegers;
};
#endif
#ifndef _SMESHDS_CommandType_HeaderFile
#define _SMESHDS_CommandType_HeaderFile
+//#include <Standard_PrimitiveTypes.hxx>
+
enum SMESHDS_CommandType {
SMESHDS_AddNode,
-SMESHDS_AddEdge,
-SMESHDS_AddTriangle,
-SMESHDS_AddQuadrangle,
-SMESHDS_AddTetrahedron,
-SMESHDS_AddPyramid,
-SMESHDS_AddPrism,
-SMESHDS_AddHexahedron,
-SMESHDS_RemoveNode,
-SMESHDS_RemoveElement,
-SMESHDS_MoveNode
+ SMESHDS_AddEdge,
+ SMESHDS_AddTriangle,
+ SMESHDS_AddQuadrangle,
+ SMESHDS_AddTetrahedron,
+ SMESHDS_AddPyramid,
+ SMESHDS_AddPrism,
+ SMESHDS_AddHexahedron,
+ SMESHDS_RemoveNode,
+ SMESHDS_RemoveElement,
+ SMESHDS_MoveNode,
+ SMESHDS_ChangeElementNodes,
+ SMESHDS_Renumber
};
-#ifndef _Standard_PrimitiveTypes_HeaderFile
-#include <Standard_PrimitiveTypes.hxx>
-#endif
-
#endif
#include "SMESHDS_Document.hxx"
#include "utilities.h"
+using namespace std;
+
//=======================================================================
//function : Create
//purpose :
#ifndef _SMESHDS_Document_HeaderFile
#define _SMESHDS_Document_HeaderFile
-#include <map>
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Hypothesis.hxx"
-using namespace std;
+#include <map>
+
class SMESHDS_Document
{
private:
int myUserID;
- map<int,SMESHDS_Mesh*> myMeshes;
- map<int,SMESHDS_Hypothesis*> myHypothesis;
- map<int,SMESHDS_Mesh*>::iterator myMeshesIt;
- map<int,SMESHDS_Hypothesis*>::iterator myHypothesisIt;
+ std::map<int,SMESHDS_Mesh*> myMeshes;
+ std::map<int,SMESHDS_Hypothesis*> myHypothesis;
+ std::map<int,SMESHDS_Mesh*>::iterator myMeshesIt;
+ std::map<int,SMESHDS_Hypothesis*>::iterator myHypothesisIt;
};
#endif
#include <SMESHDS_Group.hxx>
#include <SMESHDS_Mesh.hxx>
+using namespace std;
+
//=============================================================================
/*!
*
*/
//=============================================================================
-SMESHDS_Group::SMESHDS_Group (const SMESHDS_Mesh* theMesh,
+SMESHDS_Group::SMESHDS_Group (const int theID,
+ const SMESHDS_Mesh* theMesh,
const SMDSAbs_ElementType theType)
- : SMDS_MeshGroup(theMesh,theType), myStoreName(""),
+ : SMDS_MeshGroup(theMesh,theType),
+ myID(theID), myStoreName(""),
myCurIndex(0), myCurID(0)
{
}
{
public:
- SMESHDS_Group (const SMESHDS_Mesh* theMesh,
+ SMESHDS_Group (const int theID,
+ const SMESHDS_Mesh* theMesh,
const SMDSAbs_ElementType theType);
+ int GetID() const { return myID; }
+
void SetStoreName (const char* theName)
{ myStoreName = theName; }
const SMDS_MeshElement* findInMesh (const int theID) const;
- string myStoreName;
- int myCurIndex;
- int myCurID;
+ int myID;
+ std::string myStoreName;
+ int myCurIndex;
+ int myCurID;
};
// Module : SMESH
// $Header$
-using namespace std;
-using namespace std;
#include "SMESHDS_Hypothesis.hxx"
+using namespace std;
//=============================================================================
/*!
#ifndef _SMESHDS_HYPOTHESIS_HXX_
#define _SMESHDS_HYPOTHESIS_HXX_
-#if (__GNUC__>2)
#include <string>
-#include <istream>
-#include <ostream>
-#else
-#include <string>
-#include <istream.h>
-#include <ostream.h>
-#endif
-using namespace std;
+#include <iostream>
class SMESHDS_Hypothesis
{
int GetID() const;
int GetType() const;
- virtual ostream & SaveTo(ostream & save)=0;
- virtual istream & LoadFrom(istream & load)=0;
+ virtual std::ostream & SaveTo(std::ostream & save)=0;
+ virtual std::istream & LoadFrom(std::istream & load)=0;
enum hypothesis_type {PARAM_ALGO, ALGO, ALGO_1D, ALGO_2D, ALGO_3D};
protected:
- string _name;
+ std::string _name;
int _hypId;
int _type;
};
// $Header:
#include "SMESHDS_Mesh.hxx"
+
+#include "SMESHDS_Group.hxx"
#include "SMDS_VertexPosition.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx"
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
+#include <TopoDS_Iterator.hxx>
#include "utilities.h"
+
+using namespace std;
+
//=======================================================================
//function : Create
//purpose :
}
//=======================================================================
-//function : AddEdge
+//function : ChangeElementNodes
+//purpose :
+//=======================================================================
+
+bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
+ const SMDS_MeshNode * nodes[],
+ const int nbnodes)
+{
+ if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
+ return false;
+
+ ASSERT( nbnodes < 9 );
+ int i, IDs[ 8 ];
+ for ( i = 0; i < nbnodes; i++ )
+ IDs [ i ] = nodes[ i ]->GetID();
+ myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes);
+
+ return true;
+}
+
+//=======================================================================
+//function : Renumber
+//purpose :
+//=======================================================================
+
+void SMESHDS_Mesh::Renumber (const bool isNodes, const int startID, const int deltaID)
+{
+ SMDS_Mesh::Renumber( isNodes, startID, deltaID );
+ myScript->Renumber( isNodes, startID, deltaID );
+}
+
+//=======================================================================
+//function :AddEdgeWithID
//purpose :
//=======================================================================
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID)
return anElem;
}
//=======================================================================
-//function : removeFromSubMeshes
+//function : removeFromContainers
//purpose :
//=======================================================================
-static void removeFromSubMeshes (map<int,SMESHDS_SubMesh*> & theSubMeshes,
- list<const SMDS_MeshElement *> & theElems,
- const bool isNode)
+static void removeFromContainers (map<int,SMESHDS_SubMesh*> & theSubMeshes,
+ set<SMESHDS_Group*>& theGroups,
+ list<const SMDS_MeshElement *> & theElems,
+ const bool isNode)
{
if ( theElems.empty() )
return;
-
+
+ // Rm from group
+ // Element can belong to several groups
+ if ( !theGroups.empty() )
+ {
+ set<SMESHDS_Group*>::iterator GrIt = theGroups.begin();
+ for ( ; GrIt != theGroups.end(); GrIt++ )
+ {
+ SMESHDS_Group* group = *GrIt;
+ if ( group->IsEmpty() ) continue;
+
+ list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
+ for ( ; elIt != theElems.end(); elIt++ )
+ {
+ (*GrIt)->SMDS_MeshGroup::Remove( *elIt );
+ if ( group->IsEmpty() ) break;
+ }
+ }
+ }
+
+ // Rm from sub-meshes
+ // Element should belong to only one sub-mesh
map<int,SMESHDS_SubMesh*>::iterator SubIt = theSubMeshes.begin();
for ( ; SubIt != theSubMeshes.end(); SubIt++ )
{
+ int size = isNode ? (*SubIt).second->NbNodes() : (*SubIt).second->NbElements();
+ if ( size == 0 ) continue;
+
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
while ( elIt != theElems.end() )
{
SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
- removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
- removeFromSubMeshes( myShapeIndexToSubMesh, removedNodes, true );
+ removeFromContainers( myShapeIndexToSubMesh, myGroups, removedElems, false );
+ removeFromContainers( myShapeIndexToSubMesh, myGroups, removedNodes, true );
}
//=======================================================================
SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false);
- removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
+ removeFromContainers( myShapeIndexToSubMesh, myGroups, removedElems, false );
}
//=======================================================================
return myShape;
}
+//=======================================================================
+//function : IsGroupOfSubShapes
+//purpose :
+//=======================================================================
+
+bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const
+{
+ if ( aSubShape.ShapeType() != TopAbs_COMPOUND || myShape.IsSame( aSubShape ))
+ return false;
+
+ for ( TopoDS_Iterator it( aSubShape ); it.More(); it.Next() )
+ if ( !myIndexToShape.Contains( it.Value() ))
+ return false;
+
+ return true;
+}
+
///////////////////////////////////////////////////////////////////////////////
/// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
/// TopoDS_Shape is unknown
{
if (myShape.IsNull()) MESSAGE("myShape is NULL");
- int Index = myIndexToShape.FindIndex(S);
+ int Index = ShapeToIndex(S);
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
return myShapeIndexToSubMesh[Index];
else
//=======================================================================
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
{
- if (myShape.IsNull()) MESSAGE("myShape is NULL");
- return myIndexToShape.FindIndex(S);
+ if (myShape.IsNull())
+ MESSAGE("myShape is NULL");
+
+ int index = myIndexToShape.FindIndex(S);
+ if ( index == 0 && IsGroupOfSubShapes( S ))
+ {
+ index = myIndexToShape.Add( S );
+ SMESHDS_SubMesh* aSubMesh = new SMESHDS_SubMesh;
+ myShapeIndexToSubMesh[index] = aSubMesh;
+
+ for ( TopoDS_Iterator it( S ); it.More(); it.Next() )
+ {
+ int subIndex = myIndexToShape.FindIndex( it.Value() );
+ NewSubMesh( subIndex );
+ aSubMesh->AddSubMesh( MeshElements( subIndex ));
+ }
+ }
+
+ return index;
}
//=======================================================================
//Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more.
#ifdef __GNUC__
-#if __GNUC__ < 3
- #include <hash_map.h>
- // _CS_gbo_100504 Do not forget to define the namespace alias gstd
- namespace gstd { using ::hash_map; } // inherits globals
-#else
- #include <ext/hash_map>
- namespace gstd = __gnu_cxx;
-#endif
+ #if __GNUC__ < 3
+ #include <hash_map.h>
+ namespace gstd { using ::hash_map; }; // inherit globals
+ #else
+ #include <ext/hash_map>
+ #if __GNUC_MINOR__ == 0
+ namespace gstd = std; // GCC 3.0
+ #else
+ namespace gstd = ::__gnu_cxx; // GCC 3.1 and later
+ #endif
+ #endif
+#else // ... there are other compilers, right?
+ namespace gstd = std;
#endif
+class SMESHDS_Group;
+
class SMESHDS_Mesh:public SMDS_Mesh{
public:
SMESHDS_Mesh(int MeshID);
void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
virtual void RemoveNode(const SMDS_MeshNode *);
void RemoveElement(const SMDS_MeshElement *);
+ bool ChangeElementNodes(const SMDS_MeshElement * elem,
+ const SMDS_MeshNode * nodes[],
+ const int nbnodes);
+ void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S);
void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
+ void AddGroup (SMESHDS_Group* theGroup) { myGroups.insert(theGroup); }
+ void RemoveGroup (SMESHDS_Group* theGroup) { myGroups.erase(theGroup); }
+ int GetNbGroups() const { return myGroups.size(); }
+ const set<SMESHDS_Group*>& GetGroups() const { return myGroups; }
+
+ bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
+
~SMESHDS_Mesh();
private:
};
typedef std::list<const SMESHDS_Hypothesis*> THypList;
typedef gstd::hash_map<TopoDS_Shape,THypList,HashTopoDS_Shape> ShapeToHypothesis;
- ShapeToHypothesis myShapeToHypothesis;
+ ShapeToHypothesis myShapeToHypothesis;
- int myMeshID;
- TopoDS_Shape myShape;
+ int myMeshID;
+ TopoDS_Shape myShape;
TopTools_IndexedMapOfShape myIndexToShape;
- std::map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
- SMESHDS_Script* myScript;
+ map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
+ set<SMESHDS_Group*> myGroups;
+ SMESHDS_Script* myScript;
};
// Module : SMESH
// $Header:
-using namespace std;
#include "SMESHDS_Script.hxx"
+using namespace std;
+
+//=======================================================================
+//function : getCommand
+//purpose :
+//=======================================================================
+SMESHDS_Command* SMESHDS_Script::getCommand(const SMESHDS_CommandType aType)
+{
+ SMESHDS_Command* com;
+ if (myCommands.empty())
+ {
+ com = new SMESHDS_Command(aType);
+ myCommands.insert(myCommands.end(),com);
+ }
+ else
+ {
+ com = myCommands.back();
+ if (com->GetType() != aType)
+ {
+ com = new SMESHDS_Command(aType);
+ myCommands.insert(myCommands.end(),com);
+ }
+ }
+ return com;
+}
+
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z)
{
- SMESHDS_Command* com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddNode);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddNode)
- {
- com = new SMESHDS_Command(SMESHDS_AddNode);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddNode(NewNodeID, x, y, z);
+ getCommand(SMESHDS_AddNode)->AddNode(NewNodeID, x, y, z);
}
//=======================================================================
//=======================================================================
void SMESHDS_Script::AddEdge(int NewEdgeID, int idnode1, int idnode2)
{
- SMESHDS_Command* com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddEdge);
- myCommands.insert(myCommands.end(), com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddEdge)
- {
- com = new SMESHDS_Command(SMESHDS_AddEdge);
- myCommands.insert(myCommands.end(), com);
- }
- }
- com->AddEdge(NewEdgeID, idnode1, idnode2);
+ getCommand(SMESHDS_AddEdge)->AddEdge(NewEdgeID, idnode1, idnode2);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(int NewFaceID,
- int idnode1, int idnode2, int idnode3)
+ int idnode1, int idnode2, int idnode3)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddTriangle);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddTriangle)
- {
- com = new SMESHDS_Command(SMESHDS_AddTriangle);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddFace(NewFaceID, idnode1, idnode2, idnode3);
+ getCommand(SMESHDS_AddTriangle)->AddFace(NewFaceID,
+ idnode1, idnode2, idnode3);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(int NewFaceID,
- int idnode1, int idnode2, int idnode3, int idnode4)
+ int idnode1, int idnode2,
+ int idnode3, int idnode4)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddQuadrangle)
- {
- com = new SMESHDS_Command(SMESHDS_AddQuadrangle);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddFace(NewFaceID, idnode1, idnode2, idnode3, idnode4);
+ getCommand(SMESHDS_AddQuadrangle)->AddFace(NewFaceID,
+ idnode1, idnode2,
+ idnode3, idnode4);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewID,
- int idnode1, int idnode2, int idnode3, int idnode4)
+ int idnode1, int idnode2,
+ int idnode3, int idnode4)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddTetrahedron);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddTetrahedron)
- {
- com = new SMESHDS_Command(SMESHDS_AddTetrahedron);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4);
+ getCommand(SMESHDS_AddTetrahedron)->AddVolume(NewID,
+ idnode1, idnode2,
+ idnode3, idnode4);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewID,
- int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
+ int idnode1, int idnode2,
+ int idnode3, int idnode4, int idnode5)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddPyramid);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddPyramid)
- {
- com = new SMESHDS_Command(SMESHDS_AddPyramid);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5);
+ getCommand(SMESHDS_AddPyramid)->AddVolume(NewID,
+ idnode1, idnode2,
+ idnode3, idnode4, idnode5);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewID,
- int idnode1,
- int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
+ int idnode1, int idnode2, int idnode3,
+ int idnode4, int idnode5, int idnode6)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddPrism);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddPrism)
- {
- com = new SMESHDS_Command(SMESHDS_AddPrism);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6);
+ getCommand(SMESHDS_AddPrism)->AddVolume(NewID,
+ idnode1, idnode2, idnode3,
+ idnode4, idnode5, idnode6);
}
//=======================================================================
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewID,
- int idnode1,
- int idnode2,
- int idnode3,
- int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
+ int idnode1, int idnode2, int idnode3, int idnode4,
+ int idnode5, int idnode6, int idnode7, int idnode8)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_AddHexahedron);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_AddHexahedron)
- {
- com = new SMESHDS_Command(SMESHDS_AddHexahedron);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->AddVolume(NewID, idnode1, idnode2, idnode3, idnode4,
- idnode5, idnode6, idnode7, idnode8);
+ getCommand(SMESHDS_AddHexahedron)->AddVolume(NewID,
+ idnode1, idnode2, idnode3, idnode4,
+ idnode5, idnode6, idnode7, idnode8);
}
//=======================================================================
//=======================================================================
void SMESHDS_Script::MoveNode(int NewNodeID, double x, double y, double z)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_MoveNode);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_MoveNode)
- {
- com = new SMESHDS_Command(SMESHDS_MoveNode);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->MoveNode(NewNodeID, x, y, z);
+ getCommand(SMESHDS_MoveNode)->MoveNode(NewNodeID, x, y, z);
}
//=======================================================================
//=======================================================================
void SMESHDS_Script::RemoveNode(int ID)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_RemoveNode);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_RemoveNode)
- {
- com = new SMESHDS_Command(SMESHDS_RemoveNode);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->RemoveNode(ID);
+ getCommand(SMESHDS_RemoveNode)->RemoveNode(ID);
}
//=======================================================================
//=======================================================================
void SMESHDS_Script::RemoveElement(int ElementID)
{
- SMESHDS_Command * com;
- if (myCommands.empty())
- {
- com = new SMESHDS_Command(SMESHDS_RemoveElement);
- myCommands.insert(myCommands.end(),com);
- }
- else
- {
- com = myCommands.back();
- if (com->GetType() != SMESHDS_RemoveElement)
- {
- com = new SMESHDS_Command(SMESHDS_RemoveElement);
- myCommands.insert(myCommands.end(),com);
- }
- }
- com->RemoveElement(ElementID);
+ getCommand(SMESHDS_RemoveElement)->RemoveElement(ElementID);
+}
+
+//=======================================================================
+//function : ChangeElementNodes
+//purpose :
+//=======================================================================
+
+void SMESHDS_Script::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
+{
+ getCommand(SMESHDS_ChangeElementNodes)->ChangeElementNodes( ElementID, nodes, nbnodes );
+}
+
+//=======================================================================
+//function : Renumber
+//purpose :
+//=======================================================================
+
+void SMESHDS_Script::Renumber (const bool isNodes, const int startID, const int deltaID)
+{
+ getCommand(SMESHDS_Renumber)->Renumber( isNodes, startID, deltaID );
}
//=======================================================================
#define _SMESHDS_Script_HeaderFile
#include "SMESHDS_Command.hxx"
+
#include <list>
-using namespace std;
+
class SMESHDS_Script
{
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);
+ void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+ void Renumber (const bool isNodes, const int startID, const int deltaID);
void Clear();
- const list<SMESHDS_Command*> & GetCommands();
+ const std::list<SMESHDS_Command*> & GetCommands();
~SMESHDS_Script();
private:
- list<SMESHDS_Command*> myCommands;
+ SMESHDS_Command* getCommand(const SMESHDS_CommandType aType);
+
+ std::list<SMESHDS_Command*> myCommands;
};
#endif
// Module : SMESH
// $Header:
-using namespace std;
#include "SMESHDS_SubMesh.hxx"
+#include "utilities.h"
+
+using namespace std;
+
//=======================================================================
//function : AddElement
//purpose :
//function : RemoveNode
//purpose :
//=======================================================================
+
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
{
if ( NbNodes() )
//=======================================================================
int SMESHDS_SubMesh::NbElements() const
{
- return myElements.size();
+ if ( mySubMeshes.empty() )
+ return myElements.size();
+
+ int nbElems = 0;
+ set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
+ for ( ; it != mySubMeshes.end(); it++ )
+ nbElems += (*it)->NbElements();
+
+ return nbElems;
}
//=======================================================================
//function : NbNodes
//purpose :
//=======================================================================
+
int SMESHDS_SubMesh::NbNodes() const
{
- return myNodes.size();
+ if ( mySubMeshes.empty() )
+ return myNodes.size();
+
+ int nbElems = 0;
+ set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
+ for ( ; it != mySubMeshes.end(); it++ )
+ nbElems += (*it)->NbNodes();
+
+ return nbElems;
}
+// =====================
+// class MySetIterator
+// =====================
+
template<typename T> class MySetIterator:public SMDS_Iterator<const T*>
{
typedef const set<const T*> TSet;
return t;
}
};
-///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on the elements of submesh
-///The created iterator must be free by the caller
-///////////////////////////////////////////////////////////////////////////////
+
+// =====================
+// class MyIterator
+// =====================
+
+template<typename VALUE> class MyIterator : public SMDS_Iterator<VALUE>
+{
+ public:
+ MyIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
+ : mySubMeshes( theSubMeshes ), mySubIt( theSubMeshes.begin() ) {}
+ bool more()
+ {
+ while (( !myElemIt.get() || !myElemIt->more() ) &&
+ mySubIt != mySubMeshes.end())
+ {
+ myElemIt = getElements(*mySubIt);
+ mySubIt++;
+ }
+ return myElemIt.get() && myElemIt->more();
+ }
+ VALUE next()
+ {
+ if ( more() )
+ return myElemIt->next();
+ return 0;
+ }
+ protected:
+ virtual boost::shared_ptr< SMDS_Iterator<VALUE> >
+ getElements(const SMESHDS_SubMesh*) const = 0;
+
+ private:
+ const set<const SMESHDS_SubMesh*>& mySubMeshes;
+ set<const SMESHDS_SubMesh*>::const_iterator mySubIt;
+ boost::shared_ptr< SMDS_Iterator<VALUE> > myElemIt;
+};
+
+// =====================
+// class MyElemIterator
+// =====================
+
+class MyElemIterator: public MyIterator<const SMDS_MeshElement*>
+{
+ public:
+ MyElemIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
+ :MyIterator<const SMDS_MeshElement*>( theSubMeshes ) {}
+ SMDS_ElemIteratorPtr getElements(const SMESHDS_SubMesh* theSubMesh) const
+ { return theSubMesh->GetElements(); }
+};
+
+// =====================
+// class MyNodeIterator
+// =====================
+
+class MyNodeIterator: public MyIterator<const SMDS_MeshNode*>
+{
+ public:
+ MyNodeIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
+ :MyIterator<const SMDS_MeshNode*>( theSubMeshes ) {}
+ SMDS_NodeIteratorPtr getElements(const SMESHDS_SubMesh* theSubMesh) const
+ { return theSubMesh->GetNodes(); }
+};
+
+//=======================================================================
+//function : GetElements
+//purpose :
+//=======================================================================
+
SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
{
- return SMDS_ElemIteratorPtr(new MySetIterator<SMDS_MeshElement>(myElements));
+ if ( mySubMeshes.empty() )
+ return SMDS_ElemIteratorPtr(new MySetIterator<SMDS_MeshElement>(myElements));
+
+ return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
}
-///////////////////////////////////////////////////////////////////////////////
-///Return an iterator on the nodes of submesh
-///The created iterator must be free by the caller
-///////////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//function : GetNodes
+//purpose :
+//=======================================================================
+
SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
{
- return SMDS_NodeIteratorPtr(new MySetIterator<SMDS_MeshNode>(myNodes));
+ if ( mySubMeshes.empty() )
+ return SMDS_NodeIteratorPtr(new MySetIterator<SMDS_MeshNode>(myNodes));
+
+ return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
+}
+
+//=======================================================================
+//function : Contains
+//purpose : check if elem or node is in
+//=======================================================================
+
+bool SMESHDS_SubMesh::Contains(const SMDS_MeshElement * ME)
+{
+ if ( !ME )
+ return false;
+
+ // DO NOT TRY TO FIND A REMOVED ELEMENT !!
+ if ( ME->GetType() == SMDSAbs_Node ) {
+ const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( ME );
+ return ( myNodes.find( n ) != myNodes.end() );
+ }
+
+ return ( myElements.find( ME ) != myElements.end() );
}
+//=======================================================================
+//function : AddSubMesh
+//purpose :
+//=======================================================================
+
+void SMESHDS_SubMesh::AddSubMesh( const SMESHDS_SubMesh* theSubMesh )
+{
+ ASSERT( theSubMesh );
+ mySubMeshes.insert( theSubMesh );
+}
+
+//=======================================================================
+//function : RemoveSubMesh
+//purpose :
+//=======================================================================
+
+bool SMESHDS_SubMesh::RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh )
+{
+ return mySubMeshes.erase( theSubMesh );
+}
+
+//=======================================================================
+//function : ContainsSubMesh
+//purpose :
+//=======================================================================
+
+bool SMESHDS_SubMesh::ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const
+{
+ return mySubMeshes.find( theSubMesh ) != mySubMeshes.end();
+}
#include "SMDS_Mesh.hxx"
#include <set>
-using namespace std;
-
class SMESHDS_SubMesh
{
- public:
- void AddElement(const SMDS_MeshElement * ME);
- bool RemoveElement(const SMDS_MeshElement * ME); // ret true if ME was in
- void AddNode(const SMDS_MeshNode * ME);
- bool RemoveNode(const SMDS_MeshNode * ME); // ret true if ME was in
- int NbElements() const;
- SMDS_ElemIteratorPtr GetElements() const;
- int NbNodes() const;
- SMDS_NodeIteratorPtr GetNodes() const;
+ public:
+ void AddElement(const SMDS_MeshElement * ME);
+ bool RemoveElement(const SMDS_MeshElement * ME); // ret true if ME was in
+ void AddNode(const SMDS_MeshNode * ME);
+ bool RemoveNode(const SMDS_MeshNode * ME); // ret true if ME was in
+ bool Contains(const SMDS_MeshElement * ME); // check if elem or node is in
+
+ int NbElements() const;
+ SMDS_ElemIteratorPtr GetElements() const;
+ int NbNodes() const;
+ SMDS_NodeIteratorPtr GetNodes() const;
+
+ // child sub-meshes
+ void AddSubMesh( const SMESHDS_SubMesh* theSubMesh );
+ bool RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh );
+ bool ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const;
- private:
- const SMDS_Mesh * myMesh;
- set<const SMDS_MeshElement*> myElements;
- set<const SMDS_MeshNode*> myNodes;
+ private:
+ //const SMDS_Mesh * myMesh;
+ std::set<const SMDS_MeshElement*> myElements;
+ std::set<const SMDS_MeshNode*> myNodes;
+ std::set<const SMESHDS_SubMesh*> mySubMeshes;
};
#endif
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@
# Libraries targets
LIB = libSMESHFiltersSelection.la
-LIB_SRC = SMESH_TypeFilter.cxx
+LIB_SRC = SMESH_TypeFilter.cxx \
+ SMESH_NumberFilter.cxx
-LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl
+LIB_CLIENT_IDL = SALOME_Exception.idl \
+ GEOM_Gen.idl \
+ SMESH_Gen.idl \
+ SMESH_Mesh.idl \
+ SMESH_Hypothesis.idl \
+ SMESH_Group.idl \
+ SALOMEDS.idl \
+ SALOMEDS_Attributes.idl \
+ SALOME_ModuleCatalog.idl \
+ SALOME_Component.idl \
+ SMESH_Filter.idl \
+ SMESH_Pattern.idl \
+ SALOME_GenericObj.idl
# header files
EXPORT_HEADERS= SMESH_Type.h \
SMESH_TypeFilter.hxx \
- Handle_SMESH_TypeFilter.hxx
+ Handle_SMESH_TypeFilter.hxx \
+ SMESH_NumberFilter.hxx
# additionnal information to compil and link file
-CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(OCC_KERNEL_LIBS)
+CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+LDFLAGS += $(OCC_KERNEL_LIBS) -L${GEOM_ROOT_DIR}/lib/salome
# additional file to be cleaned
MOSTLYCLEAN =
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_NumberFilter.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESH_NumberFilter.hxx"
+#include "GEOMBase.h"
+#include "TopTools_MapOfShape.hxx"
+#include "TopExp_Explorer.hxx"
+#include "SALOME_InteractiveObject.hxx"
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+
+
+/*
+ Class : SMESH_NumberFilter
+ Description : Filter for geom objects.
+ Filter geom objects by number of subshapes of the given type
+*/
+
+IMPLEMENT_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
+IMPLEMENT_STANDARD_RTTIEXT( SMESH_NumberFilter, SALOME_TypeFilter )
+
+//=======================================================================
+// name : SMESH_NumberFilter::SMESH_NumberFilter
+// Purpose : Constructor
+//=======================================================================
+SMESH_NumberFilter::SMESH_NumberFilter( const char* theKind,
+ const TopAbs_ShapeEnum theSubShapeType,
+ const int theNumber,
+ const TopAbs_ShapeEnum theShapeType,
+ GEOM::GEOM_Object_ptr theMainObj,
+ const bool theIsClosedOnly )
+: SALOME_TypeFilter( (char*)theKind )
+{
+ mySubShapeType = theSubShapeType;
+ myNumber = theNumber;
+ myIsClosedOnly = theIsClosedOnly;
+ myShapeTypes.Add( theShapeType );
+ myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+}
+
+//=======================================================================
+// name : SMESH_NumberFilter::SMESH_NumberFilter
+// Purpose : Constructor
+//=======================================================================
+SMESH_NumberFilter::SMESH_NumberFilter( const char* theKind,
+ const TopAbs_ShapeEnum theSubShapeType,
+ const int theNumber,
+ const TColStd_MapOfInteger& theShapeTypes,
+ GEOM::GEOM_Object_ptr theMainObj,
+ const bool theIsClosedOnly )
+: SALOME_TypeFilter( (char*)theKind )
+{
+ mySubShapeType = theSubShapeType;
+ myNumber = theNumber;
+ myIsClosedOnly = theIsClosedOnly;
+ myShapeTypes = theShapeTypes;
+ myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+}
+
+SMESH_NumberFilter::~SMESH_NumberFilter()
+{
+}
+
+//=======================================================================
+// name : SMESH_NumberFilter::SMESH_NumberFilter
+// Purpose : Verify validity of entry object
+//=======================================================================
+Standard_Boolean SMESH_NumberFilter::IsOk( const Handle(SALOME_InteractiveObject)& theObj ) const
+{
+ if ( theObj.IsNull() || !SALOME_TypeFilter::IsOk( theObj ) )
+ return false;
+
+ // Get geom object from IO
+ GEOM::GEOM_Object_var aGeomObj = getGeom( theObj );
+ if ( aGeomObj->_is_nil() )
+ return false;
+
+ // Get shape from geom object and verify its parameters
+ TopoDS_Shape aShape;
+ if ( !GEOMBase::GetShape( aGeomObj, aShape ) ||
+ aShape.IsNull() ||
+ !myShapeTypes.Contains( aShape.ShapeType() ) ||
+ myIsClosedOnly && aShape.ShapeType() == TopAbs_SHELL && !aShape.Closed() )
+ return false;
+
+ // Verify whether shape of entry object is sub-shape of myMainObj
+ if ( !myMainObj->_is_nil() )
+ {
+ TopoDS_Shape aMainShape;
+ if ( !GEOMBase::GetShape( myMainObj, aMainShape ) )
+ return false;
+
+ bool isFound = false;
+ TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
+ TopExp_Explorer anExp( aMainShape, aShapeType );
+ for ( ; anExp.More(); anExp.Next() )
+ if ( anExp.Current() == aShape )
+ {
+ isFound = true;
+ break;
+ }
+ if ( !isFound )
+ return false;
+ }
+ // Verify number of sub-shapes
+ if ( mySubShapeType == TopAbs_SHAPE );
+ return true;
+
+ int nbShapes = 0;
+ TopExp_Explorer anExp2( aShape, mySubShapeType );
+ TopTools_MapOfShape aMap;
+ for ( ; anExp2.More(); anExp2.Next() )
+ aMap.Add( anExp2.Current() );
+
+ return myNumber == aMap.Extent();
+}
+
+//=======================================================================
+// name : SMESH_NumberFilter::getGeom
+// Purpose : Retrieve geom object from SALOME_InteractiveObject
+//=======================================================================
+GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom(
+ const Handle(SALOME_InteractiveObject)& theObj ) const
+{
+ if ( theObj->isComponentType( "GEOM" ) )
+ {
+ Standard_Boolean aRes = Standard_False;
+ GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( theObj, aRes );
+ return aRes ? aGeomObj._retn() : GEOM::GEOM_Object::_nil();
+ }
+ else
+ {
+ // Get geom object corresponding to the mesh
+ SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+ SALOMEDS::SObject_var aSO = aStudy->FindObjectID( theObj->getEntry() );
+ if ( aSO->_is_nil() )
+ return GEOM::GEOM_Object::_nil();
+
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
+ for( ; anIter->More(); anIter->Next() )
+ {
+ SALOMEDS::SObject_var aSO = anIter->Value();
+ SALOMEDS::SObject_var aRefSO;
+
+ GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
+ aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
+
+ if ( !aMeshShape->_is_nil() )
+ return aMeshShape._retn();
+ }
+
+ return GEOM::GEOM_Object::_nil();
+ }
+}
+
+
+void SMESH_NumberFilter::SetSubShapeType( const TopAbs_ShapeEnum theSubShapeType )
+{
+ mySubShapeType = theSubShapeType;
+}
+
+void SMESH_NumberFilter::SetNumber( const int theNumber )
+{
+ myNumber = theNumber;
+}
+
+void SMESH_NumberFilter::SetClosedOnly( const bool theIsClosedOnly )
+{
+ myIsClosedOnly = theIsClosedOnly;
+}
+
+void SMESH_NumberFilter::SetShapeType( const TopAbs_ShapeEnum theShapeType )
+{
+ myShapeTypes.Add( theShapeType );
+}
+
+void SMESH_NumberFilter::SetMainShape( GEOM::GEOM_Object_ptr theMainObj )
+{
+ myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_NumberFilter.hxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#ifndef _SMESH_NumberFilter_HeaderFile
+#define _SMESH_NumberFilter_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include "SALOME_TypeFilter.hxx"
+#include <TopAbs_ShapeEnum.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
+DEFINE_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
+
+/*
+ Class : SMESH_NumberFilter
+ Description : Filter for geom or smesh objects.
+ Filter geom objects by number of subshapes of the given type
+ Parameters of constructor:
+ * theSubShapeType - Type of subshape
+ * theNumber - Number of subshapes. Object is selected if it contains theNumber of
+ theSubShapeType sub-shapes
+ * theShapeType - This map specifies types of object to be selected
+ * theMainObject - Sub-shapes of this object is selected only
+ * theIsClosedOnly - Closed shapes is selected if this parameter is true
+*/
+class SMESH_NumberFilter : public SALOME_TypeFilter
+{
+
+public:
+
+ SMESH_NumberFilter( const char* theKind,
+ const TopAbs_ShapeEnum theSubShapeType,
+ const int theNumber,
+ const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
+ GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
+ const bool theIsClosedOnly = false );
+
+ SMESH_NumberFilter( const char* theKind,
+ const TopAbs_ShapeEnum theSubShapeType,
+ const int theNumber,
+ const TColStd_MapOfInteger& theShapeTypes,
+ GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
+ const bool theIsClosedOnly = false );
+
+ virtual ~SMESH_NumberFilter();
+ virtual Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
+
+ void SetSubShapeType( const TopAbs_ShapeEnum );
+ void SetNumber( const int );
+ void SetClosedOnly( const bool );
+ void SetShapeType( const TopAbs_ShapeEnum );
+ void SetShapeTypes( const TColStd_MapOfInteger& );
+ void SetMainShape( GEOM::GEOM_Object_ptr );
+
+private:
+ GEOM::GEOM_Object_ptr getGeom( const Handle(SALOME_InteractiveObject)& theObj ) const;
+
+
+private:
+ TopAbs_ShapeEnum mySubShapeType;
+ int myNumber;
+ bool myIsClosedOnly;
+ TColStd_MapOfInteger myShapeTypes;
+ GEOM::GEOM_Object_var myMainObj;
+
+public:
+ DEFINE_STANDARD_RTTI( SMESH_NumberFilter )
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-using namespace std;
// File : SMESH_TypeFilter.cxx
// Created : Fri Dec 07 09:57:24 2001
// Author : Nicolas REJNERI
#include "QAD_Desktop.h"
#include "QAD_Study.h"
+using namespace std;
SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType)
{
Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
{
- Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "MESH" );
+ Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "SMESH" );
if ( !meshFilter->IsOk(anObj) )
return false;
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
- if ( strlen( obj->GetID() ) <= strlen( objComponent->GetID() ) )
+ int aLevel = obj->Depth() - objComponent->Depth();
+
+ // Max level under the component is 4:
+ //
+ // 0 Mesh Component
+ // 1 |- Hypotheses
+ // 2 | |- Regular 1D
+ // |- Algorithms
+ // |- Mesh 1
+ // |- Applied Hypotheses
+ // |- Applied Algorithms
+ // |- Submeshes on Face
+ // 3 | |- SubmeshFace
+ // 4 | |- Applied algorithms ( selectable in Use Case Browser )
+ // |- Group Of Nodes
+
+ if ( aLevel <= 0 )
return false;
switch ( myKind )
{
case HYPOTHESIS:
{
- if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
+ if ( aLevel == 2 && ( objFather->Tag() == 1 ))
Ok = true;
break;
}
case ALGORITHM:
{
- if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
+ if ( aLevel == 2 && ( objFather->Tag() == 2 ))
Ok = true;
break;
}
case MESH:
{
- if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
+ if ( aLevel == 1 && ( obj->Tag() >= 3 ))
Ok = true;
break;
}
case SUBMESH:
{
- if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
+ // see SMESH_Gen_i.cxx for tag numbers
+ if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
Ok = true;
break;
}
case MESHorSUBMESH:
{
- if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
+ if ( aLevel == 1 && ( obj->Tag() >= 3 ))
+ Ok = true; // mesh
+ else if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
Ok = true;
-
- if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
- Ok = true;
-
break;
}
case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
{
- if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
+ if ( aLevel == 3 && ( objFather->Tag() == 4 ))
Ok = true;
break;
}
case SUBMESH_EDGE:
{
- if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
+ if ( aLevel == 3 && ( objFather->Tag() == 5 ))
Ok = true;
break;
}
case SUBMESH_FACE:
{
- if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
+ if ( aLevel == 3 && ( objFather->Tag() == 7 ))
Ok = true;
break;
}
case SUBMESH_SOLID:
{
- if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
+ if ( aLevel == 3 && ( objFather->Tag() == 9 ))
Ok = true;
break;
}
case SUBMESH_COMPOUND:
{
- if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
+ if ( aLevel == 3 && ( objFather->Tag() == 10 ))
Ok = true;
break;
}
case GROUP:
{
- if (( objFather->Tag() >= 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
+ if ( aLevel == 3 && ( objFather->Tag() > 10 ))
Ok = true;
break;
}
EXPORT_HEADERS= SMESHGUI_Swig.hxx \
SMESHGUI_Swig.i \
SMESHGUI.h \
+ SMESHGUI_Utils.h \
SMESHGUI_Hypotheses.h \
+ SMESHGUI_HypothesesUtils.h \
SMESHGUI_SpinBox.h \
- SMESHGUI_StudyAPI.h
+ SMESHGUI_aParameter.h \
+ SMESHGUI_aParameterDlg.h
# .po files to transform in .qm
PO_FILES = \
# Libraries targets
LIB = libSMESHGUI.la
LIB_SRC = SMESHGUI.cxx \
- SMESHGUI_StudyAPI.cxx \
+ SMESHGUI_PatternWidget.cxx \
+ SMESHGUI_CreatePatternDlg.cxx \
+ SMESHGUI_MeshPatternDlg.cxx \
SMESHGUI_SpinBox.cxx \
SMESHGUI_NodesDlg.cxx \
- SMESHGUI_AddHypothesisDlg.cxx \
- SMESHGUI_AddAlgorithmDlg.cxx \
SMESHGUI_InitMeshDlg.cxx \
SMESHGUI_AddSubMeshDlg.cxx \
SMESHGUI_TransparencyDlg.cxx \
+ SMESHGUI_ClippingDlg.cxx \
SMESHGUI_GroupDlg.cxx \
SMESHGUI_RemoveNodesDlg.cxx \
SMESHGUI_RemoveElementsDlg.cxx \
SMESHGUI_Preferences_SelectionDlg.cxx \
SMESHGUI_aParameterDlg.cxx \
SMESHGUI_Swig.cxx \
- SMESHGUI_ComputeScalarValue.cxx \
SMESHGUI_MoveNodesDlg.cxx \
- SMESHGUI_OrientationElementsDlg.cxx \
- SMESHGUI_DiagonalInversionDlg.cxx \
- SMESHGUI_AddFaceDlg.cxx \
- SMESHGUI_AddVolumeDlg.cxx \
- SMESHGUI_AddEdgeDlg.cxx \
+ SMESHGUI_AddMeshElementDlg.cxx \
SMESHGUI_EditHypothesesDlg.cxx \
SMESHGUI_CreateHypothesesDlg.cxx \
SMESHGUI_XmlHandler.cxx \
SMESHGUI_Filter.cxx \
- SMESHGUI_FilterDlg.cxx
+ SMESHGUI_FilterDlg.cxx \
+ SMESHGUI_FilterLibraryDlg.cxx \
+ SMESHGUI_SingleEditDlg.cxx \
+ SMESHGUI_MultiEditDlg.cxx \
+ SMESHGUI_aParameter.cxx \
+ SMESHGUI_DeleteGroupDlg.cxx \
+ SMESHGUI_GroupOpDlg.cxx \
+ SMESHGUI_SmoothingDlg.cxx \
+ SMESHGUI_RenumberingDlg.cxx \
+ SMESHGUI_ExtrusionDlg.cxx \
+ SMESHGUI_RevolutionDlg.cxx \
+ SMESHGUI_RotationDlg.cxx \
+ SMESHGUI_TranslationDlg.cxx \
+ SMESHGUI_SymmetryDlg.cxx \
+ SMESHGUI_SewingDlg.cxx \
+ SMESHGUI_MergeNodesDlg.cxx \
+ SMESHGUI_Utils.cxx \
+ SMESHGUI_SMESHGenUtils.cxx \
+ SMESHGUI_GEOMGenUtils.cxx \
+ SMESHGUI_MeshUtils.cxx \
+ SMESHGUI_GroupUtils.cxx \
+ SMESHGUI_FilterUtils.cxx \
+ SMESHGUI_PatternUtils.cxx \
+ SMESHGUI_HypothesesUtils.cxx \
+ SMESHGUI_PrecisionDlg.cxx \
+ SMESHGUI_VTKUtils.cxx
LIB_MOC = \
SMESHGUI.h \
+ SMESHGUI_PatternWidget.h \
+ SMESHGUI_MeshPatternDlg.h \
+ SMESHGUI_CreatePatternDlg.h \
SMESHGUI_NodesDlg.h \
SMESHGUI_SpinBox.h \
- SMESHGUI_AddHypothesisDlg.h \
- SMESHGUI_AddAlgorithmDlg.h \
SMESHGUI_InitMeshDlg.h \
SMESHGUI_AddSubMeshDlg.h \
SMESHGUI_TransparencyDlg.h \
+ SMESHGUI_ClippingDlg.h \
SMESHGUI_GroupDlg.h \
SMESHGUI_RemoveNodesDlg.h \
SMESHGUI_RemoveElementsDlg.h \
SMESHGUI_Preferences_SelectionDlg.h \
SMESHGUI_aParameterDlg.h \
SMESHGUI_MoveNodesDlg.h \
- SMESHGUI_OrientationElementsDlg.h \
- SMESHGUI_DiagonalInversionDlg.h \
- SMESHGUI_AddEdgeDlg.h \
- SMESHGUI_AddVolumeDlg.h \
- SMESHGUI_AddFaceDlg.h \
+ SMESHGUI_AddMeshElementDlg.h \
SMESHGUI_EditHypothesesDlg.h \
SMESHGUI_CreateHypothesesDlg.h \
- SMESHGUI_FilterDlg.h
-
+ SMESHGUI_FilterDlg.h \
+ SMESHGUI_FilterLibraryDlg.h \
+ SMESHGUI_SingleEditDlg.h \
+ SMESHGUI_MultiEditDlg.h \
+ SMESHGUI_DeleteGroupDlg.h \
+ SMESHGUI_GroupOpDlg.h \
+ SMESHGUI_SmoothingDlg.h \
+ SMESHGUI_RenumberingDlg.h \
+ SMESHGUI_ExtrusionDlg.h \
+ SMESHGUI_RevolutionDlg.h \
+ SMESHGUI_RotationDlg.h \
+ SMESHGUI_TranslationDlg.h \
+ SMESHGUI_SymmetryDlg.h \
+ SMESHGUI_SewingDlg.h \
+ SMESHGUI_PrecisionDlg.h \
+ SMESHGUI_MergeNodesDlg.h
+
LIB_CLIENT_IDL = SALOME_Exception.idl \
GEOM_Gen.idl \
- GEOM_Shape.idl \
SMESH_Gen.idl \
SMESH_Mesh.idl \
SMESH_Hypothesis.idl \
SALOME_Component.idl \
MED.idl \
SMESH_Filter.idl \
+ SMESH_Pattern.idl \
SALOME_GenericObj.idl
LIB_SERVER_IDL =
# additionnal information to compil and link file
+#BIN = SMESHBin
+
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
$(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS)
+
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
-#$(OCC_CXXFLAGS)
-LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lSMESHObject -lSMDS -lSMESHDS -lSMESHFiltersSelection -lGEOMClient -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
+
+LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -lVTKViewer -lSalomeGUI -lSalomePrs -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSALOMELocalTrace -lSalomeVTKFilter -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOMGUI -lGEOMClient -lGEOMFiltersSelection -lGEOMBase -lGEOMObject
+
+LDFLAGSFORBIN += $(LDFLAGS)
@CONCLUDE@
--- /dev/null
+int main(int argc, char** argv){
+ return 0;
+}
+
// $Header$
#include "SMESHGUI.h"
-#include "SMESHGUI_AddHypothesisDlg.h"
-#include "SMESHGUI_AddAlgorithmDlg.h"
#include "SMESHGUI_InitMeshDlg.h"
#include "SMESHGUI_AddSubMeshDlg.h"
#include "SMESHGUI_NodesDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
+#include "SMESHGUI_ClippingDlg.h"
#include "SMESHGUI_GroupDlg.h"
#include "SMESHGUI_RemoveNodesDlg.h"
#include "SMESHGUI_RemoveElementsDlg.h"
#include "SMESHGUI_Preferences_ColorDlg.h"
#include "SMESHGUI_Preferences_ScalarBarDlg.h"
#include "SMESHGUI_Preferences_SelectionDlg.h"
-#include "SMESHGUI_aParameterDlg.h"
-#include "SMESHGUI_ComputeScalarValue.h"
+#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MoveNodesDlg.h"
-#include "SMESHGUI_OrientationElementsDlg.h"
-#include "SMESHGUI_DiagonalInversionDlg.h"
-#include "SMESHGUI_AddFaceDlg.h"
-#include "SMESHGUI_AddEdgeDlg.h"
-#include "SMESHGUI_AddVolumeDlg.h"
+#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_EditHypothesesDlg.h"
#include "SMESHGUI_CreateHypothesesDlg.h"
#include "SMESHGUI_FilterDlg.h"
-#include "SMESHGUI_XmlHandler.h"
+#include "SMESHGUI_FilterLibraryDlg.h"
+#include "SMESHGUI_SingleEditDlg.h"
+#include "SMESHGUI_MultiEditDlg.h"
+#include "SMESHGUI_GroupOpDlg.h"
+#include "SMESHGUI_DeleteGroupDlg.h"
+#include "SMESHGUI_SmoothingDlg.h"
+#include "SMESHGUI_RenumberingDlg.h"
+#include "SMESHGUI_ExtrusionDlg.h"
+#include "SMESHGUI_RevolutionDlg.h"
+#include "SMESHGUI_TranslationDlg.h"
+#include "SMESHGUI_RotationDlg.h"
+#include "SMESHGUI_SymmetryDlg.h"
+#include "SMESHGUI_SewingDlg.h"
+#include "SMESHGUI_MergeNodesDlg.h"
+#include "SMESHGUI_MeshPatternDlg.h"
+#include "SMESHGUI_PrecisionDlg.h"
+
+#include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_RenderWindowInteractor.h"
#include "SMESH_Actor.h"
#include "SMESH_Object.h"
-// SALOME Includes
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-
#include "QAD.h"
#include "QAD_Tools.h"
#include "QAD_Config.h"
#include "QAD_ResourceMgr.h"
#include "QAD_WaitCursor.h"
-#include "OCCViewer_ViewPort.h"
-#include "OCCViewer_ViewPort3d.h"
-#include "OCCViewer_Viewer3d.h"
-
-#include "GEOM_InteractiveObject.hxx"
-
#include "SALOME_NamingService.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_InteractiveObject.hxx"
#include "SALOMEGUI_ImportOperation.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
-#include <dlfcn.h>
-
-#include "SMDS_Mesh.hxx"
-#include "SMESHDS_Document.hxx"
-#include "Document_Reader.h"
-#include "Document_Writer.h"
-#include "Mesh_Reader.h"
-#include "Mesh_Writer.h"
-
-#include "DriverDAT_R_SMESHDS_Document.h"
-#include "DriverMED_R_SMESHDS_Document.h"
-#include "DriverUNV_R_SMESHDS_Document.h"
-#include "DriverDAT_W_SMESHDS_Document.h"
-#include "DriverMED_W_SMESHDS_Document.h"
-#include "DriverUNV_W_SMESHDS_Document.h"
-#include "DriverDAT_R_SMESHDS_Mesh.h"
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "DriverUNV_R_SMESHDS_Mesh.h"
-#include "DriverDAT_W_SMESHDS_Mesh.h"
-#include "DriverMED_W_SMESHDS_Mesh.h"
-#include "DriverUNV_W_SMESHDS_Mesh.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_SMESHGenUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_GroupUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_VTKUtils.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
// QT Includes
#define INCLUDE_MENUITEM_DEF
#include <qpopupmenu.h>
#include <qfont.h>
#include <qstring.h>
+#include <qpainter.h>
#include <qcheckbox.h>
#include <qcolordialog.h>
#include <qspinbox.h>
#include <qevent.h>
#include <qradiobutton.h>
-// VTK Includes
-#include "VTKViewer_Common.h"
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
+#include <boost/shared_ptr.hpp>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkActorCollection.h>
#include <vtkScalarBarActor.h>
-#include <vtkLegendBoxActor.h>
-#include <vtkFeatureEdges.h>
-#include <vtkDoubleArray.h>
-#include <vtkTextProperty.h>
-// Open CASCADE Includes
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
+#include "utilities.h"
-#include <boost/shared_ptr.hpp>
+using namespace std;
-static SMESHGUI *smeshGUI = 0;
-static CORBA::ORB_var _orb;
+namespace{
+ // Decalarations
+ //=============================================================
+ void ImportMeshesFromFile(QAD_Desktop * parent,
+ SMESH::SMESH_Gen_ptr theComponentMesh,
+ int theCommandID);
-using namespace std;
+ void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
-typedef pair<int,string> TKeyOfVisualObj;
-typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
-typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
-static TVisualObjCont VISUALOBJCONT;
-
-
-TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
- TVisualObjPtr aVisualObj;
- try{
- TVisualObjCont::key_type aKey(theStudyId,theEntry);
- TVisualObjCont::iterator anIter = VISUALOBJCONT.find(aKey);
- if(anIter != VISUALOBJCONT.end()){
- aVisualObj = anIter->second;
- }else{
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theEntry);
- if(!CORBA::is_nil(aSObj)){
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- CORBA::String_var aVal = anIOR->Value();
- CORBA::Object_var anObj =_orb->string_to_object(aVal.in());
- if(!CORBA::is_nil(anObj)){
- //Try narrow to SMESH_Mesh interafce
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
- if(!aMesh->_is_nil()){
- aVisualObj.reset(new SMESH_MeshObj(aMesh));
- aVisualObj->Update();
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUALOBJCONT.insert(aValue);
- return aVisualObj;
- }
- //Try narrow to SMESH_Group interafce
- SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow(anObj);
- if(!aGroup->_is_nil()){
- SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
- if(aFatherSObj->_is_nil()) return aVisualObj;
- aFatherSObj = aFatherSObj->GetFather();
- if(aFatherSObj->_is_nil()) return aVisualObj;
- CORBA::String_var anEntry = aFatherSObj->GetID();
- TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
- if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
- aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
- aVisualObj->Update();
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUALOBJCONT.insert(aValue);
- return aVisualObj;
- }
- }
- //Try narrow to SMESH_subMesh interafce
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
- if(!aSubMesh->_is_nil()){
- SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
- if(aFatherSObj->_is_nil()) return aVisualObj;
- aFatherSObj = aFatherSObj->GetFather();
- if(aFatherSObj->_is_nil()) return aVisualObj;
- CORBA::String_var anEntry = aFatherSObj->GetID();
- TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
- if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
- aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
- aVisualObj->Update();
- TVisualObjCont::value_type aValue(aKey,aVisualObj);
- VISUALOBJCONT.insert(aValue);
- return aVisualObj;
- }
+ void SetViewMode(int theCommandID);
+
+ void Control( int theCommandID );
+
+ void SetDisplaySettings();
+
+
+ // Definitions
+ //=============================================================
+ void ImportMeshesFromFile(QAD_Desktop * parent,
+ SMESH::SMESH_Gen_ptr theComponentMesh,
+ int theCommandID)
+ {
+ QString filter;
+ string myExtension;
+
+ if(theCommandID == 113){
+ filter = QObject::tr("MED files (*.med)");
+ }else if (theCommandID == 112){
+ filter = QObject::tr("IDEAS files (*.unv)");
+ }else if (theCommandID == 111){
+ filter = QObject::tr("DAT files (*.dat)");
+ }
+ QString filename = QAD_FileDlg::getFileName(parent,
+ "",
+ filter,
+ QObject::tr("Import mesh"),
+ true);
+ if(!filename.isEmpty()) {
+ QAD_WaitCursor wc;
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+
+ try {
+ SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
+ switch ( theCommandID ) {
+ case 112:
+ {
+ aMeshes->length( 1 );
+ aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.latin1());
+ break;
+ }
+ case 113:
+ {
+ SMESH::DriverMED_ReadStatus res;
+ aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res);
+ if ( res != SMESH::DRS_OK ) {
+ wc.stop();
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr(QString("SMESH_DRS_%1").arg(res)),
+ QObject::tr("SMESH_BUT_OK"));
+ aMeshes->length( 0 );
+ wc.start();
}
+ break;
}
}
+
+ bool isEmpty = false;
+ for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
+ SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( aMeshes[i] );
+ if ( !aMeshSO->_is_nil() ) {
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow( aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ) );
+ aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED");
+ if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
+ SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
+ } else
+ isEmpty = true;
+ }
+
+ if ( isEmpty ) {
+ wc.stop();
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_DRS_EMPTY"),
+ QObject::tr("SMESH_BUT_OK"));
+ wc.start();
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex){
+ wc.stop();
+ QtCatchCorbaException(S_ex);
+ wc.start();
}
}
- }catch(...){
- INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
}
- return aVisualObj;
-}
-
-VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame){
- QAD_ViewFrame* aViewFrame = theStudyFrame->getRightFrame()->getViewFrame();
- return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
-}
-void UpdateSelectionProp() {
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QList<QAD_StudyFrame> aFrameList = aStudy->getStudyFrames();
-
- QString SCr, SCg, SCb;
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
- QColor aHiColor = Qt::white;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aHiColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
- QColor aSelColor = Qt::yellow;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aSelColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- QString SW = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
- if (SW.isEmpty()) SW = "5";
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
- QColor aPreColor = Qt::cyan;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aPreColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- QString PW = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
- if (PW.isEmpty()) PW = "5";
-
- QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
- if (SP1.isEmpty()) SP1 = "0.025";
- QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
- if (SP2.isEmpty()) SP2 = "0.001";
-
- for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
- if (aStudyFrame->getTypeView() == VIEW_VTK) {
- VTKViewer_ViewFrame* aVtkViewFrame = GetVtkViewFrame(aStudyFrame);
- if (!aVtkViewFrame) continue;
- // update VTK viewer properties
- VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
- if (anInteractor) {
- // mesh element selection
- anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
- aSelColor.blue()/255., SW.toInt());
-
- // tolerances
- anInteractor->SetSelectionTolerance(SP1.toDouble(), SP2.toDouble());
-
- // pre-selection
- VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
- if (aStyle) {
- aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
- aPreColor.blue()/255., PW.toInt());
+ void ExportMeshToFile(QAD_Desktop * parent, int theCommandID)
+ {
+ SALOME_Selection *aSel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
+ if(aSel->IObjectCount()){
+ Handle(SALOME_InteractiveObject) anIObject = aSel->firstIObject();
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
+ if ( !aMesh->_is_nil() ) {
+ QString aFilter, aTitle = QObject::tr("Export mesh");
+ switch ( theCommandID ) {
+ case 122:
+ aFilter = QObject::tr("MED files (*.med)");
+ break;
+ case 121:
+ aFilter = QObject::tr("DAT files (*.dat)");
+ break;
+ case 123: {
+ if(aMesh->NbPyramids()){
+ int aRet = QAD_MessageBox::warn2(QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
+ QObject::tr("SMESH_BUT_YES"),
+ QObject::tr("SMESH_BUT_NO"),
+ 0,1,0);
+ if(aRet)
+ return;
+ }
+ aFilter = QObject::tr("IDEAS files (*.unv)");
+ break;
+ default:
+ return;
+ }}
+
+ QString aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
+ if ( !aFilename.isEmpty() ) {
+ // Check whether the file already exists and delete it if yes
+ QFile aFile( aFilename );
+ if ( aFile.exists() )
+ aFile.remove();
+ QAD_WaitCursor wc;
+ switch ( theCommandID ) {
+ case 122:
+ aMesh->ExportMED( aFilename.latin1(), true ); // currently, automatic groups are always created
+ break;
+ case 121:
+ aMesh->ExportDAT( aFilename.latin1() );
+ break;
+ case 123:
+ aMesh->ExportUNV( aFilename.latin1() );
+ break;
+ default:
+ break;
+ }
}
}
- // update actors
- vtkRenderer* aRenderer = aVtkViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
- aHiColor.blue()/255.);
- anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
- aPreColor.blue()/255.);
+ }
+ }
+
+ void SetViewMode(int theCommandID){
+ SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
+ if(Sel->IObjectCount() >= 1){
+ switch(theCommandID){
+ case 1134:{
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ SMESHGUI_ClippingDlg *aDlg =
+ new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
+ return;
+ }
+ case 1133:{
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ SMESHGUI_TransparencyDlg *aDlg =
+ new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
+ return;
+ }}
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for(; It.More(); It.Next()){
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if(IObject->hasEntry()){
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
+ switch(theCommandID){
+ case 211:
+ anActor->SetRepresentation(SMESH_Actor::eEdge);
+ break;
+ case 212:
+ anActor->SetRepresentation(SMESH_Actor::eSurface);
+ break;
+ case 213:
+ if(anActor->IsShrunk())
+ anActor->UnShrink();
+ else
+ anActor->SetShrink();
+ break;
+ case 215:
+ anActor->SetRepresentation(SMESH_Actor::ePoint);
+ break;
+ case 1132:{
+ float color[3];
+ anActor->GetSufaceColor(color[0], color[1], color[2]);
+ int c0 = int (color[0] * 255);
+ int c1 = int (color[1] * 255);
+ int c2 = int (color[2] * 255);
+ QColor c(c0, c1, c2);
+
+ float edgecolor[3];
+ anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
+ c0 = int (edgecolor[0] * 255);
+ c1 = int (edgecolor[1] * 255);
+ c2 = int (edgecolor[2] * 255);
+ QColor e(c0, c1, c2);
+
+ float backfacecolor[3];
+ anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
+ c0 = int (backfacecolor[0] * 255);
+ c1 = int (backfacecolor[1] * 255);
+ c2 = int (backfacecolor[2] * 255);
+ QColor b(c0, c1, c2);
+
+ float nodecolor[3];
+ anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
+ c0 = int (nodecolor[0] * 255);
+ c1 = int (nodecolor[1] * 255);
+ c2 = int (nodecolor[2] * 255);
+ QColor n(c0, c1, c2);
+
+ int Edgewidth = (int)anActor->GetLineWidth();
+ if(Edgewidth == 0)
+ Edgewidth = 1;
+ int intValue = int(anActor->GetNodeSize());
+ float Shrink = anActor->GetShrinkFactor();
+
+ SMESHGUI_Preferences_ColorDlg *aDlg =
+ new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(),"");
+ aDlg->SetColor(1, c);
+ aDlg->SetColor(2, e);
+ aDlg->SetColor(3, n);
+ aDlg->SetColor(4, b);
+ aDlg->SetIntValue(1, Edgewidth);
+ aDlg->SetIntValue(2, intValue);
+ aDlg->SetIntValue(3, int(Shrink*100.));
+ if(aDlg->exec()){
+ QColor color = aDlg->GetColor(1);
+ QColor edgecolor = aDlg->GetColor(2);
+ QColor nodecolor = aDlg->GetColor(3);
+ QColor backfacecolor = aDlg->GetColor(4);
+ /* actor color and backface color */
+ anActor->SetSufaceColor(float (color.red()) / 255.,
+ float (color.green()) / 255.,
+ float (color.blue()) / 255.);
+ anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
+ float (backfacecolor.green()) / 255.,
+ float (backfacecolor.blue()) / 255.);
+
+ /* edge color */
+ anActor->SetEdgeColor(float (edgecolor.red()) / 255.,
+ float (edgecolor.green()) / 255.,
+ float (edgecolor.blue()) / 255.);
+
+ /* Shrink factor and size edges */
+ anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
+ anActor->SetLineWidth(aDlg->GetIntValue(1));
+
+ /* Nodes color and size */
+ anActor->SetNodeColor(float (nodecolor.red()) / 255.,
+ float (nodecolor.green()) / 255.,
+ float (nodecolor.blue()) / 255.);
+ anActor->SetNodeSize(aDlg->GetIntValue(2));
+
+ delete aDlg;
+ }
+ break;
+ }}
+ }
}
}
+ SMESH::RepaintCurrentView();
}
}
-}
-
-VTKViewer_ViewFrame* GetCurrentVtkView(){
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
- return GetVtkViewFrame(aStudyFrame);
-}
-SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
- const char* theEntry)
-{
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
- vtkRenderer *aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->hasIO()){
- Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
- if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
- return anActor;
+ void SetDisplaySettings()
+ {
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ SMESHGUI_Preferences_ColorDlg *aDlg =
+ new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(), "");
+
+ QColor color;
+ QString SCr, SCg, SCb;
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else color = QColor(0, 170, 255);
+ aDlg->SetColor(1, color);
+
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else color = QColor(0, 170, 255);
+ aDlg->SetColor(2, color);
+
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else color = Qt::red;
+ aDlg->SetColor(3, color);
+
+ QString SBr = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed");
+ QString SBg = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen");
+ QString SBb = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ color = QColor(SBr.toInt(), SBg.toInt(), SBb.toInt());
+ else color = Qt::blue;
+ aDlg->SetColor(4, color);
+
+ QString intValue = QAD_CONFIG->getSetting("SMESH:SettingsWidth");
+ if (intValue.isEmpty()) intValue = "1";
+ aDlg->SetIntValue(1, intValue.toInt());
+ intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize");
+ if (intValue.isEmpty()) intValue = "3";
+ aDlg->SetIntValue(2, intValue.toInt());
+ intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff");
+ if (intValue.isEmpty()) intValue = "75";
+ aDlg->SetIntValue(3, intValue.toInt());
+
+ if (aDlg->exec()) {
+ QColor colorFill = aDlg->GetColor(1);
+ QAD_CONFIG->addSetting("SMESH:SettingsFillColorRed", colorFill.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsFillColorGreen", colorFill.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsFillColorBlue", colorFill.blue());
+
+ QColor colorOutline = aDlg->GetColor(2);
+ QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorRed", colorOutline.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorGreen", colorOutline.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorBlue", colorOutline.blue());
+
+ QColor colorNode = aDlg->GetColor(3);
+ QAD_CONFIG->addSetting("SMESH:SettingsNodeColorRed", colorNode.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsNodeColorGreen", colorNode.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsNodeColorBlue", colorNode.blue());
+
+ QColor colorBackFace = aDlg->GetColor(4);
+ QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorRed", colorBackFace.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorGreen", colorBackFace.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorBlue", colorBackFace.blue());
+
+ int width = aDlg->GetIntValue(1);
+ QAD_CONFIG->addSetting("SMESH:SettingsWidth", width);
+
+ int nodes_size = aDlg->GetIntValue(2);
+ QAD_CONFIG->addSetting("SMESH:SettingsNodesSize", nodes_size);
+
+ int shrink_coeff = aDlg->GetIntValue(3);
+ QAD_CONFIG->addSetting("SMESH:SettingsShrinkCoeff", shrink_coeff);
+ }
+
+ delete aDlg;
+ }
+
+
+ void Control( int theCommandID )
+ {
+ SALOME_Selection *Sel = SALOME_Selection::Selection( SMESH::GetActiveStudy()->getSelection() );
+ if(Sel){
+ Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
+ if(!anIO.IsNull()){
+ QString aTitle;
+ SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
+ switch ( theCommandID ){
+ case 6001:
+ aTitle = QObject::tr( "LENGTH_EDGES" );
+ aControl = SMESH_Actor::eLengthEdges;
+ break;
+ case 6002:
+ aTitle = QObject::tr( "FREE_EDGES" );
+ aControl = SMESH_Actor::eFreeEdges;
+ break;
+ case 6003:
+ aTitle = QObject::tr( "FREE_BORDERS" );
+ aControl = SMESH_Actor::eFreeBorders;
+ break;
+ case 6004:
+ aTitle = QObject::tr( "MULTI_BORDERS" );
+ aControl = SMESH_Actor::eMultiConnection;
+ break;
+ case 6011:
+ aTitle = QObject::tr( "AREA_ELEMENTS" );
+ aControl = SMESH_Actor::eArea;
+ break;
+ case 6012:
+ aTitle = QObject::tr( "TAPER_ELEMENTS" );
+ aControl = SMESH_Actor::eTaper;
+ break;
+ case 6013:
+ aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
+ aControl = SMESH_Actor::eAspectRatio;
+ break;
+ case 6014:
+ aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
+ aControl = SMESH_Actor::eMinimumAngle;
+ break;
+ case 6015:
+ aTitle = QObject::tr( "WARP_ELEMENTS" );
+ aControl = SMESH_Actor::eWarping;
+ break;
+ case 6016:
+ aTitle = QObject::tr( "SKEW_ELEMENTS" );
+ aControl = SMESH_Actor::eSkew;
+ break;
}
+ anActor->SetControlMode(aControl);
+ anActor->GetScalarBarActor()->SetTitle(aTitle.latin1());
}
}
}
}
- return NULL;
-}
-
-
-SMESH_Actor* FindActorByEntry(const char* theEntry){
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
- return FindActorByEntry(aStudyFrame,theEntry);
-}
-
+
-SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
- const char* theEntry,
- int theIsClear = false)
-{
- SMESH_Actor *anActor = NULL;
- CORBA::Long anId = theStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
- SALOMEDS::SObject_var aSObj = theStudy->FindObjectID(theEntry);
- if(!aSObj->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObj->FindAttribute(anAttr,"AttributeName")){
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aVal = aName->Value();
- string aNameVal = aVal.in();
- SMESH::FilterManager_ptr aFilterMgr = smeshGUI->GetFilterMgr();
- anActor = SMESH_Actor::New(aVisualObj,aFilterMgr,theEntry,aNameVal.c_str(),theIsClear);
- }
+ bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
+ MeshObjectType theType,
+ const QString theInTypeName,
+ QString & theOutTypeName)
+ {
+ SMESH_TypeFilter aTypeFilter( theType );
+ if ( aTypeFilter.IsOk( theIO )) {
+ theOutTypeName = theInTypeName;
+ return true;
}
+ return false;
}
- return anActor;
-}
-
+
-void DisplayActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
- aViewFrame->AddActor(theActor);
- aViewFrame->Repaint();
+ QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
+ {
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+ SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theIO->getEntry());
+ if (!aSObj->_is_nil()) {
+ SALOMEDS::SComponent_var aSComp = aSObj->GetFatherComponent();
+ CORBA::String_var anID = aSComp->GetID();
+ if (!strcmp(anID.in(),theIO->getEntry()))
+ return "Component";
+ }
+
+ QString aTypeName;
+ if (
+ CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
+ CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
+ CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
+ CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
+ CheckOIType ( theIO, GROUP, "Group", aTypeName )
+ )
+ return aTypeName;
+
+ return "NoType";
}
-}
-void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
- aViewFrame->RemoveActor(theActor);
- aViewFrame->Repaint();
- }
-}
-
+ QString CheckHomogeneousSelection()
+ {
+ QAD_Study* aStudy = SMESH::GetActiveStudy();
+ SALOME_Selection *aSel = SALOME_Selection::Selection(aStudy->getSelection());
+ /* copy the list */
+ SALOME_ListIO List;
+ SALOME_ListIteratorOfListIO Itinit(aSel->StoredIObjects());
+ for (; Itinit.More(); Itinit.Next())
+ {
+ List.Append(Itinit.Value());
+ }
-void FitAll(){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
- aViewFrame->onViewFitAll();
- aViewFrame->Repaint();
+ QString RefType = CheckTypeObject(aSel->firstIObject());
+ SALOME_ListIteratorOfListIO It(List);
+ for (; It.More(); It.Next())
+ {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ QString Type = CheckTypeObject(IObject);
+ if (Type.compare(RefType) != 0)
+ return "Heterogeneous Selection";
+ }
+
+ aSel->ClearIObjects();
+ SALOME_ListIteratorOfListIO It1(List);
+ for (; It1.More(); It1.Next())
+ {
+ int res = aSel->AddIObject(It1.Value());
+ if (res == -1)
+ aStudy->highlight(It1.Value(), false);
+ if (res == 0)
+ aStudy->highlight(It1.Value(), true);
+ }
+ return RefType;
}
-}
-
-vtkRenderer* GetCurrentRenderer(){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView())
- return aViewFrame->getRenderer();
- return NULL;
-}
-
-void RepaintCurrentView(){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView())
- aViewFrame->Repaint();
-}
+ void OnEditDelete()
+ {
+ if (QAD_MessageBox::warn2
+ (QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_REALLY_DELETE"),
+ QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
+ return;
-enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
-void UpdateView(QAD_StudyFrame *theStudyFrame, EDisplaing theAction,
- const char* theEntry = "")
-{
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
- vtkRenderer *aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- switch(theAction){
- case eDisplayAll: {
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- anActor->SetVisibility(true);
+ QAD_Study* anActiveStudy = SMESH::GetActiveStudy();
+ int nbSf = anActiveStudy->getStudyFramesCount();
+
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+
+ SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection());
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for(; It.More(); It.Next()){
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ if(IObject->hasEntry()){
+ SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
+
+ /* Erase child graphical objects */
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
+ for(; it->More(); it->Next()){
+ SALOMEDS::SObject_var CSO = it->Value();
+ if(CSO->FindAttribute(anAttr, "AttributeIOR")){
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+
+ for(int i = 0; i < nbSf; i++){
+ QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
+ CORBA::String_var anEntry = CSO->GetID();
+ if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.in())){
+ SMESH::RemoveActor(sf,anActor);
+ }
+ }
}
}
- break;
- }
- case eDisplayOnly:
- case eEraseAll: {
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- anActor->SetVisibility(false);
+
+ /* Erase main graphical object */
+ for(int i = 0; i < nbSf; i++){
+ QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
+ if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,IObject->getEntry())){
+ SMESH::RemoveActor(sf,anActor);
}
}
- }
- default: {
- if(SMESH_Actor *anActor = FindActorByEntry(theStudyFrame,theEntry)){
- switch(theAction) {
- case eDisplay:
- case eDisplayOnly:
- anActor->SetVisibility(true);
- break;
- case eErase:
- anActor->SetVisibility(false);
- break;
- }
- } else {
- switch(theAction){
- case eDisplay:
- case eDisplayOnly:{
- QAD_Study* aStudy = theStudyFrame->getStudy();
- SALOMEDS::Study_var aDocument = aStudy->getStudyDocument();
- if(anActor = CreateActor(aDocument,theEntry,true)) {
- DisplayActor(theStudyFrame,anActor);
- FitAll();
- }
- break;
- }
+
+ // Remove object(s) from data structures
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
+ if(!obj->_is_nil()){
+ SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group ::_narrow(obj->GetObject());
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(obj->GetObject());
+
+ if ( !aGroup->_is_nil() ) { // DELETE GROUP
+ SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
+ aMesh->RemoveGroup( aGroup );
+ }
+ else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ aMesh->RemoveSubMesh( aSubMesh );
+ }
+ else {// default action: remove SObject from the study
+ // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
+ //QAD_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
+ //op->start();
+ aStudyBuilder->RemoveObjectWithChildren( obj );
+ //op->finish();
}
}
- }
- }
+
+ } /* IObject->hasEntry() */
+ } /* more/next */
+
+ /* Clear any previous selection */
+ Sel->ClearIObjects();
+ anActiveStudy->updateObjBrowser();
}
-}
-
-
-void UpdateView(EDisplaing theAction, const char* theEntry = ""){
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
- UpdateView(aStudyFrame,theAction,theEntry);
-}
-static bool IsReferencedObject( SALOMEDS::SObject_ptr SO )
-{
- if ( !SO->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( SO->FindAttribute( anAttr, "AttributeTarget" ) ) {
- SALOMEDS::AttributeTarget_var aTarget = SALOMEDS::AttributeTarget::_narrow( anAttr );
- SALOMEDS::Study::ListOfSObject_var aList = aTarget->Get();
- if ( aList->length() > 0 ) {
- return true;
- }
- }
- }
- return false;
-}
-void SetPointRepresentation(bool theIsVisible){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
- vtkRenderer *aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->GetVisibility()){
- anActor->SetPointRepresentation(theIsVisible);
- }
- }
- }
- RepaintCurrentView();
- }
}
-
//=============================================================================
/*!
*
SMESHGUI::SMESHGUI( const QString& theName, QObject* theParent ) :
SALOMEGUI( theName, theParent )
{
+ myActiveDialogBox = 0 ;
+ myState = -1 ;
+
+ SMESH::GetSMESHGen();
+ SMESH::GetFilterManager();
+ SMESH::GetPattern();
+
+ /* load resources for all available meshers */
+ SMESH::InitAvailableHypotheses();
}
//=============================================================================
//=============================================================================
SMESHGUI::~SMESHGUI()
{
+ SMESH::GetFilterManager()->Destroy();
}
//=============================================================================
//=============================================================================
SMESHGUI* SMESHGUI::GetSMESHGUI()
{
- if ( !smeshGUI )
- GetOrCreateSMESHGUI( QAD_Application::getDesktop() );
- return smeshGUI;
+ static SMESHGUI aSMESHGUI;
+ aSMESHGUI.myActiveStudy = SMESH::GetActiveStudy();
+ SMESH::GetSMESHGen()->SetCurrentStudy( SMESH::GetActiveStudyDocument() );
+
+ /* Automatic Update flag */
+ aSMESHGUI.myAutomaticUpdate = ( QAD_CONFIG->getSetting( "SMESH:AutomaticUpdate" ).compare( "true" ) == 0 );
+
+ return &aSMESHGUI;
}
extern "C"
return SMESHGUI::GetSMESHGUI();
}
}
+
//=============================================================================
/*!
*
*/
//=============================================================================
-SMESHGUI* SMESHGUI::GetOrCreateSMESHGUI( QAD_Desktop* desktop )
+void SMESHGUI::SetState(int aState)
{
- if( !smeshGUI ) {
- setOrb();
- smeshGUI = new SMESHGUI;
- smeshGUI->myActiveDialogBox = 0 ;
- smeshGUI->myState = -1 ;
- smeshGUI->myDesktop = desktop ;
-
- /* get smesh engine */
- Engines::Component_var comp = desktop->getEngine("FactoryServer", "SMESH");
- smeshGUI->myComponentMesh = SMESH::SMESH_Gen::_narrow(comp);
-
- /* get geom engine */
- Engines::Component_var comp1 = desktop->getEngine("FactoryServer", "GEOM");
- smeshGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp1);
-
- /* set current study */
- smeshGUI->myActiveStudy = desktop->getActiveStudy();
- smeshGUI->myStudyId = smeshGUI->myActiveStudy->getStudyId();
- smeshGUI->myStudy = smeshGUI->myActiveStudy->getStudyDocument();
- smeshGUI->myComponentGeom->GetCurrentStudy( smeshGUI->myStudyId );
- smeshGUI->myComponentMesh->SetCurrentStudy( smeshGUI->myStudy );
- // smeshGUI->myComponentGeom->NbLabels();
-
- /* create service object */
- smeshGUI->myStudyAPI = SMESHGUI_StudyAPI(smeshGUI->myStudy, smeshGUI->myComponentMesh);
-
- smeshGUI->myDocument = new SMESHDS_Document(1);//NBU
-
- smeshGUI->mySimulationActors = vtkActorCollection::New();
- smeshGUI->mySimulationActors2D = vtkActor2DCollection::New();
-
- /*filter manager*/
- smeshGUI->myFilterMgr = smeshGUI->myComponentMesh->CreateFilterManager();
-
- /* load resources for all available meshers */
- smeshGUI->InitAvailableHypotheses();
- } else {
- /* study may have changed - set current study */
- smeshGUI->myActiveStudy = desktop->getActiveStudy();
- smeshGUI->myStudyId = smeshGUI->myActiveStudy->getStudyId();
- smeshGUI->myStudy = smeshGUI->myActiveStudy->getStudyDocument();
- smeshGUI->myComponentGeom->GetCurrentStudy( smeshGUI->myStudyId );
- smeshGUI->myComponentMesh->SetCurrentStudy( smeshGUI->myStudy );
-
- // Set active study to Study API
- smeshGUI->myStudyAPI.Update( smeshGUI->myStudy );
- }
-
- /* Automatic Update flag */
- smeshGUI->myAutomaticUpdate = ( QAD_CONFIG->getSetting( "SMESH:AutomaticUpdate" ).compare( "true" ) == 0 );
-
- return smeshGUI;
+ this->myState = aState;
+ return;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::SetState(int aState)
+void SMESHGUI::ResetState()
{
- this->myState = aState;
+ this->myState = -1;
return;
}
*
*/
//=============================================================================
-void SMESHGUI::ResetState()
+void SMESHGUI::EmitSignalDeactivateDialog()
{
- this->myState = -1;
+ emit this->SignalDeactivateActiveDialog();
return;
}
*
*/
//=============================================================================
-void SMESHGUI::EmitSignalDeactivateDialog()
+void SMESHGUI::EmitSignalStudyFrameChanged()
{
- emit this->SignalDeactivateActiveDialog();
+ emit this->SignalStudyFrameChanged();
return;
}
return this->myActiveStudy;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SALOMEDS::Study_ptr SMESHGUI::GetStudy()
-{
- return SALOMEDS::Study::_narrow(myStudy);
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESHGUI_StudyAPI SMESHGUI::GetStudyAPI()
-{
- return myStudyAPI;
-}
-
//=============================================================================
/*!
*
//=============================================================================
QAD_Desktop *SMESHGUI::GetDesktop()
{
- return this->myDesktop;
+ return QAD_Application::getDesktop();
}
//=============================================================================
bool SMESHGUI::ActiveStudyChanged(QAD_Desktop* parent)
{
MESSAGE("SMESHGUI::activeStudyChanged init.");
- QAD_Study* prevStudy = 0;
- if ( smeshGUI )
- prevStudy = smeshGUI->myActiveStudy;
+ QAD_Study* prevStudy = myActiveStudy;
/* Create or retrieve an object SMESHGUI */
MESSAGE("Active study changed : prev study =" << prevStudy);
- SMESHGUI::GetOrCreateSMESHGUI( parent );
- MESSAGE("Active study changed : active study =" << smeshGUI->myActiveStudy);
- if ( prevStudy != smeshGUI->myActiveStudy ) {
- smeshGUI->EmitSignalCloseAllDialogs();
+ SMESHGUI::GetSMESHGUI();
+ EmitSignalStudyFrameChanged();
+ MESSAGE("Active study changed : active study =" << myActiveStudy);
+ if ( prevStudy != myActiveStudy ) {
+ EmitSignalCloseAllDialogs();
MESSAGE("Active study changed : SMESHGUI nullified" << endl);
//smeshGUI = 0;
- ::UpdateSelectionProp();
+ SMESH::UpdateSelectionProp();
}
MESSAGE("SMESHGUI::activeStudyChanged done.");
return true;
*
*/
//=============================================================================
-void SMESHGUI::EraseSimulationActors()
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
- { //VTK
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
-
- if (mySimulationActors != NULL)
- {
- mySimulationActors->InitTraversal();
- vtkActor *ac = mySimulationActors->GetNextActor();
- while (!(ac == NULL))
- {
- theRenderer->RemoveActor(ac);
- ac = mySimulationActors->GetNextActor();
- }
- mySimulationActors->RemoveAllItems();
- }
- if (mySimulationActors2D != NULL)
- {
- mySimulationActors2D->InitTraversal();
- vtkActor2D *ac = mySimulationActors2D->GetNextActor2D();
- while (!(ac == NULL))
- {
- theRenderer->RemoveActor2D(ac);
- ac = mySimulationActors2D->GetNextActor2D();
- }
- mySimulationActors2D->RemoveAllItems();
- }
- SetPointRepresentation(false);
+static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
+ return theStudy->GetProperties()->IsLocked();
+}
+
+static bool checkLock(const SALOMEDS::Study_var& theStudy) {
+ if (isStudyLocked(theStudy)) {
+ QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return true;
}
+ return false;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Mesh_ptr SMESHGUI::InitMesh( GEOM::GEOM_Shape_ptr aShape,
- QString NameMesh )
-{
- try {
- if ( !myComponentMesh->_is_nil() && !aShape->_is_nil() ) {
- SMESH::SMESH_Mesh_var aMesh = myComponentMesh->CreateMesh( aShape );
- if ( !aMesh->_is_nil() ) {
- SALOMEDS::SObject_var SM = smeshGUI->myStudy->FindObjectIOR( _orb->object_to_string( aMesh ) );
- myStudyAPI.SetName( SM, NameMesh );
- return SMESH::SMESH_Mesh::_narrow(aMesh);
- }
- }
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- QtCatchCorbaException( S_ex );
- }
- return SMESH::SMESH_Mesh::_nil();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_subMesh_ptr SMESHGUI::AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh,
- GEOM::GEOM_Shape_ptr aShape,
- QString NameMesh )
-{
- SMESH::SMESH_subMesh_var aSubMesh;
- try {
- if ( !aMesh->_is_nil() && !aShape->_is_nil() )
- // create sub mesh
- aSubMesh = SMESH::SMESH_subMesh::_duplicate( aMesh->GetSubMesh( aShape, NameMesh.latin1() ) ); //VSR: published automatically
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- QtCatchCorbaException( S_ex );
- aSubMesh = SMESH::SMESH_subMesh::_nil();
- }
- return aSubMesh._retn();
-}
+//=======================================================================
+//function : CheckActiveStudyLocked
+//purpose :
+//=======================================================================
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Group_ptr SMESHGUI::AddGroup( SMESH::SMESH_Mesh_ptr aMesh,
- SMESH::ElementType aType,
- QString aName )
+bool SMESHGUI::ActiveStudyLocked()
{
- SMESH::SMESH_Group_var aGroup;
- try {
- if ( !aMesh->_is_nil() )
- // create group
- aGroup = SMESH::SMESH_Group::_duplicate( aMesh->CreateGroup( aType, strdup(aName) ) ); //VSR: published automatically
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- QtCatchCorbaException( S_ex );
- aGroup = SMESH::SMESH_Group::_nil();
- }
- myActiveStudy->updateObjBrowser( true );
- return aGroup._retn();
+ SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
+ return checkLock( aStudy );
}
//=============================================================================
*
*/
//=============================================================================
-
-static void addMap( const map<string, HypothesisData*>& theMap,
- map<string, HypothesisData*>& toMap)
+bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
{
- map<string, HypothesisData*>::const_iterator it;
- for ( it = theMap.begin(); it != theMap.end(); it++ )
- toMap.insert( *it );
-}
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+ switch (theCommandID) {
+ case 33: // DELETE
+ if(checkLock(aStudy)) break;
+ ::OnEditDelete();
+ break;
-//=============================================================================
-/*!
- * InitAvailableHypotheses (read from resource XML file)
- */
-//=============================================================================
-void SMESHGUI::InitAvailableHypotheses ()
-{
- QAD_WaitCursor wc;
- if ((myHypothesesMap.begin() == myHypothesesMap.end()) &&
- (myAlgorithmsMap.begin() == myAlgorithmsMap.end()))
- {
- // Resource manager
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
- if (!resMgr) return;
-
- // Find name of a resource XML file ("SMESH_Meshers.xml");
- QString HypsXml;
- char* cenv = getenv("SMESH_MeshersList");
- if (cenv)
- HypsXml.sprintf("%s", cenv);
-
- QStringList HypsXmlList = QStringList::split( ":", HypsXml, false );
- if (HypsXmlList.count() == 0)
+ case 113: // IMPORT
+ case 112:
+ case 111:
{
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("MESHERS_FILE_NO_VARIABLE"),
- tr("SMESH_BUT_OK"));
- return;
+ if(checkLock(aStudy)) break;
+ ::ImportMeshesFromFile(parent,SMESH::GetSMESHGen(),theCommandID);
+ break;
}
- // loop on files in HypsXml
- QString aNoAccessFiles;
- for ( int i = 0; i < HypsXmlList.count(); i++ ) {
- QString HypsXml = HypsXmlList[ i ];
-
- // Find full path to the resource XML file
- QString xmlFile = HypsXml + ".xml";
- xmlFile = QAD_Tools::addSlash(resMgr->findFile(xmlFile, HypsXml)) + xmlFile;
-
- QFile file (QAD_Tools::unix2win(xmlFile));
- if (file.exists() && file.open(IO_ReadOnly))
- {
- file.close();
-
- SMESHGUI_XmlHandler* myXmlHandler = new SMESHGUI_XmlHandler();
- ASSERT(myXmlHandler);
-
- QXmlInputSource source (file);
- QXmlSimpleReader reader;
- reader.setContentHandler(myXmlHandler);
- reader.setErrorHandler(myXmlHandler);
- bool ok = reader.parse(source);
- file.close();
- if (ok)
- {
- addMap( myXmlHandler->myHypothesesMap, myHypothesesMap );
- addMap( myXmlHandler->myAlgorithmsMap, myAlgorithmsMap );
- }
- else
- {
- QAD_MessageBox::error1(myDesktop,
- tr("INF_PARSE_ERROR"),
- tr(myXmlHandler->errorProtocol()),
- tr("SMESH_BUT_OK"));
- }
- }
- else
- {
- if (aNoAccessFiles.isEmpty())
- aNoAccessFiles = xmlFile;
- else
- aNoAccessFiles += ", " + xmlFile;
- }
- } // end loop
-
-
- if (!aNoAccessFiles.isEmpty())
+ case 122: // EXPORT MED
+ case 121:
+ case 123:
{
- QString aMess = tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
- aMess += tr("MESHERS_FILE_CHECK_VARIABLE");
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- aMess,
- tr("SMESH_BUT_OK"));
- wc.start();
+ ::ExportMeshToFile(parent, theCommandID);
+ break;
}
- }
-}
-
-//=============================================================================
-/*!
- * GetAvailableHypotheses (read from resource XML file)
- */
-//=============================================================================
-QStringList SMESHGUI::GetAvailableHypotheses (const bool isAlgo)
-{
- QStringList aHypList;
-
- // Init list of available hypotheses, if needed
- InitAvailableHypotheses();
- // fill list of hypotheses/algorithms
- map<string, HypothesisData*>::iterator anIter;
- if (isAlgo)
- {
- anIter = myAlgorithmsMap.begin();
- for (; anIter != myAlgorithmsMap.end(); anIter++)
+ case 200: // SCALAR BAR
{
- aHypList.append(((*anIter).first).c_str());
+ SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ if( Sel && Sel->IObjectCount() ) {
+ Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
+ if( anIO->hasEntry() ) {
+ if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
+ anActor->SetControlMode( SMESH_Actor::eNone );
+ }
+ }
+ }
+ break;
}
- }
- else
- {
- anIter = myHypothesesMap.begin();
- for (; anIter != myHypothesesMap.end(); anIter++)
+ case 201:
{
- aHypList.append(((*anIter).first).c_str());
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( parent, Sel );
+ break;
}
- }
-
- return aHypList;
-}
-
-//=============================================================================
-/*!
- * GetHypothesisData
- */
-//=============================================================================
-HypothesisData* SMESHGUI::GetHypothesisData (const char* aHypType)
-{
- HypothesisData* aHypData = 0;
-
- // Init list of available hypotheses, if needed
- InitAvailableHypotheses();
- if (myHypothesesMap.find(aHypType) == myHypothesesMap.end())
- {
- if (myAlgorithmsMap.find(aHypType) != myAlgorithmsMap.end())
+ case 1134: // Clipping
+ case 1133: // Tranparency
+ case 1132: // Colors / Size
+ case 215:
+ case 213:
+ case 212:
+ case 211:
{
- aHypData = myAlgorithmsMap[aHypType];
+ ::SetViewMode(theCommandID);
+ break;
}
- }
- else
- {
- aHypData = myHypothesesMap[aHypType];
- }
- return aHypData;
-}
-
-//=============================================================================
-/*!
- * Get a Hypothesis Creator from a Plugin Library
- */
-//=============================================================================
-SMESHGUI_GenericHypothesisCreator* SMESHGUI::GetHypothesisCreator(const QString& aHypType)
-{
- char* sHypType = (char*)aHypType.latin1();
- MESSAGE("Get HypothesisCreator for " << sHypType);
-
- SMESHGUI_GenericHypothesisCreator* aCreator = 0;
-
- // check, if creator for this hypothesis type already exists
- if (myHypCreatorMap.find(sHypType) != myHypCreatorMap.end())
- {
- aCreator = myHypCreatorMap[sHypType];
- }
- else
- {
- // 1. Init list of available hypotheses, if needed
- InitAvailableHypotheses();
- // 2. Get names of plugin libraries
- HypothesisData* aHypData = GetHypothesisData(sHypType);
- if (!aHypData)
+ case 214: // UPDATE
{
- return aCreator;
+ if(checkLock(aStudy)) break;
+ SMESH::UpdateView();
+ break;
}
- QString aClientLibName = aHypData->ClientLibName;
- QString aServerLibName = aHypData->ServerLibName;
- // 3. Load Client Plugin Library
- try
+ case 300: // ERASE
+ case 301: // DISPLAY
+ case 302: // DISPLAY ONLY
{
- // load plugin library
- MESSAGE("Loading client meshers plugin library ...");
- void* libHandle = dlopen (aClientLibName, RTLD_LAZY);
- if (!libHandle)
- {
- // report any error, if occured
- const char* anError = dlerror();
- MESSAGE(anError);
+ SMESH::EDisplaing anAction;
+ switch(theCommandID){
+ case 300: anAction = SMESH::eErase; break;
+ case 301: anAction = SMESH::eDisplay; break;
+ case 302: anAction = SMESH::eDisplayOnly; break;
}
- else
- {
- // get method, returning hypothesis creator
- MESSAGE("Find GetHypothesisCreator() method ...");
- typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
- (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
- GetHypothesisCreator procHandle =
- (GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
- if (!procHandle)
- {
- MESSAGE("bad hypothesis client plugin library");
- dlclose(libHandle);
- }
- else
- {
- // get hypothesis creator
- MESSAGE("Get Hypothesis Creator for " << aHypType);
- aCreator = procHandle(aHypType, aServerLibName, smeshGUI);
- if (!aCreator)
- {
- MESSAGE("no such a hypothesis in this plugin");
- }
- else
- {
- // map hypothesis creator to a hypothesis name
- myHypCreatorMap[sHypType] = aCreator;
- }
- }
+
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ if (IOS->hasEntry()) {
+ SMESH::UpdateView(anAction,IOS->getEntry());
+ }
+ }
}
+ Sel->ClearIObjects();
+ break;
}
- catch (const SALOME::SALOME_Exception& S_ex)
- {
- QtCatchCorbaException(S_ex);
- }
- }
-
- return aCreator;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Hypothesis_ptr SMESHGUI::CreateHypothesis (const QString& aHypType,
- const QString& aHypName,
- const bool isAlgo)
-{
- MESSAGE("Create " << aHypType << " with name " << aHypName);
- SMESH::SMESH_Hypothesis_var Hyp;
-
- HypothesisData* aHypData = GetHypothesisData((char*)aHypType.latin1());
- QString aServLib = aHypData->ServerLibName;
-
- try
- {
- Hyp = myComponentMesh->CreateHypothesis(aHypType, aServLib);
- if (!Hyp->_is_nil())
+ case 400: // NODES
{
- SALOMEDS::SObject_var SHyp =
- smeshGUI->myStudy->FindObjectIOR( _orb->object_to_string( Hyp ) );
- if (!SHyp->_is_nil())
- {
- if ( !aHypName.isEmpty() )
- myStudyAPI.SetName( SHyp, aHypName );
- myActiveStudy->updateObjBrowser(true);
- return Hyp._retn();
- }
- }
- }
- catch (const SALOME::SALOME_Exception & S_ex)
- {
- QtCatchCorbaException(S_ex);
- }
-
- return SMESH::SMESH_Hypothesis::_nil();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::AddHypothesisOnMesh(SMESH::SMESH_Mesh_ptr aMesh,
- SMESH::SMESH_Hypothesis_ptr aHyp)
-{
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
-
- if ( !aMesh->_is_nil() ) {
- SALOMEDS::SObject_var SM = myStudyAPI.FindObject( aMesh );
- GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh(SM);
- try {
- res = aMesh->AddHypothesis( aShape, aHyp );
- if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
- SALOMEDS::SObject_var SH = myStudyAPI.FindObject(aHyp);
- if ( !SM->_is_nil() && !SH->_is_nil() ) {
- //myStudyAPI.SetHypothesis(SM, SH); // VSR: published automatically by engine
- myStudyAPI.ModifiedMesh(SM, false);
- }
- }
- if ( res >= SMESH::HYP_UNKNOWN_FATAL ) {
- wc.stop();
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("SMESH_ERROR"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_NodesDlg *aDlg = new SMESHGUI_NodesDlg(parent, "", Sel);
}
- else if ( res > SMESH::HYP_OK ) {
- wc.stop();
+ else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr(QString("SMESH_HYP_%1").arg(res)),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_VIEWER_VTK"),
tr("SMESH_BUT_OK"));
- wc.start();
}
+ break;
}
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::RemoveHypothesisOrAlgorithmOnMesh
- (const Handle(SALOME_InteractiveObject)& IObject)
-{
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
- if (IObject->hasReference())
+ case 2151: // FILTER
{
- try {
- SMESH::SMESH_Hypothesis_var anHyp;
- SALOMEDS::SObject_var SO_Hypothesis =
- smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
-
- if (!SO_Hypothesis->_is_nil()) {
- if (SO_Hypothesis->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- anHyp = SMESH::SMESH_Hypothesis::_narrow
- (_orb->string_to_object(anIOR->Value()));
- }
-
- SALOMEDS::SObject_var SO_Applied_Hypothesis =
- smeshGUI->myStudy->FindObjectID(IObject->getReference());
- if (!SO_Applied_Hypothesis->_is_nil()) {
- SALOMEDS::SObject_var MorSM =
- smeshGUI->myStudyAPI.GetMeshOrSubmesh(SO_Applied_Hypothesis);
- if (!MorSM->_is_nil()) {
- GEOM::GEOM_Shape_var aShape =
- smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShape->_is_nil() && MorSM->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- SMESH::SMESH_Mesh_var aMesh =
- SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value()));
- SMESH::SMESH_subMesh_var aSubMesh =
- SMESH::SMESH_subMesh::_narrow(_orb->string_to_object(anIOR->Value()));
-
- if (!aSubMesh->_is_nil())
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil())
- {
- res = aMesh->RemoveHypothesis(aShape, anHyp);
- if ( res < SMESH::HYP_UNKNOWN_FATAL )
- smeshGUI->myStudyAPI.ModifiedMesh(MorSM, false);
- if ( res > SMESH::HYP_OK ) {
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
- }
- }
- }
- }
- }
- }
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+ {
+ EmitSignalDeactivateDialog();
+ SMESHGUI_FilterDlg *aDlg = new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
}
+ break;
}
- else if (IObject->hasEntry())
- {
- MESSAGE("IObject entry " << IObject->getEntry());
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::RemoveHypothesisOrAlgorithmOnMesh(SALOMEDS::SObject_ptr MorSM,
- SMESH::SMESH_Hypothesis_ptr anHyp)
-{
- SALOMEDS::SObject_var AHR, aRef;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
-
- if (!MorSM->_is_nil()) {
- try {
- GEOM::GEOM_Shape_var aShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShape->_is_nil()) {
- if (MorSM->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- SMESH::SMESH_Mesh_var aMesh =
- SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value()));
- SMESH::SMESH_subMesh_var aSubMesh =
- SMESH::SMESH_subMesh::_narrow(_orb->string_to_object(anIOR->Value()));
-
- if ( !aSubMesh->_is_nil() )
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil()) {
- res = aMesh->RemoveHypothesis(aShape, anHyp);
- if ( res < SMESH::HYP_UNKNOWN_FATAL )
- smeshGUI->myStudyAPI.ModifiedMesh(MorSM, false);
- if ( res > SMESH::HYP_OK ) {
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
- }
- }
- }
+
+ case 406: // MOVE NODE
+ {
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
+ {
+ QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+ break;
}
+
+ if(checkLock(aStudy)) break;
+ SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ SMESHGUI_MoveNodesDlg *aDlg = new SMESHGUI_MoveNodesDlg( parent, Sel );
+ break;
}
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
+
+ case 701: // COMPUTE MESH
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ int nbSel = Sel->IObjectCount();
+ if (nbSel != 1){
+ break;
+ }
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::AddAlgorithmOnMesh( SMESH::SMESH_Mesh_ptr aMesh,
- SMESH::SMESH_Hypothesis_ptr aHyp )
-{
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
-
- if ( !aMesh->_is_nil() ) {
- SALOMEDS::SObject_var SM = myStudyAPI.FindObject( aMesh );
- GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SM );
- try {
- res = aMesh->AddHypothesis( aShape, aHyp );
- if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
- //SALOMEDS::SObject_var SH = myStudyAPI.FindObject( aHyp );
- //if ( !SM->_is_nil() && !SH->_is_nil() ) {
- //myStudyAPI.SetAlgorithms(SM, SH);
- myStudyAPI.ModifiedMesh( SM, false );
- //}
- }
- if ( res >= SMESH::HYP_UNKNOWN_FATAL ) {
- wc.stop();
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("SMESH_ERROR"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
- }
- else if ( res > SMESH::HYP_OK ) {
- wc.stop();
- QAD_MessageBox::warn1( QAD_Application::getDesktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr( "SMESH_BUT_OK" ) );
- wc.start();
- }
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::AddHypothesisOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh,
- SMESH::SMESH_Hypothesis_ptr aHyp )
-{
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
-
- if ( !aSubMesh->_is_nil() ) {
- try {
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- SALOMEDS::SObject_var SsubM = myStudyAPI.FindObject( aSubMesh );
- GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SsubM );
- if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShape->_is_nil() ) {
- res = aMesh->AddHypothesis( aShape, aHyp );
- if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
- //SALOMEDS::SObject_var SH = myStudyAPI.FindObject(aHyp);
- // if (!SsubM->_is_nil() && !SH->_is_nil())
- // {
- // myStudyAPI.SetHypothesis(SsubM, SH);
- myStudyAPI.ModifiedMesh( SsubM, false );
- // }
- }
- if ( res >= SMESH::HYP_UNKNOWN_FATAL ) {
- wc.stop();
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("SMESH_ERROR"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
+ SMESH::SMESH_Mesh_var aMesh;
+ SMESH::SMESH_subMesh_var aSubMesh;
+ Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+ if (IObject->hasEntry()){
+ SALOMEDS::SObject_var aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
+ if ( aShapeObject->_is_nil() ) {
+ // imported mesh
+ break;
+ }
+ if(!aMeshSObj->_is_nil()) {
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
+
+ if (!aMesh->_is_nil()){
+ GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
+ if (!refShapeObject->_is_nil()) {
+ if(!SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_MISSING_PARAMETERS"),
+ tr("SMESH_BUT_OK"));
+ break;
+ }
+ try{
+ if (SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject))
+ SMESH::ModifiedMesh(aMeshSObj,true);
+ // TO Do : change icon of all submeshes
+ else
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_COMPUTE_FAILED"),
+ tr("SMESH_BUT_OK"));
+ }
+ catch(const SALOME::SALOME_Exception & S_ex){
+ QtCatchCorbaException(S_ex);
+ }
+ }
+ }else if(!aSubMesh->_is_nil()){
+ aMesh = aSubMesh->GetFather();
+ GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
+ if(!refShapeObject->_is_nil()){
+ bool compute = SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
+ if(!compute){
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_MISSING_PARAMETERS"),
+ tr("SMESH_BUT_OK"));
+ break;
+ }
+ try{
+ if ( SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject) )
+ SMESH::ModifiedMesh(aMeshSObj,true);
+ // TO Do : change icon of all submeshes
+ else
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_COMPUTE_FAILED"),
+ tr("SMESH_BUT_OK"));
+ }catch(const SALOME::SALOME_Exception & S_ex){
+ QtCatchCorbaException(S_ex);
+ }
+ }
+ }
+ }
}
- else if ( res > SMESH::HYP_OK ) {
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr( "SMESH_BUT_OK" ) );
- wc.start();
+ CORBA::Long anId = aStudy->StudyId();
+ TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
+ if(myAutomaticUpdate && aVisualObj){
+ aVisualObj->Update();
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
+ if(!anActor){
+ anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
+ if(anActor){
+ SMESH::DisplayActor(myActiveStudy->getActiveStudyFrame(),anActor); //apo
+ SMESH::FitAll();
+ }
+ }
}
+ }else{
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
}
+ break;
}
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::AddAlgorithmOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh,
- SMESH::SMESH_Hypothesis_ptr aHyp )
-{
- int res = SMESH::HYP_UNKNOWN_FATAL;
- QAD_WaitCursor wc;
-
- if ( !aSubMesh->_is_nil() ) {
- try {
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- SALOMEDS::SObject_var SsubM = myStudyAPI.FindObject(aSubMesh);
- GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh(SsubM);
- if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShape->_is_nil() ) {
- res = aMesh->AddHypothesis( aShape, aHyp );
- if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
- //SALOMEDS::SObject_var SH = myStudyAPI.FindObject(aHyp);
- //if (!SsubM->_is_nil() && !SH->_is_nil()) {
- //myStudyAPI.SetAlgorithms(SsubM, SH);
- myStudyAPI.ModifiedMesh( SsubM, false );
- //}
- }
- if ( res >= SMESH::HYP_UNKNOWN_FATAL ) {
- wc.stop();
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("SMESH_ERROR"),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
- }
- else if ( res > SMESH::HYP_OK ) {
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr(QString("SMESH_HYP_%1").arg(res)),
- tr( "SMESH_BUT_OK" ) );
- wc.start();
- }
+ case 702: // ADD SUB MESH
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_AddSubMeshDlg *aDlg = new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
}
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- return res < SMESH::HYP_UNKNOWN_FATAL;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-int SMESHGUI::GetNameOfSelectedIObjects(SALOME_Selection * Sel, QString & aName)
-{
- int nbSel = Sel->IObjectCount();
- if (nbSel == 1)
- {
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- aName = IObject->getName();
- }
- else
- {
- aName = tr("SMESH_OBJECTS_SELECTED").arg(nbSel);
- }
- return nbSel;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-int SMESHGUI::GetNameOfSelectedNodes(SALOME_Selection * Sel, QString & aName){
- aName = "";
- if(Sel->IObjectCount() == 1){
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = ::FindActorByEntry(IObject->getEntry())){
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex(IObject, MapIndex);
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(; ite.More(); ite.Next()){
- aName += QString(" %1").arg(anActor->GetNodeObjId(ite.Key()));
- }
- return MapIndex.Extent();
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
}
+ break;
}
- }
- return -1;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-int SMESHGUI::GetNameOfSelectedElements(SALOME_Selection * Sel, QString & aName){
- aName = "";
- if(Sel->IObjectCount() == 1){
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = ::FindActorByEntry(IObject->getEntry())){
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex(IObject, MapIndex);
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- std::vector<int> aList;
- for(; ite.More(); ite.Next()){
- int aVtkId = ite.Key();
- int anObjId = anActor->GetElemObjId(aVtkId);
- std::vector<int>::iterator found = find(aList.begin(), aList.end(), anObjId);
- // MESSAGE("GetNameOfSelectedElements(): VTK Id = " << aVtkId << ", OBJECT Id = " << anObjId);
- if (found == aList.end()) {
- aList.push_back(anObjId);
- aName += QString(" %1").arg(anObjId);
- }
- }
- return aList.size();
- }
+
+ case 703: // INIT MESH
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_InitMeshDlg *aDlg = new SMESHGUI_InitMeshDlg(parent, "", Sel);
+ break;
}
- }
- return -1;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-int SMESHGUI::GetNameOfSelectedEdges(SALOME_Selection * Sel, QString & aName){
- aName = "";
- if(Sel->IObjectCount() == 1){
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = ::FindActorByEntry(IObject->getEntry())){
- TColStd_MapOfInteger MapIndex;
- Sel->GetIndex(IObject, MapIndex);
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(; ite.More(); ite.Next()){
- aName += QString(" %1").arg(ite.Key());
- }
- return MapIndex.Extent();
- }
+ case 704: // EDIT Hypothesis
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+ break;
}
- }
- return -1;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH_Actor *SMESHGUI::FindActorByEntry(QString theEntry,
- Standard_Boolean & theResult,
- bool onlyInActiveView)
-{
- theResult = false;
- int aNbStudyFrames = myActiveStudy->getStudyFramesCount();
- for (int i = 0; i < aNbStudyFrames; i++){
- QAD_StudyFrame *aStudyFrame = myActiveStudy->getStudyFrame(i);
- if(SMESH_Actor *anActor = ::FindActorByEntry(aStudyFrame,theEntry.latin1())){
- theResult = true;
- return anActor;
+ case 705: // EDIT Global Hypothesis
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+ break;
}
- }
- return NULL;
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH_Actor* SMESHGUI::FindActor(CORBA::Object_ptr theObj,
- Standard_Boolean & theResult,
- bool theOnlyInActiveView)
-{
- theResult = false;
- SMESH_Actor* aRes = NULL;
- if ( !CORBA::is_nil( theObj ) ) {
- SALOMEDS::SObject_var aSObject = SALOMEDS::SObject::_narrow( myStudy->FindObjectIOR( _orb->object_to_string( theObj ) ) );
- if( !aSObject->_is_nil()) {
- CORBA::String_var anEntry = aSObject->GetID();
- aRes = FindActorByEntry( anEntry.in(), theResult, theOnlyInActiveView );
+ case 706: // EDIT Local Hypothesis
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
+ break;
}
- }
- return aRes;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Mesh_ptr SMESHGUI::ConvertIOinMesh(const Handle(SALOME_InteractiveObject) & IO,
- Standard_Boolean & testResult)
-{
- SMESH::SMESH_Mesh_var aMesh;
- testResult = false;
- /* case SObject */
- if (IO->hasEntry())
- {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IO->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if (!obj->_is_nil())
+ case 407: // DIAGONAL INVERSION
+ case 408: // Delete diagonal
{
- if (obj->FindAttribute(anAttr, "AttributeIOR"))
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
{
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aMesh =
- SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value()));
- if (!aMesh->_is_nil())
- {
- testResult = true;
- return SMESH::SMESH_Mesh::_duplicate(aMesh);
- }
- }
+ QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+ break;
+ }
+
+ if ( checkLock( aStudy ) )
+ break;
+
+ SALOME_Selection *aSel =
+ SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ /*Standard_Boolean aRes;
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
+ if ( aMesh->_is_nil() )
+ {
+ QAD_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) );
+ break;
+ }
+ */
+ EmitSignalDeactivateDialog();
+ if ( theCommandID == 407 )
+ new SMESHGUI_TrianglesInversionDlg( parent, aSel );
+ else
+ new SMESHGUI_UnionOfTwoTrianglesDlg( parent, aSel );
+ break;
}
- }
- return SMESH::SMESH_Mesh::_nil();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_subMesh_ptr SMESHGUI::ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject) & IO,
- Standard_Boolean & testResult)
-{
- SMESH::SMESH_subMesh_var aSubMesh;
- testResult = false;
-
- /* case SObject */
- if (IO->hasEntry())
- {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IO->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if (!obj->_is_nil())
+ case 409: // Change orientation
+ case 410: // Union of triangles
+ case 411: // Cutting of quadrangles
{
- if (obj->FindAttribute(anAttr, "AttributeIOR"))
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
{
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aSubMesh = SMESH::SMESH_subMesh::_narrow(_orb->string_to_object(anIOR->Value()));
- if (!aSubMesh->_is_nil())
- {
- testResult = true;
- return SMESH::SMESH_subMesh::_duplicate(aSubMesh);
- }
+ QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+ break;
}
- }
- }
- return SMESH::SMESH_subMesh::_nil();
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Hypothesis_ptr SMESHGUI::ConvertIOinSMESHHypothesis(const Handle(SALOME_InteractiveObject) & IO,
- Standard_Boolean & testResult)
-{
- SMESH::SMESH_Hypothesis_var aHyp;
- testResult = false;
+ if ( checkLock( aStudy ) )
+ break;
- /* case SObject */
- if (IO->hasEntry())
- {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IO->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if (!obj->_is_nil())
- {
- if (obj->FindAttribute(anAttr, "AttributeIOR"))
- {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(anIOR->Value()));
- if (!aHyp->_is_nil())
- {
- testResult = true;
- return SMESH::SMESH_Hypothesis::_duplicate(aHyp);
- }
- }
- }
- }
- return SMESH::SMESH_Hypothesis::_nil();
-}
+ SALOME_Selection *aSel =
+ SALOME_Selection::Selection( myActiveStudy->getSelection() );
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH::SMESH_Group_ptr SMESHGUI::ConvertIOinSMESHGroup(const Handle(SALOME_InteractiveObject) & IO,
- Standard_Boolean & testResult)
-{
- SMESH::SMESH_Group_var aGroup;
- testResult = false;
+ EmitSignalDeactivateDialog();
+ SMESHGUI_MultiEditDlg* aDlg;
+ if ( theCommandID == 409 )
+ aDlg = new SMESHGUI_ChangeOrientationDlg( parent, aSel );
+ else if ( theCommandID == 410 )
+ aDlg = new SMESHGUI_UnionOfTrianglesDlg( parent, aSel );
+ else
+ aDlg = new SMESHGUI_CuttingOfQuadsDlg( parent, aSel );
- /* case SObject */
- if (IO->hasEntry()) {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IO->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if (!obj->_is_nil()) {
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aGroup = SMESH::SMESH_Group::_narrow(_orb->string_to_object(anIOR->Value()));
- if (!aGroup->_is_nil()) {
- testResult = true;
- return SMESH::SMESH_Group::_duplicate(aGroup);
- }
- }
+ int x, y ;
+ DefineDlgPosition( aDlg, x, y );
+ aDlg->move( x, y );
+ aDlg->show();
+ break;
+ }
+ case 412: // Smoothing
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_SmoothingDlg *aDlg = new SMESHGUI_SmoothingDlg(parent, "", Sel);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
+ break;
+ }
+ case 413: // Extrusion
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_ExtrusionDlg *aDlg = new SMESHGUI_ExtrusionDlg(parent, "", Sel);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
+ break;
+ }
+ case 414: // Revolution
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RevolutionDlg *aDlg = new SMESHGUI_RevolutionDlg(parent, "", Sel);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
+ break;
+ }
+ case 415: // Pattern mapping
+ {
+ if ( checkLock( aStudy ) )
+ break;
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+ {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(
+ myActiveStudy->getSelection() );
+ new SMESHGUI_MeshPatternDlg( parent, Sel );
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
+ break;
+ }
+ case 801: // CREATE GROUP
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ int nbSel = Sel->IObjectCount();
+ if (nbSel == 1) {
+ // check if mesh is selected
+ SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(Sel->firstIObject());
+ if (!aMesh->_is_nil()) {
+ SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aMesh);
+ aDlg->show();
+ }
+ }
+ break;
}
- }
- return SMESH::SMESH_Group::_nil();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-GEOM::GEOM_Shape_ptr SMESHGUI::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject) & IO,
- Standard_Boolean & testResult)
-{
- GEOM::GEOM_Shape_var aShape;
- testResult = false;
- /* case SObject */
- if (IO->hasEntry()) {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IO->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if (!obj->_is_nil()) {
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aShape = myComponentGeom->GetIORFromString(anIOR->Value());
- if (!aShape->_is_nil()) {
- testResult = true;
- return GEOM::GEOM_Shape::_duplicate(aShape);
+ case 802: // CONSTRUCT GROUP
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ int nbSel = Sel->IObjectCount();
+ if (nbSel == 1) {
+ // check if submesh is selected
+ Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+ if (IObject->hasEntry()) {
+ SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(IObject->getEntry());
+ if(!aSObj->_is_nil()) {
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(aSObj->GetObject());
+ if (!aSubMesh->_is_nil()) {
+ try {
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ // get submesh elements list by types
+ SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
+ SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
+ SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
+ SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
+ // create group for each type o elements
+ QString aName = IObject->getName();
+ if (aNodes->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName);
+ aGroup->Add(aNodes.inout());
+ }
+ if (aEdges->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName);
+ aGroup->Add(aEdges.inout());
+ }
+ if (aFaces->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName);
+ aGroup->Add(aFaces.inout());
+ }
+ if (aVolumes->length() > 0) {
+ SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName);
+ aGroup->Add(aVolumes.inout());
+ }
+ myActiveStudy->updateObjBrowser(true);
+ }catch(const SALOME::SALOME_Exception & S_ex){
+ QtCatchCorbaException(S_ex);
+ }
+ }
+ }
}
}
+ break;
}
- }
- return GEOM::GEOM_Shape::_nil();
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::SetViewMode(int commandId){
- SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
- if(Sel->IObjectCount() >= 1){
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for(; It.More(); It.Next()){
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()){
- if(SMESH_Actor *anActor = ::FindActorByEntry(IObject->getEntry())){
- switch(commandId){
- case 211:
- ChangeRepresentation(anActor,0);
- break;
- case 212:
- ChangeRepresentation(anActor,1);
- break;
- case 213:
- ChangeRepresentation(anActor,2);
- break;
- case 215:
- ChangeRepresentation(anActor,5);
- break;
- case 1132:
- ChangeRepresentation(anActor,3);
- break;
- }
+ case 803: // EDIT GROUP
+ {
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
+ SALOME_ListIteratorOfListIO It (IOs);
+ for ( ; It.More(); It.Next() )
+ {
+ SMESH::SMESH_Group_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_Group>(It.Value());
+ if (!aGroup->_is_nil()) {
+ SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aGroup);
+ aDlg->show();
}
}
+ break;
}
- if(commandId == 1133)
- ChangeRepresentation(NULL,4);
- }
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::ChangeRepresentation(SMESH_Actor * theActor, int type){
- switch (type){
- case 0:{
- //theActor->UnShrink();
- theActor->SetRepresentation(SMESH_Actor::eEdge);
- break;
- }
- case 1:{
- //theActor->UnShrink();
- theActor->SetRepresentation(SMESH_Actor::eSurface);
- break;
- }
- case 2:{
- theActor->IsShrunk() ? theActor->UnShrink() : theActor->SetShrink();
- //theActor->SetRepresentation(SMESH_Actor::eSurface);
- break;
- }
- case 5:{
- //theActor->UnShrink();
- theActor->SetRepresentation(SMESH_Actor::ePoint);
- break;
- }
- case 3:{
- float color[3];
- theActor->GetSufaceColor(color[0], color[1], color[2]);
- int c0 = int (color[0] * 255);
- int c1 = int (color[1] * 255);
- int c2 = int (color[2] * 255);
- QColor c(c0, c1, c2);
-
- float edgecolor[3];
- theActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
- c0 = int (edgecolor[0] * 255);
- c1 = int (edgecolor[1] * 255);
- c2 = int (edgecolor[2] * 255);
- QColor e(c0, c1, c2);
-
- float backfacecolor[3];
- theActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
- c0 = int (backfacecolor[0] * 255);
- c1 = int (backfacecolor[1] * 255);
- c2 = int (backfacecolor[2] * 255);
- QColor b(c0, c1, c2);
-
- float nodecolor[3];
- theActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
- c0 = int (nodecolor[0] * 255);
- c1 = int (nodecolor[1] * 255);
- c2 = int (nodecolor[2] * 255);
- QColor n(c0, c1, c2);
-
- int Edgewidth = (int)theActor->GetLineWidth();
- if(Edgewidth == 0)
- Edgewidth = 1;
- int intValue = int(theActor->GetNodeSize());
- float Shrink = theActor->GetShrinkFactor();
-
- SMESHGUI_Preferences_ColorDlg *aDlg = new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(),"");
- aDlg->SetColor(1, c);
- aDlg->SetColor(2, e);
- aDlg->SetColor(3, n);
- aDlg->SetColor(4, b);
- aDlg->SetIntValue(1, Edgewidth);
- aDlg->SetIntValue(2, intValue);
- aDlg->SetIntValue(3, int(Shrink*100.));
- if(aDlg->exec()){
- QColor color = aDlg->GetColor(1);
- QColor edgecolor = aDlg->GetColor(2);
- QColor nodecolor = aDlg->GetColor(3);
- QColor backfacecolor = aDlg->GetColor(4);
- /* actor color and backface color */
- theActor->SetSufaceColor(float (color.red()) / 255.,
- float (color.green()) / 255.,
- float (color.blue()) / 255.);
- theActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
- float (backfacecolor.green()) / 255.,
- float (backfacecolor.blue()) / 255.);
-
- /* edge color */
- theActor->SetEdgeColor(float (edgecolor.red()) / 255.,
- float (edgecolor.green()) / 255.,
- float (edgecolor.blue()) / 255.);
-
- /* Shrink factor and size edges */
- theActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
- theActor->SetLineWidth(aDlg->GetIntValue(1));
-
- /* Nodes color and size */
- theActor->SetNodeColor(float (nodecolor.red()) / 255.,
- float (nodecolor.green()) / 255.,
- float (nodecolor.blue()) / 255.);
- theActor->SetNodeSize(aDlg->GetIntValue(2));
+ case 804: // Add elements to group
+ {
+ if(checkLock(aStudy)) break;
+ if (myState == 800) {
+ SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
+ if (aDlg) aDlg->onAdd();
+ }
+ break;
+ }
- delete aDlg;
+ case 805: // Remove elements from group
+ {
+ if(checkLock(aStudy)) break;
+ if (myState == 800) {
+ SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
+ if (aDlg) aDlg->onRemove();
+ }
+ break;
}
- break;
- }
- case 4:{
- EmitSignalDeactivateDialog();
- SMESHGUI_TransparencyDlg *aDlg = new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
- break;
- }
- }
- UpdateView();
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::UpdateView(){
- ::RepaintCurrentView();
-}
+ case 810: // Union Groups
+ case 811: // Intersect groups
+ case 812: // Cut groups
+ {
+ if ( checkLock( aStudy ) )
+ break;
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DisplayActor(SMESH_Actor * theActor, bool theVisibility){
- theActor->SetVisibility(theVisibility);
- ::DisplayActor(myActiveStudy->getActiveStudyFrame(),theActor);
-}
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(
+ myActiveStudy->getSelection() );
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::EraseActor(SMESH_Actor * theActor){
- theActor->SetVisibility(false);
-}
+ int aMode;
+ if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
+ else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
+ else aMode = SMESHGUI_GroupOpDlg::CUT;
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::AddActorInSelection(SMESH_Actor * ac)
-{
- SALOME_Selection *Sel =
- SALOME_Selection::Selection(myActiveStudy->getSelection());
- Sel->ClearIObjects();
- if (ac->hasIO())
- return Sel->AddIObject(ac->getIO());
- else
- return -1;
-}
+ ( new SMESHGUI_GroupOpDlg( parent, Sel, aMode ) )->show();
+ break;
+ }
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-QString SMESHGUI::CheckHomogeneousSelection()
-{
- SALOME_Selection *Sel =
- SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- /* copy the list */
- SALOME_ListIO List;
- SALOME_ListIteratorOfListIO Itinit(Sel->StoredIObjects());
- for (; Itinit.More(); Itinit.Next())
- {
- List.Append(Itinit.Value());
- }
+ case 813: // Delete groups with their contents
+ {
+ if ( checkLock( aStudy ) )
+ break;
- QString RefType = CheckTypeObject(Sel->firstIObject());
- SALOME_ListIteratorOfListIO It(List);
- for (; It.More(); It.Next())
- {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- QString Type = CheckTypeObject(IObject);
- if (Type.compare(RefType) != 0)
- return "Heterogeneous Selection";
- }
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(
+ myActiveStudy->getSelection() );
- Sel->ClearIObjects();
- SALOME_ListIteratorOfListIO It1(List);
- for (; It1.More(); It1.Next())
- {
- int res = Sel->AddIObject(It1.Value());
- if (res == -1)
- myActiveStudy->highlight(It1.Value(), false);
- if (res == 0)
- myActiveStudy->highlight(It1.Value(), true);
- }
- return RefType;
-}
+ ( new SMESHGUI_DeleteGroupDlg( parent, Sel ) )->show();
+ break;
+ }
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-QString SMESHGUI::CheckTypeObject(const Handle(SALOME_InteractiveObject) & IO)
-{
- SALOMEDS::SObject_var sobj = smeshGUI->myActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry());
- if (!sobj->_is_nil()) {
- SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent();
- if (strcmp(scomp->GetID(), IO->getEntry()) == 0)
- { // component is selected
- return "Component";
+ case 900: // MESH INFOS
+ {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel =
+ SALOME_Selection::Selection(myActiveStudy->getSelection());
+ if ( Sel->IObjectCount() > 1 ) { // a dlg for each IO
+ SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
+ SALOME_ListIteratorOfListIO It (IOs);
+ for ( ; It.More(); It.Next() ) {
+ Sel->ClearIObjects();
+ Sel->AddIObject( It.Value() );
+ SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false);
+ }
+ // restore selection
+ Sel->ClearIObjects();
+ for (It.Initialize( IOs ) ; It.More(); It.Next() )
+ Sel->AddIObject( It.Value() );
}
- }
-
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
-
- Handle(SMESH_TypeFilter) aHypFilter = new SMESH_TypeFilter(HYPOTHESIS);
- Handle(SMESH_TypeFilter) anAlgoFilter = new SMESH_TypeFilter(ALGORITHM);
- Handle(SMESH_TypeFilter) aMeshFilter = new SMESH_TypeFilter(MESH);
- Handle(SMESH_TypeFilter) aSubMeshFilter = new SMESH_TypeFilter(SUBMESH);
- Handle(SMESH_TypeFilter) aGroupFilter = new SMESH_TypeFilter(GROUP);
- Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
- Handle(SMESH_TypeFilter) aSubMeshVextexFilter = new SMESH_TypeFilter(SUBMESH_VERTEX);
- Handle(SMESH_TypeFilter) aSubMeshEdgeFilter = new SMESH_TypeFilter(SUBMESH_EDGE);
- Handle(SMESH_TypeFilter) aSubMeshFaceFilter = new SMESH_TypeFilter(SUBMESH_FACE);
- Handle(SMESH_TypeFilter) aSubMeshSolidFilter = new SMESH_TypeFilter(SUBMESH_SOLID);
- Handle(SMESH_TypeFilter) aSubMeshCompoundFilter = new SMESH_TypeFilter(SUBMESH_COMPOUND);
-
- Sel->AddFilter(aHypFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "Hypothesis";
- }
+ else
+ SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false);
+ break;
+ }
- Sel->ClearFilters();
- Sel->AddFilter(anAlgoFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "Algorithm";
- }
+ case 1001: // AUTOMATIC UPDATE PREFERENCES
+ {
+ parent->menuBar()->setItemChecked(1001, !parent->menuBar()->isItemChecked(1001));
+ if (parent->menuBar()->isItemChecked(1001)) {
+ QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "true");
+ myAutomaticUpdate = true;
+ }
+ else {
+ QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "false");
+ myAutomaticUpdate = false;
+ }
+ break;
+ }
- Sel->ClearFilters();
- Sel->AddFilter(aMeshFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "Mesh";
- }
+ case 1003: // MESH PREFERENCES
+ {
+ ::SetDisplaySettings();
+ break;
+ }
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMesh";
- }
+ case 1005:
+ {
+ SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( parent );
+ break;
+ }
- Sel->ClearFilters();
- Sel->AddFilter(aGroupFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "Group";
- }
+ case 1007:
+ {
+ ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
+ break;
+ }
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshVextexFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMeshVertex";
- }
+ case 1006:
+ {
+ SMESHGUI_Preferences_SelectionDlg* aDlg =
+ new SMESHGUI_Preferences_SelectionDlg(parent);
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshEdgeFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMeshEdge";
- }
+ QColor aColor;
+ QString SCr, SCg, SCb;
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else aColor = Qt::cyan;
+ aDlg->SetColor(1, aColor);
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshFaceFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMeshFace";
- }
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else aColor = Qt::yellow;
+ aDlg->SetColor(2, aColor);
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshSolidFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMeshSolid";
- }
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ else aColor = Qt::white;
+ aDlg->SetColor(3, aColor);
- Sel->ClearFilters();
- Sel->AddFilter(aSubMeshCompoundFilter);
- if (Sel->AddIObject(IO) != -1) {
- Sel->ClearFilters();
- return "SubMeshCompound";
- }
+ QString SW1 = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
+ if (SW1.isEmpty()) SW1 = "5";
+ aDlg->SetWidth(1, SW1.toInt());
- Sel->ClearFilters();
- Sel->AddIObject(IO);
- return "NoType";
-}
+ QString SW2 = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
+ if (SW2.isEmpty()) SW2 = "5";
+ aDlg->SetWidth(2, SW2.toInt());
+ QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
+ if (SP1.isEmpty()) SP1 = "0.025";
+ aDlg->SetPrecision(1, SP1.toDouble());
-static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
- return theStudy->GetProperties()->IsLocked();
-}
+ QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
+ if (SP2.isEmpty()) SP2 = "0.001";
+ aDlg->SetPrecision(2, SP2.toDouble());
-static int checkLock(const SALOMEDS::Study_var& theStudy) {
- if (isStudyLocked(theStudy)) {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return true;
- }
- return false;
-}
+ if (aDlg->exec()) {
+ QColor aPreColor = aDlg->GetColor(1);
+ QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorRed", aPreColor.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorGreen", aPreColor.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorBlue", aPreColor.blue());
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
-{
- SALOMEDS::Study_var aStudy = smeshGUI->myActiveStudy->getStudyDocument(); //Document OCAF de l'etude active
- // QAD_Viewer3d* v3d;
- OCCViewer_Viewer3d *v3d;
-
- Handle(AIS_InteractiveContext) ic;
- vtkRenderer *Renderer;
- vtkRenderWindow *RenWin;
-
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- v3d = ((OCCViewer_ViewFrame *) smeshGUI->myActiveStudy->
- getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- ic = v3d->getAISContext();
- }
- else if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- Renderer = ((VTKViewer_ViewFrame *) smeshGUI->myActiveStudy->
- getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
- RenWin = Renderer->GetRenderWindow();
- }
+ QColor aSelColor = aDlg->GetColor(2);
+ QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorRed", aSelColor.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorGreen", aSelColor.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorBlue", aSelColor.blue());
+
+ QColor aHiColor = aDlg->GetColor(3);
+ QAD_CONFIG->addSetting("SMESH:SettingsSelectColorRed", aHiColor.red());
+ QAD_CONFIG->addSetting("SMESH:SettingsSelectColorGreen", aHiColor.green());
+ QAD_CONFIG->addSetting("SMESH:SettingsSelectColorBlue", aHiColor.blue());
+
+ int aPreWidth = aDlg->GetWidth(1);
+ QAD_CONFIG->addSetting("SMESH:SettingsPreSelectWidth", aPreWidth);
+ int aSelWidth = aDlg->GetWidth(2);
+ QAD_CONFIG->addSetting("SMESH:SettingsItemSelectWidth", aSelWidth);
+
+ double aTolNodes = aDlg->GetPrecision(1);
+ QAD_CONFIG->addSetting("SMESH:SettingsNodeSelectTol", aTolNodes);
+ double aTolItems = aDlg->GetPrecision(2);
+ QAD_CONFIG->addSetting("SMESH:SettingsElementsSelectTol", aTolItems);
+
+ // update current study settings
+ SMESH::UpdateSelectionProp();
+
+ QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
+ if (studyFrame->getTypeView() == VIEW_VTK) {
+ VTKViewer_ViewFrame* aViewFrame = SMESH::GetVtkViewFrame(studyFrame);
+ // update VTK viewer properties
+ VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor();
+ if (anInteractor) {
+ anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
+ aSelColor.blue()/255., aSelWidth);
+ anInteractor->SetSelectionTolerance(aTolNodes, aTolItems);
+ VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
+ if (aStyle)
+ aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
+ aPreColor.blue()/255., aPreWidth);
+ }
+ // update actors
+ vtkRenderer* aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
+ aHiColor.blue()/255.);
+ anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
+ aPreColor.blue()/255.);
+ }
+ }
+ }
+ }
- switch (theCommandID) {
- case 33: // DELETE
- if(checkLock(aStudy)) break;
- smeshGUI->OnEditDelete();
- break;
-
- case 113: // IMPORT
- case 112:
- case 111:
- {
- if(checkLock(aStudy)) break;
- //Import_Document(parent, theCommandID); //NBU
- Import_Mesh(parent,theCommandID);
break;
}
- case 122: // EXPORT MED
- case 121:
- case 123:
+ case 1100: // EDIT HYPOTHESIS
{
- Export_Mesh(parent, theCommandID);
+ if(checkLock(aStudy)) break;
+ SALOME_Selection *Sel =
+ SALOME_Selection::Selection(myActiveStudy->getSelection());
+ int nbSel = Sel->IObjectCount();
+
+ if (nbSel == 1) {
+ SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(Sel->firstIObject());
+
+ /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
+ /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
+ /* Warning : however by internal mechanism all subMeshes icons are changed ! */
+ if ( !Hyp->_is_nil() )
+ {
+ char* sName = Hyp->GetName();
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName);
+ if (aCreator)
+ {
+ aCreator->EditHypothesis(Hyp);
+ }
+ else
+ {
+ // report error
+ }
+ }
+ }
break;
}
- case 200: // SCALAR BAR
+ case 1101: // RENAME
{
- SALOME_Selection *Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() );
- if( Sel && Sel->IObjectCount() ) {
- Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
- if( anIO->hasEntry() ) {
- if( SMESH_Actor* anActor = ::FindActorByEntry( anIO->getEntry() ) ) {
- anActor->SetControlMode( SMESH_Actor::eNone );
- }
- }
+ if ( checkLock( aStudy ) )
+ break;
+
+ SALOME_Selection *Sel =
+ SALOME_Selection::Selection( myActiveStudy->getSelection() );
+
+ SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ for ( ; It.More(); It.Next() )
+ {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ if ( !obj->_is_nil() )
+ {
+ if ( obj->FindAttribute(anAttr, "AttributeName") )
+ {
+ aName = SALOMEDS::AttributeName::_narrow( anAttr );
+ QString newName = QString(aName->Value());
+ newName = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), newName );
+ if ( !newName.isEmpty() )
+ {
+ myActiveStudy->renameIObject( IObject, newName );
+
+ // if current object is group update group's name
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IObject);
+ if (!aGroup->_is_nil() )
+ aGroup->SetName( newName.latin1() );
+ }
+ }
+ }
}
break;
}
- case 201:
+
+ case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
{
- SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() );
- SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( parent, Sel );
+ if(checkLock(aStudy)) break;
+ QAD_WaitCursor wc;
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for (int i = 0; It.More(); It.Next(), i++) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
+ }
+ Sel->ClearIObjects();
+ myActiveStudy->updateObjBrowser(true);
break;
}
- case 1133: // DISPLAY MODE : WireFrame, Surface, Shrink
- case 1132:
- case 215:
- case 213:
- case 212:
- case 211:
+ case 401: // GEOM::EDGE
+ case 4021: // TRIANGLE
+ case 4022: // QUAD
+ case 4031: // TETRA
+ case 4032: // HEXA
{
- smeshGUI->SetViewMode(theCommandID);
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMDSAbs_ElementType type = SMDSAbs_Edge;
+ int nbNodes = 2;
+ switch (theCommandID) {
+ case 4021: // TRIANGLE
+ type = SMDSAbs_Face; nbNodes = 3; break;
+ case 4022: // QUAD
+ type = SMDSAbs_Face; nbNodes = 4; break;
+ case 4031: // TETRA
+ type = SMDSAbs_Volume; nbNodes = 4; break;
+ case 4032: // HEXA
+ type = SMDSAbs_Volume; nbNodes = 8; break;
+ default:;
+ }
+ SMESHGUI_AddMeshElementDlg *aDlg =
+ new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
break;
}
- case 214: // UPDATE
+ case 4041: // REMOVES NODES
{
if(checkLock(aStudy)) break;
- smeshGUI->Update();
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RemoveNodesDlg *aDlg = new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
break;
}
-
- case 300: // ERASE
- case 301: // DISPLAY
- case 302: // DISPLAY ONLY
+ case 4042: // REMOVES ELEMENTS
{
- EDisplaing anAction;
- switch(theCommandID){
- case 300: anAction = eErase; break;
- case 301: anAction = eDisplay; break;
- case 302: anAction = eDisplayOnly; break;
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RemoveElementsDlg *aDlg = new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
}
-
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for (; It.More(); It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- if (IOS->hasEntry()) {
- ::UpdateView(anAction,IOS->getEntry());
- }
+ else
+ {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
}
+ break;
+ }
+ case 4051: // RENUMBERING NODES
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
}
- Sel->ClearIObjects();
+ else
+ {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
break;
}
-
- case 400: // NODES
+ case 4052: // RENUMBERING ELEMENTS
{
if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_NodesDlg *aDlg = new SMESHGUI_NodesDlg(parent, "", Sel);
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
+ }
+ else
+ {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
+ break;
+ }
+ case 4061: // TRANSLATION
+ {
+ if(checkLock(aStudy)) break;
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_TranslationDlg *aDlg = new SMESHGUI_TranslationDlg(parent, "", Sel);
}
else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
tr("SMESH_BUT_OK"));
}
break;
}
-
- case 2151: // FILTER
- {
- if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
- {
- smeshGUI->EmitSignalDeactivateDialog();
- SMESHGUI_FilterDlg *aDlg = new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
- }
- break;
- }
-
- case 405: // MOVE NODE
+ case 4062: // ROTATION
{
if(checkLock(aStudy)) break;
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_MoveNodesDlg *aDlg = new SMESHGUI_MoveNodesDlg(parent, "", Sel);
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_RotationDlg *aDlg = new SMESHGUI_RotationDlg(parent, "", Sel);
+ }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
+ }
break;
}
-
- case 701: // COMPUTE MESH
+ case 4063: // SYMMETRY
{
if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
- if (nbSel != 1){
- break;
- }
-
- SMESH::SMESH_Mesh_var aMesh;
- SMESH::SMESH_subMesh_var aSubMesh;
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if (IObject->hasEntry()){
- SALOMEDS::SObject_var aMeshSObj = smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- GEOM::GEOM_Shape_var aShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh( aMeshSObj );
- if ( aShape->_is_nil() ) {
- // imported mesh
- break;
- }
- SALOMEDS::GenericAttribute_var anAttr;
- if(!aMeshSObj->_is_nil() && aMeshSObj->FindAttribute(anAttr, "AttributeIOR")){
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- MESSAGE("SMESHGUI::OnGUIEvent - Compute mesh : IOR = "<< anIOR->Value());
- CORBA::Object_var anObj;
- try{
- anObj = _orb->string_to_object(anIOR->Value());
- if (CORBA::is_nil(anObj)){
- MESSAGE("SMESHGUI::OnGUIEvent - Compute mesh : nil object");
- }
- }catch(CORBA::COMM_FAILURE & ex){
- INFOS("SMESHGUI::OnGUIEvent - Compute mesh : exception (1)");
- }
- aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
- aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
- if (!aMesh->_is_nil()){
- GEOM::GEOM_Shape_var refShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(aMeshSObj);
- if (!refShape->_is_nil()) {
- if(!smeshGUI->myComponentMesh->IsReadyToCompute(aMesh,refShape)){
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_MISSING_PARAMETERS"),
- tr("SMESH_BUT_OK"));
- break;
- }
- try{
- if (smeshGUI->myComponentMesh->Compute(aMesh,refShape))
- smeshGUI->myStudyAPI.ModifiedMesh(aMeshSObj,true);
- // TO Do : change icon of all submeshes
- }
- catch(const SALOME::SALOME_Exception & S_ex){
- QtCatchCorbaException(S_ex);
- }
- }
- }else if(!aSubMesh->_is_nil()){
- aMesh = aSubMesh->GetFather();
- GEOM::GEOM_Shape_var refShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(aMeshSObj);
- if(!refShape->_is_nil()){
- bool compute = smeshGUI->myComponentMesh->IsReadyToCompute(aMesh,refShape);
- if(!compute){
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_MISSING_PARAMETERS"),
- tr("SMESH_BUT_OK"));
- break;
- }
- try{
- if ( smeshGUI->myComponentMesh->Compute(aMesh,refShape) )
- smeshGUI->myStudyAPI.ModifiedMesh(aMeshSObj,true);
- // TO Do : change icon of all submeshes
- }catch(const SALOME::SALOME_Exception & S_ex){
- QtCatchCorbaException(S_ex);
- }
- }
- }
- }
- }
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- TVisualObjPtr aVisualObj = GetVisualObj(anId,IObject->getEntry());
- if(smeshGUI->myAutomaticUpdate && aVisualObj){
- aVisualObj->Update();
- SMESH_Actor* anActor = ::FindActorByEntry(IObject->getEntry());
- if(!anActor){
- anActor = ::CreateActor(smeshGUI->myStudy,IObject->getEntry());
- if(anActor){
- ::DisplayActor(smeshGUI->myActiveStudy->getActiveStudyFrame(),anActor); //apo
- ::FitAll();
- }
- }
- }
- }else{
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_SymmetryDlg *aDlg = new SMESHGUI_SymmetryDlg(parent, "", Sel);
+ }
+ else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
tr("SMESH_BUT_OK"));
}
break;
}
-
- case 702: // ADD SUB MESH
+ case 4064: // SEWING
{
if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_AddSubMeshDlg *aDlg = new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_SewingDlg *aDlg = new SMESHGUI_SewingDlg(parent, "", Sel);
}
else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
}
break;
}
-
- case 703: // INIT MESH
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_InitMeshDlg *aDlg = new SMESHGUI_InitMeshDlg(parent, "", Sel);
- break;
- }
-
- case 704: // EDIT Hypothesis
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
- break;
- }
-
- case 705: // EDIT Global Hypothesis
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
- break;
- }
-
- case 706: // EDIT Local Hypothesis
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
- break;
- }
-
- case 406: // ORIENTATION ELEMENTS
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- smeshGUI->myDesktop->SetSelectionMode(FaceSelection, true);
- SMESHGUI_OrientationElementsDlg *aDlg = new SMESHGUI_OrientationElementsDlg(parent, "", Sel);
- break;
- }
-
- case 407: // DIAGONAL INVERSION
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(EdgeOfCellSelection, true);
- SMESHGUI_DiagonalInversionDlg *aDlg = new SMESHGUI_DiagonalInversionDlg(parent, "", Sel);
- break;
- }
-
- case 801: // CREATE GROUP
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
- if (nbSel == 1) {
- // check if mesh is selected
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if (IObject->hasEntry()) {
- SALOMEDS::SObject_var aMeshSObj = smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- if (!aMeshSObj->_is_nil()) {
- CORBA::Object_var anObj = aMeshSObj->GetObject();
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
- if (aMesh->_is_nil() && !aSubMesh->_is_nil()) {
- aMesh = aSubMesh->GetFather();
- }
- if (!aMesh->_is_nil()) {
- SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aMesh);
- aDlg->show();
- }
- }
- }
- }
- break;
- }
-
- case 802: // CONSTRUCT GROUP
+ case 4065: // MERGE NODES
{
if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
- if (nbSel == 1) {
- // check if submesh is selected
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if (IObject->hasEntry()) {
- SALOMEDS::SObject_var aSObj = smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- if(!aSObj->_is_nil()) {
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(aSObj->GetObject());
- if (!aSubMesh->_is_nil()) {
- try {
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- // get submesh elements list by types
- SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
- SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
- SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
- SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
- // create group for each type o elements
- QString aName = IObject->getName();
- MESSAGE("SMESHGUI::OnGUIEvent - Construct group on submesh : "<<aName);
- MESSAGE(" Number of elements : nodes "<<aNodes->length() << ", edges " << aEdges->length()
- << ", faces " << aFaces->length() << ", volumes " << aVolumes->length());
- if (aNodes->length() > 0) {
- SMESH::SMESH_Group_var aGroup = smeshGUI->AddGroup(aMesh, SMESH::NODE, aName);
- aGroup->Add(aNodes);
- }
- if (aEdges->length() > 0) {
- SMESH::SMESH_Group_var aGroup = smeshGUI->AddGroup(aMesh, SMESH::EDGE, aName);
- aGroup->Add(aEdges);
- }
- if (aFaces->length() > 0) {
- SMESH::SMESH_Group_var aGroup = smeshGUI->AddGroup(aMesh, SMESH::FACE, aName);
- aGroup->Add(aFaces);
- }
- if (aVolumes->length() > 0) {
- SMESH::SMESH_Group_var aGroup = smeshGUI->AddGroup(aMesh, SMESH::VOLUME, aName);
- aGroup->Add(aVolumes);
- }
- smeshGUI->myActiveStudy->updateObjBrowser(true);
- }catch(const SALOME::SALOME_Exception & S_ex){
- QtCatchCorbaException(S_ex);
- }
- }
- }
- }
+ if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ EmitSignalDeactivateDialog();
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ SMESHGUI_MergeNodesDlg *aDlg = new SMESHGUI_MergeNodesDlg(parent, "", Sel);
}
- break;
- }
-
- case 803: // EDIT GROUP
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
- if (nbSel == 1) {
- // check if group is selected
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- if (IObject->hasEntry()) {
- SALOMEDS::SObject_var aSObj = smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- if(!aSObj->_is_nil()) {
- SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow(aSObj->GetObject());
- if (!aGroup->_is_nil()) {
- SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aGroup);
- aDlg->show();
- }
- }
- }
+ else {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+ tr("SMESH_BUT_OK"));
}
break;
}
+
- case 804: // Add elements to group
+ case 5000: // HYPOTHESIS
{
if(checkLock(aStudy)) break;
- if (smeshGUI->myState == 800) {
- SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) smeshGUI->myActiveDialogBox;
- if (aDlg) aDlg->onAdd();
- }
+ EmitSignalDeactivateDialog();
+ SMESHGUI_CreateHypothesesDlg *aDlg =
+ new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
break;
}
-
- case 805: // Remove elements from group
+ case 5010: // ALGO
{
if(checkLock(aStudy)) break;
- if (smeshGUI->myState == 800) {
- SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) smeshGUI->myActiveDialogBox;
- if (aDlg) aDlg->onRemove();
- }
+ EmitSignalDeactivateDialog();
+ SMESHGUI_CreateHypothesesDlg *aDlg =
+ new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
break;
}
- case 900: // MESH INFOS
+ case 5105: // Library of selection filters
+ {
+ static QValueList<int> aTypes;
+ if ( aTypes.isEmpty() )
{
- smeshGUI->EmitSignalDeactivateDialog();
- SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false);
- break;
+ aTypes.append( SMESH::NODE );
+ aTypes.append( SMESH::EDGE );
+ aTypes.append( SMESH::FACE );
+ aTypes.append( SMESH::VOLUME );
}
+ new SMESHGUI_FilterLibraryDlg( parent, aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+ }
+ break;
- case 1001: // AUTOMATIC UPDATE PREFERENCES
- {
- parent->menuBar()->setItemChecked(1001, !parent->menuBar()->isItemChecked(1001));
- if (parent->menuBar()->isItemChecked(1001)) {
- QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "true");
- smeshGUI->myAutomaticUpdate = true;
- }
- else {
- QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "false");
- smeshGUI->myAutomaticUpdate = false;
+ case 6016: // CONTROLS
+ case 6015:
+ case 6014:
+ case 6013:
+ case 6012:
+ case 6011:
+ case 6001:
+ case 6002:
+ case 6003:
+ case 6004:
+ if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ if ( Sel->IObjectCount() == 1 && Sel->firstIObject()->hasEntry() ) {
+ SALOMEDS::SObject_var SO = aStudy->FindObjectID( Sel->firstIObject()->getEntry() );
+ if ( !SO->_is_nil() ) {
+ CORBA::Object_var aObject = SO->GetObject();
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
+ SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aObject );
+ if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
+ ::Control( theCommandID );
+ break;
+ }
+ }
}
+ QAD_MessageBox::warn1(GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_BAD_SELECTION" ),
+ tr( "SMESH_BUT_OK" ) );
break;
}
-
- case 1003: // MESH PREFERENCES
- {
- smeshGUI->SetDisplaySettings();
- break;
- }
-
- case 1005:
- {
- SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( parent );
- break;
+ else {
+ QAD_MessageBox::warn1(GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ),
+ tr( "SMESH_BUT_OK" ) );
}
-
- case 1006:
- {
- SMESHGUI_Preferences_SelectionDlg* aDlg =
- new SMESHGUI_Preferences_SelectionDlg(parent);
-
- QColor aColor;
- QString SCr, SCg, SCb;
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else aColor = Qt::cyan;
- aDlg->SetColor(1, aColor);
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else aColor = Qt::yellow;
- aDlg->SetColor(2, aColor);
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else aColor = Qt::white;
- aDlg->SetColor(3, aColor);
-
- QString SW1 = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
- if (SW1.isEmpty()) SW1 = "5";
- aDlg->SetWidth(1, SW1.toInt());
-
- QString SW2 = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
- if (SW2.isEmpty()) SW2 = "5";
- aDlg->SetWidth(2, SW2.toInt());
-
- QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
- if (SP1.isEmpty()) SP1 = "0.025";
- aDlg->SetPrecision(1, SP1.toDouble());
-
- QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
- if (SP2.isEmpty()) SP2 = "0.001";
- aDlg->SetPrecision(2, SP2.toDouble());
-
- if (aDlg->exec()) {
- QColor aPreColor = aDlg->GetColor(1);
- QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorRed", aPreColor.red());
- QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorGreen", aPreColor.green());
- QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorBlue", aPreColor.blue());
-
- QColor aSelColor = aDlg->GetColor(2);
- QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorRed", aSelColor.red());
- QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorGreen", aSelColor.green());
- QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorBlue", aSelColor.blue());
-
- QColor aHiColor = aDlg->GetColor(3);
- QAD_CONFIG->addSetting("SMESH:SettingsSelectColorRed", aHiColor.red());
- QAD_CONFIG->addSetting("SMESH:SettingsSelectColorGreen", aHiColor.green());
- QAD_CONFIG->addSetting("SMESH:SettingsSelectColorBlue", aHiColor.blue());
-
- int aPreWidth = aDlg->GetWidth(1);
- QAD_CONFIG->addSetting("SMESH:SettingsPreSelectWidth", aPreWidth);
- int aSelWidth = aDlg->GetWidth(2);
- QAD_CONFIG->addSetting("SMESH:SettingsItemSelectWidth", aSelWidth);
-
- double aTolNodes = aDlg->GetPrecision(1);
- QAD_CONFIG->addSetting("SMESH:SettingsNodeSelectTol", aTolNodes);
- double aTolItems = aDlg->GetPrecision(2);
- QAD_CONFIG->addSetting("SMESH:SettingsElementsSelectTol", aTolItems);
-
- // update current study settings
- ::UpdateSelectionProp();
-
- QAD_StudyFrame* studyFrame = smeshGUI->myActiveStudy->getActiveStudyFrame();
- if (studyFrame->getTypeView() == VIEW_VTK) {
- VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(studyFrame);
- // update VTK viewer properties
- VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor();
- if (anInteractor) {
- anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
- aSelColor.blue()/255., aSelWidth);
- anInteractor->SetSelectionTolerance(aTolNodes, aTolItems);
- VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
- if (aStyle)
- aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
- aPreColor.blue()/255., aPreWidth);
- }
- // update actors
- vtkRenderer* aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
- aHiColor.blue()/255.);
- anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
- aPreColor.blue()/255.);
- }
- }
- }
- }
-
- break;
- }
-
- case 1100: // EDIT HYPOTHESIS
- {
- if(checkLock(aStudy)) break;
- SALOME_Selection *Sel =
- SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
-
- if (nbSel == 1) {
- Standard_Boolean res;
- SMESH::SMESH_Hypothesis_var Hyp =
- smeshGUI->ConvertIOinSMESHHypothesis(Sel->firstIObject(), res);
-
- /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
- /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
- /* Warning : however by internal mechanism all subMeshes icons are changed ! */
- if ( res )
- {
- char* sName = Hyp->GetName();
- SMESHGUI_GenericHypothesisCreator* aCreator = smeshGUI->GetHypothesisCreator(sName);
- if (aCreator)
- {
- aCreator->EditHypothesis(Hyp);
- }
- else
- {
- // report error
- }
- }
- }
- break;
- }
-
- case 1101: // RENAME
- {
- if(checkLock(aStudy)) break;
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for (; It.More(); It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
-
- SALOMEDS::SObject_var obj = smeshGUI->myStudy->FindObjectID(IObject->getEntry());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if (!obj->_is_nil()) {
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- QString newName = QString(aName->Value());
- newName = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), newName);
- if (!newName.isEmpty()) {
- smeshGUI->myActiveStudy->renameIObject(IObject, newName);
- }
- }
- }
- }
- break;
- }
-
- case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
- {
- if(checkLock(aStudy)) break;
- QAD_WaitCursor wc;
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for (int i = 0; It.More(); It.Next(), i++) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- smeshGUI->RemoveHypothesisOrAlgorithmOnMesh(IObject);
- }
- Sel->ClearIObjects();
- smeshGUI->myActiveStudy->updateObjBrowser(true);
- break;
- }
-
- case 401: // GEOM::EDGE
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_AddEdgeDlg *aDlg = new SMESHGUI_AddEdgeDlg(parent, "", Sel);
- }
- else {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
- case 4021: // TRIANGLE
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_AddFaceDlg *aDlg = new SMESHGUI_AddFaceDlg(parent, "", Sel, 3);
- }
- else {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
- case 4022: // QUAD
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_AddFaceDlg *aDlg = new SMESHGUI_AddFaceDlg(parent, "", Sel, 4);
- }
- else
- {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
- case 4031: // TETRA
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_AddVolumeDlg *aDlg = new SMESHGUI_AddVolumeDlg(parent, "", Sel, 4);
- }
- else {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
- case 4032: // HEXA
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_AddVolumeDlg *aDlg = new SMESHGUI_AddVolumeDlg(parent, "", Sel, 8);
- }
- else {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
-
- case 4041: // REMOVES NODES
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(NodeSelection, true);
- smeshGUI->ViewNodes();
- SMESHGUI_RemoveNodesDlg *aDlg = new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
- }
- else {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
- case 4042: // REMOVES ELEMENTS
- {
- if(checkLock(aStudy)) break;
- if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- smeshGUI->EmitSignalDeactivateDialog();
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- Sel->ClearIObjects();
- smeshGUI->myDesktop->SetSelectionMode(CellSelection, true);
- SMESHGUI_RemoveElementsDlg *aDlg = new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
- }
- else
- {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- break;
- }
-
- case 5000: // HYPOTHESIS
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SMESHGUI_CreateHypothesesDlg *aDlg =
- new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
- break;
- }
- case 5010: // ALGO
- {
- if(checkLock(aStudy)) break;
- smeshGUI->EmitSignalDeactivateDialog();
- SMESHGUI_CreateHypothesesDlg *aDlg =
- new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
- break;
- }
-
- case 6016: // CONTROLS
- case 6015:
- case 6014:
- case 6013:
- case 6012:
- case 6011:
- case 6001:
- case 6003:
- case 6004:
- if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- if ( Sel->IObjectCount() == 1 && Sel->firstIObject()->hasEntry() ) {
- SALOMEDS::SObject_var SO = smeshGUI->myStudy->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() ) {
- CORBA::Object_var aObject = SO->GetObject();
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
- SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aObject );
- if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
- smeshGUI->Control( theCommandID );
- break;
- }
- }
- }
- QAD_MessageBox::warn1(smeshGUI->GetDesktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_BAD_SELECTION" ),
- tr( "SMESH_BUT_OK" ) );
- break;
- }
- else {
- QAD_MessageBox::warn1(smeshGUI->GetDesktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "NOT_A_VTK_VIEWER" ),
- tr( "SMESH_BUT_OK" ) );
- }
- break;
- case 9010:
- {
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- if (Sel->IObjectCount() == 1) {
- Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
- if(anIObject->hasEntry())
- if(SMESH_Actor *anActor = ::FindActorByEntry(anIObject->getEntry())){
- anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
- }
- }
- break;
- }
- case 9011:
- {
- SALOME_Selection *Sel = SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- if (Sel->IObjectCount() == 1) {
- Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
- if(anIObject->hasEntry())
- if(SMESH_Actor *anActor = ::FindActorByEntry(anIObject->getEntry())){
- anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
- }
- }
- break;
- }
- case 10001: // DISPLAY MODE PREFERENCE
- {
- // Wireframe
- parent->menuBar()->setItemChecked(10001, true);
- parent->menuBar()->setItemChecked(10002, false);
- parent->menuBar()->setItemChecked(10004, false);
- parent->menuBar()->setItemEnabled(10003, true);
- QAD_CONFIG->addSetting("SMESH:DisplayMode", "Wireframe");
- break;
- }
- case 10002:
- {
- parent->menuBar()->setItemChecked(10002, true);
- parent->menuBar()->setItemChecked(10001, false);
- parent->menuBar()->setItemChecked(10004, false);
- parent->menuBar()->setItemEnabled(10003, true);
- QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
- break;
- }
- case 10003:
- {
- parent->menuBar()->setItemChecked(10003,!parent->menuBar()->isItemChecked(10003));
- QAD_CONFIG->addSetting("SMESH:Shrink", parent->menuBar()->isItemChecked(10003) ? "yes" : "no");
- break;
- }
- case 10004:
- {
- parent->menuBar()->setItemChecked(10001, false);
- parent->menuBar()->setItemChecked(10004, true);
- parent->menuBar()->setItemChecked(10002, false);
- parent->menuBar()->setItemEnabled(10003, false);
- QAD_CONFIG->addSetting("SMESH:DisplayMode", "Nodes");
- break;
- }
-
- }
-
- smeshGUI->myActiveStudy->updateObjBrowser(true);
- return true;
-}
-
-//=============================================================================
-/*! function : GetMeshesUsingAlgoOrHypothesis()
- * purpose : return a list of Study objects (mesh kind) that have 'AlgoOrHyp' affected.
- * : However is supposed here that father of father of an hypothesis is a Mesh Object.
- */
-//=============================================================================
-SALOMEDS::Study::ListOfSObject *
- SMESHGUI::GetMeshesUsingAlgoOrHypothesis(SMESH::
- SMESH_Hypothesis_ptr AlgoOrHyp)
-{
- SALOMEDS::Study::ListOfSObject_var listSOmesh =
- new SALOMEDS::Study::ListOfSObject;
- listSOmesh->length(0);
- unsigned int index = 0;
- if (!AlgoOrHyp->_is_nil()) {
- SALOMEDS::SObject_var SO_Hypothesis =
- smeshGUI->GetStudyAPI().FindObject(AlgoOrHyp);
- if (!SO_Hypothesis->_is_nil()) {
- SALOMEDS::Study::ListOfSObject_var listSO =
- smeshGUI->myStudy->FindDependances(SO_Hypothesis);
- MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO->length());
- for (unsigned int i = 0; i < listSO->length(); i++) {
- SALOMEDS::SObject_ptr SO = listSO[i];
- if (!SO->_is_nil()) {
- SALOMEDS::SObject_var aFather = SO->GetFather();
- if (!aFather->_is_nil()) {
- SALOMEDS::SObject_var SOfatherFather = aFather->GetFather();
- if (!SOfatherFather->_is_nil()) {
- MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
- index++;
- listSOmesh->length(index);
- listSOmesh[index - 1] = SOfatherFather;
- }
- }
- }
- }
- }
- }
- MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
- return listSOmesh._retn();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Import_Mesh(QAD_Desktop * parent, int theCommandID){
- QString filter;
- string myExtension;
-
- if(theCommandID == 113){
- filter = tr("MED files (*.med)");
- }else if (theCommandID == 112){
- filter = tr("IDEAS files (*.unv)");
- }else if (theCommandID == 111){
- filter = tr("DAT files (*.dat)");
- }
- QString filename = QAD_FileDlg::getFileName(parent,
- "",
- filter,
- tr("Import mesh"),
- true);
- if(!filename.isEmpty()){
- QAD_WaitCursor wc;
- SMESH::mesh_array_var aMeshes;
- try {
- SMESH::DriverMED_ReadStatus res;
- aMeshes = smeshGUI->myComponentMesh->CreateMeshesFromMED(filename.latin1(),
- res);
- if ( res > SMESH::DRS_OK ) {
- wc.stop();
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr(QString("SMESH_DRS_%1").arg(res)),
- tr("SMESH_BUT_OK"));
- wc.start();
-
- }
- }
- catch (const SALOME::SALOME_Exception& S_ex)
- {
- wc.stop();
- QtCatchCorbaException(S_ex);
- wc.start();
- }
- for ( int i = 0, n = aMeshes->length(); i < n; i++ ) {
- SALOMEDS::SObject_var aMeshSO = smeshGUI->myStudyAPI.FindObject( aMeshes[i] );
- if ( !aMeshSO->_is_nil() ) {
- SALOMEDS::StudyBuilder_var aBuilder = smeshGUI->myStudy->NewBuilder();
- SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow( aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ) );
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
- }
- }
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Export_Mesh(QAD_Desktop * parent, int theCommandID)
-{
- SALOME_Selection *Sel =
- SALOME_Selection::Selection(smeshGUI->myActiveStudy->getSelection());
- int nbSel = Sel->IObjectCount();
- if ( !nbSel )
- return;
- Standard_Boolean res;
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- SMESH::SMESH_Mesh_var aMesh = smeshGUI->ConvertIOinMesh(IObject, res);
- if ( res && ( nbSel == 1 || theCommandID == 122 ) ) {// MED export supports multiple meshes
- QString aFilter, aTitle = tr("Export mesh");
- switch ( theCommandID ) {
- case 122:
- aFilter = tr("MED files (*.med)");
- break;
- case 121:
- aFilter = tr("DAT files (*.dat)");
- break;
- case 123:
- aFilter = tr("IDEAS files (*.unv)");
- break;
- default:
- break;
- }
-
- QString filename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
-
- if ( !filename.isEmpty() ) {
- // Check whether the file already exists and delete it if yes
- QFile aFile( filename );
- if ( aFile.exists() )
- aFile.remove();
-
- QAD_WaitCursor wc;
- for ( SALOME_ListIteratorOfListIO it( Sel->StoredIObjects() ); it.More(); it.Next() ) {
- aMesh = smeshGUI->ConvertIOinMesh( it.Value(), res );
- if ( res ) {
- switch ( theCommandID ) {
- case 122:
- aMesh->ExportMED( filename.latin1(), true ); // currently, automatic groups are always created
- break;
- case 121:
- aMesh->ExportDAT( filename.latin1() );
- break;
- case 123:
- aMesh->ExportUNV( filename.latin1() );
- break;
- default:
- break;
- }
- }
- }
- }
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::OnMousePress(QMouseEvent * pe, QAD_Desktop * parent,
- QAD_StudyFrame * studyFrame)
-{
- return false;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::OnMouseMove(QMouseEvent * pe, QAD_Desktop * parent,
- QAD_StudyFrame * studyFrame)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::OnKeyPress(QKeyEvent * pe, QAD_Desktop * parent,
- QAD_StudyFrame * studyFrame)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::SetSettings(QAD_Desktop * parent)
-{
- MESSAGE("SMESHGUI::SetSettings.");
- SMESHGUI::GetOrCreateSMESHGUI(parent);
-
- /* Display mode */
- QString DisplayMode = "Shading";
- if ( QAD_CONFIG->hasSetting("SMESH:DisplayMode") )
- DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
- else
- QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
-
- bool Shrink = false;
- if ( QAD_CONFIG->hasSetting("SMESH:Shrink") )
- Shrink = QAD_CONFIG->getSetting("SMESH:Shrink") == "yes";
-
- if (DisplayMode == "Wireframe") {
- // wireframe
- parent->menuBar()->setItemChecked(10004, false);
- parent->menuBar()->setItemChecked(10002, false);
- parent->menuBar()->setItemChecked(10001, true);
- parent->menuBar()->setItemEnabled(10003, true);
- }
- else if (DisplayMode == "Nodes") {
- // poins
- parent->menuBar()->setItemChecked(10004, true);
- parent->menuBar()->setItemChecked(10002, false);
- parent->menuBar()->setItemChecked(10001, false);
- parent->menuBar()->setItemEnabled(10003, false);
- }
- else {
- // default is shading
- parent->menuBar()->setItemChecked(10004, false);
- parent->menuBar()->setItemChecked(10002, true);
- parent->menuBar()->setItemChecked(10001, false);
- parent->menuBar()->setItemEnabled(10003, true);
- }
- parent->menuBar()->setItemChecked(10003, Shrink);
-
- /* Automatic Update */
- QString AutoUpdate = QAD_CONFIG->getSetting("SMESH:AutomaticUpdate");
- if (AutoUpdate.compare("true") == 0) {
- parent->menuBar()->setItemChecked(1001, true);
- smeshGUI->myAutomaticUpdate = true;
- }
- else {
- parent->menuBar()->setItemChecked(1001, false);
- smeshGUI->myAutomaticUpdate = false;
- }
-
- /* Selection */
- ::UpdateSelectionProp();
-
- /* menus disable */
- parent->menuBar()->setItemEnabled(111, false); // IMPORT DAT
- parent->menuBar()->setItemEnabled(112, false); // IMPORT UNV
-
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
-{
- // NRI : Temporary added
- // if ( smeshGUI->myStudy->GetProperties()->IsLocked() ) {
- // theObject = "NothingSelected";
- // theContext = "NothingSelected";
- // }
- // NRI
-
- SALOME_Selection *Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() );
- int nbSel = Sel->IObjectCount();
- switch ( nbSel ) {
- case 0:
- theObject = "NothingSelected";
- theContext = "NothingSelected";
- break;
- case 1:
- if ( smeshGUI->myState == 800 && Sel->HasIndex( Sel->firstIObject() ) )
- theObject = "Elements";
- else
- theObject = smeshGUI->CheckTypeObject( Sel->firstIObject() );
- theContext = "";
- break;
- default:
- theObject = smeshGUI->CheckHomogeneousSelection();
- theContext = "";
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
- const QString& theParent, const QString& theObject)
-{
- // get active study frame
- QAD_StudyFrame* studyFrame = smeshGUI->myActiveStudy->getActiveStudyFrame();
-
- // get parent component which selected object(s) belongs to
- QString parentComp = ( (SALOMEGUI_Desktop*)parent )->getComponentFromSelection();
-
- // get selection
- SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() );
- int nbSel = Sel->IObjectCount();
-
- if ( nbSel == 0 ) {
- popup->clear();
- }
- else if ( nbSel == 1 ) {
- if ( parentComp != parent->getActiveComponent() ) {
- // object not belongs to SMESH module - remove all commands except common Display/Erase...
- while ( 1 ) {
- int id = popup->idAt( 0 );
- if ( id <= QAD_TopLabel_Popup_ID )
- popup->removeItemAt( 0 );
- else
- break;
- }
- }
- else {
- // get selected interactive object
- Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
- SALOMEDS::SObject_var SO = smeshGUI->myStudy->FindObjectID( IObject->getEntry() );
- // find popup menu's TopLabel item
- int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
- if ( topItem >= 0 ) {
- if ( theParent == "Viewer" ) {
- // set bold font for popup menu's TopLabel item (Viewer popup)
- QFont fnt = QApplication::font(); fnt.setBold( TRUE );
- popup->removeItem( QAD_TopLabel_Popup_ID );
- popup->insertItem( new CustomItem( QString( IObject->getName() ), fnt ), QAD_TopLabel_Popup_ID, topItem );
- }
- else if ( theParent == "ObjectBrowser" ) {
- // remove popup menu's TopLabel item (Object Browser popup)
- popup->removeItem( QAD_TopLabel_Popup_ID );
- }
- }
-
- // remove "Display only" command for component object
- if ( theObject.compare( "Component" ) == 0 ) {
- popup->removeItem( QAD_DisplayOnly_Popup_ID );
- }
- else if ( theObject == "Hypothesis" || theObject == "Algorithm" ) {
- // remove Display/Erase commands
- popup->removeItem( QAD_Display_Popup_ID );
- popup->removeItem( QAD_DisplayOnly_Popup_ID );
- popup->removeItem( QAD_Erase_Popup_ID );
- // remove "Unassign ..." command if hyp/algo is not assigned
- if ( SO->_is_nil() || !IObject->hasReference()/* !IsReferencedObject( SO ) */)
- popup->removeItem( 1102 );
- }
- else if ( theObject == "Mesh" || theObject == "SubMesh" || theObject == "Group" ) {
- // get actor
- GEOM::GEOM_Shape_var aShape = GetSMESHGUI()->GetStudyAPI().GetShapeOnMeshOrSubMesh( SO );
- if ( aShape->_is_nil() ) {
- // imported mesh
- popup->removeItem( 701 ); // Compute
- popup->removeItem( 705 ); // Edit hypothesis
- popup->removeItem( 706 ); // ...
- }
- SMESH_Actor* ac = ::FindActorByEntry(IObject->getEntry());
- // if object has actor
- if ( ac && studyFrame->getTypeView() == VIEW_VTK ) {
- VTKViewer_RenderWindowInteractor* myRenderInter =
- ( ( VTKViewer_ViewFrame* ) studyFrame->getRightFrame()->getViewFrame() )->getRWInteractor();
- if ( myRenderInter->isVisible( IObject ) ) {
- popup->removeItem( QAD_Display_Popup_ID );
- popup->setItemChecked( 9010, ac->GetPointsLabeled() ); // Numbering / Display Nodes #
- popup->setItemChecked( 9011, ac->GetCellsLabeled() ); // Numbering / Display Elements #
- TVisualObjPtr aVisualObj = ac->GetObject();
- int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE);
- int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE);
- int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME);
- QMenuItem* mi = popup->findItem( 1131 );
- if ( mi && mi->popup() ) {
- int prType = ac->GetRepresentation();
- // Display Mode / Wireframe
- if(!aNbFaces && !aNbVolumes && !aNbEdges){
- mi->popup()->removeItem( 211 );
- }else{
- mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
- }
- // Display Mode / Shading
- if(!aNbFaces && !aNbVolumes){
- mi->popup()->removeItem( 212 );
- }else{
- mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
- }
- // Display Mode / Points
- mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );
- // Display Mode / Shrink
- bool isShrunk = ac->IsShrunk();
- bool isShrunkable = ac->IsShrunkable();
- mi->popup()->setItemChecked( 213, isShrunk );
- mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
- }
- // Scalar Bar
- mi = popup->findItem( 2000 );
- if ( mi && mi->popup() ) {
- SMESH_Actor::eControl cMode = ac->GetControlMode();
- switch ( cMode ) {
- case SMESH_Actor::eLengthEdges:
- mi->popup()->setItemChecked( 6001, true ); break;
- case SMESH_Actor::eFreeBorders:
- mi->popup()->setItemChecked( 6003, true );
- mi->popup()->removeItem( 201 );
- break;
- case SMESH_Actor::eMultiConnection:
- mi->popup()->setItemChecked( 6004, true ); break;
- case SMESH_Actor::eArea:
- mi->popup()->setItemChecked( 6011, true ); break;
- case SMESH_Actor::eTaper:
- mi->popup()->setItemChecked( 6012, true ); break;
- case SMESH_Actor::eAspectRatio:
- mi->popup()->setItemChecked( 6013, true ); break;
- case SMESH_Actor::eMinimumAngle:
- mi->popup()->setItemChecked( 6014, true ); break;
- case SMESH_Actor::eWarping:
- mi->popup()->setItemChecked( 6015, true ); break;
- case SMESH_Actor::eSkew:
- mi->popup()->setItemChecked( 6016, true ); break;
- case SMESH_Actor::eNone:
- default:
- mi->popup()->removeItem( 200 );
- mi->popup()->removeItem( 201 );
- break;
- }
- TVisualObjPtr aVisualObj = ac->GetObject();
- SMESH::ElementType aType;
- if(!aNbEdges){
- mi->popup()->removeItem( 6001 );
- mi->popup()->removeItem( 6003 );
- mi->popup()->removeItem( 6004 );
- }
- if(!aNbFaces){
- mi->popup()->removeItem( 6011 );
- mi->popup()->removeItem( 6012 );
- mi->popup()->removeItem( 6013 );
- mi->popup()->removeItem( 6014 );
- mi->popup()->removeItem( 6015 );
- mi->popup()->removeItem( 6016 );
- }
- if(!aNbFaces && !aNbEdges)
- popup->removeItem( 2000 ); // Scalar Bar
- }
- }
- else {
- popup->removeItem( QAD_Erase_Popup_ID );
- popup->removeItem( 114 ); // Numbering popup menu
- popup->removeItem( 1131 ); // Display mode
- popup->removeItem( 1132 ); // Color / size
- popup->removeItem( 1133 ); // Transparency
- popup->removeItem( 2000 ); // Scalar Bar
- }
- }
- else {
- // object doesn't have actor
- CORBA::Object_var anObject = SO->GetObject();
- bool bDisplay = false;
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Mesh_var aMeshObj = SMESH::SMESH_Mesh::_narrow( anObject );
- if ( !aMeshObj->_is_nil() && ( aMeshObj->NbNodes() > 0 || aMeshObj->NbFaces() > 0 || aMeshObj->NbVolumes() > 0 ) )
- bDisplay = true;
- SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( anObject );
- if ( !aSubMeshObj->_is_nil() && ( aSubMeshObj->GetNumberOfNodes() > 0 || aSubMeshObj->GetNumberOfElements() > 0 ) )
- bDisplay = true;
- SMESH::SMESH_Group_var aGroupObj = SMESH::SMESH_Group::_narrow( anObject );
- if ( !aGroupObj->_is_nil() && aGroupObj->Size() > 0 )
- bDisplay = true;
- }
- if ( !bDisplay ) {
- popup->removeItem( QAD_Display_Popup_ID );
- popup->removeItem( QAD_DisplayOnly_Popup_ID );
- }
- popup->removeItem( QAD_Erase_Popup_ID );
- popup->removeItem( 114 ); // Numbering popup menu
- popup->removeItem( 1131 ); // Display mode
- popup->removeItem( 1132 ); // Color / size
- popup->removeItem( 1133 ); // Transparency
- popup->removeItem( 2000 ); // Scalar Bar
- }
- }
- else {
- // another SMESH object
- popup->removeItem( QAD_Display_Popup_ID );
- popup->removeItem( QAD_DisplayOnly_Popup_ID );
- popup->removeItem( QAD_Erase_Popup_ID );
- }
- }
- }
- else {
- // multiple selection
- if ( parentComp != parent->getActiveComponent() ) {
- // object not belongs to SMESH module - remove all commands except common Display/Erase...
- while ( 1 ) {
- int id = popup->idAt( 0 );
- if ( id <= QAD_TopLabel_Popup_ID )
- popup->removeItemAt( 0 );
- else
- break;
- }
- if ( parentComp.isNull() ) {
- // objects from different components are selected
- popup->removeItem( QAD_DisplayOnly_Popup_ID );
- popup->removeItem( QAD_Display_Popup_ID );
- popup->removeItem( QAD_Erase_Popup_ID );
- }
- }
- else {
- QString type = smeshGUI->CheckHomogeneousSelection();
- if ( type != "Heterogeneous Selection" ) {
- int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
- if ( topItem >= 0 ) {
- // set bold font for popup menu's TopLabel item
- QFont fnt = QApplication::font(); fnt.setBold( TRUE );
- popup->removeItem( QAD_TopLabel_Popup_ID );
- popup->insertItem( new CustomItem( QString("%1 ").arg( nbSel ) + type + "(s) ", fnt ), QAD_TopLabel_Popup_ID, topItem );
- }
- }
- }
- }
- return false;
-}
-
-//=============================================================================
-/*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
- * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
- */
-//=============================================================================
-void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO)
-{
- if(theIO->hasEntry()){
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
- ::UpdateView(aStudyFrame,eDisplay,theIO->getEntry());
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::setOrb()
-{
- try
- {
- ORB_INIT & init = *SINGLETON_ < ORB_INIT >::Instance();
- ASSERT(SINGLETON_ < ORB_INIT >::IsAlreadyExisting());
- _orb = init(0, 0);
- } catch(...)
- {
- INFOS("internal error : orb not found");
- _orb = 0;
- }
- ASSERT(!CORBA::is_nil(_orb));
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SMESH_Actor *SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr theMesh){}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Dump(SMESH_Actor * Mactor)
-{
- vtkUnstructuredGrid *ugrid = Mactor->GetUnstructuredGrid();
- vtkPoints *Pts = ugrid->GetPoints();
- int nbPts = Pts->GetNumberOfPoints();
- int nbCells = ugrid->GetNumberOfCells();
-
- FILE *In;
- int i, j;
- In = fopen("/tmp/dumpMesh", "w+");
- fprintf(In, "%d %d\n", nbPts, nbCells);
- for (int i = 0; i < nbPts; i++)
- {
- float *p = ugrid->GetPoint(i);
- fprintf(In, "%d %e %e %e\n", i, p[0], p[1], p[2]);
- }
-
- for (int i = 0; i < nbCells; i++)
- {
- fprintf(In, "%d %d", i, ugrid->GetCell(i)->GetCellType());
- vtkIdList *Id = ugrid->GetCell(i)->GetPointIds();
- for (j = 0; j < Id->GetNumberOfIds(); j++)
- {
- fprintf(In, " %d", Id->GetId(j));
- }
- fprintf(In, "\n");
- }
- fclose(In);
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::RemoveNodes(SMESH::SMESH_Mesh_ptr theMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(MapIndex.Extent());
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(int i = 0; ite.More(); ite.Next(), i++){
- anArrayOfIdeces[i] = anActor->GetNodeObjId(ite.Key());
- }
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->RemoveNodes(anArrayOfIdeces);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
- }
- }
- }
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::RemoveElements(SMESH::SMESH_Mesh_ptr theMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(MapIndex.Extent());
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(int i = 0; ite.More(); ite.Next(), i++){
- anArrayOfIdeces[i] = anActor->GetElemObjId(ite.Key());
- }
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->RemoveElements(anArrayOfIdeces);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
- }
- }
- }
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::OrientationElements(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- MESSAGE("OrientationElements - not implemeted yet!");
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- MESSAGE("OrientationElements - not implemeted yet!");
-}
-
-//=====================================================================================
-// EXPORTED METHODS
-//=====================================================================================
-void SMESHGUI::SupportedViewType(int *buffer, int bufferSize)
-{
- if (!buffer || !bufferSize)
- return;
- buffer[0] = (int)VIEW_VTK;
-}
-
-void SMESHGUI::Deactivate()
-{
- if ( SMESHGUI::GetSMESHGUI() ) {
- SMESHGUI::GetSMESHGUI()->EmitSignalCloseAllDialogs();
- }
-}
-
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::SetPickable(SMESH_Actor* theActor){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
- int anIsAllPickable = (theActor == NULL);
- vtkRenderer *aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
- if(anActor->GetVisibility()){
- anActor->SetPickable(anIsAllPickable);
- }
- }
- }
- if(theActor)
- theActor->SetPickable(!anIsAllPickable);
- RepaintCurrentView();
- }
-}
-
-
-void SMESHGUI::ViewNodes(){
- EraseSimulationActors();
- ::SetPointRepresentation(true);
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Control( int theCommandID ){
- SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if(Sel){
- Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
- if(!anIO.IsNull()){
- QString aTitle;
- SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
- if(SMESH_Actor *anActor = ::FindActorByEntry(anIO->getEntry())){
- switch ( theCommandID ){
- case 6001:
- aTitle = tr( "LENGTH_EDGES" );
- aControl = SMESH_Actor::eLengthEdges;
- break;
- case 6003:
- aTitle = tr( "FREE_BORDERS" );
- aControl = SMESH_Actor::eFreeBorders;
- break;
- case 6004:
- aTitle = tr( "MULTI_BORDERS" );
- aControl = SMESH_Actor::eMultiConnection;
- break;
- case 6011:
- aTitle = tr( "AREA_ELEMENTS" );
- aControl = SMESH_Actor::eArea;
- break;
- case 6012:
- aTitle = tr( "TAPER_ELEMENTS" );
- aControl = SMESH_Actor::eTaper;
- break;
- case 6013:
- aTitle = tr( "ASPECTRATIO_ELEMENTS" );
- aControl = SMESH_Actor::eAspectRatio;
- break;
- case 6014:
- aTitle = tr( "MINIMUMANGLE_ELEMENTS" );
- aControl = SMESH_Actor::eMinimumAngle;
- break;
- case 6015:
- aTitle = tr( "WARP_ELEMENTS" );
- aControl = SMESH_Actor::eWarping;
- break;
- case 6016:
- aTitle = tr( "SKEW_ELEMENTS" );
- aControl = SMESH_Actor::eSkew;
- break;
- }
- anActor->SetControlMode(aControl);
- anActor->GetScalarBarActor()->SetTitle(aTitle.latin1());
- }
- }
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::SetSettingsScalarBar(vtkScalarBarActor * theScalarBar,
- QString Bold,
- QString Italic,
- QString Shadow,
- QString FontFamily,
- QString Orientation,
- float Width,
- float Height,
- int NbColors,
- int NbLabels)
-{
- if (Bold.isNull() || Bold.isEmpty() || (Bold.compare("true") == 0))
- theScalarBar->BoldOn();
- else
- theScalarBar->BoldOff();
-
- if (Italic.isNull() || Italic.isEmpty() || (Italic.compare("true") == 0))
- theScalarBar->ItalicOn();
- else
- theScalarBar->ItalicOff();
-
- if (Shadow.isNull() || Shadow.isEmpty() || (Shadow.compare("true") == 0))
- theScalarBar->ShadowOn();
- else
- theScalarBar->ShadowOff();
-
- if (FontFamily.compare("Arial") == 0)
- theScalarBar->SetFontFamilyToArial();
- else if (FontFamily.compare("Courier") == 0)
- theScalarBar->SetFontFamilyToCourier();
- else if (FontFamily.compare("Times") == 0)
- theScalarBar->SetFontFamilyToTimes();
- else
- theScalarBar->SetFontFamilyToArial();
-
- if (Orientation.isNull() || Orientation.isEmpty() ||
- (Orientation.compare("Vertical") == 0))
- theScalarBar->SetOrientationToVertical();
- else
- theScalarBar->SetOrientationToHorizontal();
-
- theScalarBar->SetWidth((Width == 0) ? 0.17 : Width);
- theScalarBar->SetHeight((Height == 0) ? 0.8 : Height);
-
- theScalarBar->SetNumberOfLabels((NbLabels == 0) ? 5 : NbLabels);
- theScalarBar->SetMaximumNumberOfColors((NbColors == 0) ? 64 : NbColors);
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::SetDisplaySettings()
-{
- EmitSignalDeactivateDialog();
- SMESHGUI_Preferences_ColorDlg *aDlg =
- new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(), "");
-
- QColor color;
- QString SCr, SCg, SCb;
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else color = QColor(0, 170, 255);
- aDlg->SetColor(1, color);
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else color = QColor(0, 170, 255);
- aDlg->SetColor(2, color);
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- else color = Qt::red;
- aDlg->SetColor(3, color);
-
- QString SBr = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed");
- QString SBg = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen");
- QString SBb = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue");
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- color = QColor(SBr.toInt(), SBg.toInt(), SBb.toInt());
- else color = Qt::blue;
- aDlg->SetColor(4, color);
-
- QString intValue = QAD_CONFIG->getSetting("SMESH:SettingsWidth");
- if (intValue.isEmpty()) intValue = "1";
- aDlg->SetIntValue(1, intValue.toInt());
- intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize");
- if (intValue.isEmpty()) intValue = "3";
- aDlg->SetIntValue(2, intValue.toInt());
- intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff");
- if (intValue.isEmpty()) intValue = "75";
- aDlg->SetIntValue(3, intValue.toInt());
-
- if (aDlg->exec()) {
- QColor colorFill = aDlg->GetColor(1);
- QAD_CONFIG->addSetting("SMESH:SettingsFillColorRed", colorFill.red());
- QAD_CONFIG->addSetting("SMESH:SettingsFillColorGreen", colorFill.green());
- QAD_CONFIG->addSetting("SMESH:SettingsFillColorBlue", colorFill.blue());
-
- QColor colorOutline = aDlg->GetColor(2);
- QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorRed", colorOutline.red());
- QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorGreen", colorOutline.green());
- QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorBlue", colorOutline.blue());
-
- QColor colorNode = aDlg->GetColor(3);
- QAD_CONFIG->addSetting("SMESH:SettingsNodeColorRed", colorNode.red());
- QAD_CONFIG->addSetting("SMESH:SettingsNodeColorGreen", colorNode.green());
- QAD_CONFIG->addSetting("SMESH:SettingsNodeColorBlue", colorNode.blue());
-
- QColor colorBackFace = aDlg->GetColor(4);
- QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorRed", colorBackFace.red());
- QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorGreen", colorBackFace.green());
- QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorBlue", colorBackFace.blue());
-
- int width = aDlg->GetIntValue(1);
- QAD_CONFIG->addSetting("SMESH:SettingsWidth", width);
-
- int nodes_size = aDlg->GetIntValue(2);
- QAD_CONFIG->addSetting("SMESH:SettingsNodesSize", nodes_size);
-
- int shrink_coeff = aDlg->GetIntValue(3);
- QAD_CONFIG->addSetting("SMESH:SettingsShrinkCoeff", shrink_coeff);
- }
-
- delete aDlg;
-}
-
-//=======================================================================
-// function : Parameter()
-// purpose : return a parameter (double) from a dialog box
-//
-// aValue : is a double used as a default value displayed
-// aLabel : is the title for aValue1
-// aTitle : is the main title
-// bottom : maximum value to be entered
-// top : minimum value to be entered
-// decimals : number of decimals
-//=======================================================================
-double SMESHGUI::Parameter(Standard_Boolean & res,
- const double aValue,
- const char *aLabel,
- const char *aTitle,
- const double bottom, const double top, const int decimals)
-{
- SMESHGUI_aParameterDlg *Dialog =
- new SMESHGUI_aParameterDlg(QAD_Application::getDesktop(),
- aTitle,
- aLabel,
- bottom, top, decimals,
- TRUE);
- Dialog->setValue(aValue);
- double X = 0.0;
- res = (Dialog->exec() == QDialog::Accepted);
- if (res)
- X = Dialog->getDblValue();
- return X;
-}
-
-//=======================================================================
-// function : Parameter()
-// purpose : return a parameter (int) from a dialog box
-//
-// aValue : is a int used as a default value displayed
-// aLabel : is the title for aValue1
-// aTitle : is the main title
-// bottom : maximum value to be entered
-// top : minimum value to be entered
-//=======================================================================
-int SMESHGUI::Parameter(Standard_Boolean & res,
- const int aValue,
- const char *aLabel, const char *aTitle, const int bottom, const int top)
-{
- SMESHGUI_aParameterDlg *Dialog =
- new SMESHGUI_aParameterDlg(QAD_Application::getDesktop(),
- aTitle,
- aLabel,
- bottom, top,
- TRUE);
- Dialog->setValue(aValue);
- int X = 0;
- res = (Dialog->exec() == QDialog::Accepted);
- if (res)
- X = Dialog->getIntValue();
- return X;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DisplayEdges(SMESH_Actor * ac, bool visibility){}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::InitActor(SMESH::SMESH_Mesh_ptr aMesh){}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Update(){
- if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
- SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
- if(Sel->IObjectCount() == 0){
- vtkRenderer* aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->hasIO()){
- Update(anActor->getIO());
+ break;
+ case 9010:
+ {
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ if (Sel->IObjectCount() == 1) {
+ Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
+ if(anIObject->hasEntry())
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
+ anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
}
- }
}
- }else{
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for(; It.More(); It.Next()){
- Handle(SALOME_InteractiveObject) IO = It.Value();
- Update(IO);
+ break;
+ }
+ case 9011:
+ {
+ SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
+ if (Sel->IObjectCount() == 1) {
+ Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
+ if(anIObject->hasEntry())
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
+ anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
+ }
}
+ break;
+ }
+ case 10001: // DISPLAY MODE PREFERENCE
+ {
+ // Wireframe
+ parent->menuBar()->setItemChecked(10001, true);
+ parent->menuBar()->setItemChecked(10002, false);
+ parent->menuBar()->setItemChecked(10004, false);
+ parent->menuBar()->setItemEnabled(10003, true);
+ QAD_CONFIG->addSetting("SMESH:DisplayMode", "Wireframe");
+ break;
+ }
+ case 10002:
+ {
+ parent->menuBar()->setItemChecked(10002, true);
+ parent->menuBar()->setItemChecked(10001, false);
+ parent->menuBar()->setItemChecked(10004, false);
+ parent->menuBar()->setItemEnabled(10003, true);
+ QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
+ break;
+ }
+ case 10003:
+ {
+ parent->menuBar()->setItemChecked(10003,!parent->menuBar()->isItemChecked(10003));
+ QAD_CONFIG->addSetting("SMESH:Shrink", parent->menuBar()->isItemChecked(10003) ? "yes" : "no");
+ break;
+ }
+ case 10004:
+ {
+ parent->menuBar()->setItemChecked(10001, false);
+ parent->menuBar()->setItemChecked(10004, true);
+ parent->menuBar()->setItemChecked(10002, false);
+ parent->menuBar()->setItemEnabled(10003, false);
+ QAD_CONFIG->addSetting("SMESH:DisplayMode", "Nodes");
+ break;
}
- ::RepaintCurrentView();
+
}
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::Update(const Handle(SALOME_InteractiveObject) & theIO){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- TVisualObjPtr aVisualObj = ::GetVisualObj(anId,theIO->getEntry());
- aVisualObj->Update();
- ::UpdateView(eDisplay,theIO->getEntry());
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-vtkActor *SMESHGUI::SimulationMoveNode(SMESH_Actor * Mactor, int idnode)
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return NULL;
-
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
-
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(Mactor->GetUnstructuredGrid());
- vtkIdList *IdCells = vtkIdList::New();
- ugrid->GetPointCells(idnode, IdCells);
-
- vtkPoints *Pts = vtkPoints::New();
- Pts = ugrid->GetPoints();
-
- vtkUnstructuredGrid *ugridSimulation = vtkUnstructuredGrid::New();
- ugridSimulation->SetPoints(Pts);
- vtkIdList *IdPts = vtkIdList::New();
- for (int j = 0; j < IdCells->GetNumberOfIds(); j++)
- {
- ugrid->GetCellPoints(IdCells->GetId(j), IdPts);
- ugridSimulation->InsertNextCell(ugrid->GetCellType(IdCells->GetId(j)),
- IdPts);
- }
-
- vtkProperty *prop = vtkProperty::New();
- prop->SetColor(1., 0., 0.);
- prop->SetRepresentationToWireframe();
-
- int Edgewidth = (int)Mactor->GetLineWidth();
- if (Edgewidth == 0)
- Edgewidth = 1;
- prop->SetLineWidth(Edgewidth + 1);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(ugridSimulation);
- vtkActor *ac = vtkActor::New();
- ac->SetMapper(Mapper);
- ac->SetProperty(prop);
-
- ac->GetMapper()->SetResolveCoincidentTopologyToShiftZBuffer();
- ac->GetMapper()->SetResolveCoincidentTopologyZShift(0.02);
-
- mySimulationActors->AddItem(ac);
- theRenderer->AddActor(ac);
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
-
- return ac;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DisplaySimulationNode(SMESH::SMESH_Mesh_ptr aMesh, float x,
- float y, float z)
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
-
- if (result)
- {
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
-
- vtkPoints *Pts = ugrid->GetPoints();
- vtkPoints *newPts = vtkPoints::New();
- int nbPts = Pts->GetNumberOfPoints();
- for (int i = 0; i < nbPts; i++)
- {
- newPts->InsertPoint(i, Pts->GetPoint(i));
- }
-
- newugrid->SetPoints(newPts);
- newugrid->GetPoints()->InsertNextPoint(x, y, z);
-
- vtkMaskPoints *verts = vtkMaskPoints::New();
- verts->SetInput(newugrid);
- verts->SetGenerateVertices(1);
- verts->SetOnRatio(1);
-
- vtkPolyDataMapper *vertMapper = vtkPolyDataMapper::New();
- vertMapper->SetInput(verts->GetOutput());
- vertMapper->ScalarVisibilityOff();
-
- vtkActor *node = vtkActor::New();
- node->SetMapper(vertMapper);
-
- QString SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed");
- QString SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen");
- QString SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
- QColor nodecolor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- if (!nodecolor.isValid())
-// nodecolor = QColor(0.,1.,0.);
- nodecolor = QColor(0, 1, 0);
-
- node->GetProperty()->SetColor(float (nodecolor.red()) / 255.,
- float (nodecolor.green()) / 255., float (nodecolor.blue()) / 255.);
- int intValue =
- QAD_CONFIG->getSetting("SMESH:SettingsNodesSize").toInt();
- if (intValue < 1)
- intValue == 1;
-
- node->GetProperty()->SetPointSize(intValue);
-
- node->VisibilityOn();
-
- mySimulationActors->AddItem(node);
- theRenderer->AddActor(node);
- }
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DisplaySimulationMoveNode(vtkActor * ac, int idnode, float x,
- float y, float z)
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- float *pt = ac->GetMapper()->GetInput()->GetPoint(idnode);
- pt[0] = x;
- pt[1] = y;
- pt[2] = z;
-
- ac->GetMapper()->ImmediateModeRenderingOn();
- ac->GetProperty()->SetRepresentationToWireframe();
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
-
- renWin->Render();
+ myActiveStudy->updateObjBrowser(true);
+ return true;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::MoveNode(SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x,
- float y, float z)
+bool SMESHGUI::OnMousePress(QMouseEvent * pe, QAD_Desktop * parent,
+ QAD_StudyFrame * studyFrame)
{
- Standard_Boolean result;
-
- SMESH_Actor *MeshActor = FindActor(aMesh, result, true);
- if (result)
- {
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::ScalarVisibilityOff(){
- if(vtkRenderer *aRenderer = ::GetCurrentRenderer()){
- vtkActorCollection *actorList = aRenderer->GetActors();
- actorList->InitTraversal();
- while(vtkActor *ac = actorList->GetNextActor()){
- if(SMESH_Actor *anActor = SMESH_Actor::SafeDownCast(ac)){
- anActor->GetMapper()->ScalarVisibilityOff();
- }
- }
- ::RepaintCurrentView();
- }
+ return false;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::DisplaySimulationEdge(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex)
+bool SMESHGUI::OnMouseMove(QMouseEvent * pe, QAD_Desktop * parent,
+ QAD_StudyFrame * studyFrame)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
- if (result)
- {
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- int idNodes[2];
- int pts[2];
- int i = 0;
- vtkIdList *Ids = vtkIdList::New();
- for (; ite.More(); ite.Next())
- {
- idNodes[i] = ite.Key();
- i++;
- }
-
- Ids->InsertId(0, idNodes[0]);
- pts[0] = idNodes[0];
- Ids->InsertId(1, idNodes[1]);
- pts[1] = idNodes[1];
-
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
- newugrid->SetPoints(ugrid->GetPoints());
- newugrid->InsertNextCell(VTK_LINE, 2, pts);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(newugrid);
- Mapper->Update();
-
- vtkActor *edge = vtkActor::New();
- edge->SetMapper(Mapper);
- edge->SetProperty(ac->GetProperty());
- edge->SetBackfaceProperty(ac->GetBackfaceProperty());
- edge->VisibilityOn();
- mySimulationActors->AddItem(edge);
- theRenderer->AddActor(edge);
- }
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
+ return true;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::DisplaySimulationTriangle(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex, bool reverse)
+bool SMESHGUI::OnKeyPress(QKeyEvent * pe, QAD_Desktop * parent,
+ QAD_StudyFrame * studyFrame)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
- if (result)
- {
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- int idNodes[3];
- int pts[3];
- int i = 0;
- vtkIdList *Ids = vtkIdList::New();
- for (; ite.More(); ite.Next())
- {
- idNodes[i] = ite.Key();
- i++;
- }
-
- if (reverse)
- {
- Ids->InsertId(0, idNodes[2]);
- pts[0] = idNodes[2];
- Ids->InsertId(1, idNodes[1]);
- pts[1] = idNodes[1];
- Ids->InsertId(2, idNodes[0]);
- pts[2] = idNodes[0];
- }
- else
- {
- Ids->InsertId(0, idNodes[0]);
- pts[0] = idNodes[0];
- Ids->InsertId(1, idNodes[1]);
- pts[1] = idNodes[1];
- Ids->InsertId(2, idNodes[2]);
- pts[2] = idNodes[2];
- }
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
- newugrid->SetPoints(ugrid->GetPoints());
- newugrid->InsertNextCell(VTK_TRIANGLE, 3, pts);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(newugrid);
- Mapper->Update();
-
- vtkActor *tri = vtkActor::New();
- tri->SetMapper(Mapper);
- tri->SetProperty(ac->GetProperty());
- tri->SetBackfaceProperty(ac->GetBackfaceProperty());
- tri->VisibilityOn();
- mySimulationActors->AddItem(tri);
- theRenderer->AddActor(tri);
- }
-
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
+ return true;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::DisplaySimulationQuadrangle(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex, bool reverse)
+bool SMESHGUI::SetSettings(QAD_Desktop * parent)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
+ MESSAGE("SMESHGUI::SetSettings.");
+ SMESHGUI::GetSMESHGUI();
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
+ /* Display mode */
+ QString DisplayMode = "Shading";
+ if ( QAD_CONFIG->hasSetting("SMESH:DisplayMode") )
+ DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
+ else
+ QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
- if (result)
- {
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- int i = 0;
- int idNodes[4];
- vtkIdList *Ids = vtkIdList::New();
- for (; ite.More(); ite.Next())
- {
- idNodes[i] = ite.Key();
- i++;
- }
+ bool Shrink = false;
+ if ( QAD_CONFIG->hasSetting("SMESH:Shrink") )
+ Shrink = QAD_CONFIG->getSetting("SMESH:Shrink") == "yes";
- float *p0 = ugrid->GetPoint(idNodes[0]);
- float *p1 = ugrid->GetPoint(idNodes[1]);
- float *p2 = ugrid->GetPoint(idNodes[2]);
- float *p3 = ugrid->GetPoint(idNodes[3]);
-
- gp_Pnt P0(p0[0], p0[1], p0[2]);
-
- gp_Vec V1(P0, gp_Pnt(p1[0], p1[1], p1[2]));
- gp_Vec V2(P0, gp_Pnt(p2[0], p2[1], p2[2]));
- gp_Vec V3(P0, gp_Pnt(p3[0], p3[1], p3[2]));
-
- gp_Vec Cross1 = V1 ^ V2;
- gp_Vec Cross2 = V2 ^ V3;
-
- int tmp;
- if (Cross1.Dot(Cross2) < 0)
- {
- V1 = gp_Vec(P0, gp_Pnt(p2[0], p2[1], p2[2]));
- V2 = gp_Vec(P0, gp_Pnt(p1[0], p1[1], p1[2]));
- Cross1 = V1 ^ V2;
- Cross2 = V2 ^ V3;
-
- if (Cross1.Dot(Cross2) < 0)
- {
- tmp = idNodes[2];
- idNodes[2] = idNodes[3];
- idNodes[3] = tmp;
- }
- else
- {
- tmp = idNodes[1];
- idNodes[1] = idNodes[2];
- idNodes[2] = tmp;
- }
- }
+ if (DisplayMode == "Wireframe") {
+ // wireframe
+ parent->menuBar()->setItemChecked(10004, false);
+ parent->menuBar()->setItemChecked(10002, false);
+ parent->menuBar()->setItemChecked(10001, true);
+ parent->menuBar()->setItemEnabled(10003, true);
+ }
+ else if (DisplayMode == "Nodes") {
+ // poins
+ parent->menuBar()->setItemChecked(10004, true);
+ parent->menuBar()->setItemChecked(10002, false);
+ parent->menuBar()->setItemChecked(10001, false);
+ parent->menuBar()->setItemEnabled(10003, false);
+ }
+ else {
+ // default is shading
+ parent->menuBar()->setItemChecked(10004, false);
+ parent->menuBar()->setItemChecked(10002, true);
+ parent->menuBar()->setItemChecked(10001, false);
+ parent->menuBar()->setItemEnabled(10003, true);
+ }
+ parent->menuBar()->setItemChecked(10003, Shrink);
- if (reverse)
- {
- Ids->InsertId(0, idNodes[3]);
- Ids->InsertId(1, idNodes[2]);
- Ids->InsertId(2, idNodes[1]);
- Ids->InsertId(3, idNodes[0]);
- }
- else
- {
- Ids->InsertId(0, idNodes[0]);
- Ids->InsertId(1, idNodes[1]);
- Ids->InsertId(2, idNodes[2]);
- Ids->InsertId(3, idNodes[3]);
- }
+ /* Automatic Update */
+ QString AutoUpdate = QAD_CONFIG->getSetting("SMESH:AutomaticUpdate");
+ if (AutoUpdate.compare("true") == 0) {
+ parent->menuBar()->setItemChecked(1001, true);
+ myAutomaticUpdate = true;
+ }
+ else {
+ parent->menuBar()->setItemChecked(1001, false);
+ myAutomaticUpdate = false;
+ }
- // vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->GetUnstructuredGrid() );
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
- newugrid->SetPoints(ugrid->GetPoints());
- newugrid->InsertNextCell(VTK_QUAD, Ids);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(newugrid);
- Mapper->Update();
-
- vtkActor *quad = vtkActor::New();
- quad->SetMapper(Mapper);
- quad->SetProperty(ac->GetProperty());
- quad->SetBackfaceProperty(ac->GetBackfaceProperty());
- quad->VisibilityOn();
- mySimulationActors->AddItem(quad);
- theRenderer->AddActor(quad);
- }
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
-}
+ /* Selection */
+ SMESH::UpdateSelectionProp();
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::DisplaySimulationTetra(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
- if (result)
- {
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- int i = 0;
- int idNodes[4];
- vtkIdList *Ids = vtkIdList::New();
- for (; ite.More(); ite.Next())
- {
- idNodes[i] = ite.Key();
- i++;
- }
+ /* menus disable */
+ parent->menuBar()->setItemEnabled(111, false); // IMPORT DAT
+ //parent->menuBar()->setItemEnabled(112, false); // IMPORT UNV
- Ids->InsertId(0, idNodes[0]);
- Ids->InsertId(1, idNodes[1]);
- Ids->InsertId(2, idNodes[2]);
- Ids->InsertId(3, idNodes[3]);
-
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
- newugrid->SetPoints(ugrid->GetPoints());
- newugrid->InsertNextCell(VTK_TETRA, Ids);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(newugrid);
- Mapper->Update();
-
- vtkActor *tetra = vtkActor::New();
- tetra->SetMapper(Mapper);
- tetra->SetProperty(ac->GetProperty());
- tetra->SetBackfaceProperty(ac->GetBackfaceProperty());
- tetra->VisibilityOn();
- mySimulationActors->AddItem(tetra);
- theRenderer->AddActor(tetra);
- }
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
+ return true;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESHGUI::DisplaySimulationHexa(SMESH::SMESH_Mesh_ptr aMesh,
- const TColStd_MapOfInteger & MapIndex)
+void SMESHGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors = vtkActorCollection::New();
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
- Standard_Boolean result;
- SMESH_Actor *ac = FindActor(aMesh, result, true);
- if (result)
- {
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- int i = 0;
- int idNodes[8];
- vtkIdList *Ids = vtkIdList::New();
- for (; ite.More(); ite.Next())
- {
- idNodes[i] = ite.Key();
- i++;
- }
-
- Ids->InsertId(0, idNodes[0]);
- Ids->InsertId(1, idNodes[1]);
- Ids->InsertId(2, idNodes[2]);
- Ids->InsertId(3, idNodes[3]);
- Ids->InsertId(4, idNodes[4]);
- Ids->InsertId(5, idNodes[5]);
- Ids->InsertId(6, idNodes[6]);
- Ids->InsertId(7, idNodes[7]);
-
- vtkUnstructuredGrid *ugrid =
- vtkUnstructuredGrid::SafeDownCast(ac->GetUnstructuredGrid());
- vtkUnstructuredGrid *newugrid = vtkUnstructuredGrid::New();
- newugrid->SetPoints(ugrid->GetPoints());
- newugrid->InsertNextCell(VTK_HEXAHEDRON, Ids);
-
- vtkDataSetMapper *Mapper = vtkDataSetMapper::New();
- Mapper->SetInput(newugrid);
- Mapper->Update();
-
- vtkActor *hexa = vtkActor::New();
- hexa->SetMapper(Mapper);
- hexa->SetProperty(ac->GetProperty());
- hexa->SetBackfaceProperty(ac->GetBackfaceProperty());
- hexa->VisibilityOn();
- mySimulationActors->AddItem(hexa);
- theRenderer->AddActor(hexa);
- }
- vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
- renWin->Render();
-}
+ // NRI : Temporary added
+ // if ( myStudy->GetProperties()->IsLocked() ) {
+ // theObject = "NothingSelected";
+ // theContext = "NothingSelected";
+ // }
+ // NRI
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::AddFace(SMESH::SMESH_Mesh_ptr theMesh,
- const TColStd_MapOfInteger & MapIndex,
- bool reverse)
-{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(MapIndex.Extent());
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(int i = 0; ite.More(); ite.Next(), i++){
- anArrayOfIdeces[i] = anActor->GetNodeObjId(ite.Key());
- }
- int tmp;
- if(MapIndex.Extent() == 4){
- int idNodes[4];
- TColStd_MapIteratorOfMapOfInteger ite1(MapIndex);
- for(int i = 0; ite1.More(); ite1.Next(), i++){
- idNodes[i] = ite1.Key();
- }
- vtkUnstructuredGrid *ugrid = anActor->GetUnstructuredGrid();
- float *p0 = ugrid->GetPoint(idNodes[0]);
- float *p1 = ugrid->GetPoint(idNodes[1]);
- float *p2 = ugrid->GetPoint(idNodes[2]);
- float *p3 = ugrid->GetPoint(idNodes[3]);
-
- gp_Pnt P0(p0[0], p0[1], p0[2]);
-
- gp_Vec V1(P0, gp_Pnt(p1[0], p1[1], p1[2]));
- gp_Vec V2(P0, gp_Pnt(p2[0], p2[1], p2[2]));
- gp_Vec V3(P0, gp_Pnt(p3[0], p3[1], p3[2]));
-
- gp_Vec Cross1 = V1 ^ V2;
- gp_Vec Cross2 = V2 ^ V3;
-
- if(Cross1.Dot(Cross2) < 0){
- V1 = gp_Vec(P0, gp_Pnt(p2[0], p2[1], p2[2]));
- V2 = gp_Vec(P0, gp_Pnt(p1[0], p1[1], p1[2]));
- Cross1 = V1 ^ V2;
- Cross2 = V2 ^ V3;
-
- if(Cross1.Dot(Cross2) < 0){
- tmp = anArrayOfIdeces[2];
- anArrayOfIdeces[2] = anArrayOfIdeces[3];
- anArrayOfIdeces[3] = tmp;
- }else{
- tmp = anArrayOfIdeces[1];
- anArrayOfIdeces[1] = anArrayOfIdeces[2];
- anArrayOfIdeces[2] = tmp;
- }
- }
- }
- if(reverse){
- for(int i = 0; i < (MapIndex.Extent() / 2); i++){
- tmp = anArrayOfIdeces[i];
- anArrayOfIdeces[i] = anArrayOfIdeces[MapIndex.Extent() - i - 1];
- anArrayOfIdeces[MapIndex.Extent() - i - 1] = tmp;
- }
- }
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->AddFace(anArrayOfIdeces);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
- }
- AddActorInSelection(anActor);
- }
- }
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
+ SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ int nbSel = Sel->IObjectCount();
+ switch ( nbSel ) {
+ case 0:
+ theObject = "NothingSelected";
+ theContext = "NothingSelected";
+ break;
+ case 1:
+ if ( myState == 800 && Sel->HasIndex( Sel->firstIObject() ) )
+ theObject = "Elements";
+ else
+ theObject = ::CheckTypeObject( Sel->firstIObject() );
+ theContext = "";
+ break;
+ default:
+ theObject = ::CheckHomogeneousSelection();
+ theContext = "";
}
}
*
*/
//=============================================================================
-void SMESHGUI::AddVolume(SMESH::SMESH_Mesh_ptr theMesh,
- const TColStd_MapOfInteger & MapIndex)
+bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
+ const QString& theParent, const QString& theObject)
{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(MapIndex.Extent());
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(int i = 0; ite.More(); ite.Next(), i++){
- anArrayOfIdeces[i] = anActor->GetNodeObjId(ite.Key());
+ // get active study frame
+ QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
+
+ // get parent component which selected object(s) belongs to
+ QString parentComp = ( (SALOMEGUI_Desktop*)parent )->getComponentFromSelection();
+
+ // get selection
+ SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
+ int nbSel = Sel->IObjectCount();
+
+ if ( nbSel == 0 ) {
+ popup->clear();
+ }
+ else if ( nbSel == 1 ) {
+ if ( parentComp != parent->getActiveComponent() ) {
+ // object not belongs to SMESH module - remove all commands except common Display/Erase...
+ while ( 1 ) {
+ int id = popup->idAt( 0 );
+ if ( id <= QAD_TopLabel_Popup_ID )
+ popup->removeItemAt( 0 );
+ else
+ break;
}
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->AddVolume(anArrayOfIdeces);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
+ }
+ else {
+ // get selected interactive object
+ Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
+ SALOMEDS::SObject_var SO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
+ // find popup menu's TopLabel item
+ int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
+ if ( topItem >= 0 ) {
+ if ( theParent == "Viewer" ) {
+ // set bold font for popup menu's TopLabel item (Viewer popup)
+ QFont fnt = QApplication::font(); fnt.setBold( TRUE );
+ popup->removeItem( QAD_TopLabel_Popup_ID );
+ popup->insertItem( new CustomItem( QString( IObject->getName() ), fnt ), QAD_TopLabel_Popup_ID, topItem );
+ }
+ else if ( theParent == "ObjectBrowser" ) {
+ // remove popup menu's TopLabel item (Object Browser popup)
+ popup->removeItem( QAD_TopLabel_Popup_ID );
}
}
- }
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::AddEdge(SMESH::SMESH_Mesh_ptr theMesh,
- const TColStd_MapOfInteger & MapIndex)
-{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(MapIndex.Extent());
- TColStd_MapIteratorOfMapOfInteger ite(MapIndex);
- for(int i = 0; ite.More(); ite.Next(), i++){
- anArrayOfIdeces[i] = anActor->GetNodeObjId(ite.Key());
+
+ if ( theObject == "Hypothesis" || theObject == "Algorithm" ) {
+ // remove Display/Erase commands
+ popup->removeItem( QAD_Display_Popup_ID );
+ popup->removeItem( QAD_DisplayOnly_Popup_ID );
+ popup->removeItem( QAD_Erase_Popup_ID );
+ // remove "Unassign ..." command if hyp/algo is not assigned
+ if ( SO->_is_nil() || !IObject->hasReference()/* !IsReferencedObject( SO ) */)
+ popup->removeItem( 1102 );
}
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->AddEdge(anArrayOfIdeces);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
+ else if ( theObject == "Mesh" || theObject == "SubMesh" || theObject == "Group" ) {
+ // get actor
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SO );
+ if ( aShapeObject->_is_nil() ) {
+ // imported mesh
+ popup->removeItem( 701 ); // Compute
+ popup->removeItem( 705 ); // Edit hypothesis
+ popup->removeItem( 706 ); // ...
+ }
+ SMESH_Actor* ac = SMESH::FindActorByEntry(IObject->getEntry());
+ // if object has actor
+ if ( ac && studyFrame->getTypeView() == VIEW_VTK ) {
+ VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
+ if ( myRenderInter->isVisible( IObject ) ) {
+ popup->removeItem( QAD_Display_Popup_ID );
+ popup->setItemChecked( 9010, ac->GetPointsLabeled() ); // Numbering / Display Nodes #
+ popup->setItemChecked( 9011, ac->GetCellsLabeled() ); // Numbering / Display Elements #
+ TVisualObjPtr aVisualObj = ac->GetObject();
+ int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE);
+ int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE);
+ int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME);
+ QMenuItem* mi = popup->findItem( 1131 );
+ if ( mi && mi->popup() ) {
+ int prType = ac->GetRepresentation();
+ // Display Mode / Wireframe
+ if(!aNbFaces && !aNbVolumes && !aNbEdges){
+ mi->popup()->removeItem( 211 );
+ }else{
+ mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
+ }
+ // Display Mode / Shading
+ if(!aNbFaces && !aNbVolumes){
+ mi->popup()->removeItem( 212 );
+ }else{
+ mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
+ }
+ // Display Mode / Points
+ mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );
+ // Display Mode / Shrink
+ bool isShrunk = ac->IsShrunk();
+ bool isShrunkable = ac->IsShrunkable();
+ mi->popup()->setItemChecked( 213, isShrunk );
+ mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
+ }
+ // Scalar Bar
+ mi = popup->findItem( 2000 );
+ if ( mi && mi->popup() ) {
+ SMESH_Actor::eControl cMode = ac->GetControlMode();
+ switch ( cMode ) {
+ case SMESH_Actor::eLengthEdges:
+ mi->popup()->setItemChecked( 6001, true ); break;
+ case SMESH_Actor::eFreeEdges:
+ mi->popup()->setItemChecked( 6002, true );
+ mi->popup()->removeItem( 201 );
+ break;
+ case SMESH_Actor::eFreeBorders:
+ mi->popup()->setItemChecked( 6003, true );
+ mi->popup()->removeItem( 201 );
+ break;
+ case SMESH_Actor::eMultiConnection:
+ mi->popup()->setItemChecked( 6004, true ); break;
+ case SMESH_Actor::eArea:
+ mi->popup()->setItemChecked( 6011, true ); break;
+ case SMESH_Actor::eTaper:
+ mi->popup()->setItemChecked( 6012, true ); break;
+ case SMESH_Actor::eAspectRatio:
+ mi->popup()->setItemChecked( 6013, true ); break;
+ case SMESH_Actor::eMinimumAngle:
+ mi->popup()->setItemChecked( 6014, true ); break;
+ case SMESH_Actor::eWarping:
+ mi->popup()->setItemChecked( 6015, true ); break;
+ case SMESH_Actor::eSkew:
+ mi->popup()->setItemChecked( 6016, true ); break;
+ case SMESH_Actor::eNone:
+ default:
+ mi->popup()->removeItem( 200 );
+ mi->popup()->removeItem( 201 );
+ break;
+ }
+ TVisualObjPtr aVisualObj = ac->GetObject();
+ if(!aNbEdges){
+ mi->popup()->removeItem( 6001 );
+ mi->popup()->removeItem( 6003 );
+ mi->popup()->removeItem( 6004 );
+ }
+ if(!aNbFaces){
+ mi->popup()->removeItem( 6002 );
+ mi->popup()->removeItem( 6011 );
+ mi->popup()->removeItem( 6012 );
+ mi->popup()->removeItem( 6013 );
+ mi->popup()->removeItem( 6014 );
+ mi->popup()->removeItem( 6015 );
+ mi->popup()->removeItem( 6016 );
+ }
+ if(!aNbFaces && !aNbEdges)
+ popup->removeItem( 2000 ); // Scalar Bar
+ }
+ }
+ else {
+ popup->removeItem( QAD_Erase_Popup_ID );
+ popup->removeItem( 114 ); // Numbering popup menu
+ popup->removeItem( 1131 ); // Display mode
+ popup->removeItem( 1132 ); // Color / size
+ popup->removeItem( 1133 ); // Transparency
+ popup->removeItem( 1134 ); // Clipping
+ popup->removeItem( 2000 ); // Scalar Bar
+ }
+ }
+ else {
+ // object doesn't have actor
+ CORBA::Object_var anObject = SO->GetObject();
+ bool bDisplay = false;
+ if ( !CORBA::is_nil( anObject ) ) {
+ SMESH::SMESH_Mesh_var aMeshObj = SMESH::SMESH_Mesh::_narrow( anObject );
+ if ( !aMeshObj->_is_nil() && ( aMeshObj->NbNodes() > 0 || aMeshObj->NbFaces() > 0 || aMeshObj->NbVolumes() > 0 ) )
+ bDisplay = true;
+ SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( anObject );
+ if ( !aSubMeshObj->_is_nil() && ( aSubMeshObj->GetNumberOfNodes(false) > 0 || aSubMeshObj->GetNumberOfElements() > 0 ) )
+ bDisplay = true;
+ SMESH::SMESH_Group_var aGroupObj = SMESH::SMESH_Group::_narrow( anObject );
+ if ( !aGroupObj->_is_nil() && aGroupObj->Size() > 0 )
+ bDisplay = true;
+ }
+ if ( !bDisplay ) {
+ popup->removeItem( QAD_Display_Popup_ID );
+ popup->removeItem( QAD_DisplayOnly_Popup_ID );
+ }
+ popup->removeItem( QAD_Erase_Popup_ID );
+ popup->removeItem( 114 ); // Numbering popup menu
+ popup->removeItem( 1131 ); // Display mode
+ popup->removeItem( 1132 ); // Color / size
+ popup->removeItem( 1133 ); // Transparency
+ popup->removeItem( 1134 ); // Clipping
+ popup->removeItem( 2000 ); // Scalar Bar
}
}
+ else if( theObject!="Component" ) {
+ // another SMESH object
+ popup->removeItem( QAD_Display_Popup_ID );
+ popup->removeItem( QAD_DisplayOnly_Popup_ID );
+ popup->removeItem( QAD_Erase_Popup_ID );
+ }
}
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
}
-}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESHGUI::AddNode(SMESH::SMESH_Mesh_ptr theMesh,
- float x, float y, float z)
-{
- QAD_WaitCursor wc;
- try{
- SALOMEDS::SObject_var aSobj = myStudyAPI.FindObject(theMesh);
- CORBA::String_var anEntry = aSobj->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(anEntry.in())){
- SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
- aMeshEditor->AddNode(x, y, z);
- if(myAutomaticUpdate){
- CORBA::Long anId = smeshGUI->myStudy->StudyId();
- if(TVisualObjPtr aVisualObj = GetVisualObj(anId,anEntry.in())){
- aVisualObj->Update(true);
+ else {
+ // multiple selection
+ if ( parentComp != parent->getActiveComponent() ) {
+ // object not belongs to SMESH module - remove all commands except common Display/Erase...
+ while ( 1 ) {
+ int id = popup->idAt( 0 );
+ if ( id <= QAD_TopLabel_Popup_ID )
+ popup->removeItemAt( 0 );
+ else
+ break;
+ }
+ if ( parentComp.isNull() ) {
+ // objects from different components are selected
+ popup->removeItem( QAD_DisplayOnly_Popup_ID );
+ popup->removeItem( QAD_Display_Popup_ID );
+ popup->removeItem( QAD_Erase_Popup_ID );
+ }
+ }
+ else {
+ QString type = ::CheckHomogeneousSelection();
+ if ( type != "Heterogeneous Selection" ) {
+ int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
+ if ( topItem >= 0 ) {
+ // set bold font for popup menu's TopLabel item
+ QFont fnt = QApplication::font(); fnt.setBold( TRUE );
+ popup->removeItem( QAD_TopLabel_Popup_ID );
+ popup->insertItem( new CustomItem( QString("%1 ").arg( nbSel ) + type + "(s) ", fnt ), QAD_TopLabel_Popup_ID, topItem );
}
}
}
- }catch(SALOME::SALOME_Exception& exc) {
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
}
+ return false;
}
+
//=============================================================================
-/*!
- *
+/*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+ * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
*/
//=============================================================================
-void SMESHGUI::DisplayEdgesConnectivityLegendBox(vtkActor * ac)
+void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO)
{
- if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK)
- return;
-
- EraseSimulationActors();
- mySimulationActors2D = vtkActor2DCollection::New();
-
- vtkRenderer *theRenderer =
- ((VTKViewer_ViewFrame *) myActiveStudy->getActiveStudyFrame()->
- getRightFrame()->getViewFrame())->getRenderer();
-
- vtkGlyphSource2D *gs2 = vtkGlyphSource2D::New();
- gs2->SetGlyphTypeToTriangle();
- gs2->FilledOff();
-
- vtkLegendBoxActor *legend = vtkLegendBoxActor::New();
- legend->GetPositionCoordinate()->SetValue(0.025, 0.025, 0.);
- legend->GetPosition2Coordinate()->SetValue(0.3, 0.3, 0.); //relative to Position
-
- legend->SetNumberOfEntries(4);
- legend->SetEntryString(0, tr("SMESH_BOUNDARYEDGES"));
- legend->SetEntrySymbol(0, gs2->GetOutput());
- legend->SetEntryColor(0, ac->GetMapper()->GetLookupTable()->GetColor(0.));
- legend->SetEntryString(1, tr("SMESH_MANIFOLDEDGES"));
- legend->SetEntrySymbol(1, gs2->GetOutput());
- legend->SetEntryColor(1,
- ac->GetMapper()->GetLookupTable()->GetColor(0.666667));
- legend->SetEntryString(2, tr("SMESH_NONMANIFOLDEDGES"));
- legend->SetEntrySymbol(2, gs2->GetOutput());
- legend->SetEntryColor(2,
- ac->GetMapper()->GetLookupTable()->GetColor(0.222222));
- legend->SetEntryString(3, tr("SMESH_FEATUREEDGES"));
- legend->SetEntrySymbol(3, gs2->GetOutput());
- legend->SetEntryColor(3,
- ac->GetMapper()->GetLookupTable()->GetColor(0.444444));
- legend->SetPadding(5);
- // legend->GetProperty()->SetColor();
-
- mySimulationActors2D->AddItem(legend);
- theRenderer->AddActor2D(legend);
-
- // Update the view
- myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->
- Repaint();
+ if(theIO->hasEntry()){
+ QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
+ QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
+ SMESH::UpdateView(aStudyFrame,SMESH::eDisplay,theIO->getEntry());
+ }
}
-//===============================================================================
-// function : OnEditDelete()
-// purpose :
-//===============================================================================
-void SMESHGUI::OnEditDelete()
+void SMESHGUI::SupportedViewType(int *buffer, int bufferSize)
{
- if (QAD_MessageBox::warn2
- (QAD_Application::getDesktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_REALLY_DELETE"),
- tr("SMESH_BUT_YES"), tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
+ if (!buffer || !bufferSize)
return;
-
- int nbSf = myActiveStudy->getStudyFramesCount();
-
- Standard_Boolean found;
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
-
- SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for(; It.More(); It.Next()){
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()){
- SALOMEDS::SObject_var SO = myStudy->FindObjectID(IObject->getEntry());
-
- /* Erase child graphical objects */
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for(; it->More(); it->Next()){
- SALOMEDS::SObject_var CSO = it->Value();
- if(CSO->FindAttribute(anAttr, "AttributeIOR")){
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-
- for(int i = 0; i < nbSf; i++){
- QAD_StudyFrame *sf = myActiveStudy->getStudyFrame(i);
- CORBA::String_var anEntry = CSO->GetID();
- if(SMESH_Actor* anActor = ::FindActorByEntry(sf,anEntry.in())){
- RemoveActor(sf,anActor);
- }
- }
- }
- }
-
- /* Erase main graphical object */
- for(int i = 0; i < nbSf; i++){
- QAD_StudyFrame *sf = myActiveStudy->getStudyFrame(i);
- if(SMESH_Actor* anActor = ::FindActorByEntry(sf,IObject->getEntry())){
- RemoveActor(sf,anActor);
- }
- }
-
- // Remove object(s) from data structures
- SALOMEDS::SObject_var obj = myStudy->FindObjectID(IObject->getEntry());
- if(!obj->_is_nil()){
- SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group ::_narrow(obj->GetObject());
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(obj->GetObject());
-
- if ( !aGroup->_is_nil() ) { // DELETE GROUP
- SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
- aMesh->RemoveGroup( aGroup );
- }
- else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
- SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
- aMesh->RemoveSubMesh( aSubMesh );
- }
- else {// default action: remove SObject from the study
- // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
- //QAD_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
- //op->start();
- aStudyBuilder->RemoveObjectWithChildren( obj );
- //op->finish();
- }
- }
-
- } /* IObject->hasEntry() */
- } /* more/next */
-
- /* Clear any previous selection */
- Sel->ClearIObjects();
- myActiveStudy->updateObjBrowser();
+ buffer[0] = (int)VIEW_VTK;
}
-//=======================================================================
-// name : SMESHGUI::GetFilterMgr
-// Purpose : Get filter manager
-//=======================================================================
-SMESH::FilterManager_ptr SMESHGUI::GetFilterMgr()
+void SMESHGUI::Deactivate()
{
- return myFilterMgr;
+ if ( SMESHGUI::GetSMESHGUI() ) {
+ SMESHGUI::GetSMESHGUI()->EmitSignalCloseAllDialogs();
+ }
}
#ifndef SMESHGUI_HeaderFile
#define SMESHGUI_HeaderFile
-#include "TColStd_MapOfInteger.hxx"
-#include <map>
-
-#include "SMESHDS_Document.hxx"
-
// SALOME Includes
#include "SALOMEGUI.h"
-#include "QAD_Desktop.h"
-#include "SALOME_Selection.h"
#include "SALOME_InteractiveObject.hxx"
-#include "SMESHGUI_StudyAPI.h"
-#include "SMESHGUI_Hypotheses.h"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Group)
-#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-#include CORBA_SERVER_HEADER(SMESH_Filter)
-
-// QT Includes
-#include <qstringlist.h>
+class QAD_Desktop;
+class QAD_Study;
-// VTK Inlcludes
+class QDialog;
-class vtkActorCollection;
-class vtkActor2DCollection;
-class vtkScalarBarActor;
-class vtkActor;
-
-class SMESH_Actor;
//=================================================================================
// class : SMESHGUI
//=================================================================================
class SMESHGUI : public SALOMEGUI
{
- Q_OBJECT
+ Q_OBJECT;
private :
-
- QAD_Desktop* myDesktop;
- QAD_Study* myActiveStudy;
- SMESH::SMESH_Gen_var myComponentMesh;
- GEOM::GEOM_Gen_var myComponentGeom;
-
- QDialog* myActiveDialogBox;
- int myNbMesh ;
- int myState ;
-
- vtkActorCollection* mySimulationActors;
- vtkActor2DCollection* mySimulationActors2D;
-
- SMESH_Actor* myCurrentMesh;
+ QAD_Desktop* myDesktop;
+ QAD_Study* myActiveStudy;
+ QDialog* myActiveDialogBox;
- SALOMEDS::Study_var myStudy;
- int myStudyId;
-
- SMESHGUI_StudyAPI myStudyAPI;
-
- // vtkScalarBarActor* myScalarBar;
-
- SMESHDS_Document * myDocument;//NBU
-
- bool myAutomaticUpdate;
-
- SMESH::FilterManager_var myFilterMgr;
-
- // Hypotheses/algorithms from plugin libraries
- map<string, HypothesisData*> myHypothesesMap;
- map<string, HypothesisData*> myAlgorithmsMap;
- map<string, SMESHGUI_GenericHypothesisCreator*> myHypCreatorMap;
+ int myState;
+ bool myAutomaticUpdate;
public :
-
SMESHGUI( const QString& name = "", QObject* parent = 0 );
- ~SMESHGUI();
-
- static SMESHGUI* GetOrCreateSMESHGUI( QAD_Desktop* desktop );
static SMESHGUI* GetSMESHGUI() ;
+ ~SMESHGUI();
- QAD_Study* GetActiveStudy() ;
QAD_Desktop* GetDesktop() ;
- SALOMEDS::Study_ptr GetStudy();
- SMESHGUI_StudyAPI GetStudyAPI();
+ QAD_Study* GetActiveStudy() ;
+ bool ActiveStudyLocked();
QDialog* GetActiveDialogBox() ;
void SetActiveDialogBox(QDialog* aDlg) ;
- void SetState(int aState) ;
void ResetState() ;
+ void SetState(int aState) ;
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
-
virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent);
virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
virtual void SupportedViewType (int* buffer, int bufferSize);
virtual void Deactivate ();
- void OnEditDelete();
-
- /* Mesh Management */
- SMESH::SMESH_Mesh_ptr InitMesh( GEOM::GEOM_Shape_ptr aShape, QString NameMesh );
- SMESH::SMESH_subMesh_ptr AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh, GEOM::GEOM_Shape_ptr aShape, QString NameMesh );
- SMESH::SMESH_Group_ptr AddGroup( SMESH::SMESH_Mesh_ptr aMesh, SMESH::ElementType aType, QString aName );
-
- /* Hypotheses and Algorithms Management */
- void InitAvailableHypotheses ();
- QStringList GetAvailableHypotheses (const bool isAlgo);
- HypothesisData* GetHypothesisData (const char* aHypType);
- SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator (const QString& aHypType);
-
- SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const QString& aHypType,
- const QString& aHypName,
- const bool isAlgo = false);
-
- bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
- bool AddAlgorithmOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
-
- bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
- bool AddAlgorithmOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
-
- bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject);
- bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
- SMESH::SMESH_Hypothesis_ptr anHyp);
-
- void SetPickable(SMESH_Actor* theActor = NULL);
-
- /* NODES */
- void ViewNodes();
- vtkActor* SimulationMoveNode(SMESH_Actor* Mactor, int idnode);
- void MoveNode( SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x, float y, float z);
-
- void DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z);
- void DisplaySimulationMoveNode( vtkActor* ac, int idnode, float x, float y, float z);
-
- void RemoveNodes(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ;
-
- /* EDGES */
- void DisplayEdges(SMESH_Actor* ac, bool visibility = true);
- void DisplayEdgesConnectivityLegendBox(vtkActor *ac);
- void DisplaySimulationEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
-
- /* TRIANGLES */
- void DisplaySimulationTriangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse );
-
- /* QUADRANGLES */
- void DisplaySimulationQuadrangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse );
-
- /* VOLUMES */
- void DisplaySimulationTetra( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
- void DisplaySimulationHexa( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
-
- /* ELEMENTS */
- void RemoveElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ;
- void OrientationElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex);
- void DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex);
-
- void AddFace( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse );
- void AddEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
- void AddVolume( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
- void AddNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z);
-
- /* Simulation management */
- void EraseSimulationActors() ;
-
/* Non modal dialog boxes magement */
void EmitSignalDeactivateDialog() ;
+ void EmitSignalStudyFrameChanged() ;
void EmitSignalCloseAllDialogs() ;
- /* Selection management */
- int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ;
- int GetNameOfSelectedNodes( SALOME_Selection* Sel, QString& aName ) ;
- int GetNameOfSelectedElements( SALOME_Selection* Sel, QString& aName ) ;
- int GetNameOfSelectedEdges( SALOME_Selection* Sel, QString& aName ) ;
-
- SMESH::SMESH_Hypothesis_ptr ConvertIOinSMESHHypothesis( const Handle(SALOME_InteractiveObject)& IO,
- Standard_Boolean& testResult ) ;
-
- SMESH::SMESH_Mesh_ptr ConvertIOinMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
- SMESH::SMESH_subMesh_ptr ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
- SMESH::SMESH_Group_ptr ConvertIOinSMESHGroup(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
-
- /* Geometry Client */
- GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO,
- Standard_Boolean& testResult ) ;
-
- /* Popup management */
- QString CheckTypeObject(const Handle(SALOME_InteractiveObject)& IO);
- QString CheckHomogeneousSelection();
-
- /* Scripts management */
- SMESH_Actor* ReadScript(SMESH::SMESH_Mesh_ptr aMesh);
-
- /* Actors management */
- void Dump(SMESH_Actor* Mactor);
-
- void SetViewMode(int commandId);
- void ChangeRepresentation( SMESH_Actor* ac, int type );
-
- SMESH_Actor* FindActor(CORBA::Object_ptr theObj,
- Standard_Boolean& testResult,
- bool onlyInActiveView);
- SMESH_Actor* FindActorByEntry(QString entry,
- Standard_Boolean& testResult,
- bool onlyInActiveView);
-
- void InitActor(SMESH::SMESH_Mesh_ptr aMesh);
- void DisplayActor(SMESH_Actor* ac, bool visibility = true);
- void EraseActor(SMESH_Actor* ac);
- bool AddActorInSelection(SMESH_Actor* ac);
-
- void UpdateView();
-
- void Update();
- void Update(const Handle(SALOME_InteractiveObject)& IO);
-
- void ScalarVisibilityOff();
-
-
- /* Settings management */
- void SetSettingsScalarBar(vtkScalarBarActor* theScalarBar,
- QString Bold, QString Italic, QString Shadow, QString Font,
- QString Orientation, float Width, float Height,
- int NbColors, int NbLabels);
- void SetDisplaySettings();
-
- SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
-
- /* Control management */
- void Control(int theCommandID);
-
- /* Parameter functions */
- double Parameter( Standard_Boolean& res, const double aValue,
- const char* aLabel, const char* aTitle,
- const double bottom, const double top, const int decimals ) ;
- int Parameter( Standard_Boolean& res, const int aValue,
- const char* aLabel, const char* aTitle,
- const int bottom, const int top ) ;
-
- static void setOrb();
-
- /* Import/Export */ //NBU
- static void Import_Mesh(QAD_Desktop* parent, int theCommandID);
- static void Export_Mesh(QAD_Desktop* parent, int theCommandID);
-
- /* Filter manager */
- SMESH::FilterManager_ptr GetFilterMgr();
-
signals:
void SignalDeactivateActiveDialog() ;
+ void SignalStudyFrameChanged() ;
void SignalCloseAllDialogs() ;
+
};
+
#endif
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddAlgorithmDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_AddAlgorithmDlg.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qframe.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qevent.h>
-
-
-//=================================================================================
-// class : SMESHGUI_AddAlgorithmDlg()
-// purpose : Constructs a SMESHGUI_AddAlgorithmDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-SMESHGUI_AddAlgorithmDlg::SMESHGUI_AddAlgorithmDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ADD_ALGORITHM")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_AddAlgorithmDlg" );
- resize( 322, 220 );
- setCaption( tr( "SMESH_ADD_ALGORITHM_TITLE" ) );
- setSizeGripEnabled( TRUE );
-
- SMESHGUI_AddAlgorithmDlgLayout = new QGridLayout( this );
- SMESHGUI_AddAlgorithmDlgLayout->setSpacing( 6 );
- SMESHGUI_AddAlgorithmDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_ADD_ALGORITHM" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A2Mesh = new QLineEdit( GroupConstructor1, "LineEditC1A2Mesh" );
- LineEditC1A2Mesh->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Mesh->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A2Mesh, 1, 2 );
- LineEditC1A1Hyp = new QLineEdit( GroupConstructor1, "LineEditC1A1Hyp" );
- LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1Hyp, 0, 2 );
- SelectButtonC1A1Hyp = new QPushButton( GroupConstructor1, "SelectButtonC1A1Hyp" );
- SelectButtonC1A1Hyp->setText( tr( "" ) );
- SelectButtonC1A1Hyp->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1Hyp, 0, 1 );
- SelectButtonC1A2Mesh = new QPushButton( GroupConstructor1, "SelectButtonC1A2Mesh" );
- SelectButtonC1A2Mesh->setText( tr( "" ) );
- SelectButtonC1A2Mesh->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A2Mesh, 1, 1 );
- TextLabelC1A2Mesh = new QLabel( GroupConstructor1, "TextLabelC1A2Mesh" );
- TextLabelC1A2Mesh->setText( tr( "SMESH_OBJECT_MESHorSUBMESH" ) );
- TextLabelC1A2Mesh->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2Mesh->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2Mesh->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2Mesh, 1, 0 );
- TextLabelC1A1Hyp = new QLabel( GroupConstructor1, "TextLabelC1A1Hyp" );
- TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_ALGORITHM" ) );
- TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1Hyp, 0, 0 );
- SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_1, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /* Initialisation */
- Init( Sel ) ;
-}
-
-
-//=================================================================================
-// function : ~SMESHGUI_AddAlgorithmDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_AddAlgorithmDlg::~SMESHGUI_AddAlgorithmDlg()
-{
- /* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
-}
-
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::Init( SALOME_Selection* Sel )
-{
- mySelection = Sel ;
- myConstructorId = 0 ;
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- GroupConstructor1->show();
- myConstructorId = 0 ;
- myEditCurrentArgument = LineEditC1A1Hyp ;
- Constructor1->setChecked( TRUE );
- myOkMesh = myOkSubMesh = myOkAlgorithm = false ;
-
- myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM );
- myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2Mesh, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* Displays Dialog */
-
- return ;
-}
-
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::ConstructorsClicked(int constructorId)
-{
- switch (constructorId)
- {
- case 0:
- {
- GroupConstructor1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1Hyp ;
- LineEditC1A2Mesh->setText(tr("")) ;
- Constructor1->setChecked( TRUE );
- myOkMesh = myOkSubMesh = myOkAlgorithm = false ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkMesh && myOkAlgorithm ) {
- SALOME_ListIteratorOfListIO It( AlgoList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean testResult;
- myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
- if( testResult )
- mySMESHGUI->AddAlgorithmOnMesh(myMesh, myAlgorithm) ;
- }
- } else if ( myOkSubMesh && myOkAlgorithm ) {
- SALOME_ListIteratorOfListIO It( AlgoList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean testResult;
- myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
- if( testResult )
- mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, myAlgorithm) ;
- }
- }
- break ;
- }
- }
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::ClickOnCancel()
-{
- mySelection->ClearFilters() ;
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- reject() ;
- return ;
-}
-
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- QString aString = "";
-
- int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
-
- if ( myEditCurrentArgument == LineEditC1A2Mesh ) {
- if ( nbSel == 1 ) {
- Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject();
- QString aName = IObject->getName();
- Standard_Boolean testResult;
- myOkMesh = true ;
- myMesh = mySMESHGUI->ConvertIOinMesh(IObject, testResult) ;
- if( !testResult ) {
- myOkMesh = false;
- myOkSubMesh = true;
- mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IObject, testResult) ;
- if( !testResult ) {
- myOkSubMesh = false;
- return ;
- }
- }
- LineEditC1A2Mesh->setText(aString) ;
- }
- else {
- myOkMesh = myOkSubMesh = false ;
- return ;
- }
- }
- else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
- if ( nbSel >= 1 ) {
- AlgoList.Clear(); // = mySelection->StoredIObjects() ;
- SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
- for (; Itinit.More(); Itinit.Next()) {
- AlgoList.Append(Itinit.Value());
- }
- myOkAlgorithm = true ;
- if (nbSel > 1)
- aString = tr("%1 Algorithms").arg(nbSel) ;
- LineEditC1A1Hyp->setText(aString) ;
- }
- else {
- myOkAlgorithm = false ;
- return ;
- }
- }
-
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
-
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if( send == SelectButtonC1A1Hyp ) {
- LineEditC1A1Hyp->setFocus() ;
- myEditCurrentArgument = LineEditC1A1Hyp ;
- mySelection->ClearFilters() ;
- mySelection->AddFilter(myAlgorithmFilter) ;
- }
- else if(send == SelectButtonC1A2Mesh) {
- LineEditC1A2Mesh->setFocus() ;
- myEditCurrentArgument = LineEditC1A2Mesh;
- mySelection->ClearFilters() ;
- mySelection->AddFilter(myMeshOrSubMeshFilter) ;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::LineEditReturnPressed()
-{
-
- return ;
-}
-
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
-
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- }
- return ;
-}
-
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::closeEvent( QCloseEvent* e )
-{
- this->ClickOnCancel() ; /* same than click on cancel button */
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose : when mouse enter onto the QWidget
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::enterEvent( QEvent * )
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
-}
-
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddAlgorithmDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- return ;
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddAlgorithmDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ADD_ALGORITHM_H
-#define DIALOGBOX_ADD_ALGORITHM_H
-
-#include "SALOME_Selection.h"
-#include "SMESH_TypeFilter.hxx"
-#include "SALOME_ListIO.hxx"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QFrame;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class SMESHGUI;
-
-
-//=================================================================================
-// class : SMESHGUI_AddAlgorithmDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_AddAlgorithmDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_AddAlgorithmDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_AddAlgorithmDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESH::SMESH_Gen_var myCompMesh ;
- SMESHGUI* mySMESHGUI ;
- SALOME_Selection* mySelection ;
-
- SMESH::SMESH_Mesh_var myMesh;
- SMESH::SMESH_subMesh_var mySubMesh;
- SMESH::SMESH_Hypothesis_var myAlgorithm;
-
- Handle(SMESH_TypeFilter) myAlgorithmFilter;
- Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
-
- bool myOkMesh ;
- bool myOkSubMesh ;
- bool myOkAlgorithm;
-
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SALOME_ListIO AlgoList;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
-
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A1Hyp;
- QLineEdit* LineEditC1A2Mesh;
- QPushButton* SelectButtonC1A1Hyp;
- QPushButton* SelectButtonC1A2Mesh;
- QLabel* TextLabelC1A2Mesh;
- QLabel* TextLabelC1A1Hyp;
-
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_AddAlgorithmDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructor1Layout;
-};
-
-#endif // DIALOGBOX_ADD_ALGORITHM_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddEdgeDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_AddEdgeDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qcheckbox.h>
-
-
-//=================================================================================
-// class : SMESHGUI_AddEdgeDlg()
-// purpose :
-//=================================================================================
-SMESHGUI_AddEdgeDlg::SMESHGUI_AddEdgeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- myNodes = 2;
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_LINE")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_AddEdgeDlg" );
- resize( 303, 185 );
- setCaption( tr( "SMESH_ADD_EDGE_TITLE" ) );
- setSizeGripEnabled( TRUE );
- SMESHGUI_AddEdgeDlgLayout = new QGridLayout( this );
- SMESHGUI_AddEdgeDlgLayout->setSpacing( 6 );
- SMESHGUI_AddEdgeDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_EDGE" ) );
-
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_AddEdgeDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_AddEdgeDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ADD_EDGE" ) );
-
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
- SMESHGUI_AddEdgeDlgLayout->addWidget( GroupC1, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
-}
-
-//=================================================================================
-// function : ~SMESHGUI_AddEdgeDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_AddEdgeDlg::~SMESHGUI_AddEdgeDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::Init( SALOME_Selection* Sel )
-{
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkNodes = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-
- SelectionIntoArgument();
-
- return ;
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::ConstructorsClicked(int constructorId)
-{
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkNodes) {
- mySMESHGUI->EraseSimulationActors();
- mySMESHGUI->AddEdge( myMesh, myMapIndex ) ;
- mySMESHGUI->ViewNodes();
- mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
- return ;
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::ClickOnCancel()
-{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- mySMESHGUI->EraseSimulationActors();
- reject() ;
- return ;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- myOkNodes = false;
- QString aString = "";
-
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return;
-
- int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes < 1)
- return ;
-
- if ( mySelection->SelectionMode() != NodeSelection ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
- return;
- }
-
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
-
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
-
- if ( myNodes == 2 && nbNodes == 2 ) {
- mySMESHGUI->DisplaySimulationEdge(myMesh, myMapIndex);
- myOkNodes = true ;
- } else {
- // mySMESHGUI->EraseSimulationActors();
- myOkNodes = false ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- mySMESHGUI->EraseSimulationActors() ;
- mySMESHGUI->ResetState() ;
- mySMESHGUI->SetActiveDialogBox(0) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- return ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::enterEvent(QEvent* e)
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddEdgeDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
-}
-
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddEdgeDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ADD_EDGE_H
-#define DIALOGBOX_ADD_EDGE_H
-
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class QCheckBox;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-//=================================================================================
-// class : SMESHGUI_AddEdgeDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_AddEdgeDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_AddEdgeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_AddEdgeDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkNodes ; /* to check when arguments is defined */
-
- int myNodes ;
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_AddEdgeDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
-};
-
-#endif // DIALOGBOX_ADD_EDGE_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddFaceDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_AddFaceDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qcheckbox.h>
-
-
-//=================================================================================
-// class : SMESHGUI_AddFaceDlg()
-// purpose :
-//=================================================================================
-SMESHGUI_AddFaceDlg::SMESHGUI_AddFaceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- int nbNodes, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- myNodes = nbNodes;
- QPixmap image0;
- if ( myNodes == 3 )
- image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
- else if ( myNodes == 4 )
- image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_QUADRANGLE")));
-
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_AddFaceDlg" );
- resize( 303, 185 );
- if ( myNodes == 3 )
- setCaption( tr( "SMESH_ADD_TRIANGLE_TITLE" ) );
- else if ( myNodes == 4 )
- setCaption( tr( "SMESH_ADD_QUADRANGLE_TITLE" ) );
-
- setSizeGripEnabled( TRUE );
- SMESHGUI_AddFaceDlgLayout = new QGridLayout( this );
- SMESHGUI_AddFaceDlgLayout->setSpacing( 6 );
- SMESHGUI_AddFaceDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- if ( myNodes == 3 )
- GroupConstructors->setTitle( tr( "SMESH_TRIANGLE" ) );
- else if ( myNodes == 4 )
- GroupConstructors->setTitle( tr( "SMESH_QUADRANGLE" ) );
-
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_AddFaceDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_AddFaceDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- if ( myNodes == 3 )
- GroupC1->setTitle( tr( "SMESH_ADD_TRIANGLE" ) );
- else if ( myNodes == 4 )
- GroupC1->setTitle( tr( "SMESH_ADD_QUADRANGLE" ) );
-
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
- Reverse = new QCheckBox( GroupC1, "Reverse" );
- Reverse->setText( tr( "SMESH_REVERSE" ) );
- GroupC1Layout->addWidget( Reverse, 1, 0 );
-
- SMESHGUI_AddFaceDlgLayout->addWidget( GroupC1, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
-}
-
-//=================================================================================
-// function : ~SMESHGUI_AddFaceDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_AddFaceDlg::~SMESHGUI_AddFaceDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::Init( SALOME_Selection* Sel )
-{
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkNodes = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- connect( Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
-
- reverse = false;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-
- SelectionIntoArgument();
-
- return ;
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_AddFaceDlg::ConstructorsClicked(int constructorId)
-{
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkNodes) {
- mySMESHGUI->EraseSimulationActors();
- mySMESHGUI->AddFace( myMesh, myMapIndex, reverse ) ;
- mySMESHGUI->ViewNodes();
- mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
- return ;
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::ClickOnCancel()
-{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- mySMESHGUI->EraseSimulationActors();
- reject() ;
- return ;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_AddFaceDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- myOkNodes = false;
- QString aString = "";
-
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return;
-
- int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes < 1)
- return ;
-
- if ( mySelection->SelectionMode() != NodeSelection ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
- return;
- }
-
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
-
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex );
-
- if ( myNodes == 3 && nbNodes == 3 ) {
- mySMESHGUI->DisplaySimulationTriangle(myMesh, myMapIndex, reverse);
- myOkNodes = true ;
- } else if ( myNodes == 4 && nbNodes == 4 ) {
- mySMESHGUI->DisplaySimulationQuadrangle(myMesh, myMapIndex, reverse);
- myOkNodes = true ;
- } else {
- // mySMESHGUI->EraseSimulationActors();
- myOkNodes = false ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- mySMESHGUI->EraseSimulationActors() ;
- mySMESHGUI->ResetState() ;
- mySMESHGUI->SetActiveDialogBox(0) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- return ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::enterEvent(QEvent* e)
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddFaceDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
-}
-
-
-void SMESHGUI_AddFaceDlg::CheckBox( int state )
-{
- if( Reverse->isOn() ) reverse = true;
- else reverse = false;
-
- if ( myOkNodes == false )
- return;
-
- if ( state >= 0 ) {
- mySMESHGUI->EraseSimulationActors();
- if ( myNodes == 3 )
- mySMESHGUI->DisplaySimulationTriangle( myMesh, myMapIndex, reverse);
- else if ( myNodes == 4 ) {
- mySMESHGUI->DisplaySimulationQuadrangle( myMesh, myMapIndex, reverse);
- }
- }
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddFaceDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ADD_FACE_H
-#define DIALOGBOX_ADD_FACE_H
-
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class QCheckBox;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-//=================================================================================
-// class : SMESHGUI_AddFaceDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_AddFaceDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_AddFaceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0,
- int nbNode = 3, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_AddFaceDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkNodes ; /* to check when arguments is defined */
-
- int myNodes ;
- bool reverse ;
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
-
- QCheckBox* Reverse;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void CheckBox( int );
-
-protected:
- QGridLayout* SMESHGUI_AddFaceDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
-};
-
-#endif // DIALOGBOX_ADD_FACE_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddHypothesisDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_AddHypothesisDlg.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qframe.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qevent.h>
-
-
-//=================================================================================
-// class : SMESHGUI_AddHypothesisDlg()
-// purpose : Constructs a SMESHGUI_AddHypothesisDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-SMESHGUI_AddHypothesisDlg::SMESHGUI_AddHypothesisDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ADD_HYPOTHESIS")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_AddHypothesisDlg" );
- resize( 322, 220 );
- setCaption( tr( "SMESH_ADD_HYPOTHESIS_TITLE" ) );
- setSizeGripEnabled( TRUE );
-
- SMESHGUI_AddHypothesisDlgLayout = new QGridLayout( this );
- SMESHGUI_AddHypothesisDlgLayout->setSpacing( 6 );
- SMESHGUI_AddHypothesisDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_ADD_HYPOTHESIS" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
- GroupConstructor1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupConstructor1->setColumnLayout(0, Qt::Vertical );
- GroupConstructor1->layout()->setSpacing( 0 );
- GroupConstructor1->layout()->setMargin( 0 );
- GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
- GroupConstructor1Layout->setAlignment( Qt::AlignTop );
- GroupConstructor1Layout->setSpacing( 6 );
- GroupConstructor1Layout->setMargin( 11 );
- LineEditC1A2Mesh = new QLineEdit( GroupConstructor1, "LineEditC1A2Mesh" );
- LineEditC1A2Mesh->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Mesh->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A2Mesh, 1, 2 );
- LineEditC1A1Hyp = new QLineEdit( GroupConstructor1, "LineEditC1A1Hyp" );
- LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) );
- GroupConstructor1Layout->addWidget( LineEditC1A1Hyp, 0, 2 );
- SelectButtonC1A1Hyp = new QPushButton( GroupConstructor1, "SelectButtonC1A1Hyp" );
- SelectButtonC1A1Hyp->setText( tr( "" ) );
- SelectButtonC1A1Hyp->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A1Hyp, 0, 1 );
- SelectButtonC1A2Mesh = new QPushButton( GroupConstructor1, "SelectButtonC1A2Mesh" );
- SelectButtonC1A2Mesh->setText( tr( "" ) );
- SelectButtonC1A2Mesh->setPixmap( image1 );
- GroupConstructor1Layout->addWidget( SelectButtonC1A2Mesh, 1, 1 );
- TextLabelC1A2Mesh = new QLabel( GroupConstructor1, "TextLabelC1A2Mesh" );
- TextLabelC1A2Mesh->setText( tr( "SMESH_OBJECT_MESHorSUBMESH" ) );
- TextLabelC1A2Mesh->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A2Mesh->setFrameShape( QLabel::NoFrame );
- TextLabelC1A2Mesh->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A2Mesh, 1, 0 );
- TextLabelC1A1Hyp = new QLabel( GroupConstructor1, "TextLabelC1A1Hyp" );
- TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) );
- TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain );
- GroupConstructor1Layout->addWidget( TextLabelC1A1Hyp, 0, 0 );
- SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupConstructor1, 1, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_1, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /* Initialisation */
- Init( Sel ) ;
-}
-
-
-//=================================================================================
-// function : ~SMESHGUI_AddHypothesisDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_AddHypothesisDlg::~SMESHGUI_AddHypothesisDlg()
-{
- /* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
-}
-
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::Init( SALOME_Selection* Sel )
-{
- mySelection = Sel ;
- myConstructorId = 0 ;
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- GroupConstructor1->show();
- myConstructorId = 0 ;
- myEditCurrentArgument = LineEditC1A1Hyp ;
- Constructor1->setChecked( TRUE );
- myOkMesh = myOkSubMesh = myOkHypothesis = false ;
-
- myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
- myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
-
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
- connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( SelectButtonC1A2Mesh, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* Displays Dialog */
-
- return ;
-}
-
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::ConstructorsClicked(int constructorId)
-{
- switch (constructorId)
- {
- case 0:
- {
- GroupConstructor1->show();
- myConstructorId = constructorId ;
- myEditCurrentArgument = LineEditC1A1Hyp ;
- LineEditC1A2Mesh->setText(tr("")) ;
- Constructor1->setChecked( TRUE );
- myOkMesh = myOkSubMesh = myOkHypothesis = false ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkMesh && myOkHypothesis ) {
- SALOME_ListIteratorOfListIO It( HypoList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean testResult;
- myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
- if( testResult )
- mySMESHGUI->AddHypothesisOnMesh(myMesh, myHypothesis) ;
- }
- } else if( myOkSubMesh && myOkHypothesis ) {
- SALOME_ListIteratorOfListIO It( HypoList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean testResult;
- myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
- if( testResult )
- mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, myHypothesis) ;
- }
- }
- break ;
- }
- }
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::ClickOnCancel()
-{
- mySelection->ClearFilters() ;
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- reject() ;
- return ;
-}
-
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- QString aString = "";
-
- int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
-
- if ( myEditCurrentArgument == LineEditC1A2Mesh ) {
- if ( nbSel == 1 ) {
- Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject();
- QString aName = IObject->getName();
- Standard_Boolean testResult;
- myOkMesh = true ;
- myMesh = mySMESHGUI->ConvertIOinMesh(IObject, testResult) ;
- if( !testResult ) {
- myOkMesh = false;
- myOkSubMesh = true;
- mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IObject, testResult) ;
- if( !testResult ) {
- myOkSubMesh = false;
- return ;
- }
- }
- LineEditC1A2Mesh->setText(aString) ;
- }
- else {
- myOkMesh = myOkSubMesh = false ;
- return ;
- }
- }
- else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
- if ( nbSel >= 1 ) {
- HypoList.Clear(); // = mySelection->StoredIObjects() ;
- SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
- for (; Itinit.More(); Itinit.Next()) {
- HypoList.Append(Itinit.Value());
- }
- myOkHypothesis = true ;
- if (nbSel > 1)
- aString = tr("%1 Hypothesis").arg(nbSel) ;
- LineEditC1A1Hyp->setText(aString) ;
- }
- else {
- myOkHypothesis = false ;
- return ;
- }
- }
-
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
-
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if( send == SelectButtonC1A1Hyp ) {
- myEditCurrentArgument = LineEditC1A1Hyp ;
- LineEditC1A1Hyp->setFocus() ;
- mySelection->ClearFilters() ;
- mySelection->AddFilter(myHypothesisFilter) ;
- }
- else if(send == SelectButtonC1A2Mesh) {
- myEditCurrentArgument = LineEditC1A2Mesh;
- LineEditC1A2Mesh->setFocus() ;
- mySelection->ClearFilters() ;
- mySelection->AddFilter(myMeshOrSubMeshFilter) ;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::LineEditReturnPressed()
-{
-
- return ;
-}
-
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
-
- GroupConstructors->setEnabled(false) ;
- GroupConstructor1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- disconnect( mySelection, 0, this, 0 );
- }
- return ;
-}
-
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::closeEvent( QCloseEvent* e )
-{
- this->ClickOnCancel() ; /* same than click on cancel button */
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose : when mouse enter onto the QWidget
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::enterEvent( QEvent * )
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
-}
-
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddHypothesisDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupConstructor1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-
- connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- return ;
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddHypothesisDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ADD_HYPOTHESIS_H
-#define DIALOGBOX_ADD_HYPOTHESIS_H
-
-#include "SALOME_Selection.h"
-#include "SALOME_TypeFilter.hxx"
-#include "SMESH_TypeFilter.hxx"
-#include "SALOME_ListIO.hxx"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QFrame;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class SMESHGUI;
-
-
-//=================================================================================
-// class : SMESHGUI_AddHypothesisDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_AddHypothesisDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_AddHypothesisDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_AddHypothesisDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESH::SMESH_Gen_var myCompMesh ;
- SMESHGUI* mySMESHGUI ;
- SALOME_Selection* mySelection ;
-
- SMESH::SMESH_Mesh_var myMesh;
- SMESH::SMESH_subMesh_var mySubMesh;
-
- SMESH::SMESH_Hypothesis_var myHypothesis;
-
- Handle(SMESH_TypeFilter) myHypothesisFilter;
- Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
-
- bool myOkMesh ;
- bool myOkSubMesh ;
- bool myOkHypothesis;
-
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SALOME_ListIO HypoList;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
-
- QGroupBox* GroupConstructor1;
- QLineEdit* LineEditC1A1Hyp;
- QLineEdit* LineEditC1A2Mesh;
- QPushButton* SelectButtonC1A1Hyp;
- QPushButton* SelectButtonC1A2Mesh;
- QLabel* TextLabelC1A2Mesh;
- QLabel* TextLabelC1A1Hyp;
-
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void LineEditReturnPressed() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_AddHypothesisDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupConstructor1Layout;
-};
-
-#endif // DIALOGBOX_ADD_HYPOTHESIS_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_AddMeshElementDlg.cxx
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#include "SMESHGUI_AddMeshElementDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_ActorUtils.h"
+
+#include "VTKViewer_ViewFrame.h"
+#include "SMDS_Mesh.hxx"
+#include "SMESH_Actor.h"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+
+#include "utilities.h"
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+
+// QT Includes
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+
+#include <list>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+using namespace std;
+
+namespace SMESH{
+
+ class TElementSimulation{
+ QAD_Study* myStudy;
+ QAD_StudyFrame* myStudyFrame;
+ VTKViewer_ViewFrame* myViewFrame;
+
+ SALOME_Actor *myPreviewActor;
+ vtkDataSetMapper* myMapper;
+ vtkUnstructuredGrid* myGrid;
+
+ public:
+
+ TElementSimulation(QAD_Study* theStudy):
+ myStudy(theStudy),
+ myStudyFrame(theStudy->getActiveStudyFrame()),
+ myViewFrame(GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+ {
+ myGrid = vtkUnstructuredGrid::New();
+
+ // Create and display actor
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput( myGrid );
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->PickableOff();
+ myPreviewActor->VisibilityOff();
+ myPreviewActor->SetMapper( myMapper );
+
+ vtkProperty* aProp = vtkProperty::New();
+ float anRGB[3];
+ anRGB[0] = GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
+ anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
+ anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+ aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myPreviewActor->SetProperty( aProp );
+ aProp->Delete();
+
+ vtkProperty* aBackProp = vtkProperty::New();
+ anRGB[0] = GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
+ anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
+ anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+ aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myPreviewActor->SetBackfaceProperty( aBackProp );
+ aBackProp->Delete();
+
+ myViewFrame->AddActor( myPreviewActor );
+
+ }
+
+
+ typedef list<vtkIdType> TVTKIds;
+ void SetPosition(SMESH_Actor* theActor,
+ vtkIdType theType,
+ const TVTKIds& theIds)
+ {
+ vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
+ myGrid->SetPoints(aGrid->GetPoints());
+
+ myGrid->Reset();
+ vtkIdList *anIds = vtkIdList::New();
+ TVTKIds::const_iterator anIt = theIds.begin();
+ for (int i = 0; anIt != theIds.end(); anIt++,i++)
+ anIds->InsertId(i, *anIt);
+ myGrid->InsertNextCell(theType,anIds);
+ anIds->Delete();
+
+ myGrid->Modified();
+
+ SetVisibility(true);
+ }
+
+
+ void SetVisibility(bool theVisibility){
+ myPreviewActor->SetVisibility(theVisibility);
+ RepaintCurrentView();
+ }
+
+
+ ~TElementSimulation(){
+ if(FindVtkViewFrame(myStudy,myStudyFrame)){
+ myViewFrame->RemoveActor(myPreviewActor);
+ }
+ myPreviewActor->Delete();
+
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myGrid->Delete();
+ }
+
+ };
+
+}
+
+//=================================================================================
+// class : SMESHGUI_AddMeshElementDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const char* name,
+ SALOME_Selection* Sel,
+ SMDSAbs_ElementType ElementType, int nbNodes,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ mySimulation = new SMESH::TElementSimulation(SMESH::GetActiveStudy());
+
+ // verify nb nodes and type
+ myNbNodes = nbNodes;
+ myElementType = ElementType;
+ switch ( ElementType ) {
+ case SMDSAbs_Face:
+ if ( myNbNodes != 3 && myNbNodes != 4 )
+ myNbNodes = 3;
+ break;
+ case SMDSAbs_Volume:
+ if ( myNbNodes != 4 && myNbNodes != 8 ) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
+ myNbNodes = 4;
+ break;
+ default:
+ myElementType = SMDSAbs_Edge;
+ myNbNodes = 2;
+ }
+
+ QString elemName;
+ switch ( myNbNodes ) {
+ case 2: elemName = "EDGE"; break;
+ case 3: elemName = "TRIANGLE"; break;
+ case 4: elemName =
+ myElementType == SMDSAbs_Face ? elemName = "QUADRANGLE" : elemName = "TETRAS"; break;
+// case 5:
+// case 6:
+ default: // 8
+ elemName = "HEXAS";
+ }
+ QString iconName = tr( QString("ICON_DLG_%1").arg(elemName) );
+ QString buttonGrTitle = tr( QString("SMESH_%1").arg(elemName) );
+ QString caption = tr( QString("SMESH_ADD_%1_TITLE").arg(elemName) );
+ QString grBoxTitle = tr( QString("SMESH_ADD_%1").arg(elemName) );
+
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", iconName ));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_AddMeshElementDlg" );
+ resize( 303, 185 );
+ setCaption( caption );
+
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_AddMeshElementDlgLayout = new QGridLayout( this );
+ SMESHGUI_AddMeshElementDlgLayout->setSpacing( 6 );
+ SMESHGUI_AddMeshElementDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setTitle( buttonGrTitle );
+
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
+ Constructor1->setText( tr( "" ) );
+ Constructor1->setPixmap( image0 );
+ Constructor1->setChecked( TRUE );
+ Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
+ Constructor1->setMinimumSize( QSize( 50, 0 ) );
+ GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupConstructorsLayout->addItem( spacer, 0, 1 );
+ SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setTitle( grBoxTitle );
+
+ GroupC1->setMinimumSize( QSize( 0, 0 ) );
+ GroupC1->setFrameShape( QGroupBox::Box );
+ GroupC1->setFrameShadow( QGroupBox::Sunken );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setSpacing( 0 );
+ GroupC1->layout()->setMargin( 0 );
+ GroupC1Layout = new QGridLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setSpacing( 6 );
+ GroupC1Layout->setMargin( 11 );
+ TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
+ TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) );
+ TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
+ TextLabelC1A1->setFrameShape( QLabel::NoFrame );
+ TextLabelC1A1->setFrameShadow( QLabel::Plain );
+ GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
+ SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
+ SelectButtonC1A1->setText( tr( "" ) );
+ SelectButtonC1A1->setPixmap( image1 );
+ SelectButtonC1A1->setToggleButton( FALSE );
+ GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
+ LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+// LineEditC1A1->setReadOnly( TRUE );
+ LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes ));
+ GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
+
+ if ( myElementType == SMDSAbs_Face ) {
+ Reverse = new QCheckBox( GroupC1, "Reverse" );
+ Reverse->setText( tr( "SMESH_REVERSE" ) );
+ GroupC1Layout->addWidget( Reverse, 1, 0 );
+ }
+ else
+ Reverse = 0;
+
+ SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupC1, 1, 0 );
+
+ Init(Sel) ; /* Initialisations */
+}
+
+//=================================================================================
+// function : ~SMESHGUI_AddMeshElementDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+ delete mySimulation;
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::Init( SALOME_Selection* Sel )
+{
+
+ GroupC1->show();
+ Constructor1->setChecked( TRUE );
+ myEditCurrentArgument = LineEditC1A1 ;
+ mySelection = Sel;
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myOkNodes = false ;
+ myActor = 0;
+
+ /* signals and slots connections */
+ connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) );
+ connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ;
+ connect(buttonApply, SIGNAL( clicked() ), SLOT(ClickOnApply() ) );
+
+ connect(SelectButtonC1A1, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ;
+ connect(LineEditC1A1, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&)));
+ connect(mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog()));
+ connect(mySelection, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study frame change */
+ connect( mySMESHGUI, SIGNAL ( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ) ;
+
+ if ( Reverse )
+ connect( Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ // set selection mode
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ SelectionIntoArgument();
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::ClickOnApply()
+{
+ if ( myOkNodes && !mySMESHGUI->ActiveStudyLocked() ) {
+
+ myBusy = true;
+ SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
+ anArrayOfIdeces->length( myNbNodes );
+ bool reverse = ( Reverse && Reverse->isChecked() );
+ QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+ for ( int i = 0; i < aListId.count(); i++ )
+ if ( reverse )
+ anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
+ else
+ anArrayOfIdeces[i] = aListId[ i ].toInt();
+
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ switch ( myElementType ) {
+ case SMDSAbs_Edge:
+ aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
+ case SMDSAbs_Face:
+ aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
+ case SMDSAbs_Volume:
+ aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
+ default:;
+ }
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO(), false );
+
+ SMESH::UpdateView();
+ mySimulation->SetVisibility(false);
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ myEditCurrentArgument->setText("");
+
+ myBusy = false;
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::ClickOnOk()
+{
+ this->ClickOnApply() ;
+ this->ClickOnCancel() ;
+ return ;
+}
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
+{
+ mySelection->ClearIObjects();
+ mySimulation->SetVisibility(false);
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+ return ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
+{
+ if ( myBusy ) return;
+ myBusy = true;
+
+ myOkNodes = false;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ mySimulation->SetVisibility(false);
+
+ // hilight entered nodes
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+ bool allOk = true;
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n ) {
+ if ( mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
+ allOk = false;
+ else
+ mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+ }
+ else
+ allOk = false;
+ }
+ myOkNodes = (allOk && myNbNodes == aListId.count() );
+
+ if ( myOkNodes ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ displaySimulation();
+ }
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection has changed
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+
+ myOkNodes = false;
+ myActor = 0;
+
+ myBusy = true;
+ myEditCurrentArgument->setText( "" );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ mySimulation->SetVisibility(false);
+// SMESH::SetPointRepresentation(true);
+
+ // get selected mesh
+
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+ if ( myMesh->_is_nil() )
+ return;
+
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+ if ( !myActor )
+ return;
+
+ // get selected nodes
+
+ QString aString = "";
+ int nbNodes = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+ if ( myNbNodes != nbNodes )
+ return;
+
+ // OK
+
+ myOkNodes = true;
+
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+
+ displaySimulation();
+}
+
+//=======================================================================
+//function : displaySimulation
+//purpose :
+//=======================================================================
+
+void SMESHGUI_AddMeshElementDlg::displaySimulation()
+{
+ if ( myOkNodes && GroupButtons->isEnabled() )
+ {
+ SMESH::TElementSimulation::TVTKIds anIds;
+ QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+ for ( int i = 0; i < aListId.count(); i++ )
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId( aListId[ i ].toInt() ));
+
+ if ( Reverse && Reverse->isChecked() )
+ anIds.reverse();
+
+ vtkIdType aType = 0;
+ switch ( myNbNodes ) {
+ case 2: aType = VTK_LINE; break;
+ case 3: aType = VTK_TRIANGLE; break;
+ case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
+ case 8: aType = VTK_HEXAHEDRON; break;
+ default: return;
+ }
+
+ mySimulation->SetPosition(myActor,aType,anIds);
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+ if(send == SelectButtonC1A1) {
+ LineEditC1A1->setFocus() ;
+ myEditCurrentArgument = LineEditC1A1;
+ }
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupC1->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySimulation->SetVisibility(false);
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+ return ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+
+ GroupConstructors->setEnabled(true) ;
+ GroupC1->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+ return ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_AddMeshElementDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+ return ;
+}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_AddMeshElementDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel() ;
+}
+
+//=======================================================================
+//function : CheckBox
+//purpose :
+//=======================================================================
+
+void SMESHGUI_AddMeshElementDlg::CheckBox( int state )
+{
+ if ( !myOkNodes )
+ return;
+
+ if ( state >= 0 ) {
+ mySimulation->SetVisibility(false);
+ displaySimulation();
+ }
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_AddMeshElementDlg.h
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#ifndef DIALOGBOX_ADD_FACE_H
+#define DIALOGBOX_ADD_FACE_H
+
+#include "SALOME_Selection.h"
+
+#include "SMDSAbs_ElementType.hxx"
+
+
+// QT Includes
+#include <qvariant.h>
+#include <qdialog.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI;
+class SMESH_Actor;
+class SMDS_Mesh;
+
+namespace SMESH{
+ struct TElementSimulation;
+}
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+//=================================================================================
+// class : SMESHGUI_AddMeshElementDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_AddMeshElementDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_AddMeshElementDlg( QWidget* parent = 0, const char* name = 0,
+ SALOME_Selection* Sel = 0,
+ SMDSAbs_ElementType ElementType = SMDSAbs_Edge,
+ int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_AddMeshElementDlg();
+
+private:
+
+ void Init( SALOME_Selection* Sel ) ;
+ void closeEvent( QCloseEvent* e ) ;
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void displaySimulation();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ bool myOkNodes ; /* to check when arguments is defined */
+ bool myBusy;
+
+ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+
+ int myElementType ;
+ int myNbNodes;
+
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ SMESH::TElementSimulation* mySimulation;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* Constructor1;
+ QGroupBox * GroupButtons;
+ QPushButton * buttonOk;
+ QPushButton * buttonCancel;
+ QPushButton * buttonApply;
+ QGroupBox * GroupC1;
+ QLabel * TextLabelC1A1;
+ QPushButton * SelectButtonC1A1;
+ QLineEdit * LineEditC1A1;
+
+ QCheckBox * Reverse;
+
+private slots:
+
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void CheckBox( int );
+ void onTextChange(const QString&);
+
+protected:
+ QGridLayout* SMESHGUI_AddMeshElementDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupC1Layout;
+};
+
+#endif // DIALOGBOX_ADD_FACE_H
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_AddSubMeshDlg.h"
+
#include "SMESHGUI.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_HypothesesUtils.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_WaitCursor.h"
#include "QAD_Operation.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
#include "utilities.h"
// QT Includes
#include <qlayout.h>
#include <qpixmap.h>
+using namespace std;
+
+namespace SMESH{
+ SMESH::SMESH_subMesh_var AddSubMesh(SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theShapeObject,
+ const char* theMeshName )
+ {
+ SMESH::SMESH_subMesh_var aSubMesh;
+ try {
+ if ( !theMesh->_is_nil() && !theShapeObject->_is_nil() )
+ aSubMesh = theMesh->GetSubMesh( theShapeObject, theMeshName );
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ QtCatchCorbaException( S_ex );
+ }
+ return aSubMesh._retn();
+ }
+}
+
//=================================================================================
// class : SMESHGUI_AddSubMeshDlg()
// purpose : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+ LineEditC1A1->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
SelectButtonC1A2->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
+ LineEditC1A2->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
SelectButtonC1A1Hyp->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
+ LineEditC1A1Hyp->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
SelectButtonC1A1Algo->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
+ LineEditC1A1Algo->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
//=================================================================================
bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return false;
+
QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
if ( myNameSubMesh.isEmpty() ) {
QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
return false;
- SALOMEDS::SObject_var aMeshSO = mySMESHGUI->GetStudyAPI().FindObject( myMesh );
- GEOM::GEOM_Shape_var myMainShape = mySMESHGUI->GetStudyAPI().GetShapeOnMeshOrSubMesh( aMeshSO );
+ SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
+ GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
if ( myMainShape->_is_nil() )
return false;
op->start();
// create submesh
- SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
+ int nbSuccess = 0;
if ( !aSubMesh->_is_nil() ) {
// assign hypotheses
- for( int i = 0; i < HypoList.count(); i++ ) {
- SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( HypoList[i] );
+ int nbAlgo = AlgoList.count();
+ int nbHyps = HypoList.count() + nbAlgo;
+ for( int i = 0; i < nbHyps; i++ ) {
+ SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID
+ ( i < nbAlgo ? AlgoList[i] : HypoList[i-nbAlgo] );
if ( !aHypSO->_is_nil() ) {
CORBA::Object_var anObject = aHypSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddHypothesisOnSubMesh( aSubMesh, aHyp ) ) {
- // abort transaction
- op->abort();
- return false;
- }
+ if ( SMESH::AddHypothesisOnSubMesh( aSubMesh, aHyp ) )
+ nbSuccess++;
}
+ else {
+ SCRUTE( CORBA::is_nil( anObject ));
+ }
}
- }
- // assign algorithms
- for( int i = 0; i < AlgoList.count(); i++ ) {
- SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( AlgoList[i] );
- if ( !aHypSO->_is_nil() ) {
- CORBA::Object_var anObject = aHypSO->GetObject();
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddAlgorithmOnSubMesh( aSubMesh, aHyp ) ) {
- // abort transaction
- op->abort();
- return false;
- }
- }
+ else {
+ SCRUTE( aHypSO->_is_nil() );
}
}
}
+ else {
+ SCRUTE( aSubMesh->_is_nil() );
+ }
+
// commit transaction
op->finish();
- return true;
+ return ( nbSuccess > 0 );
}
close();
}
+//=======================================================================
+//function : IsFatherOf
+//purpose :
+//=======================================================================
+
static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
SALOMEDS::SObject_var aSO = SO->GetFather();
//=================================================================================
void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
{
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
QString aString = "";
-
- int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
if ( myEditCurrentArgument == LineEditC1A1 ) {
// mesh
aString = "";
}
else {
- Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ;
- if( !testResult ) {
- myMesh = SMESH::SMESH_Mesh::_nil();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ if( myMesh->_is_nil() ) {
aString = "";
}
}
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = GEOM::GEOM_Object::_nil();
LineEditC1A2->setText( "" );
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
// geom shape
if ( nbSel != 1 ) {
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = GEOM::GEOM_Object::_nil();
aString = "";
}
else {
- Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult ) {
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
+ if( myGeomShape->_is_nil() ) {
aString = "";
}
if ( !myMesh->_is_nil() ) {
- SALOMEDS::SObject_var aMeshSO = myStudyAPI.FindObject( myMesh );
- GEOM::GEOM_Shape_var aMainGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh( aMeshSO );
- SALOMEDS::SObject_var aMainGeomShapeSO = myStudyAPI.FindObject( aMainGeomShape );
- if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( mySMESHGUI->GetStudy()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
+ GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
+ SALOMEDS::SObject_var aMainGeomShapeSO = SMESH::FindSObject( aMainGeomShape );
+ if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( SMESH::GetActiveStudyDocument()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
+ myGeomShape = GEOM::GEOM_Object::_nil();
aString = "";
}
}
bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
bool isImportedMesh = false;
if ( !myMesh->_is_nil() ) {
- SALOMEDS::SObject_var aMeshSO = mySMESHGUI->GetStudyAPI().FindObject( myMesh );
- GEOM::GEOM_Shape_var myGeomShape = mySMESHGUI->GetStudyAPI().GetShapeOnMeshOrSubMesh( aMeshSO );
+ SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
+ GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
isImportedMesh = myGeomShape->_is_nil();
}
buttonOk ->setEnabled( isEnabled && !isImportedMesh );
buttonApply->setEnabled( isEnabled && !isImportedMesh );
}
-
-
-
-
-
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QGroupBox;
SALOME_Selection* mySelection ;
SMESH::SMESH_Mesh_var myMesh;
- GEOM::GEOM_Shape_var myGeomShape ;
+ GEOM::GEOM_Object_var myGeomShape ;
QLineEdit* myEditCurrentArgument;
Handle(SALOME_TypeFilter) myGeomFilter;
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddVolumeDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_AddVolumeDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qcheckbox.h>
-
-
-//=================================================================================
-// class : SMESHGUI_AddVolumeDlg()
-// purpose :
-//=================================================================================
-SMESHGUI_AddVolumeDlg::SMESHGUI_AddVolumeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- int nbNodes, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- myNodes = nbNodes;
- QPixmap image0;
- if ( myNodes == 4 )
- image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TETRAS")));
- else if ( myNodes == 8 )
- image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_HEXAS")));
-
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_AddVolumeDlg" );
- resize( 303, 185 );
- if ( myNodes == 4 )
- setCaption( tr( "SMESH_ADD_TETRAS_TITLE" ) );
- else if ( myNodes == 8 )
- setCaption( tr( "SMESH_ADD_HEXAS_TITLE" ) );
-
- setSizeGripEnabled( TRUE );
- SMESHGUI_AddVolumeDlgLayout = new QGridLayout( this );
- SMESHGUI_AddVolumeDlgLayout->setSpacing( 6 );
- SMESHGUI_AddVolumeDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- if ( myNodes == 4 )
- GroupConstructors->setTitle( tr( "SMESH_TETRAS" ) );
- else if ( myNodes == 8 )
- GroupConstructors->setTitle( tr( "SMESH_HEXAS" ) );
-
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_AddVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_AddVolumeDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- if ( myNodes == 4 )
- GroupC1->setTitle( tr( "SMESH_ADD_TETRAS" ) );
- else if ( myNodes == 8 )
- GroupC1->setTitle( tr( "SMESH_ADD_HEXAS" ) );
-
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
- SMESHGUI_AddVolumeDlgLayout->addWidget( GroupC1, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
-}
-
-//=================================================================================
-// function : ~SMESHGUI_AddVolumeDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_AddVolumeDlg::~SMESHGUI_AddVolumeDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::Init( SALOME_Selection* Sel )
-{
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkNodes = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-
- SelectionIntoArgument();
-
- return ;
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::ConstructorsClicked(int constructorId)
-{
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkNodes) {
- mySMESHGUI->EraseSimulationActors();
- mySMESHGUI->AddVolume( myMesh, myMapIndex ) ;
- mySMESHGUI->ViewNodes();
- mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
- return ;
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::ClickOnCancel()
-{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- mySMESHGUI->EraseSimulationActors();
- reject() ;
- return ;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- myOkNodes = false;
- QString aString = "";
-
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return;
-
- int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes < 1)
- return ;
-
- if ( mySelection->SelectionMode() != NodeSelection ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
- return;
- }
-
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
-
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
-
- if ( myNodes == 4 && nbNodes == 4 ) {
- mySMESHGUI->DisplaySimulationTetra(myMesh, myMapIndex);
- myOkNodes = true ;
- } else if ( myNodes == 8 && nbNodes == 8 ) {
- mySMESHGUI->DisplaySimulationHexa(myMesh, myMapIndex);
- myOkNodes = true ;
- } else {
- // mySMESHGUI->EraseSimulationActors();
- myOkNodes = false ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- mySMESHGUI->EraseSimulationActors() ;
- mySMESHGUI->ResetState() ;
- mySMESHGUI->SetActiveDialogBox(0) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- return ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::enterEvent(QEvent* e)
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_AddVolumeDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
-}
-
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_AddVolumeDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ADD_VOLUME_H
-#define DIALOGBOX_ADD_VOLUME_H
-
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class QCheckBox;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-//=================================================================================
-// class : SMESHGUI_AddVolumeDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_AddVolumeDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_AddVolumeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0,
- int nbNode = 4, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_AddVolumeDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkNodes ; /* to check when arguments is defined */
-
- int myNodes ;
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_AddVolumeDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
-};
-
-#endif // DIALOGBOX_ADD_VOLUME_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_ClippingDlg.cxx
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#include "SMESHGUI_ClippingDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+
+#include <algorithm>
+
+// QT Includes
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qgroupbox.h>
+
+#include <vtkMath.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkObjectFactory.h>
+
+#include <vtkDataSet.h>
+#include <vtkDataSetMapper.h>
+#include <vtkPlaneSource.h>
+#include <vtkPolyData.h>
+
+#include "VTKViewer_ViewFrame.h"
+#include "QAD_RightFrame.h"
+#include "QAD_WaitCursor.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SMESH_Actor.h"
+#include "SALOME_Selection.h"
+#include "SALOME_InteractiveObject.hxx"
+#include "SMESH_ActorUtils.h"
+
+using namespace std;
+
+
+class OrientedPlane: public vtkPlane
+{
+ QAD_Study* myStudy;
+ QAD_StudyFrame* myStudyFrame;
+ VTKViewer_ViewFrame* myViewFrame;
+
+ vtkDataSetMapper* myMapper;
+
+
+public:
+ static OrientedPlane *New(){
+ return new OrientedPlane();
+ }
+ static OrientedPlane *New(QAD_Study* theStudy){
+ return new OrientedPlane(theStudy);
+ }
+ vtkTypeMacro(OrientedPlane, vtkPlane);
+
+
+ SMESH::Orientation myOrientation;
+ float myDistance;
+ double myAngle[2];
+
+ vtkPlaneSource* myPlaneSource;
+ SALOME_Actor *myActor;
+
+ void SetOrientation(SMESH::Orientation theOrientation) {myOrientation = theOrientation;}
+ SMESH::Orientation GetOrientation() {return myOrientation;}
+
+ void SetDistance(float theDistance) {myDistance = theDistance;}
+ float GetDistance() {return myDistance;}
+
+ void ShallowCopy(OrientedPlane* theOrientedPlane){
+ SetNormal(theOrientedPlane->GetNormal());
+ SetOrigin(theOrientedPlane->GetOrigin());
+
+ myOrientation = theOrientedPlane->GetOrientation();
+ myDistance = theOrientedPlane->GetDistance();
+
+ myAngle[0] = theOrientedPlane->myAngle[0];
+ myAngle[1] = theOrientedPlane->myAngle[1];
+
+ myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal());
+ myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin());
+ myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1());
+ myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2());
+ }
+
+protected:
+ OrientedPlane(QAD_Study* theStudy):
+ myOrientation(SMESH::XY),
+ myDistance(0.5),
+ myStudy(theStudy),
+ myStudyFrame(theStudy->getActiveStudyFrame()),
+ myViewFrame(SMESH::GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+ {
+ Init();
+ myViewFrame->AddActor( myActor );
+ }
+
+ OrientedPlane():
+ myOrientation(SMESH::XY),
+ myDistance(0.5),
+ myStudy(NULL),
+ myStudyFrame(NULL),
+ myViewFrame(NULL)
+ {
+ Init();
+ }
+
+ void Init(){
+ myPlaneSource = vtkPlaneSource::New();
+
+ myAngle[0] = myAngle[1] = 0.0;
+
+ // Create and display actor
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput( myPlaneSource->GetOutput() );
+
+ myActor = SALOME_Actor::New();
+ myActor->VisibilityOff();
+ myActor->PickableOff();
+ myActor->SetInfinitive(true);
+ myActor->SetMapper( myMapper );
+
+ static float anOpacity = 0.75;
+
+ vtkProperty* aProp = vtkProperty::New();
+ float anRGB[3];
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+ aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aProp->SetOpacity(0.75);
+ myActor->SetProperty( aProp );
+ aProp->Delete();
+
+ vtkProperty* aBackProp = vtkProperty::New();
+ anRGB[0] = SMESH::GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
+ anRGB[1] = SMESH::GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
+ anRGB[2] = SMESH::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+ aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ aBackProp->SetOpacity(0.75);
+ myActor->SetBackfaceProperty( aBackProp );
+ aBackProp->Delete();
+ }
+
+ ~OrientedPlane(){
+ if(myStudy && SMESH::FindVtkViewFrame(myStudy,myStudyFrame)){
+ myViewFrame->RemoveActor(myActor);
+ }
+ myActor->Delete();
+
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myPlaneSource->UnRegisterAllOutputs();
+ myPlaneSource->Delete();
+ };
+
+private:
+ // Not implemented.
+ OrientedPlane(const OrientedPlane&);
+ void operator=(const OrientedPlane&);
+
+};
+
+struct TSetVisiblity{
+ TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){}
+ void operator()(SMESH::TVTKPlane& theOrientedPlane){
+ theOrientedPlane->myActor->SetVisibility(myIsVisible);
+ }
+ int myIsVisible;
+};
+
+
+//=================================================================================
+// class : SMESHGUI_ClippingDlg()
+// purpose :
+//
+//=================================================================================
+SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
+ const char* name,
+ bool modal,
+ WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+{
+ if ( !name )
+ setName( "SMESHGUI_ClippingDlg" );
+ setCaption( tr( "SMESH_CLIPPING_TITLE" ) );
+ setSizeGripEnabled( TRUE );
+ QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout( this );
+ SMESHGUI_ClippingDlgLayout->setSpacing( 6 );
+ SMESHGUI_ClippingDlgLayout->setMargin( 11 );
+
+ // Controls for selecting, creating, deleting planes
+ QGroupBox* GroupPlanes = new QGroupBox( this, "GroupPlanes" );
+ GroupPlanes->setTitle( tr("Clipping planes") );
+ GroupPlanes->setColumnLayout(0, Qt::Vertical);
+ GroupPlanes->layout()->setSpacing( 0 );
+ GroupPlanes->layout()->setMargin( 0 );
+ QGridLayout* GroupPlanesLayout = new QGridLayout( GroupPlanes->layout() );
+ GroupPlanesLayout->setAlignment( Qt::AlignTop );
+ GroupPlanesLayout->setSpacing( 6 );
+ GroupPlanesLayout->setMargin( 11 );
+
+ ComboBoxPlanes = new QComboBox(GroupPlanes, "ComboBoxPlanes");
+ GroupPlanesLayout->addWidget( ComboBoxPlanes, 0, 0 );
+
+ QSpacerItem* spacerGP = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupPlanesLayout->addItem( spacerGP, 0, 1 );
+
+ buttonNew = new QPushButton( GroupPlanes, "buttonNew" );
+ buttonNew->setText( tr( "SMESH_BUT_NEW" ) );
+ GroupPlanesLayout->addWidget( buttonNew, 0, 2 );
+
+ buttonDelete = new QPushButton( GroupPlanes, "buttonDelete" );
+ buttonDelete->setText( tr( "SMESH_BUT_DELETE" ) );
+ GroupPlanesLayout->addWidget( buttonDelete, 0, 3 );
+
+ // Controls for defining plane parameters
+ QGroupBox* GroupParameters = new QGroupBox( this, "GroupParameters" );
+ GroupParameters->setTitle( tr("SMESH_PARAMETERS") );
+ GroupParameters->setColumnLayout(0, Qt::Vertical);
+ GroupParameters->layout()->setSpacing( 0 );
+ GroupParameters->layout()->setMargin( 0 );
+ QGridLayout* GroupParametersLayout = new QGridLayout( GroupParameters->layout() );
+ GroupParametersLayout->setAlignment( Qt::AlignTop );
+ GroupParametersLayout->setSpacing( 6 );
+ GroupParametersLayout->setMargin( 11 );
+
+ TextLabelOrientation = new QLabel( GroupParameters, "TextLabelOrientation" );
+ TextLabelOrientation->setText( tr("SMESH_ORIENTATION") );
+ GroupParametersLayout->addWidget( TextLabelOrientation, 0, 0 );
+
+ ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation");
+ GroupParametersLayout->addWidget( ComboBoxOrientation, 0, 1 );
+
+ TextLabelDistance = new QLabel( GroupParameters, "TextLabelDistance" );
+ TextLabelDistance->setText( tr("SMESH_DISTANCE") );
+ GroupParametersLayout->addWidget( TextLabelDistance, 1, 0 );
+
+ SpinBoxDistance = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxDistance" );
+ GroupParametersLayout->addWidget( SpinBoxDistance, 1, 1 );
+
+ TextLabelRot1 = new QLabel( GroupParameters, "TextLabelRot1" );
+ TextLabelRot1->setText( tr("Rotation around X (Y to Z):") );
+ GroupParametersLayout->addWidget( TextLabelRot1, 2, 0 );
+
+ SpinBoxRot1 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot1" );
+ GroupParametersLayout->addWidget( SpinBoxRot1, 2, 1 );
+
+ TextLabelRot2 = new QLabel( GroupParameters, "TextLabelRot2" );
+ TextLabelRot2->setText( tr("Rotation around Y (X to Z):") );
+ GroupParametersLayout->addWidget( TextLabelRot2, 3, 0 );
+
+ SpinBoxRot2 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot2" );
+ GroupParametersLayout->addWidget( SpinBoxRot2, 3, 1 );
+
+ PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters);
+ PreviewCheckBox->setChecked(true);
+ GroupParametersLayout->addWidget( PreviewCheckBox, 4, 0 );
+
+ AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters);
+ AutoApplyCheckBox->setChecked(false);
+ GroupParametersLayout->addWidget( AutoApplyCheckBox, 4, 1 );
+
+ // Controls for "Ok", "Apply" and "Close" button
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+
+ SMESHGUI_ClippingDlgLayout->addWidget( GroupPlanes, 0, 0 );
+ SMESHGUI_ClippingDlgLayout->addWidget( GroupParameters, 1, 0 );
+ SMESHGUI_ClippingDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection());
+
+ // Initial state
+ SpinBoxDistance->RangeStepAndValidator( 0.0, 1.0, 0.01, 3 );
+ SpinBoxRot1->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
+ SpinBoxRot2->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
+
+ ComboBoxOrientation->insertItem( tr("|| X-Y") );
+ ComboBoxOrientation->insertItem( tr("|| Y-Z") );
+ ComboBoxOrientation->insertItem( tr("|| Z-X") );
+
+ SpinBoxDistance->SetValue(0.5);
+
+ myActor = 0;
+ myIsSelectPlane = false;
+ onSelectionChanged();
+
+ // signals and slots connections :
+ connect( ComboBoxPlanes, SIGNAL( activated( int )), this, SLOT( onSelectPlane( int ) ) );
+ connect( buttonNew, SIGNAL( clicked() ), this, SLOT( ClickOnNew() ) );
+ connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( ClickOnDelete() ) );
+ connect( ComboBoxOrientation, SIGNAL( activated( int )), this, SLOT( onSelectOrientation( int ) ) );
+ connect( SpinBoxDistance, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
+ connect( SpinBoxRot1, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
+ connect( SpinBoxRot2, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
+ connect( PreviewCheckBox, SIGNAL( toggled( bool )), this, SLOT( OnPreviewToggle( bool ) ) );
+ connect( AutoApplyCheckBox, SIGNAL( toggled( bool )), this, SLOT( ClickOnApply() ) );
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+ /* to close dialog if study frame change */
+ connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalStudyFrameChanged() ), this, SLOT( ClickOnCancel() ) ) ;
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show();
+}
+
+
+//=================================================================================
+// function : ~SMESHGUI_ClippingDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+ //cout<<"SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg\n";
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
+ SMESH::GetCurrentVtkView()->Repaint();
+}
+
+
+//=======================================================================
+// function : ClickOnApply()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::ClickOnApply()
+{
+ if (!myActor)
+ return;
+
+ if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ QAD_WaitCursor wc;
+
+ vtkImplicitBoolean* aBoolean = myActor->GetPlaneContainer();
+ vtkImplicitFunctionCollection* aCollection = aBoolean->GetFunction();
+ aCollection->RemoveAllItems();
+ aBoolean->Modified(); // VTK bug
+ aCollection->InitTraversal();
+
+ SMESH::TPlanes::iterator anIter = myPlanes.begin();
+ for (;anIter != myPlanes.end();anIter++){
+ OrientedPlane* anOrientedPlane = OrientedPlane::New();
+ anOrientedPlane->ShallowCopy(anIter->GetPointer());
+ aCollection->AddItem(anOrientedPlane);
+ anOrientedPlane->Delete();
+ }
+
+ myActor->SetVisibility(myActor->GetVisibility());
+
+ SMESH::GetCurrentVtkView()->Repaint();
+ }
+}
+
+
+//=======================================================================
+// function : ClickOnOk()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::ClickOnOk()
+{
+ ClickOnApply() ;
+ ClickOnCancel() ;
+}
+
+
+//=======================================================================
+// function : ClickOnCancel()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::ClickOnCancel()
+{
+ close();
+}
+
+
+//=================================================================================
+// function : onSelectionChanged()
+// purpose : Called when selection is changed
+//=================================================================================
+void SMESHGUI_ClippingDlg::onSelectionChanged()
+{
+ if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ if ( mySelection->IObjectCount() ) {
+ Handle(SALOME_InteractiveObject) IOS = mySelection->firstIObject();
+ myActor = SMESH::FindActorByEntry(IOS->getEntry());
+ if ( myActor ){
+ vtkImplicitBoolean* aBoolean = myActor->GetPlaneContainer();
+ vtkImplicitFunctionCollection* aCollection = aBoolean->GetFunction();
+ aCollection->InitTraversal();
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
+ myPlanes.clear();
+ while(vtkImplicitFunction* aFunction = aCollection->GetNextItem()){
+ if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){
+ OrientedPlane* anOrientedPlane = OrientedPlane::New(SMESH::GetActiveStudy());
+ SMESH::TVTKPlane aTVTKPlane(anOrientedPlane);
+ anOrientedPlane->Delete();
+ aTVTKPlane->ShallowCopy(aPlane);
+ myPlanes.push_back(aTVTKPlane);
+ }
+ }
+ std::for_each(myPlanes.begin(),myPlanes.end(),
+ TSetVisiblity(PreviewCheckBox->isChecked()));
+ }
+ }
+ }
+ Sinchronize();
+ SMESH::GetCurrentVtkView()->Repaint();
+}
+
+
+//=======================================================================
+// function : onSelectPlane()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
+{
+ if (!myActor || myPlanes.empty())
+ return;
+
+ OrientedPlane* aPlane = myPlanes[theIndex].GetPointer();
+
+ // Orientation
+ SMESH::Orientation anOrientation = aPlane->GetOrientation();
+
+ // Distance and Rotations
+ float aDistance;
+ double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
+
+ // Set plane parameters in the dialog
+ myIsSelectPlane = true;
+ setDistance(aPlane->GetDistance());
+ setRotation(aRot[0], aRot[1]);
+ switch (anOrientation) {
+ case SMESH::XY:
+ ComboBoxOrientation->setCurrentItem(0);
+ onSelectOrientation(0);
+ break;
+ case SMESH::YZ:
+ ComboBoxOrientation->setCurrentItem(1);
+ onSelectOrientation(1);
+ break;
+ case SMESH::ZX:
+ ComboBoxOrientation->setCurrentItem(2);
+ onSelectOrientation(2);
+ break;
+ }
+ myIsSelectPlane = false;
+}
+
+
+//=======================================================================
+// function : ClickOnNew()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::ClickOnNew()
+{
+ if (!myActor)
+ return;
+
+ OrientedPlane* aPlane = OrientedPlane::New(SMESH::GetActiveStudy());
+ SMESH::TVTKPlane aTVTKPlane(aPlane);
+ myPlanes.push_back(aTVTKPlane);
+
+ if(PreviewCheckBox->isChecked())
+ aTVTKPlane->myActor->VisibilityOn();
+
+ Sinchronize();
+ SetCurrentPlaneParam();
+}
+
+
+//=======================================================================
+// function : ClickOnDelete()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::ClickOnDelete()
+{
+ if (!myActor || myPlanes.empty())
+ return;
+
+ int aPlaneIndex = ComboBoxPlanes->currentItem();
+
+ SMESH::TPlanes::iterator anIter = myPlanes.begin() + aPlaneIndex;
+ anIter->GetPointer()->myActor->SetVisibility(false);
+ myPlanes.erase(anIter);
+
+ if(AutoApplyCheckBox->isChecked())
+ ClickOnApply();
+
+ Sinchronize();
+ SMESH::GetCurrentVtkView()->Repaint();
+}
+
+
+//=======================================================================
+// function : onSelectOrientation()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::onSelectOrientation(int theItem)
+{
+ if (myPlanes.empty())
+ return;
+
+ if (theItem == 0) {
+ TextLabelRot1->setText( tr( "Rotation around X (Y to Z):") );
+ TextLabelRot2->setText( tr( "Rotation around Y (X to Z):" ) );
+ }
+ else if (theItem == 1) {
+ TextLabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
+ TextLabelRot2->setText( tr( "Rotation around Z (Y to X):" ) );
+ }
+ else if (theItem == 2) {
+ TextLabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
+ TextLabelRot2->setText( tr( "Rotation around X (Z to Y):" ) );
+ }
+
+ if((QComboBox*)sender() == ComboBoxOrientation)
+ SetCurrentPlaneParam();
+}
+
+
+//=======================================================================
+// function : Sinchronize()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::Sinchronize()
+{
+ int aNbPlanes = myPlanes.size();
+ ComboBoxPlanes->clear();
+
+ QString aName;
+ for(int i = 1; i<=aNbPlanes ; i++){
+ aName = QString(tr("Plane# %1")).arg(i);
+ ComboBoxPlanes->insertItem(aName);
+ }
+
+ int aPos = ComboBoxPlanes->count() - 1;
+ ComboBoxPlanes->setCurrentItem(aPos);
+
+ bool anIsControlsEnable = (aPos >= 0);
+ if(anIsControlsEnable){
+ onSelectPlane(aPos);
+ }else{
+ ComboBoxPlanes->insertItem( tr("No planes") );
+ SpinBoxRot1->SetValue(0.0);
+ SpinBoxRot2->SetValue(0.0);
+ SpinBoxDistance->SetValue(0.5);
+ }
+
+ buttonDelete->setEnabled(anIsControlsEnable);
+ buttonApply->setEnabled(anIsControlsEnable);
+ PreviewCheckBox->setEnabled(anIsControlsEnable);
+ AutoApplyCheckBox->setEnabled(anIsControlsEnable);
+ ComboBoxOrientation->setEnabled(anIsControlsEnable);
+ SpinBoxDistance->setEnabled(anIsControlsEnable);
+ SpinBoxRot1->setEnabled(anIsControlsEnable);
+ SpinBoxRot2->setEnabled(anIsControlsEnable);
+}
+
+
+//=======================================================================
+// function : setRotation()
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::setRotation( const double theRot1, const double theRot2 )
+{
+ SpinBoxRot1->SetValue(theRot1);
+ SpinBoxRot2->SetValue(theRot2);
+}
+
+
+//=======================================================================
+// function : SetCurrentPlaneParam
+// purpose :
+//=======================================================================
+void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
+{
+ if(myPlanes.empty() || myIsSelectPlane)
+ return;
+
+ int aCurPlaneIndex = ComboBoxPlanes->currentItem();
+
+ OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer();
+
+ float aNormal[3];
+ SMESH::Orientation anOrientation;
+ float aDir[3][3] = {{0, 0, 0}, {0, 0, 0}};
+ {
+ static double aCoeff = vtkMath::Pi()/180.0;
+
+ float aRot[2] = {getRotation1(), getRotation2()};
+ aPlane->myAngle[0] = aRot[0];
+ aPlane->myAngle[1] = aRot[1];
+
+ float anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])};
+ float aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])};
+ aV[0] = aRot[0] > 0? aV[0]: -aV[0];
+ aV[1] = aRot[1] > 0? aV[1]: -aV[1];
+
+ switch (ComboBoxOrientation->currentItem()) {
+ case 0:
+ anOrientation = SMESH::XY;
+
+ aDir[0][1] = anU[0];
+ aDir[0][2] = aV[0];
+
+ aDir[1][0] = anU[1];
+ aDir[1][2] = aV[1];
+
+ break;
+ case 1:
+ anOrientation = SMESH::YZ;
+
+ aDir[0][2] = anU[0];
+ aDir[0][0] = aV[0];
+
+ aDir[1][1] = anU[1];
+ aDir[1][0] = aV[1];
+
+ break;
+ case 2:
+ anOrientation = SMESH::ZX;
+
+ aDir[0][0] = anU[0];
+ aDir[0][1] = aV[0];
+
+ aDir[1][2] = anU[1];
+ aDir[1][1] = aV[1];
+
+ break;
+ }
+
+ vtkMath::Cross(aDir[1],aDir[0],aNormal);
+ vtkMath::Normalize(aNormal);
+ vtkMath::Cross(aNormal,aDir[1],aDir[0]);
+ }
+
+ aPlane->SetOrientation(anOrientation);
+ aPlane->SetDistance(getDistance());
+
+ myActor->SetPlaneParam(aNormal, getDistance(), aPlane);
+
+ float* anOrig = aPlane->GetOrigin();
+ vtkDataSet* aDataSet = myActor->GetInput();
+ float *aPnt = aDataSet->GetCenter();
+
+ float* anOrigin = aPlane->GetOrigin();
+ float aDel = aDataSet->GetLength()/2.0;
+
+ float aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
+ {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
+ float aParam, aPnt0[3], aPnt1[3], aPnt2[3];
+
+ float aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
+ aPnt[1] - aDelta[0][1] - aDelta[1][1],
+ aPnt[2] - aDelta[0][2] - aDelta[1][2]};
+ float aPnt02[3] = {aPnt01[0] + aNormal[0],
+ aPnt01[1] + aNormal[1],
+ aPnt01[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
+
+ float aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
+ aPnt[1] - aDelta[0][1] + aDelta[1][1],
+ aPnt[2] - aDelta[0][2] + aDelta[1][2]};
+ float aPnt12[3] = {aPnt11[0] + aNormal[0],
+ aPnt11[1] + aNormal[1],
+ aPnt11[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
+
+ float aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
+ aPnt[1] + aDelta[0][1] - aDelta[1][1],
+ aPnt[2] + aDelta[0][2] - aDelta[1][2]};
+ float aPnt22[3] = {aPnt21[0] + aNormal[0],
+ aPnt21[1] + aNormal[1],
+ aPnt21[2] + aNormal[2]};
+ vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
+
+ vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
+ aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
+ aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
+ aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
+ aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
+
+ if(AutoApplyCheckBox->isChecked())
+ ClickOnApply();
+
+ SMESH::GetCurrentVtkView()->Repaint();
+}
+
+
+void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
+ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
+ SMESH::GetCurrentVtkView()->Repaint();
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_TransparencyDlg.h
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#ifndef DIALOGBOX_CLIPPING_H
+#define DIALOGBOX_CLIPPING_H
+
+#include <SMESHGUI_SpinBox.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkPlane.h>
+
+#include <vector>
+
+// QT Includes
+#include <qdialog.h>
+#include <qtable.h>
+
+class QLabel;
+class QPushButton;
+class QTable;
+class QCheckBox;
+class QComboBox;
+class SALOME_Selection;
+class SMESH_Actor;
+
+class OrientedPlane;
+
+
+namespace SMESH{
+
+ typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
+ typedef std::vector<TVTKPlane> TPlanes;
+ enum Orientation {XY, YZ, ZX};
+
+};
+
+
+//=================================================================================
+// class : SMESHGUI_ClippingDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_ClippingDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_ClippingDlg( QWidget* parent = 0,
+ const char* name = 0,
+ bool modal = false,
+ WFlags fl = 0 );
+
+ float getDistance() {return (float)SpinBoxDistance->GetValue();}
+ void setDistance( const float theDistance) {SpinBoxDistance->SetValue(theDistance);}
+ double getRotation1() {return SpinBoxRot1->GetValue();}
+ double getRotation2() {return SpinBoxRot2->GetValue();}
+ void setRotation( const double theRot1, const double theRot2 );
+ void Sinchronize();
+
+ ~SMESHGUI_ClippingDlg();
+
+private:
+
+ SALOME_Selection* mySelection;
+ SMESH_Actor* myActor;
+ SMESH::TPlanes myPlanes;
+
+ QComboBox* ComboBoxPlanes;
+ QPushButton* buttonNew;
+ QPushButton* buttonDelete;
+ QLabel* TextLabelOrientation;
+ QComboBox* ComboBoxOrientation;
+ QLabel* TextLabelDistance;
+ SMESHGUI_SpinBox* SpinBoxDistance;
+ QLabel* TextLabelRot1;
+ SMESHGUI_SpinBox* SpinBoxRot1;
+ QLabel* TextLabelRot2;
+ SMESHGUI_SpinBox* SpinBoxRot2;
+ QCheckBox* PreviewCheckBox;
+ QCheckBox* AutoApplyCheckBox;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+
+ bool myIsSelectPlane;
+
+public slots:
+
+ void onSelectPlane(int theIndex);
+ void ClickOnNew();
+ void ClickOnDelete();
+ void onSelectOrientation(int theItem);
+ void SetCurrentPlaneParam();
+ void onSelectionChanged();
+ void OnPreviewToggle(bool theIsToggled);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+};
+
+#endif // DIALOGBOX_TRANSPARENCYDLG_H
+
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_ComputeScalarValue.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_ComputeScalarValue.h"
-#include "utilities.h"
-#include <math.h>
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-static double ComputeLength(float* p1, float* p2) {
- float a1,a2,a3,b1,b2,b3;
- a1 = p1[0];
- a2 = p1[1];
- a3 = p1[2];
- b1 = p2[0];
- b2 = p2[1];
- b3 = p2[2];
- // MESSAGE( a1 << " "<< a2 << " "<< a3 << " " << b1 << " "<< b2 << " "<< b3 );
- float X1,Y1,Z1,X2,Z2,Y2;
- X1 = b1 - a1;
- Y1 = b2 - a2;
- Z1 = b3 - a3;
- // MESSAGE( X1 << " "<< Y1 << " "<< Z1 );
- float e1;
- e1 = sqrt( X1*X1 + Y1*Y1 + Z1*Z1 ) ;
- // MESSAGE( "Length = " << e1 );
- return e1;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::LengthEdges(vtkCell* theCell) {
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points != 2 ) return 0;
- float* pnt1 = points->GetPoint(0);
- float* pnt2 = points->GetPoint(1);
- return ComputeLength(pnt1,pnt2);
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-static double ComputeAreaOfTriangle(float* p1, float* p2, float* p3) {
- double a1,a2,a3,b1,b2,b3,c1,c2,c3;
- a1 = p1[0];
- a2 = p1[1];
- a3 = p1[2];
- b1 = p2[0];
- b2 = p2[1];
- b3 = p2[2];
- c1 = p3[0];
- c2 = p3[1];
- c3 = p3[2];
-
- float e1, e2, e3;
- e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ;
- e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ;
- e3 = sqrt( (c1-a1)*(c1-a1) + (c2-a2)*(c2-a2) + (c3-a3)*(c3-a3) ) ;
-
- // MESSAGE( "e = " << e1 << " " << e2 <<" " << e3 );
- float s = (e1+e2+e3)/2;
- double area = sqrt(s*(s-e1)*(s-e2)*(s-e3));
- // MESSAGE( "area = " << area );
- return area;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::AreaElements(vtkCell* theCell){
- // MESSAGE ( " SMESHGUI_ComputeScalarValue::AreaElements " )
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- // MESSAGE( "num_points = "<< num_points );
- for (int j = 0; j < theCell->GetNumberOfPoints (); j++) {
- float* pnt = points->GetPoint(j);
- // MESSAGE( pnt[0] << " " << pnt[1] << " " << pnt[2] );
- }
- if (num_points < 3 ) return 0;
- if (num_points == 3) {
- float* p1 = points->GetPoint(0);
- float* p2 = points->GetPoint(1);
- float* p3 = points->GetPoint(2);
- double area = ComputeAreaOfTriangle(p1,p2,p3);
- return area;
- } else if (num_points == 4) {
- float* p1 = points->GetPoint(0);
- float* p2 = points->GetPoint(1);
- float* p3 = points->GetPoint(2);
- float* p4 = points->GetPoint(3);
- double area1 = ComputeAreaOfTriangle(p1,p2,p3);
- double area2 = ComputeAreaOfTriangle(p3,p4,p1);
- return area1+area2;
- }
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::Taper(vtkCell* theCell){
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points != 4 ) return 0;
- float* p1 = points->GetPoint(0);
- float* p2 = points->GetPoint(1);
- float* p3 = points->GetPoint(2);
- float* p4 = points->GetPoint(3);
- double A1 = ComputeAreaOfTriangle(p4,p1,p2);
- double A2 = ComputeAreaOfTriangle(p3,p1,p2);
- double A3 = ComputeAreaOfTriangle(p2,p3,p4);
- double A4 = ComputeAreaOfTriangle(p3,p4,p1);
- double JA = 0.25 * (A1 + A2 + A3 + A4);
- double taper = fabs(A1/(JA-1));
- if (fabs(A2/(JA-1)) > taper) taper = fabs(A2/(JA-1));
- if (fabs(A3/(JA-1)) > taper) taper = fabs(A3/(JA-1));
- if (fabs(A4/(JA-1)) > taper) taper = fabs(A4/(JA-1));
- // MESSAGE( "Taper = " << taper);
- return taper;
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::AspectRatio(vtkCell* theCell) {
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points < 3 ) return 0;
- if (num_points == 3) {
- float a1,a2,a3,b1,b2,b3,c1,c2,c3;
- float* pnt = points->GetPoint(0);
- a1 = pnt[0];
- a2 = pnt[1];
- a3 = pnt[2];
- pnt = points->GetPoint(1);
- b1 = pnt[0];
- b2 = pnt[1];
- b3 = pnt[2];
- pnt = points->GetPoint(2);
- c1 = pnt[0];
- c2 = pnt[1];
- c3 = pnt[2];
-
- float e1, e2, e3;
- e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ;
- e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ;
- e3 = sqrt( (c1-a1)*(c1-a1) + (c2-a2)*(c2-a2) + (c3-a3)*(c3-a3) ) ;
-
- float amax,p,s;
-
- amax=e1;
- if (e2>amax) amax=e2;
- if (e3>amax) amax=e3;
-
- p=(e1+e2+e3)/2;
- s=AreaElements(theCell);
-
- double aspectRatio=amax*p*sqrt(double(3))/(s*6);
- // MESSAGE( "aspectRatio = " << aspectRatio );
- return(aspectRatio);
- }
- else if (num_points == 4) {
- float a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3;
- float* pnt = points->GetPoint(0);
- a1 = pnt[0];
- a2 = pnt[1];
- a3 = pnt[2];
- pnt = points->GetPoint(1);
- b1 = pnt[0];
- b2 = pnt[1];
- b3 = pnt[2];
- pnt = points->GetPoint(2);
- c1 = pnt[0];
- c2 = pnt[1];
- c3 = pnt[2];
- pnt = points->GetPoint(3);
- d1 = pnt[0];
- d2 = pnt[1];
- d3 = pnt[2];
-
- float e1, e2, e3, e4;
- float len_min, len_max;
- e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ;
- e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ;
- e3 = sqrt( (c1-d1)*(c1-d1) + (c2-d2)*(c2-d2) + (c3-d3)*(c3-d3) ) ;
- e4 = sqrt( (d1-a1)*(d1-a1) + (d2-a2)*(d2-a2) + (d3-a3)*(d3-a3) ) ;
-
- len_min = e1; len_max = e1;
-
- if (e2 >len_max ) len_max = e2;
- if (e3 >len_max ) len_max = e3;
- if (e4 >len_max ) len_max = e4;
- if (e2 <len_min ) len_min = e2;
- if (e3 <len_min ) len_min = e3;
- if (e4 <len_min ) len_min = e4;
-
- return (len_max/len_min);
- }
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-static double ComputeAngle(float* p1, float* p2, float* p3) {
- const double pi=4*atan(double(1));
- float a1,a2,a3,b1,b2,b3,c1,c2,c3;
- a1 = p1[0];
- a2 = p1[1];
- a3 = p1[2];
- b1 = p2[0];
- b2 = p2[1];
- b3 = p2[2];
- c1 = p3[0];
- c2 = p3[1];
- c3 = p3[2];
- float X1,Y1,Z1,X2,Z2,Y2;
- X1 = b1 - a1;
- X2 = c1 - b1;
- Y1 = b2 - a2;
- Y2 = c2 - b2;
- Z1 = b3 - a3;
- Z2 = c3 - b3;
-
-
- float e1, e2, e3;
- e1 = sqrt( X1*X1 + Y1*Y1 + Z1*Z1 ) ;
- e2 = sqrt( X2*X2 + Y2*Y2 + Z2*Z2 ) ;
- double dot=(X1*(X2)+Y1*(Y2)+Z1*(Z2));
- // MESSAGE( pi );
- // MESSAGE( dot/(e1*e2) );
- double cosinus = dot/(e1*e2);
- cosinus = fabs(cosinus);
- return 180*acos (cosinus)/pi;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::MinimumAngle(vtkCell* theCell) {
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points < 3 ) return 0;
- float* pnt1 = points->GetPoint(0);
- float* pnt2 = points->GetPoint(1);
- float* pnt3 = points->GetPoint(2);
- if (num_points == 3) {
- double a1,a2,a3,amin;
- a1=fabs(ComputeAngle(pnt1,pnt2,pnt3));
- amin=a1;
- a2=fabs(ComputeAngle(pnt2,pnt3,pnt1));
- if (a2<amin) amin=a2;
- a3=fabs(ComputeAngle(pnt3,pnt1,pnt2));
- if (a3<amin) amin=a3;
- // MESSAGE( "Minimal angle " << amin );
- return amin;
- }
- else if (num_points == 4) {
- float* pnt4 = points->GetPoint(3);
- double a1,a2,a3,a4,amin;
- a1=fabs(ComputeAngle(pnt1,pnt2,pnt3));
- amin=a1;
- a2=fabs(ComputeAngle(pnt2,pnt3,pnt4));
- if (a2<amin) amin=a2;
- a3=fabs(ComputeAngle(pnt3,pnt4,pnt1));
- if (a3<amin) amin=a3;
- a4=fabs(ComputeAngle(pnt4,pnt1,pnt2));
- if (a4<amin) amin=a4;
-
- // MESSAGE( "Minimal angle " << amin );
- return amin;
- }
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::Skew(vtkCell* theCell) {
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points < 3 ) return 0;
- //triangle case
- if (num_points == 3) {
- float* pnt1 = points->GetPoint(0);
- float* pnt2 = points->GetPoint(1);
- float* pnt3 = points->GetPoint(2);
- double a1,a2,a3,amax;
- a1=fabs(60 - fabs(ComputeAngle(pnt1,pnt2,pnt3)));
- amax=a1;
- a2=fabs(60 - fabs(ComputeAngle(pnt2,pnt3,pnt1)));
- if (a2>amax) amax=a2;
- a3=fabs(60 - fabs(ComputeAngle(pnt3,pnt1,pnt2)));
- if (a3>amax) amax=a3;
- // MESSAGE( "Skew = " << amax );
- return amax;
- }
- //quadrangle case
- else if (num_points == 4) {
- float* pnt1 = points->GetPoint(0);
- float* pnt2 = points->GetPoint(1);
- float* pnt3 = points->GetPoint(2);
- float* pnt4 = points->GetPoint(3);
-
- double a1,a2,a3,a4,amax;
- a1=fabs(90 - fabs(ComputeAngle(pnt1,pnt2,pnt3)));
- amax=a1;
- a2=fabs(90 - fabs(ComputeAngle(pnt2,pnt3,pnt4)));
- if (a2>amax) amax=a2;
- a3=fabs(90 - fabs(ComputeAngle(pnt3,pnt4,pnt1)));
- if (a3>amax) amax=a3;
- a4=fabs(90 - fabs(ComputeAngle(pnt4,pnt1,pnt2)));
- if (a4>amax) amax=a4;
- // MESSAGE( "Skew = " << amax );
- return amax;
- }
-};
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-static double ComputeA(float* p1, float* p2, float* p3, float* G) {
- double e1 = sqrt(pow(p2[0]-p1[0], 2)+pow(p2[1]-p1[1], 2)+pow(p2[2]-p1[2], 2));
- double e2 = sqrt(pow(p3[0]-p2[0], 2)+pow(p3[1]-p2[1], 2)+pow(p3[2]-p2[2], 2));
- double l;
- if (e1 < e2) l = 0.5*e1;
- else l = 0.5*e2;
- float GI[3], GJ[3], N[3];;
- GI[0] = (p2[0]-p1[0])/2-G[0];
- GI[1] = (p2[1]-p1[1])/2-G[1];
- GI[2] = (p2[2]-p1[2])/2-G[2];
-
- GJ[0] = (p3[0]-p2[0])/2-G[0];
- GJ[1] = (p3[1]-p2[1])/2-G[1];
- GJ[2] = (p3[2]-p2[2])/2-G[2];
-
- N[0] = GI[1]*GJ[2] - GI[2]*GJ[1];
- N[1] = GI[2]*GJ[0] - GI[0]*GJ[2];
- N[2] = GI[0]*GJ[1] - GI[1]*GJ[0];
-
- double H;
- float T[3];
- T[0] = (p1[0]-G[0])*N[0];
- T[1] = (p1[1]-G[1])*N[1];
- T[2] = (p1[2]-G[2])*N[2];
-
- H = sqrt(pow(T[0],2)+pow(T[1],2)+pow(T[2],2))/sqrt(pow(N[0],2)+pow(N[1],2)+pow(N[2],2));
- double A = H/l;
- return A;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-double SMESHGUI_ComputeScalarValue::Warp(vtkCell* theCell) {
- int num_points = theCell->GetNumberOfPoints ();
- vtkPoints* points = theCell->GetPoints();
- if (num_points != 4 ) return 0;
- float* p1 = points->GetPoint(0);
- float* p2 = points->GetPoint(1);
- float* p3 = points->GetPoint(2);
- float* p4 = points->GetPoint(3);
- double G1, G2, G3;
- float G[3];
- G[0] = (p1[0]+p2[0]+p3[0]+p4[0])/4;
- G[1] = (p1[1]+p2[1]+p3[1]+p4[1])/4;
- G[2] = (p1[2]+p2[2]+p3[2]+p4[2])/4;
- double amax = ComputeA(p1, p2, p3, G);
- double nextA = ComputeA(p2, p3, p4, G);
- if (nextA > amax) amax = nextA;
- nextA = ComputeA(p3, p4, p1, G);
- if (nextA > amax) amax = nextA;
- nextA = ComputeA(p4, p1, p2, G);
- if (nextA > amax) amax = nextA;
- // MESSAGE( "Warp = " << amax );
- return amax;
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_ComputeScalarValue.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef SMESHGUI_CONTROLALGORITHMS_H
-#define SMESHGUI_CONTROLALGORITHMS_H
-
-#include "VTKViewer_Common.h"
-
-class SMESHGUI_ComputeScalarValue {
- public:
- static double LengthEdges(vtkCell* theCell);
- static double AreaElements(vtkCell* theCell);
- static double Taper(vtkCell* theCell);
- static double AspectRatio(vtkCell* theCell);
- static double MinimumAngle(vtkCell* theCell);
- static double Skew(vtkCell* theCell);
- static double Warp(vtkCell* theCell);
-};
-
-#endif
// Module : SMESH
// $Header$
-using namespace std;
-#include "SMESHGUI_CreateHypothesesDlg.h"
-#include "SMESHGUI.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlistview.h>
#include <qheader.h>
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SMESHGUI_CreateHypothesesDlg.h"
+#include "SMESHGUI_HypothesesUtils.h"
+#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI.h"
+
+#include "utilities.h"
+
+using namespace std;
+
//=================================================================================
// class : SMESHGUI_CreateHypothesesDlg()
// purpose : Constructs a SMESHGUI_CreateHypothesesDlg which is a child of 'parent', with the
//=================================================================================
void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
QListViewItem* item = ListAlgoDefinition->selectedItem();
if ( !item )
return;
MESSAGE("Apply " << aHypType);
char* sHypType = (char*)aHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+ HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
if ( !aHypData )
return;
QString aClientLibName = aHypData->ClientLibName;
{
// Call hypothesis creation server method (without GUI)
QString aHypName = aHypData->Label;
- mySMESHGUI->CreateHypothesis(sHypType, aHypName, myIsAlgo);
+ SMESH::CreateHypothesis(sHypType, aHypName, myIsAlgo);
}
else
{
// Get hypotheses creator client (GUI)
SMESHGUI_GenericHypothesisCreator* aCreator =
- mySMESHGUI->GetHypothesisCreator(sHypType);
+ SMESH::GetHypothesisCreator(sHypType);
// Create hypothesis/algorithm
aCreator->CreateHypothesis(myIsAlgo, this);
void SMESHGUI_CreateHypothesesDlg::InitAlgoDefinition()
{
ListAlgoDefinition->clear();
- QStringList HypList = mySMESHGUI->GetAvailableHypotheses(myIsAlgo);
+ QStringList HypList = SMESH::GetAvailableHypotheses(myIsAlgo);
for ( int i = 0; i < HypList.count(); ++i ) {
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData( HypList[i] );
+ HypothesisData* aHypData = SMESH::GetHypothesisData( HypList[i] );
QListViewItem* parentItem = 0;
QListViewItem* childItem = ListAlgoDefinition->firstChild();
while ( childItem ) {
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include <map>
#include <string>
-using namespace std;
-
class QButtonGroup;
class QGroupBox;
class QPushButton;
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : SMESHGUI_CreatePatternDlg.cxx\r
+// Author : Sergey LITONIN\r
+// Module : SMESH\r
+\r
+#include "SMESHGUI_CreatePatternDlg.h"\r
+\r
+#include "QAD_Desktop.h"\r
+#include "QAD_FileDlg.h"\r
+\r
+#include "SMESHGUI_PatternWidget.h"\r
+#include "SMESHGUI_SpinBox.h"\r
+#include "SMESHGUI.h"\r
+#include "SALOME_Selection.h"\r
+#include "SALOME_ListIteratorOfListOfFilter.hxx"\r
+#include "SALOMEGUI_QtCatchCorbaException.hxx"\r
+#include "SMESH_NumberFilter.hxx"\r
+#include "SMESHGUI_Utils.h"\r
+#include "SMESHGUI_VTKUtils.h"\r
+#include "SMESHGUI_PatternUtils.h"\r
+\r
+#include <TColStd_MapOfInteger.hxx>\r
+\r
+#include <qframe.h>\r
+#include <qlayout.h>\r
+#include <qlineedit.h>\r
+#include <qpushbutton.h>\r
+#include <qgroupbox.h>\r
+#include <qlabel.h>\r
+#include <qradiobutton.h>\r
+#include <qcheckbox.h>\r
+#include <qbuttongroup.h>\r
+#include <qmessagebox.h>\r
+#include <qapplication.h>\r
+\r
+#define SPACING 5\r
+#define MARGIN 10\r
+\r
+/*\r
+ Class : SMESHGUI_CreatePatternDlg\r
+ Description : Dialog to specify filters for VTK viewer\r
+*/\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg\r
+// Purpose : Constructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( QWidget* theParent,\r
+ SALOME_Selection* theSelection,\r
+ const int theType,\r
+ const char* theName )\r
+: QDialog( theParent, theName, false,\r
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
+{\r
+ setCaption( tr( "CAPTION" ) );\r
+\r
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );\r
+\r
+ QFrame* aMainFrame = createMainFrame ( this );\r
+ QFrame* aBtnFrame = createButtonFrame( this );\r
+\r
+ aDlgLay->addWidget( aMainFrame );\r
+ aDlgLay->addWidget( aBtnFrame );\r
+\r
+ aDlgLay->setStretchFactor( aMainFrame, 1 );\r
+\r
+ Init( theSelection, theType );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::createMainFrame\r
+// Purpose : Create frame containing dialog's input fields\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createMainFrame( QWidget* theParent )\r
+{\r
+ QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );\r
+ QPixmap icon2d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );\r
+ QPixmap icon3d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );\r
+\r
+ QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );\r
+\r
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );\r
+ aMainGrp->setFrameStyle( QFrame::NoFrame );\r
+ aMainGrp->setInsideMargin( 0 );\r
+\r
+ // Pattern type group\r
+\r
+ myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );\r
+ mySwitch2d = new QRadioButton( myTypeGrp );\r
+ mySwitch3d = new QRadioButton( myTypeGrp );\r
+ mySwitch2d->setPixmap( icon2d );\r
+ mySwitch3d->setPixmap( icon3d );\r
+ myTypeGrp->insert( mySwitch2d, Type_2d );\r
+ myTypeGrp->insert( mySwitch3d, Type_3d );\r
+\r
+ QGroupBox* aPatternGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );\r
+\r
+ // Mesh and pattern name group\r
+ \r
+ QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, aPatternGrp );\r
+ aMeshGrp->setFrameStyle( QFrame::NoFrame );\r
+ aMeshGrp->setInsideMargin( 0 );\r
+ \r
+ new QLabel( tr( "MESH_OR_SUBMESH" ), aMeshGrp );\r
+\r
+ QPushButton* aSelBtn = new QPushButton( aMeshGrp );\r
+ aSelBtn->setPixmap( iconSlct );\r
+ myMeshEdit = new QLineEdit( aMeshGrp );\r
+ myMeshEdit->setReadOnly( true );\r
+\r
+ QGroupBox* aPattGrp = new QGroupBox( 1, Qt::Vertical, aPatternGrp );\r
+ aPattGrp->setFrameStyle( QFrame::NoFrame );\r
+ aPattGrp->setInsideMargin( 0 );\r
+ \r
+ new QLabel( tr( "PATTERN_NAME" ), aPattGrp );\r
+ myName = new QLineEdit( aPattGrp );\r
+\r
+ // Picture 2d\r
+ \r
+ myPicture2d = new SMESHGUI_PatternWidget( aPatternGrp ),\r
+ myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+\r
+ // Project check box\r
+ \r
+ myProjectChk = new QCheckBox( tr( "PROJECT" ), aPatternGrp );\r
+ \r
+ // Connect signals and slots\r
+\r
+ connect( myTypeGrp, SIGNAL( clicked( int ) ), SLOT( onTypeChanged( int ) ) );\r
+ connect( myProjectChk, SIGNAL( toggled( bool ) ), SLOT( onProject( bool ) ) );\r
+ connect( aSelBtn, SIGNAL( clicked() ), SLOT( onSelBtnClicked() ) );\r
+\r
+ return aMainGrp;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::createButtonFrame\r
+// Purpose : Create frame containing buttons\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent )\r
+{\r
+ QFrame* aFrame = new QFrame( theParent );\r
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
+\r
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );\r
+ mySaveBtn = new QPushButton( tr( "SAVE" ), aFrame );\r
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aFrame );\r
+\r
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
+\r
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );\r
+\r
+ aLay->addWidget( myOkBtn );\r
+ aLay->addWidget( mySaveBtn );\r
+ aLay->addItem( aSpacer);\r
+ aLay->addWidget( myCloseBtn );\r
+\r
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );\r
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;\r
+ connect( mySaveBtn, SIGNAL( clicked() ), SLOT( onSave() ) );\r
+\r
+ return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg\r
+// Purpose : Destructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()\r
+{\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onProject\r
+// Purpose : SLOT. Called when state of "Project nodes on ther face"\r
+// checkbox is changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onProject( bool )\r
+{\r
+ loadFromObject( false );\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::Init\r
+// Purpose : Init dialog fields, connect signals and slots, show dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::Init( SALOME_Selection* theSelection, const int theType )\r
+{\r
+ myIsLoaded = false;\r
+ myType = -1;\r
+ myNbPoints = -1;\r
+ mySelection = theSelection;\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ myPattern = SMESH::SMESH_Pattern::_nil();\r
+ \r
+ erasePreview();\r
+\r
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();\r
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );\r
+\r
+ // selection and SMESHGUI\r
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );\r
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );\r
+\r
+ mySwitch2d->setEnabled( theType == Type_2d );\r
+ mySwitch3d->setEnabled( theType == Type_3d );\r
+\r
+ if ( theType == Type_2d )\r
+ myProjectChk->show();\r
+ else\r
+ myProjectChk->hide();\r
+ \r
+ myTypeGrp->setButton( theType );\r
+ onTypeChanged( theType );\r
+ \r
+ myName->setText( getDefaultName() );\r
+ myMeshEdit->setText( "" );\r
+\r
+ setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );\r
+ qApp->processEvents();\r
+ updateGeometry();\r
+ myPicture2d->updateGeometry();\r
+ adjustSize();\r
+ resize( minimumSize() );\r
+\r
+ activateSelection();\r
+ onSelectionDone();\r
+\r
+ int x, y ;\r
+ aSMESHGUI->DefineDlgPosition( this, x, y );\r
+ this->move( x, y );\r
+ this->show();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::SetMesh\r
+// Purpose : Set mesh to dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::SetMesh( SMESH::SMESH_Mesh_ptr thePtr )\r
+{\r
+ myMesh = SMESH::SMESH_Mesh::_duplicate( thePtr );\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+\r
+ bool isValidMesh = false;\r
+ if ( !myMesh->_is_nil() )\r
+ {\r
+ SALOMEDS::SObject_var aSobj = SMESH::FindSObject( thePtr );\r
+ CORBA::String_var anEntry = aSobj->GetID();\r
+ Handle(SALOME_InteractiveObject) anIObj =\r
+ new SALOME_InteractiveObject( anEntry.in(), "SMESH" );\r
+\r
+ const SALOME_ListOfFilter& aList = mySelection->StoredFilters();\r
+ SALOME_ListIteratorOfListOfFilter anIter( aList );\r
+ for ( ; anIter.More(); anIter.Next() )\r
+ if ( !anIter.Value()->IsOk( anIObj ) )\r
+ break;\r
+\r
+ if ( !anIter.More() )\r
+ isValidMesh = true;\r
+ }\r
+\r
+\r
+ if ( isValidMesh )\r
+ {\r
+ SALOMEDS::SObject_var aSO = SMESH::FindSObject( myMesh.in() );\r
+ myMeshEdit->setText( aSO->GetName() );\r
+ myGeomObj = getGeom( aSO );\r
+ }\r
+ else\r
+ {\r
+ myMeshEdit->setText( "" );\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ }\r
+\r
+ if ( myType == Type_2d )\r
+ {\r
+ loadFromObject( false );\r
+ displayPreview();\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::isValid\r
+// Purpose : Verify validity of entry data\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::isValid()\r
+{\r
+ if ( myGeomObj->_is_nil() )\r
+ {\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );\r
+ return false;\r
+ }\r
+ else\r
+ return true;\r
+}\r
+\r
+\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::getDefaultName\r
+// Purpose : Get default pattern name\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::getDefaultName() const\r
+{\r
+ return myType == Type_2d ? tr( "DEFAULT_2D" ) : tr( "DEFAULT_3D" );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onSave\r
+// Purpose : SLOT called when "Save" button pressed. Build pattern and\r
+\r
+// save it to disk\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSave()\r
+{\r
+ try\r
+ {\r
+ if ( !isValid() )\r
+ return;\r
+\r
+ if ( !myIsLoaded )\r
+ loadFromObject( true );\r
+\r
+ // Load pattern from object\r
+ if ( !myIsLoaded )\r
+ return;\r
+\r
+ ///////////////////////////////////////////////////////\r
+ QAD_FileDlg* aDlg = new QAD_FileDlg( this, false );\r
+ aDlg->setCaption( tr( "SAVE_PATTERN" ) );\r
+ aDlg->setMode( QFileDialogP::AnyFile );\r
+ aDlg->setFilters( tr( "PATTERN_FILT" ) );\r
+ if ( myName->text() != "" )\r
+ aDlg->setSelection( myName->text() );\r
+\r
+ if ( aDlg->exec() != Accepted )\r
+ return;\r
+\r
+ QString fName = aDlg->selectedFile();\r
+ if ( fName.isEmpty() )\r
+ return;\r
+\r
+ if ( QFileInfo( fName ).extension().isEmpty() )\r
+ fName = autoExtension( fName );\r
+\r
+ fName = QDir::convertSeparators( fName );\r
+\r
+ QString aData( myPattern->GetString() );\r
+ long aLen = aData.length();\r
+\r
+ QFile aFile( fName );\r
+ aFile.open( IO_WriteOnly );\r
+ long aWritten = aFile.writeBlock( aData, aLen );\r
+ aFile.close();\r
+\r
+ if ( aWritten != aLen )\r
+ {\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_SAVING" ), QMessageBox::Ok );\r
+ }\r
+ else\r
+ {\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ disconnect( mySelection, 0, this, 0 );\r
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
+ SMESHGUI::GetSMESHGUI()->ResetState();\r
+ accept();\r
+ emit NewPattern();\r
+ }\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ }\r
+ catch( ... )\r
+ {\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::GetPatternName\r
+// Purpose : Get name of pattern\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::GetPatternName() const\r
+{\r
+ return myName->text();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::GetPattern\r
+// Purpose : Get result pattern\r
+//=======================================================================\r
+SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()\r
+{\r
+ return myPattern.in();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onOk\r
+// Purpose : SLOT called when "Ok" button pressed.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onOk()\r
+{\r
+ try\r
+ {\r
+ if ( !isValid() )\r
+ return;\r
+\r
+ if ( !myIsLoaded )\r
+ loadFromObject( true );\r
+\r
+ // Load pattern from object\r
+ if ( !myIsLoaded )\r
+ return;\r
+ else\r
+ {\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ disconnect( mySelection, 0, this, 0 );\r
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
+ SMESHGUI::GetSMESHGUI()->ResetState();\r
+ accept();\r
+ emit NewPattern();\r
+ }\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ }\r
+ catch( ... )\r
+ {\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onClose\r
+// Purpose : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onClose()\r
+{\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ disconnect( mySelection, 0, this, 0 );\r
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
+ SMESHGUI::GetSMESHGUI()->ResetState();\r
+ reject();\r
+ emit Close();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::loadFromObject\r
+// Purpose : Load pattern from geom object corresponding to the mesh/submesh\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::loadFromObject( const bool theMess )\r
+{\r
+ try\r
+ {\r
+ myIsLoaded = false;\r
+ \r
+ if ( myPattern->_is_nil() )\r
+ myPattern = SMESH::GetPattern();\r
+\r
+ if ( myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil() )\r
+ return false;\r
+\r
+ SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();\r
+\r
+ myIsLoaded = myType == Type_2d\r
+ ? myPattern->LoadFromFace( aMesh, myGeomObj, myProjectChk->isChecked() )\r
+ : myPattern->LoadFrom3DBlock( aMesh, myGeomObj );\r
+\r
+ if ( !myIsLoaded && theMess )\r
+ {\r
+ QString aMess;\r
+ SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();\r
+ \r
+ if ( aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr( "ERR_LOAD_EMPTY_SUBMESH" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr( "ERR_LOADF_NARROW_FACE" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr( "ERR_LOADF_CLOSED_FACE" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr( "ERR_LOADV_BAD_SHAPE" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS ) aMess = tr( "ERR_LOADV_COMPUTE_PARAMS" );\r
+ else aMess = tr( "ERROR_OF_CREATION" );\r
+\r
+ QMessageBox::information(\r
+ SMESHGUI::GetSMESHGUI()->GetDesktop(), tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );\r
+ }\r
+\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ }\r
+ \r
+ return myIsLoaded;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::getGeom\r
+// Purpose : Retrieve geom object from SObject\r
+//=======================================================================\r
+GEOM::GEOM_Object_ptr SMESHGUI_CreatePatternDlg::getGeom( SALOMEDS::SObject_ptr theSO )\r
+{\r
+ if ( theSO->_is_nil() )\r
+ return GEOM::GEOM_Object::_nil();\r
+\r
+ SALOMEDS::Study_var aStudy =\r
+ SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();\r
+\r
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSO );\r
+ for( ; anIter->More(); anIter->Next() )\r
+ {\r
+ SALOMEDS::SObject_var aSO = anIter->Value();\r
+ SALOMEDS::SObject_var aRefSO;\r
+\r
+ GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(\r
+ aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );\r
+\r
+ if ( !aMeshShape->_is_nil() )\r
+ return aMeshShape._retn();\r
+ }\r
+ return GEOM::GEOM_Object::_nil();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onSelectionDone\r
+// Purpose : SLOT called when selection changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelectionDone()\r
+{\r
+ try\r
+ {\r
+ if ( mySelection->IObjectCount() != 1 )\r
+ return;\r
+\r
+ // Get mesh or sub-mesh from selection\r
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );\r
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIO );\r
+ if ( aMesh->_is_nil() && aSubMesh->_is_nil() )\r
+ return;\r
+\r
+ // Get geom object corresponding to the mesh\r
+ SALOMEDS::SObject_var aSO;\r
+ if ( !aMesh->_is_nil() )\r
+ aSO = SMESH::FindSObject( aMesh.in() );\r
+ else\r
+ aSO = SMESH::FindSObject( aSubMesh.in() );\r
+\r
+\r
+ GEOM::GEOM_Object_var aGeomObj = getGeom( aSO );\r
+ if ( aGeomObj->_is_nil() )\r
+ return;\r
+\r
+ myGeomObj = aGeomObj;\r
+\r
+ // init class fields\r
+ if ( !aMesh->_is_nil() )\r
+ {\r
+ myMesh = aMesh;\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ }\r
+ else\r
+ {\r
+ mySubMesh = aSubMesh;\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ }\r
+\r
+ QString aName;\r
+ SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
+ myMeshEdit->setText( aName );\r
+\r
+ if ( myType == Type_2d )\r
+ {\r
+ loadFromObject( true );\r
+ displayPreview();\r
+ }\r
+ }\r
+ catch( ... )\r
+ {\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ erasePreview();\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onDeactivate\r
+// Purpose : SLOT called when dialog must be deativated\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onDeactivate()\r
+{\r
+ disconnect( mySelection, 0, this, 0 );\r
+ setEnabled( false );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::enterEvent\r
+// Purpose : Event filter\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* )\r
+{\r
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();\r
+ setEnabled( true );\r
+ activateSelection();\r
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : closeEvent()\r
+// purpose : Close dialog box\r
+//=================================================================================\r
+void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* e )\r
+{\r
+ onClose() ;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onSelBtnClicked\r
+// Purpose : SLOT. Called when -> button clicked.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelBtnClicked()\r
+{\r
+ onSelectionDone();\r
+}\r
+\r
+//================================================================\r
+// Function : SMESHGUI_CreatePatternDlg::autoExtension\r
+// Purpose : Append extension to the file name\r
+//================================================================\r
+QString SMESHGUI_CreatePatternDlg::autoExtension( const QString& theFileName ) const\r
+{\r
+ QString anExt = theFileName.section( '.', -1 );\r
+ return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::displayPreview\r
+// Purpose : Display preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::displayPreview()\r
+{\r
+\r
+ // Redisplay preview in dialog\r
+\r
+ try\r
+ {\r
+ if ( !myIsLoaded )\r
+ erasePreview();\r
+ else\r
+ {\r
+ SMESH::point_array_var pnts = myPattern->GetPoints();\r
+ SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
+ SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();\r
+\r
+ if ( pnts->length() == 0 ||\r
+ keyPoints->length() == 0 ||\r
+ elemPoints->length() == 0 )\r
+ {\r
+ myIsLoaded = false;\r
+ erasePreview();\r
+ return;\r
+ }\r
+\r
+ PointVector aPoints( pnts->length() );\r
+ QValueVector<int> aKeyPoints( keyPoints->length() );\r
+ ConnectivityVector anElemPoints( elemPoints->length() );\r
+\r
+ for ( int i = 0, n = pnts->length(); i < n; i++ )\r
+ aPoints[ i ] = pnts[ i ];\r
+\r
+ for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )\r
+ aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
+\r
+ for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )\r
+ {\r
+ QValueVector<int> aVec( elemPoints[ i3 ].length() );\r
+ for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )\r
+ aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
+\r
+ anElemPoints[ i3 ] = aVec;\r
+ }\r
+\r
+ myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );\r
+ }\r
+\r
+ return;\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ }\r
+ catch( ... )\r
+ {\r
+ }\r
+ erasePreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::erasePreview\r
+// Purpose : Erase preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::erasePreview()\r
+\r
+{\r
+ // Erase preview in 2D viewer\r
+ myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::activateSelection\r
+// Purpose : Activate selection in accordance with current pattern type\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::activateSelection()\r
+{\r
+ mySelection->ClearFilters();\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ \r
+ if ( myType == Type_2d )\r
+ {\r
+ mySelection->AddFilter(\r
+ new SMESH_NumberFilter( "SMESH", TopAbs_SHAPE, -1, TopAbs_FACE ) );\r
+ }\r
+ else\r
+ {\r
+ TColStd_MapOfInteger aTypes;\r
+ aTypes.Add( TopAbs_SHELL );\r
+ aTypes.Add( TopAbs_SOLID );\r
+ mySelection->AddFilter( new SMESH_NumberFilter(\r
+ "SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true ) );\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_CreatePatternDlg::onTypeChanged\r
+// Purpose : SLOT. Called when pattern type changed.\r
+// Change dialog's look and feel\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onTypeChanged( int theType )\r
+{\r
+ if ( myType == theType )\r
+ return;\r
+\r
+ myType = theType;\r
+\r
+ if ( theType == Type_2d )\r
+ myPicture2d->show();\r
+ else\r
+ myPicture2d->hide();\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : SMESHGUI_CreatePatternDlg.h\r
+// Author : Sergey LITONIN\r
+// Module : SMESH\r
+\r
+\r
+#ifndef SMESHGUI_CreatePatternDlg_H\r
+#define SMESHGUI_CreatePatternDlg_H\r
+\r
+#include <qdialog.h>\r
+\r
+// IDL Headers\r
+#include <SALOMEconfig.h>\r
+#include CORBA_SERVER_HEADER(GEOM_Gen)\r
+#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
+#include CORBA_SERVER_HEADER(SMESH_Pattern)\r
+\r
+class SMESHGUI_PatternWidget;\r
+class QCloseEvent;\r
+class QFrame;\r
+class QLineEdit;\r
+class SMESHGUI_SpinBox;\r
+class QPushButton;\r
+class SALOME_Selection;\r
+class QRadioButton;\r
+class QCheckBox;\r
+class QButtonGroup;\r
+class QLabel;\r
+\r
+/*\r
+ Class : SMESHGUI_CreatePatternDlg\r
+ Description : Dialog to specify filters for VTK viewer\r
+*/\r
+\r
+class SMESHGUI_CreatePatternDlg : public QDialog\r
+{\r
+ Q_OBJECT\r
+\r
+public:\r
+ \r
+ enum { Type_2d, Type_3d };\r
+\r
+public:\r
+ SMESHGUI_CreatePatternDlg( QWidget*,\r
+ SALOME_Selection*,\r
+ const int,\r
+ const char* = 0 );\r
+ virtual ~SMESHGUI_CreatePatternDlg();\r
+\r
+ void Init( SALOME_Selection*, const int );\r
+ QString GetPatternName() const;\r
+ SMESH::SMESH_Pattern_ptr GetPattern();\r
+ void SetMesh( SMESH::SMESH_Mesh_ptr );\r
+ \r
+signals:\r
+\r
+ void NewPattern();\r
+ void Close();\r
+ \r
+private:\r
+\r
+ void closeEvent( QCloseEvent* e ) ;\r
+ void enterEvent ( QEvent * ) ; \r
+ \r
+private slots:\r
+\r
+ void onOk();\r
+ void onSave();\r
+ void onClose();\r
+\r
+ void onDeactivate();\r
+\r
+ void onSelectionDone();\r
+ void onTypeChanged( int );\r
+ void onProject( bool );\r
+ void onSelBtnClicked();\r
+\r
+private:\r
+\r
+ QFrame* createButtonFrame( QWidget* );\r
+ QFrame* createMainFrame ( QWidget* );\r
+ void displayPreview();\r
+ void erasePreview();\r
+ void activateSelection();\r
+ QString autoExtension( const QString& theFileName ) const;\r
+ bool isValid();\r
+ bool loadFromObject( const bool = true );\r
+ QString getDefaultName() const;\r
+ GEOM::GEOM_Object_ptr getGeom( SALOMEDS::SObject_ptr );\r
+\r
+private:\r
+\r
+ QPushButton* myOkBtn;\r
+ QPushButton* mySaveBtn;\r
+ QPushButton* myCloseBtn;\r
+\r
+ QButtonGroup* myTypeGrp;\r
+ QRadioButton* mySwitch2d;\r
+ QRadioButton* mySwitch3d;\r
+ QRadioButton* mySwitchSMESH_Pattern3d;\r
+\r
+ QLineEdit* myMeshEdit;\r
+ QLineEdit* myName;\r
+\r
+ SMESHGUI_PatternWidget* myPicture2d;\r
+ \r
+ QCheckBox* myProjectChk;\r
+ \r
+ SALOME_Selection* mySelection;\r
+ int myNbPoints;\r
+ int myType;\r
+\r
+ SMESH::SMESH_Mesh_var myMesh;\r
+ SMESH::SMESH_subMesh_var mySubMesh;\r
+ GEOM::GEOM_Object_var myGeomObj;\r
+\r
+ SMESH::SMESH_Pattern_var myPattern;\r
+ bool myIsLoaded;\r
+};\r
+\r
+#endif\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_DeleteGroupDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_DeleteGroupDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESH_TypeFilter.hxx"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+
+#include "QAD_Desktop.h"
+#include "SALOME_Selection.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include <qframe.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qlist.h>
+#include <qmessagebox.h>
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+#define SPACING 5
+#define MARGIN 10
+
+/*
+ Class : SMESHGUI_DeleteGroupDlg
+ Description : Delete groups and their contents
+*/
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg( QWidget* theParent,
+ SALOME_Selection* theSelection )
+: QDialog( theParent, "SMESHGUI_DeleteGroupDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr( "CAPTION" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
+
+ Init( theSelection ) ;
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "SELECTED_GROUPS" ), theParent );
+
+ myListBox = new QListBox( aMainGrp );
+ myListBox->setMinimumHeight( 100 );
+ myListBox->setSelectionMode( QListBox::NoSelection );
+ myListBox->setRowMode( QListBox::FitToWidth );
+
+ return aMainGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+
+ aLay->addWidget( myOkBtn );
+ aLay->addWidget( myApplyBtn );
+ aLay->addItem( aSpacer);
+ aLay->addWidget( myCloseBtn );
+
+ // connect signals and slots
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::Init( SALOME_Selection* theSelection )
+{
+ myBlockSelection = false;
+ mySelection = theSelection;
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+
+ // selection and SMESHGUI
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( ClickOnClose() ) );
+
+ int x, y ;
+ aSMESHGUI->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+ this->show();
+
+ // set selection mode
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+ onSelectionDone();
+
+ return;
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::isValid
+// Purpose : Verify validity of input data
+//=======================================================================
+bool SMESHGUI_DeleteGroupDlg::isValid()
+{
+ if ( myListBox->count() == 0 )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "NO_SELECTED_GROUPS" ), QMessageBox::Ok );
+ return false;
+ }
+
+ return !SMESHGUI::GetSMESHGUI()->ActiveStudyLocked();
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::onApply
+// Purpose : SLOT called when "Apply" button pressed.
+//=======================================================================
+bool SMESHGUI_DeleteGroupDlg::onApply()
+{
+ if ( !isValid() )
+ return false;
+
+ myBlockSelection = true;
+
+ QValueList<SMESH::SMESH_Group_var>::iterator anIter;
+ for ( anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter )
+ {
+ SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh();
+ if ( !aMesh->_is_nil() )
+ aMesh->RemoveGroupWithContents( *anIter );
+ }
+
+ myListBox->clear();
+ myListGrp.clear();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
+
+ myBlockSelection = false;
+ return false;
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::onOk()
+{
+ if ( onApply() )
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::onClose()
+{
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState() ;
+ mySelection->ClearFilters();
+ reject();
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::onSelectionDone()
+{
+ if ( myBlockSelection )
+ return;
+
+ myListGrp.clear();
+ QStringList aNames;
+
+ const SALOME_ListIO& aListIO = mySelection->StoredIObjects();
+ SALOME_ListIteratorOfListIO anIter( aListIO );
+ for( ; anIter.More(); anIter.Next() )
+ {
+ SMESH::SMESH_Group_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_Group>( anIter.Value() );
+ if ( !aGroup->_is_nil() )
+ {
+ aNames.append( aGroup->GetName() );
+ myListGrp.append( aGroup );
+ }
+ }
+
+ myListBox->clear();
+ myListBox->insertStringList( aNames );
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::onDeactivate()
+{
+ mySelection->ClearFilters();
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_DeleteGroupDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_DeleteGroupDlg::enterEvent( QEvent* )
+{
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
+ setEnabled( true );
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_DeleteGroupDlg::closeEvent( QCloseEvent* )
+{
+ onClose() ;
+}
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_DeleteGroupDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_DELETEGROUPDLG_H
+#define SMESHGUI_DELETEGROUPDLG_H
+
+#include <qdialog.h>
+#include <qlist.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+class QCloseEvent;
+class QFrame;
+class QPushButton;
+class SALOME_Selection;
+class QListBox;
+
+/*
+ Class : SMESHGUI_DeleteGroupDlg
+ Description : Delete groups and their contents
+*/
+
+class SMESHGUI_DeleteGroupDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_DeleteGroupDlg( QWidget*, SALOME_Selection* );
+ virtual ~SMESHGUI_DeleteGroupDlg();
+
+ void Init( SALOME_Selection* ) ;
+
+private:
+
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+
+private slots:
+
+ void onOk();
+ bool onApply();
+ void onClose();
+
+ void onDeactivate();
+
+ void onSelectionDone();
+
+private:
+
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid();
+
+private:
+
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+ QListBox* myListBox;
+ SALOME_Selection* mySelection;
+
+ QValueList<SMESH::SMESH_Group_var> myListGrp;
+ bool myBlockSelection;
+
+};
+
+#endif
+
+
+
+
+
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_DiagonalInversionDlg.cxx
-// Author : Damien COQUERET
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_DiagonalInversionDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
-
-//=================================================================================
-// class : SMESHGUI_DiagonalInversionDlg()
-// purpose :
-//=================================================================================
-SMESHGUI_DiagonalInversionDlg::SMESHGUI_DiagonalInversionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MESH_DIAGONAL")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_DiagonalInversionDlg" );
- resize( 303, 185 );
- setCaption( tr( "SMESH_DIAGONAL_INVERSION_TITLE" ) );
- setSizeGripEnabled( TRUE );
- SMESHGUI_DiagonalInversionDlgLayout = new QGridLayout( this );
- SMESHGUI_DiagonalInversionDlgLayout->setSpacing( 6 );
- SMESHGUI_DiagonalInversionDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_DIAGONAL" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_DIAGONAL" ) );
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_DIAGONAL" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
- SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupC1, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
-}
-
-//=================================================================================
-// function : ~SMESHGUI_DiagonalInversionDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_DiagonalInversionDlg::~SMESHGUI_DiagonalInversionDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::Init( SALOME_Selection* Sel )
-{
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkElements = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-
- return ;
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::ConstructorsClicked(int constructorId)
-{
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkElements) {
- mySMESHGUI->DiagonalInversion( myMesh, myMapIndex ) ;
- mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::ClickOnCancel()
-{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- reject() ;
- return ;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- myOkElements = false;
- QString aString = "";
-
- if ( mySelection->SelectionMode() != EdgeSelection ) {
- return;
- }
-
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return;
-
- int nbElements = mySMESHGUI->GetNameOfSelectedEdges(mySelection, aString) ;
- if(nbElements < 1)
- return ;
- MESSAGE( "DCQ : nb. elements = " << nbElements )
-
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
-
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
- myOkElements = true ;
- myEditCurrentArgument->setText(aString) ;
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- return ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::enterEvent(QEvent* e)
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_DiagonalInversionDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
-}
-
-
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_DiagonalInversionDlg.h
-// Author : Damien COQUERET
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_DIAGONAL_INVERSION_H
-#define DIALOGBOX_DIAGONAL_INVERSION_H
-
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-//=================================================================================
-// class : SMESHGUI_DiagonalInversionDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_DiagonalInversionDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_DiagonalInversionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_DiagonalInversionDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkElements ; /* to check when arguments is defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_DiagonalInversionDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
-};
-
-#endif // DIALOGBOX_DIAGONAL_INVERSION_H
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_EditHypothesesDlg.h"
+
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_HypothesesUtils.h"
+
#include "SALOME_ListIteratorOfListIO.hxx"
#include "QAD_Application.h"
#include "QAD_WaitCursor.h"
#include "QAD_Operation.h"
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
#include "utilities.h"
// QT Includes
#include <qlayout.h>
#include <qpixmap.h>
+using namespace std;
+
//VRV: porting on Qt 3.0.5
#if QT_VERSION >= 0x030005
#include <qlistbox.h>
SelectButtonC1A1->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+ LineEditC1A1->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
SelectButtonC1A2->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
+ LineEditC1A2->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupC1, 0, 0 );
myGeomFilter = new SALOME_TypeFilter( "GEOM" );
myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = GEOM::GEOM_Object::_nil();
myMesh = SMESH::SMESH_Mesh::_nil();
mySubMesh = SMESH::SMESH_subMesh::_nil();
//=================================================================================
bool SMESHGUI_EditHypothesesDlg::ClickOnApply()
{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return false;
+
bool aRes = false;
QAD_WaitCursor wc;
else if ( !mySubMesh->_is_nil() )
aRes = StoreSubMesh();
- if ( aRes )
+ if ( true/*aRes*/ ) // abort desynchronizes contents of a Study and a mesh on server
+ {
// commit transaction
op->finish();
+ InitHypAssignation();
+ InitAlgoAssignation();
+ }
else
// abort transaction
op->abort();
+ UpdateControlState();
+
return aRes;
}
{
QString aString = "";
- int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
if ( myEditCurrentArgument == LineEditC1A1 ) {
if ( nbSel != 1 ) {
mySubMesh = SMESH::SMESH_subMesh::_nil();
aString = "";
} else {
- Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ;
- if( !testResult ) {
- myMesh = SMESH::SMESH_Mesh::_nil();
- mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IO, testResult) ;
- if( !testResult ) {
- mySubMesh = SMESH::SMESH_subMesh::_nil();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ if(myMesh->_is_nil()){
+ mySubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(mySubMesh->_is_nil()){
aString = "";
}
}
}
myEditCurrentArgument->setText( aString );
- myGeomShape = GEOM::GEOM_Shape::_nil(); // InitGeom() will try to retrieve a shape from myMesh or mySubMesh
+ myGeomShape = GEOM::GEOM_Object::_nil(); // InitGeom() will try to retrieve a shape from myMesh or mySubMesh
InitGeom();
myImportedMesh = myGeomShape->_is_nil();
InitHypAssignation();
InitAlgoAssignation();
- }
+ }
else if ( myEditCurrentArgument == LineEditC1A2 ) {
if ( nbSel != 1 )
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = GEOM::GEOM_Object::_nil();
else {
- Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult )
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
}
InitGeom();
}
QDialog::closeEvent( e );
}
+//=======================================================================
+//function : IsOld
+//purpose :
+//=======================================================================
+
+bool SMESHGUI_EditHypothesesDlg::IsOld(QListBoxItem* hypItem)
+{
+ if ( hypItem->rtti() == ListBoxIOR::RTTI_IOR ) {
+ ListBoxIOR* hyp = ( ListBoxIOR* ) hypItem;
+ return (myMapOldHypos.find( hyp->GetIOR() ) != myMapOldHypos.end() ||
+ myMapOldAlgos.find( hyp->GetIOR() ) != myMapOldAlgos.end() );
+ }
+
+ return false;
+}
//=================================================================================
// function : removeItem()
if (!item) return;
if ( aSender == ListHypAssignation ) {
+ myNbModification += IsOld( item ) ? 1 : -1;
ListHypAssignation->removeItem( ListHypAssignation->index( item ) );
}
else if ( aSender == ListAlgoAssignation ) {
+ myNbModification += IsOld( item ) ? 1 : -1;
ListAlgoAssignation->removeItem( ListAlgoAssignation->index( item ) );
}
+
UpdateControlState();
}
}
if ( !isFound )
ListBoxIOR* anItem = new ListBoxIOR( ListHypAssignation,
- strdup( i->GetIOR() ),
- strdup( i->text().latin1() ) );
+ CORBA::string_dup( i->GetIOR() ),
+ CORBA::string_dup( i->text().latin1() ) );
}
else if ( aSender == ListAlgoDefinition ) {
for ( int j = 0, n = ListAlgoAssignation->count(); !isFound && j < n; j++ ) {
}
if ( !isFound )
ListBoxIOR* anItem = new ListBoxIOR( ListAlgoAssignation,
- strdup( i->GetIOR() ),
- strdup( i->text().latin1() ) );
+ CORBA::string_dup( i->GetIOR() ),
+ CORBA::string_dup( i->text().latin1() ) );
}
+ if ( !isFound )
+ myNbModification += IsOld( item ) ? -1 : 1;
+
UpdateControlState();
}
{
ListHypDefinition->clear();
- SALOMEDS::SComponent_var father = mySMESHGUI->GetStudy()->FindComponent("MESH");
+ SALOMEDS::SComponent_var father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
if ( father->_is_nil() )
return;
int Tag_HypothesisRoot = 1;
if (father->FindSubObject (1, HypothesisRoot)) {
- SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(HypothesisRoot);
+ SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(HypothesisRoot);
for (; it->More();it->Next()) {
SALOMEDS::SObject_var Obj = it->Value();
if (Obj->FindAttribute(anAttr, "AttributeName") ) {
//=================================================================================
void SMESHGUI_EditHypothesesDlg::InitHypAssignation()
{
- MESSAGE ( " InitHypAssignation " << myMesh->_is_nil() )
- MESSAGE ( " InitHypAssignation " << mySubMesh->_is_nil() )
+ myNbModification = 0;
+// MESSAGE ( " InitHypAssignation " << myMesh->_is_nil() )
+// MESSAGE ( " InitHypAssignation " << mySubMesh->_is_nil() )
myMapOldHypos.clear();
ListHypAssignation->clear();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
SALOMEDS::AttributeIOR_var anIOR;
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
if ( !myMesh->_is_nil() )
- aMorSM = myStudyAPI.FindObject( myMesh );
+ aMorSM = SMESH::FindSObject( myMesh );
else if ( !mySubMesh->_is_nil() )
- aMorSM = myStudyAPI.FindObject( mySubMesh );
+ aMorSM = SMESH::FindSObject( mySubMesh );
if ( !aMorSM->_is_nil() && aMorSM->FindSubObject (2, AHR)) {
- SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR);
+ SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
for (; it->More();it->Next()) {
SALOMEDS::SObject_var Obj = it->Value();
if ( Obj->ReferencedObject(aRef) ) {
{
ListAlgoDefinition->clear();
- SALOMEDS::SComponent_var father = mySMESHGUI->GetStudy()->FindComponent("MESH");
+ SALOMEDS::SComponent_var father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
if ( father->_is_nil() )
return;
SALOMEDS::AttributeIOR_var anIOR;
if (father->FindSubObject (2, AlgorithmsRoot)) {
- SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AlgorithmsRoot);
+ SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AlgorithmsRoot);
for (; it->More();it->Next()) {
SALOMEDS::SObject_var Obj = it->Value();
if (Obj->FindAttribute(anAttr, "AttributeName") ) {
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
SALOMEDS::AttributeIOR_var anIOR;
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
if ( !myMesh->_is_nil() )
- aMorSM = myStudyAPI.FindObject( myMesh );
+ aMorSM = SMESH::FindSObject( myMesh );
else if ( !mySubMesh->_is_nil() )
- aMorSM = myStudyAPI.FindObject( mySubMesh );
+ aMorSM = SMESH::FindSObject( mySubMesh );
if ( !aMorSM->_is_nil() && aMorSM->FindSubObject (3, AHR)) {
- SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR);
+ SALOMEDS::ChildIterator_var it = SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
for (; it->More();it->Next()) {
SALOMEDS::SObject_var Obj = it->Value();
if ( Obj->ReferencedObject(aRef) ) {
void SMESHGUI_EditHypothesesDlg::InitGeom()
{
LineEditC1A2->setText("") ;
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
if ( myGeomShape->_is_nil() && !myMesh->_is_nil() ) {
- SALOMEDS::SObject_var aMesh = myStudyAPI.FindObject( myMesh );
+ SALOMEDS::SObject_var aMesh = SMESH::FindSObject( myMesh );
if ( !aMesh->_is_nil() )
- myGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh(aMesh);
+ myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMesh);
}
if ( myGeomShape->_is_nil() && !mySubMesh->_is_nil() ) {
- SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindObject( mySubMesh );
+ SALOMEDS::SObject_var aSubMesh = SMESH::FindSObject( mySubMesh );
if ( !aSubMesh->_is_nil() )
- myGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh(aSubMesh);
+ myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aSubMesh);
}
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
if ( !myGeomShape->_is_nil() && (!myMesh->_is_nil() || !mySubMesh->_is_nil()) ) {
- SALOMEDS::SObject_var aSO = mySMESHGUI->GetStudy()->FindObjectIOR( myGeomShape->Name() );
+ SALOMEDS::SObject_var aSO = SMESH::GetActiveStudyDocument()->FindObjectIOR( myGeomShape->GetName() );
if ( !aSO->_is_nil() ) {
if (aSO->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- LineEditC1A2->setText( QString(aName->Value()) ) ;
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ LineEditC1A2->setText( QString(aName->Value()) ) ;
}
}
}
bool isEnabled = ( !myMesh ->_is_nil() && !myGeomShape->_is_nil() && ListHypAssignation->count() && ListAlgoAssignation->count() ) ||
( !mySubMesh->_is_nil() && !myGeomShape->_is_nil() && ( ListHypAssignation->count() || ListAlgoAssignation->count() ) );
- buttonOk ->setEnabled( isEnabled && !myImportedMesh );
- buttonApply->setEnabled( isEnabled && !myImportedMesh );
+ buttonOk ->setEnabled( myNbModification && isEnabled && !myImportedMesh );
+ buttonApply->setEnabled( myNbModification && isEnabled && !myImportedMesh );
SelectButtonC1A2 ->setEnabled( ALLOW_CHANGE_SHAPE && !myImportedMesh );
LineEditC1A2 ->setEnabled( ALLOW_CHANGE_SHAPE && !myImportedMesh );
//=================================================================================
bool SMESHGUI_EditHypothesesDlg::StoreMesh()
{
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
MapIOR anOldHypos, aNewHypos;
if ( myGeomShape->_is_nil() )
return false;
// 1. Check whether the geometric shape has changed
- SALOMEDS::SObject_var aMeshSO = myStudyAPI.FindObject( myMesh );
- GEOM::GEOM_Shape_var aIniGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh( aMeshSO );
+ SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
+ GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent( myGeomShape );
if ( bShapeChanged ) {
// VSR : TODO : Set new shape - not supported yet by SMESH engine
- // 1) remove all old hypotheses and algorithms and also submeshes
- // 2) set new shape
+ // 1. remove all old hypotheses and algorithms and also submeshes
+ // 2. set new shape
}
+
+ int nbFail = 0;
MapIOR::iterator it;
// 2. remove not used hypotheses from the mesh
for ( it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it ) {
string ior = it->first;
int index = findItem( ListHypAssignation, ior );
if ( index < 0 ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ) )
- return false;
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ))
+ nbFail++;
}
}
}
string ior = it->first;
int index = findItem( ListAlgoAssignation, ior );
if ( index < 0 ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ) )
- return false;
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aMeshSO, aHyp ))
+ nbFail++;
}
}
}
- // 4. Add new hypotheses
- for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
- if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
- ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
+ // 4. Add new algorithms
+ for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
+ if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
+ ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
if ( anItem ) {
string ior = anItem->GetIOR();
- if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddHypothesisOnMesh( myMesh, aHyp ) )
- return false;
+ if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::AddHypothesisOnMesh( myMesh, aHyp ))
+ nbFail++;
}
}
}
}
}
- // 4. Add new algorithms
- for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
- if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
- ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
+ // 5. Add new hypotheses
+ for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
+ if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
+ ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
if ( anItem ) {
string ior = anItem->GetIOR();
- if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddAlgorithmOnMesh( myMesh, aHyp ) )
- return false;
+ if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::AddHypothesisOnMesh( myMesh, aHyp ))
+ nbFail++;
}
}
}
}
}
- return true;
+ return ( nbFail == 0 );
}
//=================================================================================
//=================================================================================
bool SMESHGUI_EditHypothesesDlg::StoreSubMesh()
{
- SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
MapIOR anOldHypos, aNewHypos;
if ( myGeomShape->_is_nil() )
return false;
// 1. Check whether the geometric shape has changed
- SALOMEDS::SObject_var aSubMeshSO = myStudyAPI.FindObject( mySubMesh );
- GEOM::GEOM_Shape_var aIniGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh( aSubMeshSO );
+ SALOMEDS::SObject_var aSubMeshSO = SMESH::FindSObject( mySubMesh );
+ GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aSubMeshSO );
bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent( myGeomShape );
if ( bShapeChanged ) {
// VSR : TODO : Set new shape - not supported yet by engine
- // 1) remove all old hypotheses and algorithms
- // 2) set new shape
+ // 1. remove all old hypotheses and algorithms
+ // 2. set new shape
}
+ int nbFail = 0;
MapIOR::iterator it;
// 2. remove not used hypotheses from the submesh
for ( it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it ) {
string ior = it->first;
int index = findItem( ListHypAssignation, ior );
if ( index < 0 ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ) )
- return false;
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ))
+ nbFail++;
}
}
}
string ior = it->first;
int index = findItem( ListAlgoAssignation, ior );
if ( index < 0 ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ) )
- return false;
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh( aSubMeshSO, aHyp ))
+ nbFail++;
}
}
}
- // 4. Add new hypotheses
- for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
- if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
- ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
+ // 4. Add new algorithms
+ for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
+ if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
+ ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
if ( anItem ) {
string ior = anItem->GetIOR();
- if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddHypothesisOnSubMesh( mySubMesh, aHyp ) )
- return false;
+ if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::AddHypothesisOnSubMesh( mySubMesh, aHyp ))
+ nbFail++;
}
}
}
}
}
- // 4. Add new algorithms
- for ( int i = 0; i < ListAlgoAssignation->count(); i++ ) {
- if ( ListAlgoAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
- ListBoxIOR* anItem = ( ListBoxIOR* )( ListAlgoAssignation->item( i ) );
+ // 5. Add new hypotheses
+ for ( int i = 0; i < ListHypAssignation->count(); i++ ) {
+ if ( ListHypAssignation->item( i )->rtti() == ListBoxIOR::RTTI_IOR ) {
+ ListBoxIOR* anItem = ( ListBoxIOR* )( ListHypAssignation->item( i ) );
if ( anItem ) {
string ior = anItem->GetIOR();
- if ( myMapOldAlgos.find( ior ) == myMapOldAlgos.end() ) {
- CORBA::Object_var anObject = myStudyAPI.StringToIOR( ior.c_str() );
- if ( !CORBA::is_nil( anObject ) ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
- if ( !aHyp->_is_nil() )
- if ( !mySMESHGUI->AddAlgorithmOnSubMesh( mySubMesh, aHyp ) )
- return false;
+ if ( myMapOldHypos.find( ior ) == myMapOldHypos.end() ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
+ if ( !aHyp->_is_nil() ){
+ if (!SMESH::AddHypothesisOnSubMesh( mySubMesh, aHyp ))
+ nbFail++;
}
}
}
}
}
- return true;
+ return ( nbFail == 0 );
}
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include <map>
bool StoreMesh();
bool StoreSubMesh();
+ bool IsOld(QListBoxItem* hypItem);
+
private:
SMESHGUI* mySMESHGUI ;
SALOME_Selection* mySelection ;
- GEOM::GEOM_Shape_var myGeomShape ;
+ GEOM::GEOM_Object_var myGeomShape ;
QLineEdit* myEditCurrentArgument;
SMESH::SMESH_Mesh_var myMesh;
Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
MapIOR myMapOldHypos, myMapOldAlgos;
+ int myNbModification;
bool myImportedMesh;
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_ExtrusionDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_ExtrusionDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include <TopoDS.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Vec.hxx>
+#include <BRepAdaptor_Curve.hxx>
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qvalidator.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_ExtrusionDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_ExtrusionDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "EXTRUSION_ALONG_LINE" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_ExtrusionDlgLayout = new QGridLayout( this );
+ SMESHGUI_ExtrusionDlgLayout->setSpacing( 6 );
+ SMESHGUI_ExtrusionDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setTitle( tr( "SMESH_EXTRUSION" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
+ RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+ RadioButton2->setText( tr( "" ) );
+ RadioButton2->setPixmap( image1 );
+ GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
+ SMESHGUI_ExtrusionDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_ExtrusionDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout());
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image2 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
+
+ // Controls for vector selection
+ TextLabelVector = new QLabel( GroupArguments, "TextLabelVector" );
+ TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
+ GroupArgumentsLayout->addWidget( TextLabelVector, 1, 0 );
+
+ TextLabelDx = new QLabel( GroupArguments, "TextLabelDx" );
+ TextLabelDx->setText( tr( "SMESH_DX" ) );
+ GroupArgumentsLayout->addWidget( TextLabelDx, 1, 2 );
+
+ SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
+ GroupArgumentsLayout->addWidget( SpinBox_Dx, 1, 3 );
+
+ TextLabelDy = new QLabel( GroupArguments, "TextLabelDy" );
+ TextLabelDy->setText( tr( "SMESH_DY" ) );
+ GroupArgumentsLayout->addWidget( TextLabelDy, 1, 4 );
+
+ SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
+ GroupArgumentsLayout->addWidget( SpinBox_Dy, 1, 5 );
+
+ TextLabelDz = new QLabel( GroupArguments, "TextLabelDz" );
+ TextLabelDz->setText( tr( "SMESH_DZ" ) );
+ GroupArgumentsLayout->addWidget( TextLabelDz, 1, 6 );
+
+ SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
+ GroupArgumentsLayout->addWidget( SpinBox_Dz, 1, 7 );
+
+ // Controls for nb. steps defining
+ TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
+ TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 2, 2, 0, 1 );
+
+ SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
+ GroupArgumentsLayout->addMultiCellWidget( SpinBox_NbSteps, 2, 2, 2, 7 );
+
+ SMESHGUI_ExtrusionDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ SpinBox_Dx->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Dy->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Dz->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+
+ QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
+ SpinBox_NbSteps->setValidator(anIntValidator);
+ SpinBox_NbSteps->setRange( 1, 999999 );
+
+ GroupArguments->show();
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_ExtrusionDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::Init()
+{
+ myBusy = false;
+
+ SpinBox_NbSteps->setValue(1);
+
+ myEditCurrentArgument = LineEditElements;
+ LineEditElements->setFocus();
+ myNbOkElements = 0 ;
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ SpinBox_Dx->SetValue(0);
+ SpinBox_Dy->SetValue(0);
+ SpinBox_Dz->SetValue(0);
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::ConstructorsClicked(int constructorId)
+{
+ disconnect(mySelection, 0, this, 0);
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+ myNbOkElements = 0 ;
+ myEditCurrentArgument = LineEditElements;
+ LineEditElements->setText("");
+ LineEditElements->setFocus();
+
+ switch(constructorId)
+ {
+ case 0 :
+ {
+ GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+ break;
+ }
+ case 1 :
+ {
+ GroupArguments->setTitle( tr( "EXTRUSION_2D" ) );
+ QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+ break;
+ }
+ }
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements)
+ {
+ QStringList aListElementsId = QStringList::split( " ", LineEditElements->text(), false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::DirStruct aVector;
+ aVector.PS.x = SpinBox_Dx->GetValue();
+ aVector.PS.y = SpinBox_Dy->GetValue();
+ aVector.PS.z = SpinBox_Dz->GetValue();
+
+ long aNbSteps = (long)SpinBox_NbSteps->value();
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ Init();
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::ClickOnOk()
+{
+ this->ClickOnApply() ;
+ this->ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+void SMESHGUI_ExtrusionDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements/nodes
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ }
+ }
+
+ if ( myNbOkElements ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+
+ myActor = 0;
+ QString aString = "";
+
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected mesh
+
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+
+ if (myEditCurrentArgument == LineEditElements)
+ {
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ // get selected elements
+ int aNbElements = 0;
+
+ aNbElements = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+
+ if(aNbElements < 1)
+ return ;
+ }
+
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+
+ // OK
+
+ if (myEditCurrentArgument == LineEditElements )
+ myNbOkElements = true;
+
+ if(myNbOkElements)
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = LineEditElements;
+ int aConstructorId = GetConstructorId();
+ if (aConstructorId == 0)
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+ else if (aConstructorId == 1)
+ QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+ return ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ ConstructorsClicked(GetConstructorId());
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+ return ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_ExtrusionDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+int SMESHGUI_ExtrusionDlg::GetConstructorId()
+{
+ if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+ return GroupConstructors->id( GroupConstructors->selected() );
+ return -1;
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_ExtrusionDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_EXTRUSION_H
+#define DIALOGBOX_EXTRUSION_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QSpinBox;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_ExtrusionDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_ExtrusionDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_ExtrusionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_ExtrusionDlg();
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ int GetConstructorId();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myNbOkElements ; /* to check when elements are defined */
+ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QRadioButton* RadioButton2;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+ QLabel* TextLabelVector;
+ QLabel* TextLabelDx;
+ SMESHGUI_SpinBox* SpinBox_Dx;
+ QLabel* TextLabelDy;
+ SMESHGUI_SpinBox* SpinBox_Dy;
+ QLabel* TextLabelDz;
+ SMESHGUI_SpinBox* SpinBox_Dz;
+ QLabel* TextLabelNbSteps;
+ QSpinBox* SpinBox_NbSteps;
+
+ private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+
+protected:
+ QGridLayout* SMESHGUI_ExtrusionDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_EXTRUSION_H
-// SMESHGUI_Filter : Filters for VTK viewer
+// SMESHGUI_PredicateFilter : Filters for VTK viewer
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// Module : SMESH
#include "SMESHGUI_Filter.h"
+#include "SMESHGUI_Utils.h"
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDSAbs_ElementType.hxx"
#include <vtkCell.h>
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
+IMPLEMENT_STANDARD_HANDLE(SMESHGUI_PredicateFilter, SMESHGUI_Filter)
+IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_PredicateFilter, SMESHGUI_Filter)
+
+IMPLEMENT_STANDARD_HANDLE(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter)
+IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter)
+
+IMPLEMENT_STANDARD_HANDLE(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
+IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
+
/*
- Class : SMESHGUI_Filter
+ Class : SMESHGUI_PredicateFilter
Description : Selection filter for VTK viewer. This class aggregate object
- of SMESH_Filter class and uses it for verification of criterion
+ of SMESH_Predicate class and uses it for verification of criterion
*/
//=======================================================================
-// name : SMESHGUI_Filter::SMESHGUI_Filter
+// name : SMESHGUI_PredicateFilter::SMESHGUI_PredicateFilter
// Purpose : Constructor
//=======================================================================
-SMESHGUI_Filter::SMESHGUI_Filter()
+SMESHGUI_PredicateFilter::SMESHGUI_PredicateFilter()
{
- myActor = 0;
}
-SMESHGUI_Filter::~SMESHGUI_Filter()
+SMESHGUI_PredicateFilter::~SMESHGUI_PredicateFilter()
{
}
//=======================================================================
-// name : SMESHGUI_Filter::IsValid
+// name : SMESHGUI_PredicateFilter::IsValid
// Purpose : Verify whether entry id satisfies to criterion of the filter
//=======================================================================
-bool SMESHGUI_Filter::IsValid( const int theCellId ) const
+bool SMESHGUI_PredicateFilter::IsValid( const int theCellId ) const
{
if ( myActor == 0 || myPred->_is_nil() )
return false;
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ SMESH::ElementType anElemType = myPred->GetElementType();
+ int aMeshId = anElemType == SMESH::NODE ? anActor->GetNodeObjId( theCellId )
+ : anActor->GetElemObjId( theCellId );
- int aMeshId = anActor->GetElemObjId( theCellId );
-
+ // if type of element != type of predicate return true because
+ // this predicate is not intended for filtering sush elements
+ const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( aMeshId )
+ : aMesh->FindElement( aMeshId );
+ if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
+ return true;
+
return myPred->IsSatisfy( aMeshId );
}
//=======================================================================
-// name : SMESHGUI_Filter::SetPredicate
-// Purpose : Set new pridicate to the filter
+// name : SMESHGUI_PredicateFilter::IsValid
+// Purpose : Verify whether entry id satisfies to criterion of the filter
//=======================================================================
-void SMESHGUI_Filter::SetPredicate( SMESH::Predicate_ptr thePred )
+bool SMESHGUI_PredicateFilter::IsObjValid( const int theObjId ) const
{
- myPred = thePred;
+ if ( myActor == 0 || myPred->_is_nil() )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ SMESH::ElementType anElemType = myPred->GetElementType();
+
+ // if type of element != type of predicate return true because
+ // this predicate is not intended for filtering sush elements
+ const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( theObjId )
+ : aMesh->FindElement( theObjId );
+ if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
+ return true;
+
+ return myPred->IsSatisfy( theObjId );
}
//=======================================================================
-// name : SMESHGUI_Filter::GetActor
-// Purpose : Get actor of the filter
+// name : SMESHGUI_PredicateFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
//=======================================================================
-SALOME_Actor* SMESHGUI_Filter::GetActor() const
+bool SMESHGUI_PredicateFilter::IsNodeFilter() const
{
- return myActor;
+ return GetId() == SMESHGUI_NodeFilter;
}
//=======================================================================
-// name : SMESHGUI_Filter::SetActor
+// name : SMESHGUI_PredicateFilter::SetPredicate
+// Purpose : Set new pridicate to the filter
+//=======================================================================
+void SMESHGUI_PredicateFilter::SetPredicate( SMESH::Predicate_ptr thePred )
+{
+ myPred = SMESH::Predicate::_duplicate( thePred );
+}
+
+//=======================================================================
+// name : SMESHGUI_PredicateFilter::SetActor
// Purpose : Set new actor
//=======================================================================
-void SMESHGUI_Filter::SetActor( SALOME_Actor* theActor )
+void SMESHGUI_PredicateFilter::SetActor( SALOME_Actor* theActor )
{
if ( myActor == theActor )
return;
- VTKViewer_Filter::SetActor( theActor );
+ SMESHGUI_Filter::SetActor( theActor );
if ( myActor != 0 && !myPred->_is_nil() )
{
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
if ( !anIO.IsNull() )
{
- Standard_Boolean aRes = false;
- SMESH::SMESH_Mesh_ptr aMeshPtr = SMESHGUI::GetSMESHGUI()->ConvertIOinMesh( anIO, aRes );
- if ( aRes )
- myPred->SetMesh( aMeshPtr );
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
+ if(!aMesh->_is_nil())
+ myPred->SetMesh(aMesh);
}
}
}
+
+//=======================================================================
+// name : SMESHGUI_PredicateFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_PredicateFilter::GetId() const
+{
+ if ( myPred->GetElementType() == SMESH::NODE ) return SMESHGUI_NodeFilter;
+ else if ( myPred->GetElementType() == SMESH::EDGE ) return SMESHGUI_EdgeFilter;
+ else if ( myPred->GetElementType() == SMESH::FACE ) return SMESHGUI_FaceFilter;
+ else if ( myPred->GetElementType() == SMESH::VOLUME ) return SMESHGUI_VolumeFilter;
+ else if ( myPred->GetElementType() == SMESH::ALL ) return SMESHGUI_AllElementsFilter;
+ else return SMESHGUI_UnknownFilter;
+}
+
+
+/*
+ Class : SMESHGUI_QuadrangleFilter
+ Description : Verify whether selected cell is quadranle
+*/
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::SMESHGUI_QuadrangleFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_QuadrangleFilter::SMESHGUI_QuadrangleFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_QuadrangleFilter::~SMESHGUI_QuadrangleFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsValid
+// Purpose : Verify whether selected cell is quadranle
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 4 : false;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsValid
+// Purpose : Verify whether selected cell is quadranle
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 4 : false;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_QuadrangleFilter::GetId() const
+{
+ return SMESHGUI_QuadFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsNodeFilter() const
+{
+ return false;
+}
+
+
+/*
+ Class : SMESHGUI_TriangleFilter
+ Description : Verify whether selected cell is triangle
+*/
+
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::SMESHGUI_TriangleFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_TriangleFilter::SMESHGUI_TriangleFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_TriangleFilter::~SMESHGUI_TriangleFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsValid
+// Purpose : Verify whether selected cell is triangle
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 3 : false;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsValid
+// Purpose : Verify whether selected cell is triangle
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 3 : false;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_TriangleFilter::GetId() const
+{
+ return SMESHGUI_TriaFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsNodeFilter() const
+{
+ return false;
+}
+
+
+
+
+
+
+
+
+
+
+
#ifndef SMESHGUI_Filter_HeaderFile
#define SMESHGUI_Filter_HeaderFile
-#include "VTKViewer_Filter.h"\r
-\r
+#include "VTKViewer_Filter.h"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Filter)
class SALOME_Actor;
-
-DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
+enum SMESHGUI_FilterType
+{
+ SMESHGUI_UnknownFilter = -1,
+ SMESHGUI_NodeFilter = 0,
+ SMESHGUI_EdgeFilter = 1,
+ SMESHGUI_FaceFilter = 2,
+ SMESHGUI_VolumeFilter = 3,
+ SMESHGUI_AllElementsFilter = 4,
+ SMESHGUI_QuadFilter = 5,
+ SMESHGUI_TriaFilter = 6
+};
/*
Class : SMESHGUI_Filter
- Description : Selection filter for VTK viewer
+ Description : Base class for SMESH selection filters for VTK viewer.
*/
+DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
+
class SMESHGUI_Filter : public VTKViewer_Filter
{
public:
- SMESHGUI_Filter();
- virtual ~SMESHGUI_Filter();
- virtual bool IsValid( const int theCellId ) const;
+ virtual bool IsObjValid( const int theObjId ) const = 0;
+public:
+ DEFINE_STANDARD_RTTI(SMESHGUI_Filter)
+};
+
+/*
+ Class : SMESHGUI_PredicateFilter
+ Description : Selection filter for VTK viewer. This class aggregate object
+ of SMESH_Predicate class and uses it for verification of criterion
+*/
+
+DEFINE_STANDARD_HANDLE(SMESHGUI_PredicateFilter, SMESHGUI_Filter)
+
+class SMESHGUI_PredicateFilter : public SMESHGUI_Filter
+{
- virtual void SetActor( SALOME_Actor* );
- SALOME_Actor* GetActor() const;\r
-\r
+public:
+ SMESHGUI_PredicateFilter();
+ virtual ~SMESHGUI_PredicateFilter();
+
+ virtual bool IsValid( const int theCellId ) const;
+ virtual bool IsObjValid( const int theObjId ) const;
+ virtual int GetId() const;
+ virtual bool IsNodeFilter() const;
void SetPredicate( SMESH::Predicate_ptr );
-\r
+
+ void SetActor( SALOME_Actor* );
+
private:
-\r
+
SMESH::Predicate_var myPred;
-public:
- DEFINE_STANDARD_RTTI(SMESHGUI_Filter)
+public:
+ DEFINE_STANDARD_RTTI(SMESHGUI_PredicateFilter)
+};
+
+/*
+ Class : SMESHGUI_QuadrangleFilter
+ Description : Verify whether selected cell is quadranle
+*/
+
+DEFINE_STANDARD_HANDLE(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter)
+
+class SMESHGUI_QuadrangleFilter : public SMESHGUI_Filter
+{
+
+public:
+ SMESHGUI_QuadrangleFilter();
+ virtual ~SMESHGUI_QuadrangleFilter();
+
+ virtual bool IsValid( const int theCellId ) const;
+ virtual bool IsObjValid( const int theObjId ) const;
+ virtual int GetId() const;
+ virtual bool IsNodeFilter() const;
+
+public:
+ DEFINE_STANDARD_RTTI(SMESHGUI_QuadrangleFilter)
+};
+
+/*
+ Class : SMESHGUI_TriangleFilter
+ Description : Verify whether selected cell is triangle
+*/
+
+DEFINE_STANDARD_HANDLE(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
+
+class SMESHGUI_TriangleFilter : public SMESHGUI_Filter
+{
+
+public:
+ SMESHGUI_TriangleFilter();
+ virtual ~SMESHGUI_TriangleFilter();
+
+ virtual bool IsValid( const int theCellId ) const;
+ virtual bool IsObjValid( const int theObjId ) const;
+ virtual int GetId() const;
+ virtual bool IsNodeFilter() const;
+
+public:
+ DEFINE_STANDARD_RTTI(SMESHGUI_TriangleFilter)
};
#endif
// Author : Sergey LITONIN
// Module : SMESH
-#include "SMESHGUI.h"
#include "SMESHGUI_FilterDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+
#include "SMESHGUI_Filter.h"
#include "SMESH_Actor.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
#include "VTKViewer_ViewFrame.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
#include "QAD_RightFrame.h"
+#include "QAD_Config.h"
#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "SMESHGUI_FilterLibraryDlg.h"
+#include "SALOME_TypeFilter.hxx"
+#include "GEOMBase.h"
+#include "GEOM_FaceFilter.hxx"
#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <Precision.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_CylindricalSurface.hxx>
#include <qframe.h>
#include <qlayout.h>
#include <qregexp.h>
#include <qlistbox.h>
#include <qcheckbox.h>
+#include <qobjectlist.h>
+#include <qvalidator.h>
#define SPACING 5
#define MARGIN 10
-static int maxLength( const QStringList& theList, const QFontMetrics& theMetrics )
+using namespace SMESH;
+
+static int maxLength( const QMap<int, QString> theMap, const QFontMetrics& theMetrics )
{
int aRes = 0;
- QStringList::const_iterator anIter;
- for ( anIter = theList.begin(); anIter != theList.end(); ++anIter )
- aRes = Max( aRes, theMetrics.width( *anIter ) );
+ QMap<int, QString>::const_iterator anIter;
+ for ( anIter = theMap.begin(); anIter != theMap.end(); ++anIter )
+ aRes = Max( aRes, theMetrics.width( anIter.data() ) );
return aRes;
}
+static int getFilterId( SMESH::ElementType theType )
+{
+ switch ( theType )
+ {
+ case SMESH::NODE : return SMESHGUI_NodeFilter;
+ case SMESH::EDGE : return SMESHGUI_EdgeFilter;
+ case SMESH::FACE : return SMESHGUI_FaceFilter;
+ case SMESH::VOLUME : return SMESHGUI_VolumeFilter;
+ case SMESH::ALL : return SMESHGUI_AllElementsFilter;
+ default : return SMESHGUI_UnknownFilter;
+ }
+}
+
/*
- Class : SMESHGUI_FilterDlg::Table
- Description : Table used by this dialog
+ Class : SMESHGUI_FilterTable::AdditionalWidget
+ Description : Class for storing additional parameters of criterion
*/
-class SMESHGUI_FilterDlg::Table : public QTable
+class SMESHGUI_FilterTable::AdditionalWidget : public QFrame
{
public:
- Table( QWidget* parent = 0 );
- Table( int numRows, int numCols, QWidget* parent = 0 );
- virtual ~Table();
-
- void SetEditable( const bool state, const int row, const int col );
- bool IsEditable( const int row, const int col ) const;
+ enum { Tolerance };
+
+public:
- virtual bool eventFilter( QObject *o, QEvent *e );
- virtual void insertRows( int row, int count = 1 );
- virtual QString text( int row, int col ) const;
+ AdditionalWidget( QWidget* theParent );
+ virtual ~AdditionalWidget();
+
+ virtual void GetParameters( QValueList<int>& ) const;
+ virtual bool IsValid( const bool theMsg = true ) const;
+ virtual double GetDouble( const int theId ) const;
+ virtual int GetInteger( const int theId ) const;
+ virtual QString GetString( const int theId ) const;
+ virtual void SetDouble( const int theId, const double theVal );
+ virtual void SetInteger( const int theId, const int theVal );
+ virtual void SetString( const int theId, const QString& theVal );
+ void SetEditable( const int theId, const bool isEditable );
+ void SetEditable( const bool isEditable );
+
+private:
+ QMap< int, QLineEdit* > myLineEdits;
};
-SMESHGUI_FilterDlg::Table::Table( QWidget* parent )
-: QTable( parent, "SMESHGUI_FilterDlg::Table" )
+SMESHGUI_FilterTable::AdditionalWidget::AdditionalWidget( QWidget* theParent )
+: QFrame( theParent )
{
-}
+ QLabel* aLabel = new QLabel( tr( "SMESH_TOLERANCE" ), this );
+ myLineEdits[ Tolerance ] = new QLineEdit( this );
+ QDoubleValidator* aValidator = new QDoubleValidator( myLineEdits[ Tolerance ] );
+ aValidator->setBottom( 0 );
+ myLineEdits[ Tolerance ]->setValidator( aValidator );
+
+ QHBoxLayout* aLay = new QHBoxLayout( this, 0, SPACING );
+ aLay->addWidget( aLabel );
+ aLay->addWidget( myLineEdits[ Tolerance ] );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ aLay->addItem( aSpacer );
-SMESHGUI_FilterDlg::Table::Table( int numRows, int numCols, QWidget* parent )
-: QTable( numRows, numCols, parent, "SMESHGUI_FilterDlg::Table" )
+ QString aText = QString( "%1" ).arg( Precision::Confusion() );
+ myLineEdits[ Tolerance ]->setText( aText );
+}
+SMESHGUI_FilterTable::AdditionalWidget::~AdditionalWidget()
{
}
-SMESHGUI_FilterDlg::Table::~Table()
+void SMESHGUI_FilterTable::AdditionalWidget::GetParameters( QValueList<int>& theList ) const
{
+ theList.clear();
+ theList.append( Tolerance );
}
-void SMESHGUI_FilterDlg::Table::SetEditable( const bool isEditable, const int row, const int col )
+bool SMESHGUI_FilterTable::AdditionalWidget::IsValid( const bool theMsg ) const
{
- QTableItem* anItem = item( row, col );
- if( anItem )
- takeItem( anItem );
+ if ( !isEnabled() )
+ return true;
- if ( !isEditable )
- {
- setItem( row, col, new QTableItem( this, QTableItem::Never, "" ) );
- }
- else
+ QValueList<int> aParams;
+ GetParameters( aParams );
+ QValueList<int>::const_iterator anIter;
+ for ( anIter = aParams.begin(); anIter != aParams.end(); ++anIter )
{
- setItem( row, col, new QTableItem( this, QTableItem::OnTyping, "" ) );
+ const QLineEdit* aWg = myLineEdits[ *anIter ];
+ int p = 0;
+ QString aText = aWg->text();
+ if ( aWg->isEnabled() && aWg->validator()->validate( aText, p ) != QValidator::Acceptable )
+ {
+ if ( theMsg )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );
+ return false;
+ }
}
+
+ return true;
}
-bool SMESHGUI_FilterDlg::Table::IsEditable( const int row, const int col ) const
+double SMESHGUI_FilterTable::AdditionalWidget::GetDouble( const int theId ) const
{
- QTableItem* anItem = item( row, col );
- return anItem == 0 || anItem->editType() != QTableItem::Never;
+ return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text().toDouble() : 0;
}
-void SMESHGUI_FilterDlg::Table::insertRows( int row, int count )
+int SMESHGUI_FilterTable::AdditionalWidget::GetInteger( const int theId ) const
{
- int anEditRow = currEditRow();
- int anEditCol = currEditCol();
-
-// printf( "sln: anEditRow = %d, anEditCol = %d\n", anEditRow, anEditCol );
+ return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text().toInt() : 0;
+}
- if ( anEditRow >= 0 && anEditCol >= 0 )
- endEdit( anEditRow, anEditCol, true, false );
+QString SMESHGUI_FilterTable::AdditionalWidget::GetString( const int theId ) const
+{
+ return myLineEdits.contains( theId ) ? myLineEdits[ theId ]->text() : QString("");
+}
- QTable::insertRows( row, count );
+void SMESHGUI_FilterTable::AdditionalWidget::SetDouble( const int theId, const double theVal )
+{
+ if ( myLineEdits.contains( theId ) )
+ myLineEdits[ theId ]->setText( QString( "%1" ).arg( theVal ) );
}
-QString SMESHGUI_FilterDlg::Table::text( int row, int col ) const
+void SMESHGUI_FilterTable::AdditionalWidget::SetInteger( const int theId, const int theVal )
{
- int anEditRow = currEditRow();
- int anEditCol = currEditCol();
+ if ( myLineEdits.contains( theId ) )
+ myLineEdits[ theId ]->setText( QString( "%1" ).arg( theVal ) );
+}
- if ( anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col )
- ((Table*)this)->endEdit( row, col, true, false );
+void SMESHGUI_FilterTable::AdditionalWidget::SetString( const int theId, const QString& theVal )
+{
+ if ( myLineEdits.contains( theId ) )
+ myLineEdits[ theId ]->setText( theVal );
+}
- return QTable::text( row, col );
+void SMESHGUI_FilterTable::AdditionalWidget::SetEditable( const int theId, const bool isEditable )
+{
+ if ( myLineEdits.contains( theId ) )
+ myLineEdits[ theId ]->setEdited( isEditable );
}
-bool SMESHGUI_FilterDlg::Table::eventFilter( QObject *o, QEvent *e )
+void SMESHGUI_FilterTable::AdditionalWidget::SetEditable( const bool isEditable )
{
- return QTable::eventFilter( o, e );
+ QValueList<int> aParams;
+ GetParameters( aParams );
+ QValueList<int>::const_iterator anIter;
+ for ( anIter = aParams.begin(); anIter != aParams.end(); ++anIter )
+ myLineEdits[ *anIter ]->setEdited( isEditable );
}
/*
- Class : SMESHGUI_FilterDlg
- Description : Dialog to specify filters for VTK viewer
+ Class : SMESHGUI_FilterTable::ComboItem
+ Description : Combo table item. Identificator corresponding to string may be assigned
*/
+class SMESHGUI_FilterTable::ComboItem : public QComboTableItem
-//=======================================================================
-// name : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
-// Purpose : Constructor
-//=======================================================================
-SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget* theParent,
- const int theType,
- const bool theModal,
- const char* theName )
-: QDialog( theParent, theName, theModal,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
- myType = theType;
+public:
+ ComboItem( QTable*, const QMap<int, QString>& );
+ virtual ~ComboItem();
- setCaption( tr( "CAPTION" ) );
+ virtual void setStringList ( const QStringList & l );
+ void setStringList( const QMap<int, QString>& theIds );
- QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+ int GetValue() const;
+ void SetValue( const int );
+
+private:
+
+ QMap<int, int> myNumToId;
+ QMap<int, int> myIdToNum;
+};
- myMainFrame = createMainFrame ( this );
- QFrame* aBtnFrame = createButtonFrame( this, theModal );
+SMESHGUI_FilterTable::ComboItem::ComboItem( QTable* theParent,
+ const QMap<int, QString>& theIds )
+: QComboTableItem( theParent, QStringList() )
+{
+ setStringList( theIds );
+}
- aDlgLay->addWidget( myMainFrame );
- aDlgLay->addWidget( aBtnFrame );
+void SMESHGUI_FilterTable::ComboItem::setStringList( const QStringList & l )
+{
+ QComboTableItem::setStringList( l );
+}
- aDlgLay->setStretchFactor( myMainFrame, 1 );
+void SMESHGUI_FilterTable::ComboItem::setStringList( const QMap<int, QString>& theIds )
+{
+ int i = 0;
+ QStringList aList;
+ QMap<int, QString>::const_iterator anIter;
+ for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
+ {
+ myNumToId[ i ] = anIter.key();
+ myIdToNum[ anIter.key() ] = i;
+ aList.append( anIter.data() );
+ i++;
+ }
- Init( myType );
+ setStringList( aList );
}
-
-//=======================================================================
-// name : SMESHGUI_FilterDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
-QFrame* SMESHGUI_FilterDlg::createMainFrame( QWidget* theParent )
+SMESHGUI_FilterTable::ComboItem::~ComboItem()
{
- QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
- aMainFrame->setFrameStyle( QFrame::NoFrame );
- aMainFrame->setInsideMargin( 0 );
+}
+
+int SMESHGUI_FilterTable::ComboItem::GetValue() const
+{
+ return myNumToId[ currentItem() ];
+}
- // filter frame
+void SMESHGUI_FilterTable::ComboItem::SetValue( const int theVal )
+{
+ setCurrentItem( myIdToNum[ theVal ] );
+}
- QGroupBox* aFilterGrp = new QGroupBox( 1, Qt::Horizontal, tr ( "Filter" ), aMainFrame );
- QFrame* aFilterFrame = new QFrame( aFilterGrp );
- myTableGrp = new QGroupBox( 1, Qt::Horizontal, aFilterFrame );
- myTableGrp->setFrameStyle( QFrame::NoFrame );
- myTableGrp->setInsideMargin( 0 );
-
- myTables[ myType ] = createTable( myTableGrp, myType );
- myAddBtn = new QPushButton( tr( "ADD" ), aFilterFrame );
- myRemoveBtn = new QPushButton( tr( "REMOVE" ), aFilterFrame );
- myClearBtn = new QPushButton( tr( "CLEAR" ), aFilterFrame );
+/*
+ Class : SMESHGUI_FilterTable::Table
+ Description : Table used by this widget
+*/
- QGridLayout* aLay = new QGridLayout( aFilterFrame, 4, 2, 0, SPACING );
+class SMESHGUI_FilterTable::Table : public QTable
+{
+public:
+ Table( QWidget* parent );
+ Table( int numRows, int numCols, QWidget* parent = 0 );
+ virtual ~Table();
- aLay->addMultiCellWidget( myTableGrp, 0, 3, 0, 0 );
- aLay->addWidget( myAddBtn, 0, 1 );
- aLay->addWidget( myRemoveBtn, 1, 1 );
- aLay->addWidget( myClearBtn, 2, 1 );
- aLay->setColStretch( 0, 1 );
- aLay->setColStretch( 1, 0 );
+ void SetEditable( const bool state, const int row, const int col );
+ bool IsEditable( const int row, const int col ) const;
- mySetInViewer = new QCheckBox( tr( "SET_IN_VIEWER" ), aFilterGrp );
- mySetInViewer->setChecked( true );
+ virtual void insertRows( int row, int count = 1 );
+ virtual QString text( int row, int col ) const;
+};
- QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
- aLay->addItem( aVSpacer, 3, 1 );
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::Table
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterTable::Table::Table( QWidget* parent )
+: QTable( parent, "SMESHGUI_FilterTable::Table" )
+{
+}
- // other controls
- mySourceGrp = createSourceGroup( aMainFrame );
-
- // signals and slots
- connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddBtn() ) );
- connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveBtn() ) );
- connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( onClearBtn() ) );
+SMESHGUI_FilterTable::Table::Table( int numRows, int numCols, QWidget* parent )
+: QTable( numRows, numCols, parent, "SMESHGUI_FilterTable::Table" )
+{
+}
- return aMainFrame;
+SMESHGUI_FilterTable::Table::~Table()
+{
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::createSourceFrame
-// Purpose : Create frame containing source radio button
+// name : SMESHGUI_FilterTable::Table::SetEditable
+// Purpose : Set editable of specified cell
//=======================================================================
-QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup( QWidget* theParent )
+void SMESHGUI_FilterTable::Table::SetEditable( const bool isEditable, const int row, const int col )
{
- QButtonGroup* aGrp = new QButtonGroup( 1, Qt::Vertical, tr( "SOURCE" ), theParent );
-
- QRadioButton* aMeshBtn = new QRadioButton( tr( "MESH" ), aGrp );
- QRadioButton* aSelBtn = new QRadioButton( tr( "SELECTION" ), aGrp );
- QRadioButton* aGrpBtn = new QRadioButton( tr( "CURRENT_GROUP" ), aGrp );
-// QRadioButton* aNoneBtn = new QRadioButton( tr( "NONE" ), aGrp );
-
- aGrp->insert( aMeshBtn, Mesh );
- aGrp->insert( aSelBtn, Selection );
- aGrp->insert( aGrpBtn, Dialog );
-// aGrp->insert( aNoneBtn, None );
+ QTableItem* anItem = item( row, col );
+ if( anItem )
+ takeItem( anItem );
- aGrp->setButton( Selection );
+ if ( !isEditable )
+ setItem( row, col, new QTableItem( this, QTableItem::Never, "" ) );
+ else
+ setItem( row, col, new QTableItem( this, QTableItem::OnTyping, "" ) );
+}
- return aGrp;
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::IsEditable
+// Purpose : Verify wheter cell is editable
+//=======================================================================
+bool SMESHGUI_FilterTable::Table::IsEditable( const int row, const int col ) const
+{
+ QTableItem* anItem = item( row, col );
+ return anItem == 0 || anItem->editType() != QTableItem::Never;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::createTable
-// Purpose : Create table
+// name : SMESHGUI_FilterTable::Table::insertRows
+// Purpose : Insert rows ( virtual redefined )
//=======================================================================
-SMESHGUI_FilterDlg::Table* SMESHGUI_FilterDlg::createTable( QWidget* theParent,
- const int theType )
+void SMESHGUI_FilterTable::Table::insertRows( int row, int count )
{
- // create table
- Table* aTable= new Table( 0, 5, theParent );
+ int anEditRow = currEditRow();
+ int anEditCol = currEditCol();
- QHeader* aHeaders = aTable->horizontalHeader();
+ if ( anEditRow >= 0 && anEditCol >= 0 )
+ endEdit( anEditRow, anEditCol, true, false );
- QFontMetrics aMetrics( aHeaders->font() );
+ QTable::insertRows( row, count );
+}
- int aLenCr = abs( maxLength( getCriteria( theType ), aMetrics ) -
- aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::text
+// Purpose : Get text from cell ( virtual redefined )
+//=======================================================================
+QString SMESHGUI_FilterTable::Table::text( int row, int col ) const
+{
+ int anEditRow = currEditRow();
+ int anEditCol = currEditCol();
- int aLenCo = abs( maxLength( getCriteria( theType ), aMetrics ) -
- aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
+ if ( anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col )
+ ((Table*)this)->endEdit( row, col, true, false );
- QString aCrStr;
- aCrStr.fill( ' ', aLenCr );
- QString aCoStr;
- aCoStr.fill( ' ', 10 );
+ return QTable::text( row, col );
+}
- aHeaders->setLabel( 0, tr( "CRITERION" ) + aCrStr );
- aHeaders->setLabel( 1, tr( "COMPARE" ) + aCoStr );
- aHeaders->setLabel( 2, tr( "THRESHOLD_VALUE" ) );
- aHeaders->setLabel( 3, tr( "UNARY" ) );
- aHeaders->setLabel( 4, tr( "BINARY" ) + " " );
- // set geometry of the table
- for ( int i = 0; i <= 4; i++ )
- aTable->adjustColumn( i );
+/*
+ Class : SMESHGUI_FilterTable
+ Description : Frame containig
+ - Button group for switching entity type
+ - Table for displaying filter criterions
+ - Buttons for editing table and filter libraries
+*/
- aTable->updateGeometry();
- QSize aSize = aTable->sizeHint();
- int aWidth = aSize.width();
- aTable->setMinimumSize( QSize( aWidth, aWidth / 2 ) );
- aTable->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
+//=======================================================================
+// name : SMESHGUI_FilterTable::SMESHGUI_FilterTable
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterTable::SMESHGUI_FilterTable( QWidget* parent,
+ const int type )
+: QFrame( parent )
+{
+ myEntityType = -1;
+ Init( type );
+}
- if ( theType == SMESH::EDGE )
- connect( aTable, SIGNAL( valueChanged( int, int ) ),
- this, SLOT( onCriterionChanged( int, int ) ) );
+//=======================================================================
+// name : SMESHGUI_FilterTable::SMESHGUI_FilterTable
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterTable::SMESHGUI_FilterTable( QWidget* parent,
+ const QValueList<int>& types )
+: QFrame( parent )
+{
+ myEntityType = -1;
+ Init( types );
+}
- return aTable;
+SMESHGUI_FilterTable::~SMESHGUI_FilterTable()
+{
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::createButtonFrame
-// Purpose : Create frame containing buttons
+// name : SMESHGUI_FilterTable::Init
+// Purpose : Create table corresponding to the specified type
//=======================================================================
-QFrame* SMESHGUI_FilterDlg::createButtonFrame( QWidget* theParent, const bool theModal )
+void SMESHGUI_FilterTable::Init( const int type )
{
- QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
-
- myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aGrp );
- myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
- QLabel* aLbl = new QLabel( aGrp );
- myCloseBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+ QValueList<int> aTypes;
+ aTypes.append( type );
+ Init( aTypes );
+}
- aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+//=======================================================================
+// name : SMESHGUI_FilterTable::Init
+// Purpose : Create table corresponding to the specified type
+//=======================================================================
+void SMESHGUI_FilterTable::Init( const QValueList<int>& theTypes )
+{
+ if ( theTypes.isEmpty() )
+ return;
+
+ // Create buttons if necessary
+
+ if ( myTables.isEmpty() )
+ {
+ int aType = theTypes.first();
+
+ // create main layout
+ QVBoxLayout* aMainLay = new QVBoxLayout( this );
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, this );
+ aMainGrp->setFrameStyle( QFrame::NoFrame );
+ aMainGrp->setInsideMargin( 0 );
+ aMainLay->addWidget( aMainGrp );
+
+ // create switch of entity types
+ myEntityTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "ENTITY_TYPE" ), aMainGrp );
+ const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
+ QMap<int, QString>::const_iterator anIter;
+ for ( anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter )
+ {
+ QRadioButton* aBtn = new QRadioButton( anIter.data(), myEntityTypeGrp );
+ myEntityTypeGrp->insert( aBtn, anIter.key() );
+ }
+
+ myTableGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FILTER" ), aMainGrp );
+ QFrame* aTableFrame = new QFrame( myTableGrp );
+
+ // create table
+ mySwitchTableGrp = new QGroupBox( 1, Qt::Horizontal, aTableFrame );
+ mySwitchTableGrp->setFrameStyle( QFrame::NoFrame );
+ mySwitchTableGrp->setInsideMargin( 0 );
+
+ myTables[ aType ] = createTable( mySwitchTableGrp, aType );
+
+ // create buttons
+ myAddBtn = new QPushButton( tr( "ADD" ), aTableFrame );
+ myRemoveBtn = new QPushButton( tr( "REMOVE" ), aTableFrame );
+ myClearBtn = new QPushButton( tr( "CLEAR" ), aTableFrame );
+ myInsertBtn = new QPushButton( tr( "INSERT" ), aTableFrame );
+ myCopyFromBtn = new QPushButton( tr( "COPY_FROM" ), aTableFrame );
+ myAddToBtn = new QPushButton( tr( "ADD_TO" ), aTableFrame );
+
+ myAddBtn->setAutoDefault( false );
+ myRemoveBtn->setAutoDefault( false );
+ myClearBtn->setAutoDefault( false );
+ myInsertBtn->setAutoDefault( false );
+ myCopyFromBtn->setAutoDefault( false );
+ myAddToBtn->setAutoDefault( false );
+
+ myCopyFromBtn->hide();
+ myAddToBtn->hide();
+
+ // layout widgets
+ QGridLayout* aLay = new QGridLayout( aTableFrame, 8, 2, 0, SPACING );
+
+ aLay->addMultiCellWidget( mySwitchTableGrp, 0, 6, 0, 0 );
+ aLay->addWidget( myAddBtn, 0, 1 );
+ aLay->addWidget( myInsertBtn, 1, 1 );
+ aLay->addWidget( myRemoveBtn, 2, 1 );
+ aLay->addWidget( myClearBtn, 3, 1 );
+ aLay->addWidget( myCopyFromBtn, 5, 1 );
+ aLay->addWidget( myAddToBtn, 6, 1 );
+ aLay->addMultiCellWidget( createAdditionalFrame( aTableFrame ), 7, 7, 0, 1 );
+
+ aLay->setColStretch( 0, 1 );
+ aLay->setColStretch( 1, 0 );
+
+ QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ aLay->addItem( aVSpacer, 4, 1 );
+
+ // signals and slots
+ connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddBtn() ) );
+ connect( myInsertBtn, SIGNAL( clicked() ), this, SLOT( onInsertBtn() ) );
+ connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveBtn() ) );
+ connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( onClearBtn() ) );
+
+ connect( myCopyFromBtn, SIGNAL( clicked() ), this, SLOT( onCopyFromBtn() ) );
+ connect( myAddToBtn, SIGNAL( clicked() ), this, SLOT( onAddToBtn() ) );
+
+ connect( myEntityTypeGrp, SIGNAL( clicked( int ) ), this, SLOT( onEntityType( int ) ) );
+
+ myLibDlg = 0;
+ }
+
+ // Hide buttons of entity types if necessary
+ const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
+ QMap<int, QString>::const_iterator anIt;
+ for ( anIt = aSupportedTypes.begin(); anIt != aSupportedTypes.end(); ++anIt )
+ {
+ QButton* aBtn = myEntityTypeGrp->find( anIt.key() );
+ theTypes.contains( anIt.key() ) ? aBtn->show() : aBtn->hide();
+ }
- connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
- connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
- connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+ // select first button if there is no selected buttons or it is hidden
+ QButton* aBtn = myEntityTypeGrp->selected();
+ if ( aBtn == 0 || theTypes.find( myEntityTypeGrp->id( aBtn ) ) == theTypes.end() )
+ myEntityTypeGrp->setButton( theTypes.first() );
- if ( theModal )
- myApplyBtn->hide();
+ if ( theTypes.count() == 1 )
+ myEntityTypeGrp->hide();
+ else
+ myEntityTypeGrp->show();
- return aGrp;
+ myTableGrp->updateGeometry();
+ int aType = myEntityTypeGrp->id( myEntityTypeGrp->selected() );
+ onEntityType( aType );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg
-// Purpose : Destructor
+// name : SMESHGUI_FilterTable::GetTableGrp
+// Purpose : Get group box containing table. May be used for adding new widgets in it
+////=======================================================================
+QWidget* SMESHGUI_FilterTable::createAdditionalFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+
+ QFrame* aLine1 = new QFrame( aFrame );
+ QFrame* aLine2 = new QFrame( aFrame );
+ aLine1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ aLine2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ aLine1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed) );
+ aLine2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed) );
+
+ QLabel* aLabel = new QLabel( tr( "ADDITIONAL_PARAMETERS" ), aFrame );
+
+ myWgStack = new QWidgetStack( aFrame );
+
+ QGridLayout* aLay = new QGridLayout( aFrame, 2, 3, 0, SPACING );
+ aLay->addWidget( aLine1, 0, 0 );
+ aLay->addWidget( aLabel, 0, 1 );
+ aLay->addWidget( aLine2, 0, 2 );
+ aLay->addMultiCellWidget( myWgStack, 1, 1, 0, 2 );
+
+ return aFrame;
+}
+
//=======================================================================
-SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg()
+// name : SMESHGUI_FilterTable::GetTableGrp
+// Purpose : Get group box containing table. May be used for adding new widgets in it
+////=======================================================================
+QGroupBox* SMESHGUI_FilterTable::GetTableGrp()
{
+ return myTableGrp;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::Init
-// Purpose : Init dialog fields, connect signals and slots, show dialog
+// name : SMESHGUI_FilterTable::onEntityType
+// Purpose : SLOT. Called when entity type changed.
+// Display corresponding table
//=======================================================================
-void SMESHGUI_FilterDlg::Init( const int theType )
+void SMESHGUI_FilterTable::onEntityType( int theType )
{
- mySourceWg = 0;
- mySelection = 0;
- myType = theType;
- myMesh = SMESH::SMESH_Mesh::_nil();
+ if ( myEntityType == theType )
+ return;
- // activate corresponding tab
- if ( !myTables.contains( myType ) )
- myTables[ myType ] = createTable( myTableGrp, myType );
+ myIsValid = true;
+ emit NeedValidation();
+ if ( !myIsValid )
+ {
+ myEntityTypeGrp->setButton( myEntityType );
+ return;
+ }
+ myEntityType = theType;
+
+ if ( !myTables.contains( theType ) )
+ myTables[ theType ] = createTable( mySwitchTableGrp, theType );
+
TableMap::iterator anIter;
for ( anIter = myTables.begin(); anIter != myTables.end(); ++anIter )
- if ( anIter.key() == theType )
- anIter.data()->show();
- else
- anIter.data()->hide();
-
- // set caption
- setCaption( myType == SMESH::EDGE ? tr( "EDGES_TLT" ) : tr( "FACES_TLT" ) );
+ myEntityType == anIter.key() ? anIter.data()->show() : anIter.data()->hide();
+ updateBtnState();
qApp->processEvents();
- updateGeometry();
+ myTables[ myEntityType ]->updateGeometry();
adjustSize();
- setEnabled( true );
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+ emit EntityTypeChanged( theType );
- connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
- connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+}
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y );
- this->move( x, y );
+//=======================================================================
+// name : SMESHGUI_FilterTable::IsValid
+// Purpose : Verify validity of entered data
+//=======================================================================
+bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType ) const
+{
+ int aType = theEntityType == -1 ? GetType() : theEntityType;
+
+ Table* aTable = myTables[ aType ];
+ for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+ {
+ int aCriterion = GetCriterionType( i, aType );
+
+ if ( aCriterion == FT_RangeOfIds ||
+ aCriterion == FT_BelongToGeom ||
+ aCriterion == FT_BelongToPlane ||
+ aCriterion == FT_BelongToCylinder )
+ {
+ if ( aTable->text( i, 2 ).isEmpty() )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ), QMessageBox::Ok );
+ return false;
+ }
+ }
+ else
+ {
+ bool aRes = false;
+ aTable->blockSignals( true );
+ double aThreshold = ( int )aTable->text( i, 2 ).toDouble( &aRes );
+ aTable->blockSignals( false );
+
+ if ( !aRes && aTable->IsEditable( i, 2 ) )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ), QMessageBox::Ok );
+ return false;
+ }
+ else if ( aType == SMESH::EDGE &&
+ GetCriterionType( i, aType ) == SMESH::FT_MultiConnection &&
+ aThreshold == 1 )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "MULTIEDGES_ERROR" ), QMessageBox::Ok );
+ return false;
+ }
+ }
- this->show();
+ QTableItem* anItem = aTable->item( i, 0 );
+ if ( myAddWidgets.contains( anItem ) && !myAddWidgets[ anItem ]->IsValid() )
+ return false;
+ }
- return;
+ return true;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-// Assign filters VTK viewer and close dialog
+// name : SMESHGUI_FilterTable::SetValidity
+// Purpose : Set validity of the table
//=======================================================================
-void SMESHGUI_FilterDlg::onOk()
+void SMESHGUI_FilterTable::SetValidity( const bool isValid )
{
- if ( onApply() )
- {
- disconnect( mySMESHGUI, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- accept();
- }
-
+ myIsValid = isValid;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
+// name : SMESHGUI_FilterTable::GetType
+// Purpose : Get current entity type
//=======================================================================
-void SMESHGUI_FilterDlg::onClose()
+int SMESHGUI_FilterTable::GetType() const
{
- disconnect( mySMESHGUI, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- reject() ;
- return ;
+ return myEntityType;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
+// name : SMESHGUI_FilterTable::SetType
+// Purpose : Set current entity type
//=======================================================================
-void SMESHGUI_FilterDlg::onDeactivate()
+void SMESHGUI_FilterTable::SetType( const int type )
{
- setEnabled( false );
+ myEntityTypeGrp->setButton( type );
+ onEntityType( type );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::enterEvent
-// Purpose : Event filter
+// name : SMESHGUI_FilterTable::RestorePreviousEntityType
+// Purpose : Restore previous entity type
//=======================================================================
-void SMESHGUI_FilterDlg::enterEvent( QEvent* )
+void SMESHGUI_FilterTable::RestorePreviousEntityType()
{
-// mySMESHGUI->EmitSignalDeactivateDialog();
- setEnabled( true );
+ SetType( myEntityType );
}
+//=======================================================================
+// name : SMESHGUI_FilterTable::GetCriterionType
+// Purpose : Get type of criterion from specified row ( corresponding enums in h-file )
+//=======================================================================
+int SMESHGUI_FilterTable::GetCriterionType( const int theRow, const int theType ) const
+{
+ int aType = theType == -1 ? GetType() : theType;
+ Table* aTable = myTables[ aType ];
+ ComboItem* anItem = (ComboItem*)aTable->item( theRow, 0 );
+ return anItem != 0 ? anItem->GetValue() : FT_Undefined;
+}
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_FilterDlg::closeEvent( QCloseEvent* e )
+//=======================================================================
+// name : SMESHGUI_FilterTable::GetCriterion
+// Purpose : Get parameters of criterion from specified row
+//=======================================================================
+void SMESHGUI_FilterTable::GetCriterion( const int theRow,
+ SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType ) const
{
- onClose() ;
+ int aType = theEntityType == -1 ? GetType() : theEntityType;
+ Table* aTable = myTables[ aType ];
+
+ theCriterion.Type = ( (ComboItem*)aTable->item( theRow, 0 ) )->GetValue();
+ theCriterion.UnaryOp = ( (QCheckTableItem*)aTable->item( theRow, 3 ) )->isChecked() ? FT_LogicalNOT : FT_Undefined;
+ theCriterion.BinaryOp = theRow != aTable->numRows() - 1 ?
+ ( (ComboItem*)aTable->item( theRow, 4 ) )->GetValue() : FT_Undefined;
+ theCriterion.TypeOfElement = (ElementType)aType;
+
+ int aCriterionType = GetCriterionType( theRow, aType );
+
+ if ( aCriterionType != FT_RangeOfIds &&
+ aCriterionType != FT_BelongToGeom &&
+ aCriterionType != FT_BelongToPlane &&
+ aCriterionType != FT_BelongToCylinder )
+ {
+ theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
+ theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
+ }
+ else
+ theCriterion.ThresholdStr = aTable->text( theRow, 2 ).latin1();
+
+ QTableItem* anItem = aTable->item( theRow, 0 );
+ if ( myAddWidgets.contains( anItem ) )
+ theCriterion.Tolerance = myAddWidgets[ anItem ]->GetDouble( AdditionalWidget::Tolerance );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCriteria
-// Purpose : Retrieve list of ids from given widget
+// name : SMESHGUI_FilterTable::SetCriterion
+// Purpose : Set parameters of criterion of specified row
//=======================================================================
-void SMESHGUI_FilterDlg::getIdsFromWg( const QWidget* theWg, QValueList<int>& theRes ) const
+void SMESHGUI_FilterTable::SetCriterion( const int theRow,
+ const SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType )
{
- theRes.clear();
- if ( theWg == 0 )
+ int aType = theEntityType == -1 ? GetType() : theEntityType;
+
+ Table* aTable = myTables[ aType ];
+
+ if ( theRow > aTable->numRows() - 1 )
return;
- if ( theWg->inherits( "QListBox" ) )
+ ( (ComboItem*)aTable->item( theRow, 0 ) )->SetValue( theCriterion.Type );
+ onCriterionChanged( theRow, 0, aType );
+ ( (ComboItem*)aTable->item( theRow, 1 ) )->SetValue( theCriterion.Compare );
+ ( (QCheckTableItem*)aTable->item( theRow, 3 ) )->setChecked( theCriterion.UnaryOp == FT_LogicalNOT );
+
+ if ( theCriterion.BinaryOp != FT_Undefined )
{
- QListBox* aListBox = ( QListBox* )theWg;
- bool b;
- for ( int i = 0, n = aListBox->count(); i < n; i++ )
- {
- int anId = aListBox->text( i ).toInt( &b );
- if ( b )
- theRes.append( anId );
- }
+ if ( !aTable->IsEditable( theRow, 4 ) )
+ aTable->setItem( theRow, 4, getBinaryItem( aTable ) );
+ ( (ComboItem*)aTable->item( theRow, 4 ) )->SetValue( theCriterion.BinaryOp );
}
- else if ( theWg->inherits( "QLineEdit" ) )
+ else
+ aTable->SetEditable( false, theRow, 4 );
+
+ if ( theCriterion.Type != FT_RangeOfIds &&
+ theCriterion.Type != FT_BelongToGeom &&
+ theCriterion.Type != FT_BelongToPlane &&
+ theCriterion.Type != FT_BelongToCylinder )
+ aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
+ else
+ aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
+
+ if ( theCriterion.Compare == FT_EqualTo ||
+ theCriterion.Type == FT_BelongToPlane ||
+ theCriterion.Type == FT_BelongToCylinder )
{
- QLineEdit* aLineEdit = ( QLineEdit* )theWg;
- QString aStr = aLineEdit->text();
- QRegExp aRegExp( "(\\d+)" );
- bool b;
- int aPos = 0;
- while ( aPos >= 0 )
+ QTableItem* anItem = aTable->item( theRow, 0 );
+ if ( !myAddWidgets.contains( anItem ) )
{
- aPos = aRegExp.search( aStr, aPos );
- if ( aPos > -1 )
- {
- int anId = aRegExp.cap( 1 ).toInt( &b );
- if ( b )
- theRes.append( anId );
- aPos += aRegExp.matchedLength();
- }
+ myAddWidgets[ anItem ] = new AdditionalWidget( myWgStack );
+ myWgStack->addWidget( myAddWidgets[ anItem ] );
}
+ myAddWidgets[ anItem ]->SetDouble( AdditionalWidget::Tolerance, theCriterion.Tolerance );
}
+
+ emit CretarionChanged( theRow, aType );
+
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getSelMode
-// Purpose : Get criteria for specified type
+// name : SMESHGUI_FilterTable::Update
+// Purpose : Update table
//=======================================================================
-Selection_Mode SMESHGUI_FilterDlg::getSelMode( const int theType ) const
+void SMESHGUI_FilterTable::Update()
{
- switch ( theType )
- {
- case SMESH::NODE : return NodeSelection;
- case SMESH::EDGE : return EdgeSelection;
- case SMESH::FACE : return FaceSelection;
- case SMESH::VOLUME : return VolumeSelection;
- default : return ActorSelection;
- }
-
+ Table* aTable = myTables[ GetType() ];
+ int aCurrRow = aTable->currentRow();
+ int numRows = aTable->numRows();
+ if ( ( aCurrRow < 0 || aCurrRow >= numRows ) && numRows > 0 )
+ aTable->setCurrentCell( 0, 0 );
+ updateAdditionalWidget();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCriteria
-// Purpose : Get criteria for specified type
+// name : SMESHGUI_FilterTable::AddCriterion
+// Purpose : Add criterion with parameters
//=======================================================================
-void SMESHGUI_FilterDlg::setIdsToWg( QWidget* theWg, const QValueList<int>& theIds )
+void SMESHGUI_FilterTable::AddCriterion( const SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType )
{
- if ( theWg == 0 )
- return;
-
- if ( theWg->inherits( "QListBox" ) )
- {
- QListBox* aListBox = ( QListBox* )theWg;
- aListBox->clear();
-
- QStringList aStrList;
- QValueList<int>::const_iterator anIter;
- for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
- aStrList.append( QString( "%1" ).arg( *anIter ) );
-
- aListBox->insertStringList( aStrList );
- }
- else if ( theWg->inherits( "QLineEdit" ) )
- {
- QLineEdit* aLineEdit = ( QLineEdit* )theWg;
- QString aStr;
- QValueList<int>::const_iterator anIter;
-
- for ( anIter = theIds.begin(); anIter != theIds.end(); ++ anIter )
- aStr += QString( "%1 " ).arg( *anIter );
-
- if ( !aStr.isEmpty() )
- aStr.remove( aStr.length() - 1, 1 );
-
- aLineEdit->setText( aStr );
- }
+ int aType = theEntityType == -1 ? GetType() : theEntityType;
+ Table* aTable = myTables[ aType ];
+ addRow( aTable, aType );
+ SetCriterion( aTable->numRows() - 1, theCriterion );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCriteria
-// Purpose : Get criteria for specified type
+// name : SMESHGUI_FilterTable::NumRows
+// Purpose : Get number of criterions of current type
//=======================================================================
-const QStringList& SMESHGUI_FilterDlg::getCriteria( const int theType ) const
+int SMESHGUI_FilterTable::NumRows( const int theEntityType ) const
{
- if ( theType == SMESH::EDGE )
- {
- static QStringList aCriteria;
- if ( aCriteria.isEmpty() )
- {
- aCriteria.append( tr( "FREE_BORDERS" ) );
- aCriteria.append( tr( "MULTI_BORDERS" ) );
- aCriteria.append( tr( "LENGTH" ) );
- }
- return aCriteria;
- }
- else if ( theType == SMESH::FACE )
- {
- static QStringList aCriteria;
- if ( aCriteria.isEmpty() )
- {
- aCriteria.append( tr( "ASPECT_RATIO" ) );
- aCriteria.append( tr( "WARPING" ) );
- aCriteria.append( tr( "MINIMUM_ANGLE" ) );
- aCriteria.append( tr( "TAPER" ) );
- aCriteria.append( tr( "SKEW" ) );
- aCriteria.append( tr( "AREA" ) );
- }
- return aCriteria;
- }
- else
- {
- static QStringList aCriteria;
- return aCriteria;
- }
+ return myTables[ theEntityType == -1 ? GetType() : theEntityType ]->numRows();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCompare
-// Purpose : Get operation of comparison
+// name : SMESHGUI_FilterTable::Clear
+// Purpose : Clear current table
//=======================================================================
-const QStringList& SMESHGUI_FilterDlg::getCompare () const
+void SMESHGUI_FilterTable::Clear( const int theType )
{
- static QStringList aList;
+ int aType = theType == -1 ? GetType() : theType;
+ QTable* aTable = myTables[ aType ];
+
+ if ( aTable->numRows() == 0 )
+ return;
- if ( aList.isEmpty() )
+ while ( aTable->numRows() > 0 )
{
- aList.append( tr( "LESS_THAN" ) );
- aList.append( tr( "MORE_THAN" ) );
- aList.append( tr( "EQUAL_TO" ) );
+ removeAdditionalWidget( aTable, 0 );
+ aTable->removeRow( 0 );
}
- return aList;
+ updateBtnState();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCriterionItem
-// Purpose : Get combo table item for criteria of specified type
+// name : SMESHGUI_FilterTable::onAddBtn
+// Purpose : SLOT. Called then "Add" button pressed.
+// Adds new string to table
//=======================================================================
-QTableItem* SMESHGUI_FilterDlg::getCriterionItem( QTable* theParent , const int theType )
+void SMESHGUI_FilterTable::onAddBtn()
{
- return new QComboTableItem( theParent, getCriteria( theType ) );
+ int aType = GetType();
+ addRow( myTables[ aType ], aType );
+
+ Table* aTable = myTables[ aType ];
+ Update();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCompareItem
-// Purpose : Get combo table item for operation of comparision
+// name : SMESHGUI_FilterTable::onInsertBtn
+// Purpose : SLOT. Called then "Insert" button pressed.
+// Inserts new string before current one
//=======================================================================
-QTableItem* SMESHGUI_FilterDlg::getCompareItem( QTable* theParent )
+void SMESHGUI_FilterTable::onInsertBtn()
{
- return new QComboTableItem( theParent, getCompare() );
+ addRow( myTables[ GetType() ], GetType(), false );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getLogOpItem
-// Purpose :
+// name : SMESHGUI_FilterTable::onRemoveBtn
+// Purpose : SLOT. Called then "Remove" button pressed.
+// Removes current string from table
//=======================================================================
-QTableItem* SMESHGUI_FilterDlg::getLogOpItem( QTable* theParent )
+void SMESHGUI_FilterTable::onRemoveBtn()
{
- static QStringList aList;
- if ( aList.isEmpty() )
+ Table* aTable = myTables[ GetType() ];
+
+ if ( aTable->numRows() == 0 )
+ return;
+
+ QMemArray<int> aRows;
+ for ( int i = 0, n = aTable->numRows(); i < n; i++ )
{
- aList.append( tr( "AND" ) );
- aList.append( tr( "OR" ) );
+ if ( aTable->isRowSelected( i ) )
+ {
+ aRows.resize( aRows.size() + 1 );
+ aRows[ aRows.size() - 1 ] = i;
+ removeAdditionalWidget( aTable, i );
+ }
}
- return new QComboTableItem( theParent, aList );
-}
+ aTable->removeRows( aRows );
-//=======================================================================
-// name : SMESHGUI_FilterDlg::getNotItem
-// Purpose : Get check table item
-//=======================================================================
-QTableItem* SMESHGUI_FilterDlg::getNotItem( QTable* theParent )
-{
- return new QCheckTableItem( theParent, tr( "NOT" ) );
+ // remove control of binary logical operation from last row
+ if ( aTable->numRows() > 0 )
+ aTable->SetEditable( false, aTable->numRows() - 1, 4 );
+
+ updateBtnState();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCurrType
-// Purpose : Get current entity type
+// name : SMESHGUI_FilterTable::updateAdditionalWidget
+// Purpose : Enable/Disable widget with additonal parameters
//=======================================================================
-int SMESHGUI_FilterDlg::getCurrType() const
+void SMESHGUI_FilterTable::updateAdditionalWidget()
{
- return myType;
+ Table* aTable = myTables[ GetType() ];
+ int aRow = aTable->currentRow();
+ if ( aRow < 0 || aRow >= aTable->numRows() )
+ {
+ myWgStack->setEnabled( false );
+ return;
+ }
+
+ ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
+ bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
+ GetCriterionType( aRow ) != FT_BelongToGeom &&
+ GetCriterionType( aRow ) != FT_RangeOfIds &&
+ GetCriterionType( aRow ) != FT_FreeEdges;
+ if ( !myAddWidgets.contains( anItem ) )
+ {
+ myAddWidgets[ anItem ] = new AdditionalWidget( myWgStack );
+ myWgStack->addWidget( myAddWidgets[ anItem ] );
+ }
+
+ myWgStack->raiseWidget( myWgStack->id( myAddWidgets[ anItem ] ) );
+ myWgStack->setEnabled( toEnable );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::getCriterion
-// Purpose :
+// name : SMESHGUI_FilterTable::removeAdditionalWidget
+// Purpose : Remove widgets containing additional parameters from widget
+// stack and internal map
//=======================================================================
-int SMESHGUI_FilterDlg::getCriterion( const int theType, const int theRow ) const
+void SMESHGUI_FilterTable::removeAdditionalWidget( QTable* theTable, const int theRow )
{
- QComboTableItem* anItem = ( QComboTableItem* )myTables[ getCurrType() ]->item( theRow, 0 );
- return anItem->currentItem();
+ QTableItem* anItem = theTable->item( theRow, 0 );
+ if ( myAddWidgets.contains( anItem ) )
+ {
+ myWgStack->removeWidget( myAddWidgets[ anItem ] );
+ myAddWidgets[ anItem ]->reparent( 0, QPoint() );
+ delete myAddWidgets[ anItem ];
+ myAddWidgets.remove( anItem );
+ }
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::addRow
-// Purpose :
+// name : SMESHGUI_FilterTable::onClearBtn
+// Purpose : SLOT. Called then "Clear" button pressed.
+// Removes all strings from table
//=======================================================================
-void SMESHGUI_FilterDlg::addRow( Table* theTable, const int theType )
+void SMESHGUI_FilterTable::onClearBtn()
{
- theTable->insertRows( theTable->numRows() );
- int aCurrRow = theTable->numRows() - 1;
-
- // Criteria
- theTable->setItem( aCurrRow, 0, getCriterionItem( theTable, theType ) );
+ QTable* aTable = myTables[ GetType() ];
- // Compare
- theTable->setItem( aCurrRow, 1, getCompareItem( theTable ) );
+ if ( aTable->numRows() == 0 )
+ return;
- //Logical operation NOT
- theTable->setItem( aCurrRow, 3, getNotItem( theTable ) );
+ while ( aTable->numRows() > 0 )
+ {
+ removeAdditionalWidget( aTable, 0 );
+ aTable->removeRow( 0 );
+ }
- // Logical binary operation for previous value
- if ( aCurrRow > 0 )
- theTable->setItem( aCurrRow - 1, 4, getLogOpItem( theTable ) );
- theTable->SetEditable( false, aCurrRow, 4 );
+ updateBtnState();
+}
- onCriterionChanged( aCurrRow, 0 );
+//=======================================================================
+// name : SMESHGUI_FilterTable::onCurrentChanged()
+// Purpose : SLOT. Called when current cell changed
+//=======================================================================
+void SMESHGUI_FilterTable::onCurrentChanged( int theRow, int theCol )
+{
+ updateAdditionalWidget();
+ emit CurrentChanged( theRow, theCol );
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onAddBtn
-// Purpose : SLOT. Called then "Add" button pressed.
-// Adds new string to table
+// name : SMESHGUI_FilterTable::onCriterionChanged()
+// Purpose : Provides reaction on change of criterion
//=======================================================================
-void SMESHGUI_FilterDlg::onAddBtn()
+void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, const int entityType )
{
- // QTable
- int aType = getCurrType();
+ int aType = entityType == -1 ? GetType() : entityType;
Table* aTable = myTables[ aType ];
+ ComboItem* aCompareItem = (ComboItem*)aTable->item( row, 1 );
- addRow( aTable, aType );
+ int aCriterionType = GetCriterionType( row );
- updateBtnState();
+ if ( aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
+ aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges )
+ {
+ if ( aCompareItem->count() > 0 )
+ aCompareItem->setStringList( QStringList() );
+ aTable->SetEditable( false, row, 2 );
+ }
+ else if ( aCriterionType == SMESH::FT_RangeOfIds ||
+ aCriterionType == SMESH::FT_BelongToGeom ||
+ aCriterionType == SMESH::FT_BelongToPlane ||
+ aCriterionType == SMESH::FT_BelongToCylinder )
+ {
+ QMap<int, QString> aMap;
+ aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
+ aCompareItem->setStringList( aMap );
+ if ( !aTable->IsEditable( row, 2 ) )
+ aTable->SetEditable( true, row, 2 );
+ }
+ else
+ {
+ if ( aCompareItem->count() != 3 )
+ {
+ aCompareItem->setStringList( QStringList() );
+ aCompareItem->setStringList( getCompare() );
+ }
+
+ QString aText = aTable->text( row, 2 );
+ bool isOk = false;
+ aText.toDouble( &isOk );
+ aTable->setText( row, 2, isOk ? aText : QString("") );
+ if ( !aTable->IsEditable( row, 2 ) )
+ aTable->SetEditable( true, row, 2 );
+ }
+
+ updateAdditionalWidget();
+
+ emit CretarionChanged( row, entityType );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::onCriterionChanged()
+// Purpose : SLOT. Called then contents of table changed
+// Provides reaction on change of criterion
+//=======================================================================
+void SMESHGUI_FilterTable::onCriterionChanged( int row, int col )
+{
+ onCriterionChanged( row, col, -1 );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getFirstSelectedRow
+// Purpose : Get first selected row
+//=======================================================================
+int SMESHGUI_FilterTable::getFirstSelectedRow() const
+{
+ QTable* aTable = myTables[ GetType() ];
+ for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+ if ( aTable->isRowSelected( i ) )
+ return i;
+
+ int aRow = aTable->currentRow();
+ return aRow >= 0 && aRow < aTable->numRows() ? aRow : -1;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::addRow
+// Purpose : Add row at the end of table
+//=======================================================================
+void SMESHGUI_FilterTable::addRow( Table* theTable, const int theType, const bool toTheEnd )
+{
+ int aCurrRow = 0;
+ int aSelectedRow = getFirstSelectedRow();
+ int aCurrCol = theTable->currentColumn();
+
+ if ( toTheEnd || aSelectedRow == -1 )
+ {
+ theTable->insertRows( theTable->numRows() );
+ aCurrRow = theTable->numRows() - 1;
+ }
+ else
+ {
+ theTable->insertRows( aSelectedRow );
+ aCurrRow = aSelectedRow;
+ }
+
+ // Criteria
+ theTable->setItem( aCurrRow, 0, getCriterionItem( theTable, theType ) );
+
+ // Compare
+ theTable->setItem( aCurrRow, 1, getCompareItem( theTable ) );
+
+ // Threshold
+ //theTable->setItem( aCurrRow, 2, new QTableItem( theTable ) );
+
+ //Logical operation NOT
+ theTable->setItem( aCurrRow, 3, getUnaryItem( theTable ) );
+
+ // Logical binary operation for previous value
+ int anAddBinOpStr = -1;
+ if ( aCurrRow == theTable->numRows() - 1 )
+ anAddBinOpStr = aCurrRow - 1;
+ else if ( aCurrRow >= 0 )
+ anAddBinOpStr = aCurrRow;
+
+ if ( theTable->item( aCurrRow, 4 ) == 0 ||
+ theTable->item( aCurrRow, 4 )->rtti() != 1 )
+ {
+
+
+ if ( anAddBinOpStr >= 0 &&
+ ( theTable->item( anAddBinOpStr, 4 ) == 0 ||
+ theTable->item( anAddBinOpStr, 4 )->rtti() != 1 ) )
+ theTable->setItem( anAddBinOpStr, 4, getBinaryItem( theTable ) );
+ }
+
+ theTable->SetEditable( false, theTable->numRows() - 1, 4 );
+
+ if ( aCurrRow >=0 && aCurrRow < theTable->numRows() &&
+ aCurrCol >=0 && aCurrCol < theTable->numRows() )
+ theTable->setCurrentCell( aCurrRow, aCurrCol );
+
+ onCriterionChanged( aCurrRow, 0 );
+
+ updateBtnState();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getCriterionItem
+// Purpose : Get combo table item for criteria of specified type
+//=======================================================================
+QTableItem* SMESHGUI_FilterTable::getCriterionItem( QTable* theParent , const int theType )
+{
+ return new ComboItem( theParent, getCriteria( theType ) );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getCompareItem
+// Purpose : Get combo table item for operation of comparision
+//=======================================================================
+QTableItem* SMESHGUI_FilterTable::getCompareItem( QTable* theParent )
+{
+ return new ComboItem( theParent, getCompare() );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getBinaryItem
+// Purpose :
+//=======================================================================
+QTableItem* SMESHGUI_FilterTable::getBinaryItem( QTable* theParent )
+{
+ static QMap<int, QString> aMap;
+ if ( aMap.isEmpty() )
+ {
+ aMap[ SMESH::FT_LogicalAND ] = tr( "AND" );
+ aMap[ SMESH::FT_LogicalOR ] = tr( "OR" );
+ }
+
+ return new ComboItem( theParent, aMap );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getUnaryItem
+// Purpose : Get check table item
+//=======================================================================
+QTableItem* SMESHGUI_FilterTable::getUnaryItem( QTable* theParent )
+{
+ return new QCheckTableItem( theParent, tr( "NOT" ) );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getSupportedTypes
+// Purpose : Get all supported type
+//=======================================================================
+const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
+{
+ static QMap<int, QString> aTypes;
+ if ( aTypes.isEmpty() )
+ {
+ aTypes[ SMESH::NODE ] = tr( "NODES" );
+ aTypes[ SMESH::EDGE ] = tr( "EDGES" );
+ aTypes[ SMESH::FACE ] = tr( "FACES" );
+ aTypes[ SMESH::VOLUME ] = tr( "VOLUMES" );
+ }
+
+ return aTypes;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getCriteria
+// Purpose : Get criteria for specified type
+//=======================================================================
+const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType ) const
+{
+ if ( theType == SMESH::NODE )
+ {
+ static QMap<int, QString> aCriteria;
+ if ( aCriteria.isEmpty() )
+ {
+ aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
+ aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+ aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
+ aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ }
+ return aCriteria;
+ }
+ else if ( theType == SMESH::EDGE )
+ {
+ static QMap<int, QString> aCriteria;
+ if ( aCriteria.isEmpty() )
+ {
+ aCriteria[ SMESH::FT_FreeBorders ] = tr( "FREE_BORDERS" );
+ aCriteria[ SMESH::FT_MultiConnection ] = tr( "MULTI_BORDERS" );
+ aCriteria[ SMESH::FT_Length ] = tr( "LENGTH" );
+ aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
+ aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+ aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
+ aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ }
+ return aCriteria;
+ }
+ else if ( theType == SMESH::FACE )
+ {
+ static QMap<int, QString> aCriteria;
+ if ( aCriteria.isEmpty() )
+ {
+ aCriteria[ SMESH::FT_AspectRatio ] = tr( "ASPECT_RATIO" );
+ aCriteria[ SMESH::FT_Warping ] = tr( "WARPING" );
+ aCriteria[ SMESH::FT_MinimumAngle ] = tr( "MINIMUM_ANGLE" );
+ aCriteria[ SMESH::FT_Taper ] = tr( "TAPER" );
+ aCriteria[ SMESH::FT_Skew ] = tr( "SKEW" );
+ aCriteria[ SMESH::FT_Area ] = tr( "AREA" );
+ aCriteria[ SMESH::FT_FreeEdges ] = tr( "FREE_EDGES" );
+ aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
+ aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+ aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
+ aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ }
+ return aCriteria;
+ }
+ else if ( theType == SMESH::VOLUME )
+ {
+ static QMap<int, QString> aCriteria;
+ if ( aCriteria.isEmpty() )
+ {
+ aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
+ aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+ }
+ return aCriteria;
+ }
+ else
+ {
+ static QMap<int, QString> aCriteria;
+ return aCriteria;
+ }
+}
+
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::getCompare
+// Purpose : Get operation of comparison
+//=======================================================================
+const QMap<int, QString>& SMESHGUI_FilterTable::getCompare() const
+{
+ static QMap<int, QString> aMap;
+
+ if ( aMap.isEmpty() )
+ {
+ aMap[ SMESH::FT_LessThan ] = tr( "LESS_THAN" );
+ aMap[ SMESH::FT_MoreThan ] = tr( "MORE_THAN" );
+ aMap[ SMESH::FT_EqualTo ] = tr( "EQUAL_TO" );
+ }
+
+ return aMap;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::createTable
+// Purpose : Create table
+//=======================================================================
+SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable( QWidget* theParent,
+ const int theType )
+{
+ // create table
+ Table* aTable= new Table( 0, 5, theParent );
+
+ QHeader* aHeaders = aTable->horizontalHeader();
+
+ QFontMetrics aMetrics( aHeaders->font() );
+
+ // append spaces to the header of criteria in order to
+ // provide visibility of criterion inside comboboxes
+ static int aMaxLenCr = 0;
+
+ if ( aMaxLenCr == 0 )
+ {
+ const QMap<int, QString>& aSupportedTypes = getSupportedTypes();
+ QMap<int, QString>::const_iterator anIter;
+ for ( anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter )
+ aMaxLenCr = Max( maxLength( getCriteria( anIter.key() ), aMetrics ), aMaxLenCr );
+ }
+
+ static int aLenCr = abs( aMaxLenCr -
+ aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
+
+ static int aLenCo = abs( maxLength( getCompare(), aMetrics ) -
+ aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
+
+ QString aCrStr;
+ aCrStr.fill( ' ', aLenCr );
+ QString aCoStr;
+ aCoStr.fill( ' ', 10 );
+
+ aHeaders->setLabel( 0, tr( "CRITERION" ) + aCrStr );
+ aHeaders->setLabel( 1, tr( "COMPARE" ) + aCoStr );
+ aHeaders->setLabel( 2, tr( "THRESHOLD_VALUE" ) );
+ aHeaders->setLabel( 3, tr( "UNARY" ) );
+ aHeaders->setLabel( 4, tr( "BINARY" ) + " " );
+
+ // set geometry of the table
+ for ( int i = 0; i <= 4; i++ )
+ aTable->adjustColumn( i );
+
+ aTable->updateGeometry();
+ QSize aSize = aTable->sizeHint();
+ int aWidth = aSize.width();
+ aTable->setMinimumSize( QSize( aWidth, aWidth / 2 ) );
+ aTable->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
+
+ connect( aTable, SIGNAL( valueChanged( int, int ) ),
+ this, SLOT( onCriterionChanged( int, int ) ) );
+
+ connect( aTable, SIGNAL( currentChanged( int, int ) ),
+ this, SLOT( onCurrentChanged( int, int ) ) );
+
+ return aTable;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::updateBtnState
+// Purpose : Update button state
+//=======================================================================
+void SMESHGUI_FilterTable::updateBtnState()
+{
+ myRemoveBtn->setEnabled( myTables[ GetType() ]->numRows() > 0 );
+ myClearBtn->setEnabled( myTables[ GetType() ]->numRows() > 0 );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::SetEditable
+// Purpose : Set read only flag for tables. Show/hide buttons for work with rows
+//=======================================================================
+void SMESHGUI_FilterTable::SetEditable( const bool isEditable )
+{
+ TableMap::iterator anIter;
+ for ( anIter = myTables.begin(); anIter != myTables.end(); ++anIter )
+ {
+ anIter.data()->setReadOnly( !isEditable );
+
+ if ( isEditable )
+ {
+ myAddBtn->show();
+ myInsertBtn->show();
+ myRemoveBtn->show();
+ myClearBtn->show();
+ }
+ else
+ {
+ myAddBtn->hide();
+ myInsertBtn->hide();
+ myRemoveBtn->hide();
+ myClearBtn->hide();
+ }
+ }
+
+ QMap<QTableItem*, AdditionalWidget*>::iterator anIter2;
+ for ( anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2 )
+ anIter2.data()->SetEditable( isEditable );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::SetEnabled
+// Purpose : Enable/Disable table. Switching type of elements already enabled
+//=======================================================================
+void SMESHGUI_FilterTable::SetEnabled( const bool isEnabled )
+{
+ myAddBtn->setEnabled( isEnabled );
+ myInsertBtn->setEnabled( isEnabled );
+ myRemoveBtn->setEnabled( isEnabled );
+ myClearBtn->setEnabled( isEnabled );
+
+ if ( isEnabled )
+ updateBtnState();
+
+ QMap<QTableItem*, AdditionalWidget*>::iterator anIter2;
+ for ( anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2 )
+ anIter2.data()->setEnabled( isEnabled );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::IsEditable
+// Purpose : Verify whether table is editable
+//=======================================================================
+bool SMESHGUI_FilterTable::IsEditable() const
+{
+ return !myTables[ GetType() ]->isReadOnly();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::SetLibsEnabled
+// Purpose : Show/hide buttons for work with libraries
+//=======================================================================
+void SMESHGUI_FilterTable::SetLibsEnabled( const bool isEnabled )
+{
+ if ( isEnabled )
+ {
+ myCopyFromBtn->show();
+ myAddToBtn->show();
+ }
+ else
+ {
+ myCopyFromBtn->hide();
+ myAddToBtn->hide();
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::onCopyFromBtn
+// Purpose : SLOT. Called the "Copy from ..." button clicked
+// Display filter library dialog
+//=======================================================================
+void SMESHGUI_FilterTable::onCopyFromBtn()
+{
+ if ( myLibDlg == 0 )
+ myLibDlg = new SMESHGUI_FilterLibraryDlg(
+ this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM );
+ else
+ myLibDlg->Init( GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM );
+
+ if ( myLibDlg->exec() == QDialog::Accepted )
+ {
+ Copy( myLibDlg->GetTable() );
+ Update();
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::onAddToBtn
+// Purpose : SLOT. Called the "Add to ..." button clicked
+// Display filter library dialog
+//=======================================================================
+void SMESHGUI_FilterTable::onAddToBtn()
+{
+ if ( !IsValid( true ) )
+ return;
+ if ( myLibDlg == 0 )
+ myLibDlg = new SMESHGUI_FilterLibraryDlg(
+ this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO );
+ else
+ myLibDlg->Init( GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO );
+
+ myLibDlg->SetTable( this );
+
+ myLibDlg->exec();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::Copy
+// Purpose : Initialise table with values of other table
+//=======================================================================
+void SMESHGUI_FilterTable::Copy( const SMESHGUI_FilterTable* theTable )
+{
+ Clear();
+
+ for ( int i = 0, n = theTable->NumRows(); i < n; i++ )
+ {
+ SMESH::Filter::Criterion aCriterion = SMESHGUI_FilterDlg::createCriterion();
+ theTable->GetCriterion( i, aCriterion );
+ AddCriterion( aCriterion );
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::CurrentCell
+// Purpose : Returns current cell
+//=======================================================================
+bool SMESHGUI_FilterTable::CurrentCell( int& theRow, int& theCol ) const
+{
+ theRow = myTables[ GetType() ]->currentRow();
+ theCol = myTables[ GetType() ]->currentColumn();
+ return theRow >= 0 && theCol >= 0;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::SetText
+// Purpose : Set text and internal value in cell of threshold value
+//=======================================================================
+void SMESHGUI_FilterTable::SetThreshold( const int theRow,
+ const QString& theText,
+ const int theEntityType )
+{
+ Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
+ aTable->setText( theRow, 2, theText );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterTable::SetText
+// Purpose : Get text and internal value from cell of threshold value
+//=======================================================================
+bool SMESHGUI_FilterTable::GetThreshold( const int theRow,
+ QString& theText,
+ const int theEntityType )
+{
+ Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
+ QTableItem* anItem = aTable->item( theRow, 2 );
+ if ( anItem != 0 )
+ {
+ theText = anItem->text();
+ return true;
+ }
+ else
+ return false;
+}
+
+/*
+ Class : SMESHGUI_FilterDlg
+ Description : Dialog to specify filters for VTK viewer
+*/
+
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget* theParent,
+ const QValueList<int>& theTypes,
+ const char* theName )
+: QDialog( theParent, theName, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ construct( theTypes );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget* theParent,
+ const int theType,
+ const char* theName )
+: QDialog( theParent, theName, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ QValueList<int> aTypes;
+ aTypes.append( theType );
+ construct( aTypes );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::construct
+// Purpose : Construct dialog ( called by constructor )
+//=======================================================================
+void SMESHGUI_FilterDlg::construct( const QValueList<int>& theTypes )
+{
+ myTypes = theTypes;
+
+ setCaption( tr( "CAPTION" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ myMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( myMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( myMainFrame, 1 );
+ Init( myTypes );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_FilterDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
+ aMainFrame->setFrameStyle( QFrame::NoFrame );
+ aMainFrame->setInsideMargin( 0 );
+
+ // filter frame
+
+ myTable = new SMESHGUI_FilterTable( aMainFrame, myTypes );
+ myTable->SetLibsEnabled( true );
+
+ QFrame* aLine = new QFrame( myTable->GetTableGrp() );
+ aLine->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+
+ mySetInViewer = new QCheckBox( tr( "SET_IN_VIEWER" ), myTable->GetTableGrp() );
+ mySetInViewer->setChecked( true );
+
+ // other controls
+ mySourceGrp = createSourceGroup( aMainFrame );
+
+ connect( myTable, SIGNAL( CretarionChanged( const int, const int ) ),
+ SLOT( onCriterionChanged( const int, const int ) ) );
+
+ connect( myTable, SIGNAL( CurrentChanged( int, int ) ),
+ SLOT( onCurrentChanged( int, int ) ) );
+
+ return aMainFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::createSourceFrame
+// Purpose : Create frame containing source radio button
+//=======================================================================
+QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup( QWidget* theParent )
+{
+ QButtonGroup* aGrp = new QButtonGroup( 1, Qt::Vertical, tr( "SOURCE" ), theParent );
+
+ QRadioButton* aMeshBtn = new QRadioButton( tr( "MESH" ), aGrp );
+ QRadioButton* aSelBtn = new QRadioButton( tr( "SELECTION" ), aGrp );
+ QRadioButton* aGrpBtn = new QRadioButton( tr( "CURRENT_GROUP" ), aGrp );
+
+ aGrp->insert( aMeshBtn, Mesh );
+ aGrp->insert( aSelBtn, Selection );
+ aGrp->insert( aGrpBtn, Dialog );
+
+ aGrp->setButton( Selection );
+
+ return aGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::updateMainButtons
+// Purpose : Update visibility of main buttons ( OK, Cancel, Close ... )
+//=======================================================================
+void SMESHGUI_FilterDlg::updateMainButtons()
+{
+ if ( myTypes.count() == 1 )
+ {
+ myButtons[ BTN_Cancel ]->show();
+ myButtons[ BTN_Apply ]->hide();
+ myButtons[ BTN_Close ]->hide();
+ }
+ else
+ {
+ myButtons[ BTN_Cancel ]->hide();
+ myButtons[ BTN_Apply ]->show();
+ myButtons[ BTN_Close ]->show();
+ }
+
+// updateGeometry();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_FilterDlg::createButtonFrame( QWidget* theParent )
+{
+ QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+
+ myButtons[ BTN_OK ] = new QPushButton( tr( "SMESH_BUT_OK" ), aGrp );
+ myButtons[ BTN_Apply ] = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
+
+ QLabel* aLbl = new QLabel( aGrp );
+ aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ myButtons[ BTN_Cancel ] = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+ myButtons[ BTN_Close ] = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aGrp );
+
+ connect( myButtons[ BTN_OK ], SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myButtons[ BTN_Cancel ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myButtons[ BTN_Close ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myButtons[ BTN_Apply ], SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ updateMainButtons();
+
+ return aGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::Init( const int type )
+{
+ QValueList<int> aTypes;
+ aTypes.append( type );
+ Init( aTypes );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::Init( const QValueList<int>& theTypes )
+{
+ mySourceWg = 0;
+ mySelection = 0;
+ myTypes = theTypes;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+ myIObjects.Clear();
+ myIsSelectionChanged = false;
+
+ myTable->Init( theTypes );
+
+ // set caption
+ if ( theTypes.count() == 1 )
+ {
+ int aType = theTypes.first();
+ if ( aType == SMESH::NODE ) setCaption( tr( "NODES_TLT" ) );
+ else if ( aType == SMESH::EDGE ) setCaption( tr( "EDGES_TLT" ) );
+ else if ( aType == SMESH::FACE ) setCaption( tr( "FACES_TLT" ) );
+ else if ( aType == SMESH::VOLUME ) setCaption( tr( "VOLUMES_TLT" ) );
+ }
+ else
+ setCaption( tr( "TLT" ) );
+
+ qApp->processEvents();
+ updateGeometry();
+ adjustSize();
+ setEnabled( true );
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+
+ connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+
+ updateMainButtons();
+ updateSelection();
+
+ // Initialise filter table with values of previous filter
+ QValueList<int>::const_iterator anIter;
+ for ( anIter = theTypes.begin(); anIter != theTypes.end(); ++anIter )
+ {
+ myTable->Clear( *anIter );
+ if ( !myFilter[ *anIter ]->_is_nil() )
+ {
+ SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
+ if ( myFilter[ *anIter ]->GetCriteria( aCriteria ) )
+ {
+ for ( int i = 0, n = aCriteria->length(); i < n; i++ )
+ myTable->AddCriterion( aCriteria[ i ], *anIter );
+ }
+ }
+ }
+
+ if ( myInsertState.contains( theTypes.first() ) )
+ mySetInViewer->setChecked( myInsertState[ theTypes.first() ] );
+ else
+ mySetInViewer->setChecked( true );
+ if ( myApplyToState.contains( theTypes.first() ) )
+ mySourceGrp->setButton( myApplyToState[ theTypes.first() ] );
+ else
+ mySourceGrp->setButton( Selection );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+// Assign filters VTK viewer and close dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::onOk()
+{
+ if ( onApply() )
+ {
+ mySelection->ClearFilters();
+ disconnect( mySMESHGUI, 0, this, 0 );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ accept();
+ emit Accepted();
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::onClose()
+{
+ // Restore previously selected object
+ if ( mySelection )
+ {
+ mySelection->ClearFilters();
+ mySelection->Clear();
+ SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter( myIObjects );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ mySelection->AddIObject( anIter.Key() );
+
+ TColStd_MapOfInteger aResMap;
+ const TColStd_IndexedMapOfInteger& anIndMap = anIter.Value();
+ for ( int i = 1, n = anIndMap.Extent(); i <= n; i++ )
+ aResMap.Add( anIndMap( i ) );
+
+ mySelection->AddOrRemoveIndex( anIter.Key(), aResMap, false );
+ }
+ }
+
+ disconnect( mySMESHGUI, 0, this, 0 );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+ return ;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_FilterDlg::onDeactivate()
+{
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_FilterDlg::enterEvent( QEvent* )
+{
+// mySMESHGUI->EmitSignalDeactivateDialog();
+ setEnabled( true );
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_FilterDlg::closeEvent( QCloseEvent* e )
+{
+ onClose() ;
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onCriterionChanged()
-// Purpose : SLOT. Called then contents of table changed
-// Provides reaction on change of criterion
+// name : SMESHGUI_FilterDlg::getIdsFromWg
+// Purpose : Retrieve list of ids from given widget
//=======================================================================
-void SMESHGUI_FilterDlg::onCriterionChanged( int row, int col )
+void SMESHGUI_FilterDlg::getIdsFromWg( const QWidget* theWg, QValueList<int>& theRes ) const
{
- int aType = getCurrType();
- if ( aType != SMESH::EDGE || col != 0 )
+ theRes.clear();
+ if ( theWg == 0 )
return;
- Table* aTable = myTables[ aType ];
- QComboTableItem* aCompareItem = (QComboTableItem*)aTable->item( row, 1 );
-
- if ( getCriterion( aType, row ) != FreeBorders )
+ if ( theWg->inherits( "QListBox" ) )
{
- if ( aCompareItem->count() == 0 )
- aCompareItem->setStringList( getCompare() );
-
- QString aText = aTable->text( row, 2 );
- aTable->SetEditable( true, row, 2 );
- aTable->setText( row, 2, aText );
+ QListBox* aListBox = ( QListBox* )theWg;
+ bool b;
+ for ( int i = 0, n = aListBox->count(); i < n; i++ )
+ {
+ int anId = aListBox->text( i ).toInt( &b );
+ if ( b )
+ theRes.append( anId );
+ }
}
- else
+ else if ( theWg->inherits( "QLineEdit" ) )
{
- if ( aCompareItem->count() > 0 )
- aCompareItem->setStringList( QStringList() );
- aTable->SetEditable( false, row, 2 );
+ QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+ QString aStr = aLineEdit->text();
+ QRegExp aRegExp( "(\\d+)" );
+ bool b;
+ int aPos = 0;
+ while ( aPos >= 0 )
+ {
+ aPos = aRegExp.search( aStr, aPos );
+ if ( aPos > -1 )
+ {
+ int anId = aRegExp.cap( 1 ).toInt( &b );
+ if ( b )
+ theRes.append( anId );
+ aPos += aRegExp.matchedLength();
+ }
+ }
}
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onRemoveBtn
-// Purpose : SLOT. Called then "Remove" button pressed.
-// Removes current string from table
+// name : SMESHGUI_FilterDlg::getSelMode
+// Purpose : Get selection mode of specified type
//=======================================================================
-void SMESHGUI_FilterDlg::onRemoveBtn()
+Selection_Mode SMESHGUI_FilterDlg::getSelMode( const int theType ) const
{
- Table* aTable = myTables[ getCurrType() ];
-
- if ( aTable->numRows() == 0 )
- return;
-
- QMemArray<int> aRows;
- for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+ switch ( theType )
{
- if ( aTable->isRowSelected( i ) )
- {
- aRows.resize( aRows.size() + 1 );
- aRows[ aRows.size() - 1 ] = i;
- }
+ case SMESH::NODE : return NodeSelection;
+ case SMESH::EDGE : return EdgeSelection;
+ case SMESH::FACE : return FaceSelection;
+ case SMESH::VOLUME : return VolumeSelection;
+ default : return ActorSelection;
}
- aTable->removeRows( aRows );
-
- // remove control of binary logical operation from last row
- if ( aTable->numRows() > 0 )
- aTable->SetEditable( false, aTable->numRows() - 1, 4 );
-
- updateBtnState();
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::onClearBtn
-// Purpose : SLOT. Called then "Clear" button pressed.
-// Removes all strings from table
+// name : SMESHGUI_FilterDlg::setIdsToWg
+// Purpose : Insert identifiers in specified widgets
//=======================================================================
-void SMESHGUI_FilterDlg::onClearBtn()
+void SMESHGUI_FilterDlg::setIdsToWg( QWidget* theWg, const QValueList<int>& theIds )
{
- QTable* aTable = myTables[ getCurrType() ];
-
- if ( aTable->numRows() == 0 )
+ if ( theWg == 0 )
return;
- while ( aTable->numRows() > 0 )
- aTable->removeRow( 0 );
+ if ( theWg->inherits( "QListBox" ) )
+ {
+ QListBox* aListBox = ( QListBox* )theWg;
+ aListBox->clear();
- updateBtnState();
-}
+ QStringList aStrList;
+ QValueList<int>::const_iterator anIter;
+ for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
+ aStrList.append( QString( "%1" ).arg( *anIter ) );
-//=======================================================================
-// name : SMESHGUI_FilterDlg::updateBtnState
-// Purpose : Update button state
-//=======================================================================
-void SMESHGUI_FilterDlg::updateBtnState()
-{
- myRemoveBtn->setEnabled( myTables[ getCurrType() ]->numRows() > 0 );
- myClearBtn->setEnabled( myTables[ getCurrType() ]->numRows() > 0 );
+ aListBox->insertStringList( aStrList );
+ }
+ else if ( theWg->inherits( "QLineEdit" ) )
+ {
+ QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+ QString aStr;
+ QValueList<int>::const_iterator anIter;
+
+ for ( anIter = theIds.begin(); anIter != theIds.end(); ++ anIter )
+ aStr += QString( "%1 " ).arg( *anIter );
+
+ if ( !aStr.isEmpty() )
+ aStr.remove( aStr.length() - 1, 1 );
+
+ aLineEdit->setText( aStr );
+ }
}
//=======================================================================
//=======================================================================
bool SMESHGUI_FilterDlg::isValid() const
{
- Table* aTable = myTables[ getCurrType() ];
- for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+ if ( !myTable->IsValid() )
+ return false;
+
+ for ( int i = 0, n = myTable->NumRows(); i < n; i++ )
{
- bool isEditable = aTable->IsEditable( i ,2 );
- bool aRes = false;
- int aThreshold = ( int )aTable->text( i, 2 ).toDouble( &aRes );
- if ( isEditable && !aRes )
- {
- QMessageBox::information( mySMESHGUI->GetDesktop(),
- tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ),
- QMessageBox::Ok );
- return false;
- }
- else if ( getCurrType() == SMESH::EDGE &&
- getCriterion( SMESH::EDGE, i ) == MultiBorders &&
- aThreshold == 1 )
+ int aType = myTable->GetCriterionType( i );
+ if ( aType == FT_BelongToGeom ||
+ aType == FT_BelongToPlane ||
+ aType == FT_BelongToCylinder )
{
- QMessageBox::information( mySMESHGUI->GetDesktop(),
- tr( "SMESH_INSUFFICIENT_DATA" ), tr( "MULTIEDGES_ERROR" ),
- QMessageBox::Ok );
- return false;
+ QString aName;
+ myTable->GetThreshold( i, aName );
+
+ SALOMEDS::Study::ListOfSObject_var aList = SMESHGUI::GetSMESHGUI()->GetActiveStudy()->
+ getStudyDocument()->FindObjectByName( aName.latin1(), "GEOM" );
+ if ( aList->length() == 0 )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "BAD_SHAPE_NAME" ).arg( aName ), QMessageBox::Ok );
+ return false;
+ }
+
+ if ( aType == FT_BelongToCylinder || aType == FT_BelongToPlane )
+ {
+ GEOM::GEOM_Object_var aGeomObj =
+ GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
+ if ( !aGeomObj->_is_nil() )
+ {
+ TopoDS_Shape aFace;
+ if ( !GEOMBase::GetShape( aGeomObj, aFace ) ||
+ aFace.IsNull() ||
+ aFace.ShapeType() != TopAbs_FACE )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_FACE" ).arg( aName ), QMessageBox::Ok );
+ return false;
+ }
+
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface( TopoDS::Face( aFace ) );
+ if ( aSurf.IsNull() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_FACE" ).arg( aName ), QMessageBox::Ok );
+ return false;
+ }
+
+ if ( aType == FT_BelongToPlane && !aSurf->IsKind( STANDARD_TYPE( Geom_Plane ) ) )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_PLANE" ).arg( aName ), QMessageBox::Ok );
+ return false;
+ }
+
+ if ( aType == FT_BelongToCylinder && !aSurf->IsKind( STANDARD_TYPE( Geom_CylindricalSurface ) ) )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SHAPE_IS_NOT_A_CYLINDER" ).arg( aName ), QMessageBox::Ok );
+ return false;
+ }
+ }
+ }
}
}
return true;
}
-//=======================================================================
-// name : SMESHGUI_FilterDlg::GetResultIds
-// Purpose : Get filtered ids
-//=======================================================================
-/*void SMESHGUI_FilterDlg::GetResultIds( SMESH::SMESH_Mesh_ptr theMesh,
- QValueList<int>& theIds ) const
-{
- if ( !myPredicate->_is_nil() )
- theIds = myInputIds;
- else
- myPredicate->SetMesh( theMesh );
-
- theIds.clear();
- QValueList<int>::const_iterator anIter;
- for ( anIter = myInputIds.begin(); anIter != myInputIds.end(); ++anIter )
- if ( myPredicate->IsSatisfy( *anIter ) )
- theIds.append( *anIter );
-}
-*/
-
//=======================================================================
// name : SMESHGUI_FilterDlg::SetSourceWg
// Purpose : Set widget of parent dialog containing idsto be filtered if
//=======================================================================
void SMESHGUI_FilterDlg::SetSelection( SALOME_Selection* theSel )
{
+ if ( mySelection )
+ disconnect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
+
mySelection = theSel;
+
+ if ( mySelection )
+ {
+ myIObjects.Clear();
+ const SALOME_ListIO& anObjs = mySelection->StoredIObjects();
+ SALOME_ListIteratorOfListIO anIter( anObjs );
+ for ( ;anIter.More(); anIter.Next() )
+ {
+ TColStd_IndexedMapOfInteger aMap;
+ mySelection->GetIndex( anIter.Value(), aMap );
+ myIObjects.Bind( anIter.Value(), aMap );
+ }
+
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+
+ updateSelection();
+ }
+ else
+ myIObjects.Clear();
}
//=======================================================================
try
{
- int aCurrType = getCurrType();
+ int aCurrType = myTable->GetType();
- SMESH::Predicate_ptr aPredicate = createPredicate( aCurrType );
+ if ( !createFilter( aCurrType ) )
+ return false;
- if ( mySetInViewer->isChecked() )
- insertFilterInViewer( aPredicate );
+ insertFilterInViewer();
- if ( !aPredicate->_is_nil() )
+ if ( !myFilter[ aCurrType ]->GetPredicate()->_is_nil() )
{
QValueList<int> aResultIds;
- filterSource( aCurrType, aPredicate, aResultIds );
+ filterSource( aCurrType, aResultIds );
selectInViewer( aCurrType, aResultIds );
}
+
+ myInsertState[ aCurrType ] = mySetInViewer->isChecked();
+ myApplyToState[ aCurrType ] = mySourceGrp->id( mySourceGrp->selected() );
+
}
catch( const SALOME::SALOME_Exception& S_ex )
{
}
//=======================================================================
-// name : SMESHGUI_FilterDlg::createPredicate
+// name : SMESHGUI_FilterDlg::createFilter
// Purpose : Create predicate for given type
//=======================================================================
-SMESH::Predicate_ptr SMESHGUI_FilterDlg::createPredicate( const int theType )
+bool SMESHGUI_FilterDlg::createFilter( const int theType )
{
- SMESH::FilterManager_ptr aFilterMgr = mySMESHGUI->GetFilterMgr();
+ SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
if ( aFilterMgr->_is_nil() )
- return SMESH::Predicate::_nil();
-
- QTable* aTable = myTables[ theType ];
- if ( aTable == 0 )
- return SMESH::Predicate::_nil();
-
- // CREATE two lists ( PREDICATES and LOG OP )
-
- // Criterion
- QValueList<SMESH::Predicate_ptr> aPredicates;
- QValueList<int> aLogOps;
- for ( int i = 0, n = aTable->numRows(); i < n; i++ )
- {
- int aCriterion = getCriterion( theType, i );
-
- SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
- SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
-
- if ( theType == SMESH::EDGE )
- {
- switch ( aCriterion )
- {
- case FreeBorders:
- aPredicate = aFilterMgr->CreateFreeBorders();
- break;
- case MultiBorders:
- aFunctor = aFilterMgr->CreateMultiConnection();
- break;
- case Length:
- aFunctor = aFilterMgr->CreateLength();
- break;
- default:
- continue;
- }
- }
- else
- {
- switch ( aCriterion )
- {
- case AspectRatio:
- aFunctor = aFilterMgr->CreateAspectRatio();
- break;
- case Warping:
- aFunctor = aFilterMgr->CreateWarping();
- break;
- case MinimumAngle:
- aFunctor = aFilterMgr->CreateMinimumAngle();
- break;
- case Taper:
- aFunctor = aFilterMgr->CreateTaper();
- break;
- case Skew:
- aFunctor = aFilterMgr->CreateSkew();
- break;
- case Area:
- aFunctor = aFilterMgr->CreateArea();
- break;
- default:
- continue;
- }
- }
-
- // Comparator
- if ( !aFunctor->_is_nil() && aPredicate->_is_nil() )
- {
- QComboTableItem* aCombo = (QComboTableItem*)aTable->item( i, 1 );
- int aCompareOp = aCombo->currentItem();
- double aThreshold = aTable->text( i, 2 ).toDouble();
-
- SMESH::Comparator_ptr aComparator = SMESH::Comparator::_nil();
-
- if ( aCompareOp == LessThan )
- aComparator = aFilterMgr->CreateLessThan();
- else if ( aCompareOp == MoreThan )
- aComparator = aFilterMgr->CreateMoreThan();
- else if ( aCompareOp == EqualTo )
- aComparator = aFilterMgr->CreateEqualTo();
- else
- continue;
-
- aComparator->SetNumFunctor( aFunctor );
- aComparator->SetMargin( aThreshold );
-
- aPredicate = aComparator;
- }
-
- // Logical not
- QCheckTableItem* anItem = (QCheckTableItem*)aTable->item( i, 3 );
- if ( anItem->isChecked() )
- {
- SMESH::LogicalNOT_ptr aNotPred = aFilterMgr->CreateLogicalNOT();
- aNotPred->SetPredicate( aPredicate );
- aPredicate = aNotPred;
- }
-
- // logical op
- int aLogOp = ( i == n - 1 ) ? LO_Undefined
- : ( (QComboTableItem*)aTable->item( i, 4 ) )->currentItem();
- aPredicates.append( aPredicate );
- aLogOps.append( aLogOp );
-
- } // for
-
- // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
-
- // combine all "AND" operations
-
- QValueList<SMESH::Predicate_ptr> aResList;
+ return false;
- QValueList<SMESH::Predicate_ptr>::iterator aPredIter;
- QValueList<int>::iterator aLogOpIter;
+ int n = myTable->NumRows();
- SMESH::Predicate_ptr aPrevPredicate = SMESH::Predicate::_nil();
- int aPrevLogOp = LO_Undefined;
+ SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
+ aCriteria->length( n );
- for ( aPredIter = aPredicates.begin(), aLogOpIter = aLogOps.begin();
- aPredIter != aPredicates.end() && aLogOpIter != aLogOps.end();
- ++aPredIter, ++aLogOpIter )
+ long aPrecision = -1;
+ if ( QAD_CONFIG->hasSetting( "SMESH:ControlsPrecision" ) )
{
- int aCurrLogOp = *aLogOpIter;
-
- SMESH::Predicate_ptr aCurrPred = SMESH::Predicate::_nil();
-
- if ( aPrevLogOp == LO_And )
- {
-
- SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalAND();
- aBinaryPred->SetPredicate1( aPrevPredicate );
- aBinaryPred->SetPredicate2( *aPredIter );
- aCurrPred = aBinaryPred;
- }
- else
- aCurrPred = *aPredIter;
-
- if ( aCurrLogOp != LO_And )
- aResList.append( aCurrPred );
-
- aPrevPredicate = aCurrPred;
- aPrevLogOp = aCurrLogOp;
+ QString aStr = QAD_CONFIG->getSetting( "SMESH:ControlsPrecision" );
+ bool isOk = false;
+ int aVal = aStr.toInt( &isOk );
+ if ( isOk )
+ aPrecision = aVal;
}
-
- // combine all "OR" operations
-
- SMESH::Predicate_ptr aResPredicate = SMESH::Predicate::_nil();
-
- if ( aResList.count() == 1 )
- aResPredicate = aResList.first();
- else if ( aResList.count() > 1 )
+
+ for ( CORBA::ULong i = 0; i < n; i++ )
{
- QValueList<SMESH::Predicate_ptr>::iterator anIter = aResList.begin();
- aResPredicate = *anIter;
- anIter++;
- for ( ; anIter != aResList.end(); ++anIter )
- {
- SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalOR();
- aBinaryPred->SetPredicate1( aResPredicate );
- aBinaryPred->SetPredicate2( *anIter );
- aResPredicate = aBinaryPred;
- }
+ SMESH::Filter::Criterion aCriterion = createCriterion();
+ myTable->GetCriterion( i, aCriterion );
+ aCriterion.Precision = aPrecision;
+ aCriteria[ i ] = aCriterion;
}
- return aResPredicate;
+ myFilter[ theType ] = aFilterMgr->CreateFilter();
+ myFilter[ theType ]->SetCriteria( aCriteria.inout() );
+
+ return true;
}
//=======================================================================
// name : SMESHGUI_FilterDlg::insertFilterInViewer
// Purpose : Insert filter in viewer
//=======================================================================
-void SMESHGUI_FilterDlg::insertFilterInViewer( SMESH::Predicate_ptr thePred )
+void SMESHGUI_FilterDlg::insertFilterInViewer()
{
- VTKViewer_InteractorStyleSALOME* aStyle = ((VTKViewer_ViewFrame*)mySMESHGUI->GetActiveStudy()->
- getActiveStudyFrame()->getRightFrame()->getViewFrame())->
- getRWInteractor()->GetInteractorStyleSALOME();
-
- if ( thePred->_is_nil() )
- {
- if ( myType == SMESH::EDGE )
- aStyle->RemoveEdgeFilter();
- else if ( myType == SMESH::FACE )
- aStyle->RemoveFaceFilter();
- }
- else
+ if ( VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle() )
{
- Handle(SMESHGUI_Filter) aFilter = new SMESHGUI_Filter();
- aFilter->SetPredicate( thePred );
- if ( myType == SMESH::EDGE )
- aStyle->SetEdgeFilter( aFilter );
- else if ( myType == SMESH::FACE )
- aStyle->SetFaceFilter( aFilter );
+ SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
+
+ if ( myFilter[ myTable->GetType() ]->_is_nil() ||
+ myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
+ !mySetInViewer->isChecked() )
+ SMESH::RemoveFilter( getFilterId( anEntType ), aStyle );
+ else
+ {
+ Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter();
+ aFilter->SetPredicate( myFilter[ myTable->GetType() ]->GetPredicate() );
+ SMESH::SetFilter( aFilter, aStyle );
+ }
}
}
// Purpose : Filter source ids
//=======================================================================
void SMESHGUI_FilterDlg::filterSource( const int theType,
- SMESH::Predicate_ptr thePred,
QValueList<int>& theResIds )
{
theResIds.clear();
-
+ if ( myFilter[ theType ]->_is_nil() )
+ return;
+
int aSourceId = mySourceGrp->id( mySourceGrp->selected() );
if ( aSourceId == Mesh )
{
if ( myMesh->_is_nil() )
return;
- SMESH::FilterManager_ptr aFilterMgr = mySMESHGUI->GetFilterMgr();
- SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
- aFilter->SetPredicate( thePred );
- SMESH::long_array_var anIds = aFilter->GetElementsId( myMesh );
+ SMESH::long_array_var anIds = myFilter[ theType ]->GetElementsId( myMesh );
for ( int i = 0, n = anIds->length(); i < n; i++ )
theResIds.append( anIds[ i ] );
}
else if ( aSourceId == Selection )
{
- filterSelectionSource( theType, thePred, theResIds );
+ filterSelectionSource( theType, theResIds );
}
else if ( aSourceId == Dialog )
{
// retrieve ids from dialog
QValueList<int> aDialogIds;
getIdsFromWg( mySourceWg, aDialogIds );
-
+
if ( myMesh->_is_nil() )
{
theResIds = aDialogIds;
}
// filter ids
- thePred->SetMesh( myMesh );
+ SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate();
+ aPred->SetMesh( myMesh );
QValueList<int>::const_iterator anIter;
for ( anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter )
- if ( thePred->IsSatisfy( *anIter ) )
+ if ( aPred->IsSatisfy( *anIter ) )
theResIds.append( *anIter );
// set ids to the dialog
// Purpose : Filter source selection
//=======================================================================
void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
- SMESH::Predicate_ptr thePred,
QValueList<int>& theResIds )
{
theResIds.clear();
// Create map of entities to be filtered
TColStd_MapOfInteger aToBeFiltered;
- Standard_Boolean aRes = false;
- SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
-
+ SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter( myIObjects );
+
for ( ; anIter.More(); anIter.Next() )
{
// process sub mesh
- SMESH::SMESH_subMesh_ptr aSubMesh = mySMESHGUI->ConvertIOinSubMesh( anIter.Value(), aRes );
- if ( aRes && !aSubMesh->_is_nil() )
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Key() );
+ if ( !aSubMesh->_is_nil() )
{
if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
{
}
// process group
- SMESH::SMESH_Group_ptr aGroup = mySMESHGUI->ConvertIOinSMESHGroup( anIter.Value(), aRes );
- if ( aRes && !aGroup->_is_nil() )
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>( anIter.Key() );
+ if ( !aGroup->_is_nil() )
{
if ( aGroup->GetType() == theType && aGroup->GetMesh()->GetId() == myMesh->GetId() )
{
}
// process mesh
- SMESH::SMESH_Mesh_ptr aMeshPtr = mySMESHGUI->ConvertIOinMesh( anIter.Value(), aRes );
- if ( aRes && !aMeshPtr->_is_nil() && aMeshPtr->GetId() == myMesh->GetId() )
+ SMESH::SMESH_Mesh_var aMeshPtr = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIter.Key() );
+ if ( !aMeshPtr->_is_nil() && aMeshPtr->GetId() == myMesh->GetId() )
{
- TColStd_MapOfInteger aVtkMap;
- mySelection->GetIndex( anIter.Value(), aVtkMap );
+ const TColStd_IndexedMapOfInteger& aSelMap = anIter.Value();
- if ( aVtkMap.Extent() > 0 )
+ if ( aSelMap.Extent() > 0 )
{
- SMESH_Actor *anActor = mySMESHGUI->FindActorByEntry(
- anIter.Value()->getEntry(), aRes, true );
- if ( aRes && anActor != 0 )
+ if(SMESH_Actor *anActor = SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
{
- TColStd_MapIteratorOfMapOfInteger aVtkMapIter( aVtkMap );
- for ( ; aVtkMapIter.More(); aVtkMapIter.Next() )
- aToBeFiltered.Add( theType == SMESH::NODE
- ? anActor->GetNodeObjId( aVtkMapIter.Key() )
- : anActor->GetElemObjId( aVtkMapIter.Key() ) );
+ for ( int i = 1; i <= aSelMap.Extent(); i++ )
+ aToBeFiltered.Add( aSelMap(i) );
}
}
}
}
// Filter entities
- thePred->SetMesh( myMesh );
+ SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate();
+ aPred->SetMesh( myMesh );
TColStd_MapIteratorOfMapOfInteger aResIter( aToBeFiltered );
for ( ; aResIter.More(); aResIter.Next() )
- if ( thePred->IsSatisfy( aResIter.Key() ) )
+ if ( aPred->IsSatisfy( aResIter.Key() ) )
theResIds.append( aResIter.Key() );
}
if ( mySelection == 0 || myMesh->_is_nil() )
return;
+ mySelection->ClearFilters();
+
// Set new selection mode if necessary
Selection_Mode aSelMode = getSelMode( theType );
if ( aSelMode != mySelection->SelectionMode() )
mySelection->ClearIObjects();
mySelection->ClearFilters();
if ( aSelMode == NodeSelection )
- mySMESHGUI->ViewNodes();
+ SMESH::SetPointRepresentation(true);
QAD_Application::getDesktop()->SetSelectionMode( aSelMode );
}
- Standard_Boolean aRes = false;
- SMESH_Actor* anActor = mySMESHGUI->FindActor( myMesh, aRes, true );
- if ( !aRes || anActor == 0 || !anActor->hasIO() )
+ // Clear selection
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+ if ( !anActor || !anActor->hasIO() )
return;
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
mySelection->ClearIObjects();
mySelection->AddIObject( anIO, false );
+ // Remove filter corresponding to the current type from viewer
+ int aType = myTable->GetType();
+ int aFilterId = SMESHGUI_UnknownFilter;
+ if ( aType == SMESH::EDGE ) aFilterId = SMESHGUI_EdgeFilter;
+ else if ( aType == SMESH::FACE ) aFilterId = SMESHGUI_FaceFilter;
+ else if ( aType == SMESH::VOLUME ) aFilterId = SMESHGUI_VolumeFilter;
+ Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter( aFilterId );
+ SMESH::RemoveFilter( aFilterId );
+
+ // get vtk ids
TColStd_MapOfInteger aMap;
QValueList<int>::const_iterator anIter;
for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
{
- std::vector<int> aVtkList = anActor->GetElemVtkId( *anIter );
- std::vector<int>::iterator it;
- for ( it = aVtkList.begin(); it != aVtkList.end(); ++it )
- aMap.Add( *it );
+ aMap.Add( *anIter );
}
+ // Set new selection
mySelection->AddOrRemoveIndex( anIO, aMap, false, true );
+
+ // insert previously stored filter in viewer if necessary
+ if ( !aFilter.IsNull() )
+ SMESH::SetFilter( aFilter );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::createCriterion
+// Purpose : Create criterion structure with default values
+//=======================================================================
+SMESH::Filter::Criterion SMESHGUI_FilterDlg::createCriterion()
+{
+ SMESH::Filter::Criterion aCriterion;
+
+ aCriterion.Type = FT_Undefined;
+ aCriterion.Compare = FT_Undefined;
+ aCriterion.Threshold = 0;
+ aCriterion.UnaryOp = FT_Undefined;
+ aCriterion.BinaryOp = FT_Undefined;
+ aCriterion.ThresholdStr = "";
+ aCriterion.TypeOfElement = SMESH::ALL;
+
+ return aCriterion;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onSelectionDone
+// Purpose : SLOT called when selection changed.
+// If current cell corresponds to the threshold value of
+// BelongToGeom criterion name of selected object is set in this cell
+//=======================================================================
+void SMESHGUI_FilterDlg::onSelectionDone()
+{
+ int aRow, aCol;
+ if ( mySelection->IObjectCount() != 1 ||
+ !myTable->CurrentCell( aRow, aCol ) ||
+ myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
+ myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
+ myTable->GetCriterionType( aRow ) != FT_BelongToCylinder)
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
+ GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO ) ;
+ if ( !anObj->_is_nil() )
+ myTable->SetThreshold( aRow, anIO->getName() );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onCriterionChanged
+// Purpose : SLOT called when cretarion of current row changed. Update selection
+//=======================================================================
+void SMESHGUI_FilterDlg::onCriterionChanged( const int , const int )
+{
+ updateSelection();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::onCurrentChanged
+// Purpose : SLOT called when current row changed. Update selection
+//=======================================================================
+void SMESHGUI_FilterDlg::onCurrentChanged( int, int )
+{
+ updateSelection();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterDlg::updateSelection
+// Purpose : UpdateSelection in accordance with current row
+//=======================================================================
+void SMESHGUI_FilterDlg::updateSelection()
+{
+ if ( mySelection == 0 )
+ return;
+
+ mySelection->ClearFilters();
+
+ int aRow, aCol;
+ if ( myTable->CurrentCell( aRow, aCol ) &&
+ ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
+ myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
+ myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ) )
+ {
+ if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom )
+ mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
+ else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
+ mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );
+ else if ( myTable->GetCriterionType( aRow ) == FT_BelongToCylinder )
+ mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Cylinder ) );
+
+ myIsSelectionChanged = true;
+ }
+ else
+ {
+ if ( myIsSelectionChanged )
+ mySelection->AddFilter( new SALOME_TypeFilter( "This filter deactivate selection" ) );
+ }
}
+
+
+
+
-// SMESH SMESHGUI : GUI for SMESH component\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-// File : SMESHGUI_FilterDlg.h\r
-// Author : Sergey LITONIN\r
-// Module : SMESH\r
-\r
-\r
-#ifndef SMESHGUI_FilterDlg_H\r
-#define SMESHGUI_FilterDlg_H\r
-\r
-#include <qdialog.h>\r
-#include <qmap.h>\r
-#include <qvaluelist.h>\r
-#include <SALOME_Selection.h>\r
-\r
-#include <SALOMEconfig.h>\r
-#include CORBA_SERVER_HEADER(SMESH_Filter)\r
-#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
-\r
-class QCloseEvent;\r
-class QWidgetStack;\r
-class QStringList;\r
-class QTableItem;\r
-class QFrame;\r
-class QEvent;\r
-class QPushButton;\r
-class QTable;\r
-class SALOME_Selection;\r
-class SMESHGUI;\r
-class QComboBox;\r
-class QButtonGroup;\r
-class QCheckBox;\r
-class QGroupBox;\r
-\r
-\r
-/*\r
- Class : SMESHGUI_FilterDlg\r
- Description : Dialog to specify filters for VTK viewer\r
-*/\r
-\r
-class SMESHGUI_FilterDlg : public QDialog\r
-{ \r
- Q_OBJECT\r
-\r
- class Table;\r
-\r
- // Edge criteria\r
- enum { FreeBorders = 0, MultiBorders, Length }; \r
-\r
- // Face criteria\r
- enum { AspectRatio = 0, Warping, MinimumAngle, Taper, Skew, Area }; \r
-\r
- // Comparision\r
- enum { LessThan = 0, MoreThan, EqualTo };\r
-\r
- // Logical operations\r
- enum { LO_And = 0, LO_Or, LO_Undefined };\r
-\r
- // Source elements to be selected\r
- enum { Mesh, Selection, Dialog, None };\r
-\r
- typedef QMap<int, Table*> TableMap;\r
-\r
-public:\r
- SMESHGUI_FilterDlg( QWidget* parent, \r
- const int type,\r
- const bool theModal = true,\r
- const char* name = 0 );\r
- virtual ~SMESHGUI_FilterDlg();\r
-\r
- void Init( const int type );\r
-\r
- void SetSelection( SALOME_Selection* );\r
- void SetMesh( SMESH::SMESH_Mesh_ptr );\r
- void SetSourceWg( QWidget* );\r
-\r
-private slots:\r
-\r
- void onAddBtn();\r
- void onRemoveBtn();\r
- void onClearBtn();\r
- void onCriterionChanged( int, int );\r
-\r
- void onOk();\r
- bool onApply();\r
- void onClose();\r
- void onDeactivate();\r
-\r
-private:\r
-\r
- void closeEvent( QCloseEvent* e );\r
- void enterEvent ( QEvent * );\r
-\r
- void updateBtnState();\r
-\r
- // dialog creation\r
- QFrame* createButtonFrame( QWidget*, const bool );\r
- QFrame* createMainFrame( QWidget* );\r
- Table* createTable( QWidget*, const int );\r
- QButtonGroup* createSourceGroup( QWidget* );\r
- void addRow( Table*, const int );\r
- QTableItem* getCriterionItem( QTable*, const int );\r
- QTableItem* getCompareItem( QTable* );\r
- QTableItem* getNotItem( QTable* );\r
- QTableItem* getLogOpItem( QTable* );\r
- const QStringList& getCriteria( const int theType ) const;\r
- const QStringList& getCompare () const;\r
- \r
- // query\r
- int getCurrType() const;\r
- int getCriterion( const int theType, const int theRow ) const;\r
-\r
- // execution\r
- bool isValid() const;\r
- SMESH::Predicate_ptr createPredicate( const int theType );\r
- void insertFilterInViewer( SMESH::Predicate_ptr thePred );\r
- void selectInViewer( const int theType,\r
- const QValueList<int>& theIds );\r
- void filterSource( const int theType,\r
- SMESH::Predicate_ptr thePred,\r
- QValueList<int>& theResIds );\r
- void filterSelectionSource( const int theType,\r
- SMESH::Predicate_ptr thePred,\r
- QValueList<int>& theResIds );\r
- void getIdsFromWg( const QWidget*, QValueList<int>& ) const;\r
- void setIdsToWg( QWidget*, const QValueList<int>& );\r
- Selection_Mode getSelMode( const int ) const;\r
-\r
-private:\r
-\r
- // widgets\r
- QFrame* myMainFrame;\r
- QGroupBox* myTableGrp;\r
-\r
- TableMap myTables;\r
- QPushButton* myAddBtn;\r
- QPushButton* myRemoveBtn;\r
- QPushButton* myClearBtn;\r
- QButtonGroup* mySourceGrp;\r
- QCheckBox* mySetInViewer;\r
-\r
- QPushButton* myOkBtn;\r
- QPushButton* myApplyBtn;\r
- QPushButton* myCloseBtn;\r
-\r
- // initial fields\r
- int myType;\r
- SMESHGUI* mySMESHGUI;\r
- SALOME_Selection* mySelection;\r
- SMESH::SMESH_Mesh_ptr myMesh;\r
- QWidget* mySourceWg;\r
-};\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_FilterDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_FilterDlg_H
+#define SMESHGUI_FilterDlg_H
+
+#include <qdialog.h>
+#include <qframe.h>
+#include <qmap.h>
+#include <qvaluelist.h>
+
+#include "SALOME_Selection.h"
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_DataMapOfIOMapOfInteger.hxx"
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+class QButtonGroup;
+class QCheckBox;
+class QCloseEvent;
+class QComboBox;
+class QEvent;
+class QGroupBox;
+class QPushButton;
+class QStringList;
+class QTable;
+class QTableItem;
+class QWidgetStack;
+class SALOME_Selection;
+class SMESHGUI;
+class SMESHGUI_FilterLibraryDlg;
+
+/*
+ Class : SMESHGUI_FilterTable
+ Description : Frame containig
+ - Button group for switching entity type
+ - Table for displaying filter criterions
+ - Buttons for editing table
+*/
+
+class SMESHGUI_FilterTable : public QFrame
+{
+ Q_OBJECT
+
+ class Table;
+ class ComboItem;
+ class AdditionalWidget;
+
+ typedef QMap<int, Table*> TableMap;
+
+public:
+
+ SMESHGUI_FilterTable( QWidget* parent,
+ const int type );
+ SMESHGUI_FilterTable( QWidget* parent,
+ const QValueList<int>& type );
+ virtual ~SMESHGUI_FilterTable();
+
+ void Init( const int type );
+ void Init( const QValueList<int>& types );
+
+ QGroupBox* GetTableGrp();
+
+ bool IsValid( const bool = true, const int theEntityType = -1 ) const;
+ int GetType() const;
+ void SetType( const int );
+ void RestorePreviousEntityType();
+ int NumRows( const int theEntityType = -1 ) const;
+ void Clear( const int theEntityType = -1 );
+ void SetEditable( const bool );
+ void SetEnabled( const bool );
+ void SetLibsEnabled( const bool );
+ bool IsEditable() const;
+
+ int GetCriterionType( const int theRow, const int theType = -1 ) const;
+
+ void GetCriterion( const int theRow,
+ SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType = -1 ) const;
+
+ void SetCriterion( const int theRow,
+ const SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType = -1 );
+
+ void AddCriterion( const SMESH::Filter::Criterion& theCriterion,
+ const int theEntityType = -1 );
+
+ void Copy( const SMESHGUI_FilterTable* );
+ void SetValidity( const bool );
+
+ bool CurrentCell( int& theRow, int& theCol ) const;
+ void SetThreshold( const int theRow,
+ const QString& theText,
+ const int theEntityType = -1 );
+
+ bool GetThreshold( const int theRow,
+ QString& theText,
+ const int theEntityType = -1 );
+
+ void Update();
+
+
+signals:
+
+ void CopyFromClicked();
+ void AddToClicked();
+ void EntityTypeChanged( const int );
+ void NeedValidation();
+ void CretarionChanged( const int theRow, const int theEntityType );
+ void CurrentChanged( int, int );
+
+private slots:
+
+ void onAddBtn();
+ void onInsertBtn();
+ void onRemoveBtn();
+ void onClearBtn();
+ void onCopyFromBtn();
+ void onAddToBtn();
+ void onCriterionChanged( int, int );
+ void onEntityType( int );
+ void onCurrentChanged( int, int );
+
+private:
+
+ void addRow( Table*, const int, const bool toTheEnd = true );
+ QTableItem* getCriterionItem( QTable*, const int );
+ QTableItem* getCompareItem( QTable* );
+ QTableItem* getUnaryItem( QTable* );
+ QTableItem* getBinaryItem( QTable* );
+ const QMap<int, QString>& getCriteria( const int theType ) const;
+ const QMap<int, QString>& getCompare() const;
+ Table* createTable( QWidget*, const int );
+ QWidget* createAdditionalFrame( QWidget* theParent );
+ int getFirstSelectedRow() const;
+ void onCriterionChanged( const int, const int, const int );
+
+ void updateBtnState();
+ void removeAdditionalWidget( QTable* theTable, const int theRow );
+ void updateAdditionalWidget();
+
+ const QMap<int, QString>& getSupportedTypes() const;
+
+private:
+
+ QGroupBox* myTableGrp;
+ QGroupBox* mySwitchTableGrp;
+
+ TableMap myTables;
+ QPushButton* myAddBtn;
+ QPushButton* myInsertBtn;
+ QPushButton* myRemoveBtn;
+ QPushButton* myClearBtn;
+ QPushButton* myCopyFromBtn;
+ QPushButton* myAddToBtn;
+
+ QButtonGroup* myEntityTypeGrp;
+ int myEntityType;
+ int myIsValid;
+
+ SMESHGUI_FilterLibraryDlg* myLibDlg;
+
+ QWidgetStack* myWgStack;
+ QMap<QTableItem*, AdditionalWidget*> myAddWidgets;
+};
+
+
+/*
+ Class : SMESHGUI_FilterDlg
+ Description : Dialog to specify filters for VTK viewer
+*/
+
+class SMESHGUI_FilterDlg : public QDialog
+{
+ Q_OBJECT
+
+ // Source elements to be selected
+ enum { Mesh, Selection, Dialog, None };
+
+ // Buttons
+ enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
+
+public:
+ SMESHGUI_FilterDlg( QWidget* parent,
+ const QValueList<int>& types,
+ const char* name = 0 );
+
+ SMESHGUI_FilterDlg( QWidget* parent,
+ const int type,
+ const char* name = 0 );
+ virtual ~SMESHGUI_FilterDlg();
+
+ void Init( const QValueList<int>& types );
+ void Init( const int type );
+
+ void SetSelection( SALOME_Selection* );
+ void SetMesh( SMESH::SMESH_Mesh_ptr );
+ void SetSourceWg( QWidget* );
+
+ static SMESH::Filter::Criterion createCriterion();
+
+signals:
+
+ void Accepted();
+
+private slots:
+
+ void onOk();
+ bool onApply();
+ void onClose();
+ void onDeactivate();
+ void onSelectionDone();
+ void onCriterionChanged( const int, const int );
+ void onCurrentChanged( int, int );
+
+private:
+
+ void construct( const QValueList<int>& types );
+
+ void closeEvent( QCloseEvent* e );
+ void enterEvent ( QEvent * );
+
+ // dialog creation
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame( QWidget* );
+ QButtonGroup* createSourceGroup( QWidget* );
+ void updateMainButtons();
+
+ // execution
+ bool isValid() const;
+ bool createFilter( const int theType );
+ void insertFilterInViewer();
+ void selectInViewer( const int theType,
+ const QValueList<int>& theIds );
+ void filterSource( const int theType,
+ QValueList<int>& theResIds );
+ void filterSelectionSource( const int theType,
+ QValueList<int>& theResIds );
+ void getIdsFromWg( const QWidget*, QValueList<int>& ) const;
+ void setIdsToWg( QWidget*, const QValueList<int>& );
+ Selection_Mode getSelMode( const int ) const;
+ void updateSelection();
+
+private:
+
+ // widgets
+ QFrame* myMainFrame;
+ QButtonGroup* mySourceGrp;
+
+ QCheckBox* mySetInViewer;
+
+ QMap<int, QPushButton*> myButtons;
+
+ SMESHGUI_FilterTable* myTable;
+
+ // initial fields
+ QValueList<int> myTypes;
+ SMESHGUI* mySMESHGUI;
+ SALOME_Selection* mySelection;
+ SMESH::SMESH_Mesh_ptr myMesh;
+ QWidget* mySourceWg;
+
+ SALOME_DataMapOfIOMapOfInteger myIObjects;
+ bool myIsSelectionChanged;
+ QMap< int, SMESH::Filter_var > myFilter;
+ QMap< int, bool > myInsertState;
+ QMap< int, int > myApplyToState;
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_FilterLibraryDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_FilterLibraryDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_FilterUtils.h"
+
+#include <QAD_Desktop.h>
+#include <QAD_FileDlg.h>
+
+#include <qapplication.h>
+#include <qmessagebox.h>
+#include <qframe.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qdir.h>
+
+#define SPACING 5
+#define MARGIN 10
+
+/*
+ Class : SMESHGUI_FilterLibraryDlg::Dialog
+ Description : Dialog for opening filter library
+*/
+
+class SMESHGUI_FilterLibraryDlg::Dialog : public QAD_FileDlg
+{
+public:
+ Dialog( QWidget* theParent, const bool theToOpen );
+ virtual ~Dialog();
+
+protected:
+ virtual bool acceptData();
+};
+
+SMESHGUI_FilterLibraryDlg::Dialog::Dialog( QWidget* theParent,
+ const bool theToOpen )
+: QAD_FileDlg( theParent, theToOpen )
+{
+}
+
+SMESHGUI_FilterLibraryDlg::Dialog::~Dialog()
+{
+}
+
+bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData()
+{
+ if ( mode() != QFileDialogP::AnyFile )
+ return QAD_FileDlg::acceptData();
+ else
+ return true;
+}
+
+
+/*
+ Class : SMESHGUI_FilterLibraryDlg
+ Description : Dialog to specify filters for VTK viewer
+*/
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg( QWidget* theParent,
+ const QValueList<int>& theTypes,
+ const int theMode,
+ const char* theName )
+: QDialog( theParent, theName, true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ construct( theTypes, theMode );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg( QWidget* theParent,
+ const int theType,
+ const int theMode,
+ const char* theName )
+: QDialog( theParent, theName, true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ QValueList<int> aTypes;
+ aTypes.append( theType );
+ construct( aTypes, theMode );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::construct
+// Purpose : Construct dialog ( called by constructor )
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::construct( const QValueList<int>& theTypes, const int theMode )
+{
+ myTypes = theTypes;
+ myMode = theMode;
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ myMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( myMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( myMainFrame, 1 );
+
+ Init( myTypes, myMode );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
+ aMainFrame->setFrameStyle( QFrame::NoFrame );
+ aMainFrame->setInsideMargin( 0 );
+
+ // library name
+
+ QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, aMainFrame );
+ aGrp->setFrameStyle( QFrame::NoFrame );
+ aGrp->setInsideMargin( 0 );
+
+ new QLabel( tr( "LIBRARY_FILE" ), aGrp );
+ myFileName = new QLineEdit( aGrp );
+ myOpenBtn = new QPushButton( aGrp );
+ myOpenBtn->setPixmap( QAD_Desktop::getResourceManager()->loadPixmap(
+ "QAD", tr("ICON_FILE_OPEN") ) );
+
+ // filters list box
+
+ aGrp = new QGroupBox( 1, Qt::Vertical, tr( "FILTER_NAMES" ), aMainFrame );
+ QFrame* aFrame = new QFrame( aGrp );
+ myListBox = new QListBox( aFrame );
+ myAddBtn = new QPushButton( tr( "ADD" ), aFrame );
+ myDeleteBtn = new QPushButton( tr( "DELETE" ), aFrame );
+
+ QGridLayout* aLay = new QGridLayout( aFrame, 3, 2, 0, 5 );
+ aLay->addMultiCellWidget( myListBox, 0, 2, 0, 0 );
+ aLay->addWidget( myAddBtn, 0, 1 );
+ aLay->addWidget( myDeleteBtn, 1, 1 );
+ QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ aLay->addItem( aVSpacer, 2, 1 );
+
+ // filter name
+
+ myNameGrp = new QGroupBox( 1, Qt::Vertical, aMainFrame );
+ myNameGrp->setFrameStyle( QFrame::NoFrame );
+ myNameGrp->setInsideMargin( 0 );
+ new QLabel( tr( "FILTER_NAME" ), myNameGrp );
+ myName = new QLineEdit( myNameGrp );
+
+ // table
+
+ myTable = new SMESHGUI_FilterTable( aMainFrame, myTypes );
+ myTable->SetEditable( myMode == EDIT );
+ myTable->SetLibsEnabled( false );
+
+ myListBox->setMinimumHeight( ( int )( myTable->sizeHint().height() * 0.5 ) );
+ myListBox->setRowMode( QListBox::FitToWidth );
+ myListBox->setSelectionMode( QListBox::Single );
+
+ myOpenBtn->setAutoDefault( false );
+ myAddBtn->setAutoDefault( false );
+ myDeleteBtn->setAutoDefault( false );
+
+ // connect signals and slots
+
+ connect( myFileName, SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) );
+ connect( myOpenBtn , SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
+
+ connect( myListBox, SIGNAL( highlighted( const QString& ) ),
+ this, SLOT( onFilterChanged( const QString& ) ) );
+
+ connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddBtnPressed() ) );
+ connect( myDeleteBtn, SIGNAL( clicked() ), this, SLOT( onDeleteBtnPressed() ) );
+
+ connect( myName, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( onFilterNameChanged( const QString& ) ) );
+
+ connect( myTable, SIGNAL( EntityTypeChanged( const int ) ),
+ this, SLOT( onEntityTypeChanged( const int ) ) );
+
+ connect( myTable, SIGNAL( NeedValidation() ), this, SLOT( onNeedValidation() ) );
+
+ return aMainFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame( QWidget* theParent )
+{
+ QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+
+ myButtons[ BTN_OK ] = new QPushButton( tr( "SMESH_BUT_OK" ), aGrp );
+ myButtons[ BTN_Apply ] = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
+
+ QLabel* aLbl = new QLabel( aGrp );
+ aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ myButtons[ BTN_Cancel ] = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+ myButtons[ BTN_Close ] = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aGrp );
+
+ connect( myButtons[ BTN_OK ], SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myButtons[ BTN_Cancel ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myButtons[ BTN_Close ], SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myButtons[ BTN_Apply ], SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ QMap<int, QPushButton*>::iterator anIter;
+ for ( anIter = myButtons.begin(); anIter != myButtons.end(); ++anIter )
+ anIter.data()->setAutoDefault( false );
+
+ updateMainButtons();
+
+ return aGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::updateMainButtons
+// Purpose : Update visibility of main buttons ( OK, Cancel, Close ... )
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::updateMainButtons()
+{
+ if ( myTypes.count() == 1 )
+ {
+ myButtons[ BTN_Cancel ]->show();
+ myButtons[ BTN_Apply ]->hide();
+ myButtons[ BTN_Close ]->hide();
+ }
+ else
+ {
+ myButtons[ BTN_Cancel ]->hide();
+ myButtons[ BTN_Apply ]->show();
+ myButtons[ BTN_Close ]->show();
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::~SMESHGUI_FilterLibraryDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_FilterLibraryDlg::~SMESHGUI_FilterLibraryDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::Init( const int type, const int theMode )
+{
+ QValueList<int> aTypes;
+ aTypes.append( type );
+ Init( aTypes, theMode );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::Init( const QValueList<int>& theTypes, const int theMode )
+{
+ myMode = theMode;
+ myTypes = theTypes;
+ myTable->Init( theTypes );
+ myCurrFilterName = "";
+ myCurrFilter = -1;
+ myListBox->clear();
+ myName->clear();
+ myTable->Clear();
+
+ updateControlsVisibility();
+ setEnabled( true );
+
+ SMESHGUI* aModeler = SMESHGUI::GetSMESHGUI();
+
+ connect( aModeler, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aModeler, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+ if ( myMode == ADD_TO )
+ {
+ setCaption( tr( "ADD_TO_TLT" ) );
+ if ( myFileName->text().isEmpty() )
+ myFileName->setText( getDefaultLibraryName() );
+ processNewLibrary();
+ }
+ else if ( myMode == COPY_FROM )
+ {
+ setCaption( tr( "COPY_FROM_TLT" ) );
+ if ( myFileName->text().isEmpty() )
+ myFileName->setText( getDefaultLibraryName() );
+ processNewLibrary();
+ if ( myListBox->count() > 0 )
+ myListBox->setCurrentItem( 0 );
+ }
+ else
+ {
+ setCaption( tr( "EDIT_LIB_TLT" ) );
+ if ( myFileName->text().isEmpty() )
+ myFileName->setText( getDefaultLibraryName() );
+ processNewLibrary();
+ if ( myListBox->count() > 0 )
+ myListBox->setCurrentItem( 0 );
+ }
+
+ int x, y ;
+ aModeler->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+
+ this->show();
+
+ updateMainButtons();
+ isPermissionValid( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::updateControlsVisibility
+// Purpose : Update visibility of controls in accordance with myMode
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::updateControlsVisibility()
+{
+ if ( myMode == ADD_TO )
+ {
+ myNameGrp->show();
+ myNameGrp->setEnabled( true );
+ myAddBtn->hide();
+ myDeleteBtn->hide();
+ myTable->SetEditable( false );
+ }
+ else if ( myMode == COPY_FROM )
+ {
+ myNameGrp->hide();
+ myNameGrp->setEnabled( false );
+ myAddBtn->hide();
+ myDeleteBtn->hide();
+ myTable->SetEditable( false );
+ }
+ else if ( myMode == EDIT )
+ {
+ myNameGrp->show();
+ myNameGrp->setEnabled( true );
+ myAddBtn->show();
+ myDeleteBtn->show();
+ myTable->SetEditable( true );
+ }
+
+ qApp->processEvents();
+ updateGeometry();
+ adjustSize();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onApply
+// Purpose : SLOT called when "Apply" button pressed.
+//=======================================================================
+bool SMESHGUI_FilterLibraryDlg::onApply()
+{
+ if ( !isValid( true ) || !isPermissionValid( false ) )
+ return false;
+
+ if ( myLibrary->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+ return false;
+ }
+
+ const char* aName = myFileName->text().latin1();
+ if ( strcmp( myLibrary->GetFileName(), aName ) != 0 )
+ myLibrary->SetFileName( aName );
+
+ bool aResult = false;
+
+ if ( myMode == COPY_FROM || myListBox->count() == 0 )
+ {
+ aResult = true;
+ }
+ else if ( myMode == EDIT || myMode == ADD_TO )
+ {
+ SMESH::Filter_var aFilter = createFilter();
+ if ( !myLibrary->Replace( myCurrFilterName, myName->text(), aFilter.in() ) )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_EDITING" ), QMessageBox::Ok );
+ aResult = false;
+ }
+ else
+ aResult = true;
+ }
+
+ if ( aResult && myMode != COPY_FROM )
+ aResult = myLibrary->Save();
+
+ if ( aResult )
+ {
+ char* aFileName = myLibrary->GetFileName();
+ getDefaultLibraryName() = QString( aFileName );
+ delete aFileName;
+ }
+ else if ( myMode != COPY_FROM )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_SAVING" ), QMessageBox::Ok );
+
+
+ return aResult;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+// Assign filters VTK viewer and close dialog
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onOk()
+{
+ if ( onApply() )
+ {
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState() ;
+ accept();
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onClose()
+{
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onDeactivate()
+{
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::enterEvent( QEvent* )
+{
+ setEnabled( true );
+}
+
+//=================================================================================
+// function : closeEvent()
+// purpose : Close dialog
+//=================================================================================
+void SMESHGUI_FilterLibraryDlg::closeEvent( QCloseEvent* e )
+{
+ onClose() ;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::getFileName
+// Purpose : Get file name
+//=======================================================================
+QString SMESHGUI_FilterLibraryDlg::getFileName() const
+{
+ return myFileName != 0 ? myFileName->text() : QString("");
+}
+
+//================================================================
+// Function : setFileName
+// Purpose : Set file name to line edit
+//================================================================
+void SMESHGUI_FilterLibraryDlg::setFileName( const QString& txt, const bool autoExt )
+{
+ if ( myFileName == 0 )
+ return;
+ myFileName->setText( autoExt ? autoExtension( txt ) : txt );
+}
+
+//================================================================
+// Function : autoExtension
+// Purpose : Append extension to the file name
+//================================================================
+QString SMESHGUI_FilterLibraryDlg::autoExtension( const QString& theFileName ) const
+{
+ QString anExt = theFileName.section( '.', -1 );
+ return anExt != "xml" && anExt != "XML" ? theFileName + ".xml" : theFileName;
+}
+
+//================================================================
+// Function : filterWildCards
+// Purpose :
+//================================================================
+QStringList SMESHGUI_FilterLibraryDlg::filterWildCards( const QString& theFilter ) const
+{
+ QStringList res;
+
+ int b = theFilter.findRev( "(" );
+ int e = theFilter.findRev( ")" );
+ if ( b != -1 && e != -1 )
+ {
+ QString content = theFilter.mid( b + 1, e - b - 1 ).stripWhiteSpace();
+ QStringList lst = QStringList::split( " ", content );
+ for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
+ if ( (*it).find( "." ) != -1 )
+ res.append( (*it).stripWhiteSpace() );
+ }
+ return res;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::prepareFilters
+// Purpose : Prepare filters for dialog
+//=======================================================================
+QStringList SMESHGUI_FilterLibraryDlg::prepareFilters() const
+{
+ static QStringList aList;
+ if ( aList.isEmpty() )
+ {
+ aList.append( tr( "XML_FILT" ) );
+ //aList.append( tr( "ALL_FILES_FILTER" ) );
+ }
+
+ return aList;
+}
+
+//================================================================
+// Function : onBrowse
+// Purpose : SLOT. Display "Open file" dialog for chosing library name
+//================================================================
+void SMESHGUI_FilterLibraryDlg::onBrowse()
+{
+ Dialog* aDlg = new Dialog( this, true );
+ aDlg->setCaption( tr( "OPEN_LIBRARY" ) );
+
+ aDlg->setMode( myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile );
+ aDlg->setFilters( prepareFilters() );
+ aDlg->setSelection( getFileName() );
+
+ QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );
+ if ( anOkBtn != 0 )
+ anOkBtn->setText( tr( "SMESH_BUT_OK" ) );
+
+ if ( aDlg->exec() != Accepted )
+ return;
+
+ QString fName = aDlg->selectedFile();
+
+ if ( fName.isEmpty() )
+ return;
+
+ if ( QFileInfo( fName ).extension().isEmpty() )
+ fName = autoExtension( fName );
+
+ fName = QDir::convertSeparators( fName );
+ QString prev = QDir::convertSeparators( getFileName() );
+
+ if ( prev == fName )
+ return;
+
+ setFileName( fName );
+
+ QString aName = myListBox->text( myListBox->count() - 1 );
+ processNewLibrary();
+
+ if ( myMode == ADD_TO )
+ {
+ myTable->Copy( (SMESHGUI_FilterTable*)parentWidget() );
+ myCurrFilterName = "";
+ myCurrFilter = -1;
+ addFilterToLib( aName );
+ }
+
+ isPermissionValid( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::processNewLibrary
+// Purpose : SLOT. Calleds when file name changed
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::processNewLibrary()
+{
+ SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
+ if ( aFilterMgr->_is_nil() )
+ return;
+
+ myLibrary = aFilterMgr->LoadLibrary( autoExtension( getFileName() ) );
+ if ( myLibrary->_is_nil() )
+ {
+ if ( myMode == COPY_FROM )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "ERROR_LOAD" ), QMessageBox::Ok );
+ return;
+ }
+ else
+ {
+ myLibrary = aFilterMgr->CreateLibrary();
+ myLibrary->SetFileName( getFileName().latin1() );
+ }
+ }
+
+ updateList();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::updateList
+// Purpose : Fill list box with filter names
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::updateList()
+{
+ QStringList aList;
+ SMESH::string_array_var aNames = myLibrary->GetNames( (SMESH::ElementType)myTable->GetType() );
+ for ( int i = 0, n = aNames->length(); i < n; i++ )
+ aList.append( QString( aNames[ i ] ) );
+ myListBox->clear();
+ myListBox->insertStringList( aList );
+ if ( myListBox->count() == 0 )
+ {
+ myTable->Clear( myTable->GetType() );
+ myName->clear();
+ myName->setEnabled( false );
+ myTable->SetEnabled( false );
+ }
+ else
+ {
+ myName->setEnabled( true );
+ myTable->SetEnabled( true );
+ if ( myListBox->count() )
+ {
+ myCurrFilterName = "";
+ myListBox->setCurrentItem( 0 );
+ }
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::isNameValid
+// Purpose : Verify validity if entered data
+//=======================================================================
+bool SMESHGUI_FilterLibraryDlg::isNameValid( const bool theMess ) const
+{
+ // verify validity of filter name
+ if ( myName->isEnabled() && !myCurrFilterName.isEmpty() )
+ {
+ QString aCurrName = myName->text();
+ if ( aCurrName.isEmpty() )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "EMPTY_FILTER_NAME" ), QMessageBox::Ok );
+ return false;
+ }
+
+ SMESH::string_array_var aNames = myLibrary->GetAllNames();
+ for ( int f = 0, n = aNames->length(); f < n; f++ )
+ {
+ if ( aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR_FILTER_NAME" ), QMessageBox::Ok );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::isPermissionValid
+// Purpose : Verify write permission on file
+//=======================================================================
+bool SMESHGUI_FilterLibraryDlg::isPermissionValid( const bool theIsExistingOnly )
+{
+ if ( myMode == COPY_FROM )
+ return true;
+
+ // Verify write permission
+ bool isWritable = false;
+
+ QString fName( myFileName->text() );
+ if ( QFileInfo( fName ).extension().isEmpty() )
+ fName = autoExtension( fName );
+
+ fName = QDir::convertSeparators( fName );
+
+ if ( QFileInfo( fName ).exists() )
+ isWritable = QFileInfo( fName ).isWritable();
+ else if ( !theIsExistingOnly )
+ {
+ QFileInfo aDirInfo( QFileInfo( fName ).dirPath( true ) );
+ isWritable = aDirInfo.isWritable();
+ /*if ( QDir( QFileInfo( fName ).dirPath( true ) ).exists() ||
+ QDir().mkdir( QFileInfo( fName ).dirPath( true ) ) )
+ {
+ QFile aFile( fName );
+ if ( aFile.open( IO_WriteOnly ) )
+ isWritable = true;
+ else
+ aFile.close();
+ }
+ */
+ }
+ else
+ isWritable = true;
+
+ if ( !isWritable )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ), tr( "NO_PERMISSION" ), QMessageBox::Ok );
+ return false;
+ }
+
+ return true;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::isValid
+// Purpose : Verify validity if entered data
+//=======================================================================
+bool SMESHGUI_FilterLibraryDlg::isValid( const bool theMess ) const
+{
+ // verify validity of table
+ if ( !myTable->IsValid( theMess ) || !isNameValid( theMess ) )
+ return false;
+ else
+ return true;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onFilterChanged
+// Purpose : SLOT. Called when selected filter of library changed
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onFilterChanged( const QString& theName )
+{
+ if ( myLibrary->_is_nil() )
+ return;
+
+ // Save parameters of filter if it was changed
+
+ if ( !myCurrFilterName.isEmpty() && myTable->IsEditable() )
+ {
+ if ( !isValid( true ) )
+ {
+ myListBox->blockSignals( true );
+ myListBox->setCurrentItem( myCurrFilter );
+ myListBox->blockSignals( false );
+ return;
+ }
+
+ SMESH::Filter_var aFilter = createFilter();
+ myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+ }
+
+ // Fill table with filter parameters
+
+ SMESH::Filter_var aFilter = myLibrary->Copy( theName );
+ myCurrFilterName = theName;
+ myCurrFilter = myListBox->currentItem();
+ myName->setText( theName );
+
+
+ SMESH::Filter::Criteria_var aCriteria;
+
+ myTable->Clear( myTable->GetType() );
+
+ if ( !aFilter->GetCriteria( aCriteria ) )
+ return;
+
+ for ( int i = 0, n = aCriteria->length(); i < n; i++ )
+ myTable->AddCriterion( aCriteria[ i ], myTable->GetType() );
+
+ myTable->Update();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onReturnPressed
+// Purpose : SLOT. Called when enter button is pressed in library name field
+// Reload library
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onReturnPressed()
+{
+ QString aName = myListBox->text( myListBox->count() - 1 );
+
+ processNewLibrary();
+
+ if ( myMode == ADD_TO )
+ {
+ myTable->Copy( (SMESHGUI_FilterTable*)parentWidget() );
+ myCurrFilterName = "";
+ myCurrFilter = -1;
+ addFilterToLib( aName );
+ }
+
+ isPermissionValid( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::enableMainButtons
+// Purpose : Update state of "OK", "Cancel" buttons
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::enableMainButtons()
+{
+ /*bool isEnabled = isValid( false );
+ if ( myButtons.contains( BTN_OK ) )
+ myButtons[ BTN_OK ]->setEnabled( isEnabled );
+ else if ( myButtons.contains( BTN_Apply ) )
+ myButtons[ BTN_OK ]->setEnabled( isEnabled );
+ if ( myButtons.contains( BTN_Cancel ) )
+ myButtons[ BTN_Cancel ]->setEnabled( isEnabled );
+ else if ( myButtons.contains( BTN_Close ) )
+ myButtons[ BTN_Cancel ]->setEnabled( isEnabled );
+ */
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::createFilter
+// Purpose : Cerate filter in accordance with library
+//=======================================================================
+SMESH::Filter_ptr SMESHGUI_FilterLibraryDlg::createFilter( const int theType )
+{
+ int n = myTable->NumRows( theType );
+
+ SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
+ aCriteria->length( n );
+
+ for ( int i = 0; i < n; i++ )
+ {
+ SMESH::Filter::Criterion aCriterion = SMESHGUI_FilterDlg::createCriterion();
+ myTable->GetCriterion( i, aCriterion );
+ aCriteria[ i ] = aCriterion;
+ }
+
+ SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
+ SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
+ aFilter->SetCriteria( aCriteria.inout() );
+
+ return aFilter._retn();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onAddBtnPressed
+// Purpose : SLOT. Called when "Add" button pressed
+// Add new filter to the end of library
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onAddBtnPressed()
+{
+ // Save parameters of filter if it was changed
+ if ( !myCurrFilterName.isEmpty() && myTable->IsEditable() )
+ {
+ if ( !isValid( true ) )
+ return;
+
+ SMESH::Filter_var aFilter = createFilter();
+ myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+ }
+
+ addFilterToLib( getDefaultFilterName() );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onAddBtnPressed
+// Purpose : SLOT. Called when "Add" button pressed
+// Add new filter to the end of library
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::addFilterToLib( const QString& theName )
+{
+ if ( myLibrary->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+ return;
+ }
+
+ // create filter
+ SMESH::Filter_var aFilter = createFilter();
+
+ // if name of filter already exist in the library assign default name for the filter
+ QString aName( theName );
+ SMESH::string_array_var aNames = myLibrary->GetAllNames();
+ for ( int i = 0, n = aNames->length(); i < n; i++ )
+ if ( aName == QString( aNames[ i ] ) )
+ {
+ aName = getDefaultFilterName();
+ break;
+ }
+
+ // add new filter in library
+ bool aResult = !aFilter->GetPredicate()->_is_nil()
+ ? myLibrary->Add( aName.latin1(), aFilter )
+ : myLibrary->AddEmpty( aName.latin1(), (SMESH::ElementType)myTable->GetType() );
+
+ if ( !aResult )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_ADDING" ), QMessageBox::Ok );
+ }
+
+ updateList();
+ myCurrFilterName = "";
+ myCurrFilter = -1;
+ setSelected( aName );
+
+ if ( theName != aName )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(), tr( "SMESH_WARNING" ),
+ tr( "ASSIGN_NEW_NAME" ).arg( theName ).arg( aName ) , QMessageBox::Ok );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::getDefaultLibraryName
+// Purpose : Get default library name
+//=======================================================================
+QString& SMESHGUI_FilterLibraryDlg::getDefaultLibraryName() const
+{
+ static QString aName;
+ if ( aName.isEmpty() )
+ {
+ QString aHomeDir = QDir( QDir::home() ).absPath();
+ aName = aHomeDir + "/" + tr ( "LIB_NAME" );
+ }
+ return aName;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::getDefaultFilterName
+// Purpose : Create default filter name
+//=======================================================================
+QString SMESHGUI_FilterLibraryDlg::getDefaultFilterName() const
+{
+ QString aName;
+
+ if ( myTable->GetType() == SMESH::NODE )
+ aName = tr( "NODE" );
+ else if ( myTable->GetType() == SMESH::EDGE )
+ aName = tr( "EDGE" );
+ else if ( myTable->GetType() == SMESH::FACE )
+ aName = tr( "FACE" );
+ else if ( myTable->GetType() == SMESH::VOLUME )
+ aName = tr( "VOLUME" );
+ else if ( myTable->GetType() == SMESH::ALL )
+ aName = tr( "ELEMENT" );
+ else
+ aName = tr( "SELECTION" );
+
+ aName += tr( "FILTER" );
+
+
+ QMap< QString, int > anAllNames;
+ SMESH::string_array_var aNames = myLibrary->GetAllNames();
+ for( int i = 0, n = aNames->length(); i < n; i++ )
+ anAllNames[ QString( aNames[ i ] ) ] = -1;
+
+ bool isNotValid = true;
+ int k = 1;
+ QString aNewName;
+ while ( isNotValid )
+ {
+ isNotValid = false;
+ aNewName = aName + "_" + QString( "%1" ).arg( k );
+ if ( anAllNames.contains( aNewName ) )
+ {
+ isNotValid = true;
+ k++;
+ }
+ }
+
+ return aNewName;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::setSelected
+// Purpose : set selected item in list box containing filters
+//=======================================================================
+bool SMESHGUI_FilterLibraryDlg::setSelected( const QString& theName )
+{
+ int anIndex = getIndex( theName );
+ if ( anIndex != -1 )
+ {
+ myListBox->setCurrentItem( anIndex );
+ myCurrFilterName = theName;
+ myCurrFilter = anIndex;
+ }
+ return anIndex != -1;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::getIndex
+// Purpose : Get index of the filter in list box
+//=======================================================================
+int SMESHGUI_FilterLibraryDlg::getIndex( const QString& theName ) const
+{
+ for ( int i = 0, n = myListBox->count(); i < n; i++ )
+ if ( myListBox->text( i ) == theName)
+ return i;
+ return -1;
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed
+// Purpose : SLOT. Called when "Delete" button pressed
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed()
+{
+ if ( myLibrary->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_WRN_WARNING" ), tr( "LIBRARY_IS_NOT_LOADED" ), QMessageBox::Ok );
+ return;
+ }
+
+ int anIndex = getIndex( myCurrFilterName );
+
+ if ( anIndex == -1 || !myLibrary->Delete( myCurrFilterName.latin1() ) )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_DELETING" ), QMessageBox::Ok );
+ }
+ else
+ {
+ myCurrFilterName = "";
+ myCurrFilterName = -1;
+ myListBox->removeItem( anIndex );
+
+ if ( anIndex >= 1 )
+ myListBox->setSelected( anIndex - 1, true );
+ else if ( anIndex == 0 && myListBox->count() > 0 )
+ myListBox->setSelected( 0, true );
+ else
+ myTable->Clear();
+ }
+
+ myTable->SetEnabled( myListBox->count() > 0 );
+ if ( myListBox->count() == 0 )
+ {
+ myName->setText( "" );
+ myName->setEnabled( false );
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onFilterNameChanged
+// Purpose : SLOT. Called when name of filter changed
+// Change filter name in list box
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onFilterNameChanged( const QString& theName )
+{
+ int aCurrItem = myListBox->currentItem();
+ if ( aCurrItem == -1 )
+ return;
+
+ myListBox->blockSignals( true );
+ myListBox->changeItem( theName, aCurrItem );
+ myListBox->blockSignals( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::SetTable
+// Purpose : Set table
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::SetTable( const SMESHGUI_FilterTable* theTable )
+{
+ myTable->Copy( theTable );
+ myName->setText( getDefaultFilterName() );
+ addFilterToLib( myName->text() );
+ myTable->Update();
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::GetTable
+// Purpose : Get table
+//=======================================================================
+const SMESHGUI_FilterTable* SMESHGUI_FilterLibraryDlg::GetTable() const
+{
+ return myTable;
+}
+
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onEntityTypeChanged
+// Purpose : SLOT. Called when entiyt type changed
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onEntityTypeChanged( const int theType )
+{
+ if ( myLibrary->_is_nil() )
+ return;
+
+ myName->clear();
+ myCurrFilterName = "";
+ myCurrFilter = -1;
+ updateList();
+ if ( myListBox->count() )
+ myListBox->setCurrentItem( 0 );
+}
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onNeedValidation
+// Purpose :
+//=======================================================================
+void SMESHGUI_FilterLibraryDlg::onNeedValidation()
+{
+ if ( !myCurrFilterName.isEmpty() )
+ {
+ bool valid = isValid( true );
+ myTable->SetValidity( valid );
+
+ if ( valid )
+ {
+ SMESH::Filter_var aFilter = createFilter( myTable->GetType() );
+ myLibrary->Replace( myCurrFilterName.latin1(), myName->text().latin1(), aFilter );
+ }
+ }
+}
+
+
+
+
+
+
+
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_FilterLibraryDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_FilterLibraryDlg_H
+#define SMESHGUI_FilterLibraryDlg_H
+
+#include <qdialog.h>
+#include <SMESHGUI_FilterDlg.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+
+class QCloseEvent;
+class QListBox;
+class QFrame;
+class QEvent;
+class QLineEdit;
+class QPushButton;
+class QGroupBox;
+
+/*
+ Class : SMESHGUI_FilterLibraryDlg
+ Description : Dialog to specify filters for VTK viewer
+*/
+
+class SMESHGUI_FilterLibraryDlg : public QDialog
+{
+ Q_OBJECT
+
+ // Buttons
+ enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
+
+ class Dialog;
+
+public:
+
+ // Mode
+ enum { ADD_TO, COPY_FROM, EDIT };
+
+public:
+
+ SMESHGUI_FilterLibraryDlg( QWidget* parent,
+ const QValueList<int>& types,
+ const int mode,
+ const char* name = 0 );
+
+ SMESHGUI_FilterLibraryDlg( QWidget* parent,
+ const int type,
+ const int mode,
+ const char* name = 0 );
+
+ virtual ~SMESHGUI_FilterLibraryDlg();
+
+ void Init( const QValueList<int>& types, const int theMode );
+ void Init( const int type, const int theMode );
+
+ const SMESHGUI_FilterTable* GetTable() const;
+ void SetTable( const SMESHGUI_FilterTable* );
+
+private:
+
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+
+private slots:
+
+ void onOk();
+ bool onApply();
+ void onClose();
+
+ void onDeactivate();
+
+ void onBrowse();
+ void onReturnPressed();
+ void onFilterChanged( const QString& );
+ void onAddBtnPressed();
+ void onDeleteBtnPressed();
+ void onFilterNameChanged( const QString& );
+ void onEntityTypeChanged( const int );
+ void onNeedValidation();
+
+private:
+
+ void construct( const QValueList<int>& types, const int mode );
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid( const bool theMess = true ) const;
+ bool isNameValid( const bool theMess = true ) const;
+ SMESH::Filter_ptr createFilter( const int theType = -1 );
+ QStringList prepareFilters() const;
+ QString autoExtension( const QString& ) const;
+ bool setSelected( const QString& );
+ int getIndex( const QString& ) const;
+ void updateControlsVisibility();
+ void updateMainButtons();
+ void enableMainButtons();
+ void processNewLibrary();
+ QString getFileName() const;
+ void setFileName( const QString& txt, const bool autoExtension = true );
+ QStringList filterWildCards( const QString& theFilter ) const;
+ QString& getDefaultLibraryName() const;
+ QString getDefaultFilterName() const;
+ void addFilterToLib( const QString& name );
+ void updateList();
+ bool isPermissionValid( const bool theIsExistingOnly );
+
+private:
+
+ QFrame* myMainFrame;
+ QMap<int, QPushButton*> myButtons;
+ SMESHGUI_FilterTable* myTable;
+ QLineEdit* myFileName;
+ QPushButton* myOpenBtn;
+ QListBox* myListBox;
+ QPushButton* myAddBtn;
+ QPushButton* myDeleteBtn;
+ QGroupBox* myNameGrp;
+ QLineEdit* myName;
+
+ QValueList<int> myTypes;
+ int myMode;
+
+ SMESH::FilterLibrary_var myLibrary;
+ QString myCurrFilterName;
+ int myCurrFilter;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_SMESHGenUtils.h"
+
+
+namespace SMESH
+{
+
+ SMESH::FilterManager_var GetFilterManager()
+ {
+ static SMESH::FilterManager_var aFilterManager;
+ if(CORBA::is_nil(aFilterManager)){
+ aFilterManager = GetSMESHGen()->CreateFilterManager();
+ }
+ return aFilterManager;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_FilterUtils_HeaderFile
+#define SMESHGUI_FilterUtils_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+
+
+namespace SMESH{
+
+ SMESH::FilterManager_var GetFilterManager();
+
+}
+
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "QAD_Desktop.h"
+
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_Utils.h"
+
+namespace SMESH{
+
+ GEOM::GEOM_Gen_var GetGEOMGen()
+ {
+ static GEOM::GEOM_Gen_var aGEOMGen;
+ if(CORBA::is_nil(aGEOMGen)){
+ if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
+ Engines::Component_var aComponent = aDesktop->getEngine("FactoryServer","GEOM");
+ aGEOMGen = GEOM::GEOM_Gen::_narrow(aComponent);
+ }
+ }
+ return aGEOMGen;
+ }
+
+
+ GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theSObject)
+ {
+ if(!theSObject->_is_nil()) {
+ using namespace SALOMEDS;
+ SObject_var aSubSObject;
+ static int Tag_RefOnShape = 1;
+ if(theSObject->FindSubObject(Tag_RefOnShape,aSubSObject)){
+ SObject_var aGeomSObject;
+ if(aSubSObject->ReferencedObject(aGeomSObject)){
+ return SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
+ }
+ }
+ }
+ return GEOM::GEOM_Object::_nil();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_GEOMGenUtils_HeaderFile
+#define SMESHGUI_GEOMGenUtils_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+
+namespace SMESH
+{
+
+ GEOM::GEOM_Gen_var GetGEOMGen();
+
+ GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theSObject);
+
+}
+
+
+#endif
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_GroupDlg.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_Filter.h"
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_GroupUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
-#include "VTKViewer_InteractorStyleSALOME.h"
#include "VTKViewer_ViewFrame.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "SMESH_Actor.h"
+#include "GEOMBase.h"
+
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <vector>
#include <algorithm>
+using namespace std;
+
//=================================================================================
// class : SMESHGUI_GroupDlg()
// purpose :
/***************************************************************/
QGroupBox* aSelectBox = new QGroupBox(3, Qt::Horizontal, this, "select box");
aSelectBox->setTitle(tr("SMESH_SELECT_FROM"));
-
+
mySelectSubMesh = new QCheckBox(aSelectBox, "submesh checkbox");
mySelectSubMesh->setText(tr("SMESH_SUBMESH"));
mySelectSubMesh->setMinimumSize(50, 0);
mySubMeshLine = new QLineEdit(aSelectBox, "submesh line");
mySubMeshLine->setReadOnly(true);
onSelectSubMesh(false);
-
+
mySelectGroup = new QCheckBox(aSelectBox, "group checkbox");
mySelectGroup->setText(tr("SMESH_GROUP"));
mySelectGroup->setMinimumSize(50, 0);
myGroupLine = new QLineEdit(aSelectBox, "group line");
myGroupLine->setReadOnly(true);
onSelectGroup(false);
-
- aSelectBox->setMinimumHeight(mySubMeshBtn->sizeHint().height() +
- myGroupBtn->sizeHint().height() +
- aSelectBox->sizeHint().height());
+
+ mySelectGeomGroup = new QCheckBox(aSelectBox, "geometry group checkbox");
+ mySelectGeomGroup->setText(tr("SMESH_GEOM_GROUP"));
+ mySelectGeomGroup->setMinimumSize(50, 0);
+ mySelectGeomGroup->setEnabled(create);
+ myGeomGroupBtn = new QPushButton(aSelectBox, "geometry group button");
+ myGeomGroupBtn->setText("");
+ myGeomGroupBtn->setPixmap(image0);
+ myGeomGroupLine = new QLineEdit(aSelectBox, "geometry group line");
+ myGeomGroupLine->setReadOnly(true);
+ onSelectGeomGroup(false);
+
+ aSelectBox->setMinimumHeight(137);
+ aSelectBox->setMinimumWidth(305);
/***************************************************************/
QFrame* aButtons = new QFrame(this, "button box");
connect(mySelectSubMesh, SIGNAL(toggled(bool)), this, SLOT(onSelectSubMesh(bool)));
connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool)));
+ connect(mySelectGeomGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGeomGroup(bool)));
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+ connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
mySubMeshFilter = new SMESH_TypeFilter(SUBMESH);
myGroupFilter = new SMESH_TypeFilter(GROUP);
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onClose()));
+ connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
{
// no need to delete child widgets, Qt does it all for us
+ if ( myFilterDlg != 0 )
+ {
+ myFilterDlg->reparent( 0, QPoint() );
+ delete myFilterDlg;
+ }
}
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
myGroup = SMESH::SMESH_Group::_nil();
- Standard_Boolean aResult;
- myActor = mySMESHGUI->FindActor(myMesh, aResult, true);
- mySMESHGUI->SetPickable(myActor);
+ myActor = SMESH::FindActorByObject(myMesh);
+ SMESH::SetPickable(myActor);
myTypeGroup->setButton(0);
onTypeChanged(0);
//=================================================================================
void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
{
-
myMesh = theGroup->GetMesh();
myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
-
- Standard_Boolean aResult;
- myActor = mySMESHGUI->FindActor(myMesh, aResult, true);
+
+ myActor = SMESH::FindActorByObject(myMesh);
if ( !myActor )
- myActor = mySMESHGUI->FindActor(myGroup, aResult, true);
- mySMESHGUI->SetPickable(myActor);
+ myActor = SMESH::FindActorByObject(myGroup);
+ SMESH::SetPickable(myActor);
int aType = 0;
switch(theGroup->GetType()) {
myElements->clear();
if (myCurrentLineEdit == 0)
setSelectionMode(id);
- myFilter->setEnabled(id == 1 || id == 2);
}
myTypeId = id;
}
if (mySelectionMode != theMode) {
mySelection->ClearIObjects();
mySelection->ClearFilters();
- if (mySelectionMode == 0)
- mySMESHGUI->EraseSimulationActors();
+ SMESH::SetPointRepresentation(false);
if (theMode < 4) {
- if (theMode == 0) {
- mySMESHGUI->ViewNodes();
+ switch(theMode){
+ case 0:
+ if ( myActor )
+ myActor->SetPointRepresentation(true);
+ else
+ SMESH::SetPointRepresentation(true);
QAD_Application::getDesktop()->SetSelectionMode(NodeSelection, true);
- }
- else if (theMode == 1) {
+ break;
+ case 1:
QAD_Application::getDesktop()->SetSelectionMode(EdgeSelection, true);
- }
- else if (theMode == 2) {
+ break;
+ case 2:
QAD_Application::getDesktop()->SetSelectionMode(FaceSelection, true);
- }
- else {
+ break;
+ default:
QAD_Application::getDesktop()->SetSelectionMode(VolumeSelection, true);
}
}
//=================================================================================
bool SMESHGUI_GroupDlg::onApply()
{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return false;
if (!myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0) {
mySelection->ClearIObjects();
if (myGroup->_is_nil()) {
anIdList[i] = anItem->text().toInt();
}
- myGroup = mySMESHGUI->AddGroup(myMesh, aType, myName->text());
- myGroup->Add(anIdList);
-
+ myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
+ myGroup->Add(anIdList.inout());
+
+ //Add reference to geometry group if it is neccessary
+ if (!CORBA::is_nil( myGeomGroup ))
+ {
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::SObject_var aGeomGroupSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGeomGroup) );
+ SALOMEDS::SObject_var aMeshGroupSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGroup) );
+ SALOMEDS::SObject_var aReference = aStudyBuilder->NewObject(aMeshGroupSO);
+ aStudyBuilder->Addreference(aReference, aGeomGroupSO);
+ }
+
/* init for next operation */
myName->setText("");
myElements->clear();
int i;
for (i = 0, anIt = aAddList.begin(); anIt != aAddList.end(); anIt++, i++)
anIdList[i] = *anIt;
- myGroup->Add(anIdList);
+ myGroup->Add(anIdList.inout());
}
if (!myIdList.empty()) {
SMESH::long_array_var anIdList = new SMESH::long_array;
int i;
for (i = 0, anIt = myIdList.begin(); anIt != myIdList.end(); anIt++, i++)
anIdList[i] = *anIt;
- myGroup->Remove(anIdList);
+ myGroup->Remove(anIdList.inout());
}
/* init for next operation */
myIdList.clear();
}
mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
+ SMESH::UpdateView(); // asv: fix of BUG PAL5515
mySelection->ClearIObjects();
return true;
}
onClose();
}
-//=================================================================================
-// function : onClose()
-// purpose :
-//=================================================================================
-void SMESHGUI_GroupDlg::onClose()
-{
- close();
-}
-
-
static bool busy = false;
//=================================================================================
// function : onListSelectionChanged()
QListBoxItem* anItem;
for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
if (anItem->isSelected()) {
- std::vector<int> aVtkList;
- if (myTypeId == 0)
- aVtkList = myActor->GetNodeVtkId(anItem->text().toInt());
- else
- aVtkList = myActor->GetElemVtkId(anItem->text().toInt());
-
- if (aVtkList.size() > 0) {
- std::vector<int>::iterator it;
- for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
- aIndexes.Add(*it);
- }
- }
+ int anId = anItem->text().toInt();
+ aIndexes.Add(anId);
}
}
mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
//=================================================================================
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
{
- if (busy) return;
+ if (busy || !isEnabled()) return;
busy = true;
int aNbSel = mySelection->IObjectCount();
myElements->clearSelection();
-
+
if (myCurrentLineEdit) {
myCurrentLineEdit->setText("") ;
QString aString = "";
+
+ if (myCurrentLineEdit == myGeomGroupLine)
+ {
+ if(aNbSel != 1)
+ {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ busy = false;
+ return;
+ }
+ Standard_Boolean testResult = Standard_False;
+ myGeomGroup = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
+
+ // Check if the object is a geometry group
+ if(!testResult || CORBA::is_nil( myGeomGroup ) || myGeomGroup->GetType() != 37)
+ {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ busy = false;
+ return;
+ }
+ // Check if group constructed on the same shape as a mesh or on its child
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+ GEOM::GEOM_IGroupOperations_var anOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+ // The main shape of the group
+ GEOM::GEOM_Object_var aGroupMainShape = anOp->GetMainShape( myGeomGroup );
+ SALOMEDS::SObject_var aGroupMainShapeSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(aGroupMainShape) );
+ // The mesh SObject
+ SALOMEDS::SObject_var aMeshSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myMesh) );
+
+ SALOMEDS::SObject_var anObj, aRef;
+ bool isRefOrSubShape = false;
+
+ if ( aMeshSO->FindSubObject( 1, anObj ) && anObj->ReferencedObject( aRef )) {
+ if ( strcmp( aRef->GetID(), aGroupMainShapeSO->GetID() ) == 0 )
+ isRefOrSubShape = true;
+ else
+ {
+ SALOMEDS::SObject_var aFather = aGroupMainShapeSO->GetFather();
+ SALOMEDS::SComponent_var aComponent = aGroupMainShapeSO->GetFatherComponent();
+ while ( !isRefOrSubShape && strcmp( aFather->GetID(), aComponent->GetID() ) != 0 )
+ {
+ if (strcmp( aRef->GetID(), aFather->GetID() ) == 0)
+ isRefOrSubShape = true;
+ else
+ aFather = aFather->GetFather();
+ }
+ }
+ if ( !isRefOrSubShape )
+ {
+ myGeomGroup = GEOM::GEOM_Object::_nil();
+ busy = false;
+ return;
+ }
+ }
+ }
+
if (aNbSel >= 1) {
if (aNbSel > 1) {
- if (myCurrentLineEdit = mySubMeshLine)
+ if (myCurrentLineEdit == mySubMeshLine)
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
- else if (myCurrentLineEdit = myGroupLine)
+ else if (myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
}
else {
aString = mySelection->firstIObject()->getName();
}
}
-
+
myCurrentLineEdit->setText(aString) ;
myCurrentLineEdit->home( false );
}
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
- aNbItems = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aListStr);
+ aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, aListStr);
}
else {
- aNbItems = mySMESHGUI->GetNameOfSelectedElements(mySelection, aListStr);
+ aNbItems = SMESH::GetNameOfSelectedElements(mySelection, aListStr);
}
if (aNbItems > 0) {
QStringList anElements = QStringList::split(" ", aListStr);
}
}
}
+
+ if ( !myActor ) {
+ if ( !myGroup->_is_nil() )
+ myActor = SMESH::FindActorByObject(myGroup);
+ else
+ myActor = SMESH::FindActorByObject(myMesh);
+ }
+
busy = false;
}
if (on) {
if (mySelectGroup->isChecked()) {
mySelectGroup->setChecked(false);
+ }
+ else if (mySelectGeomGroup->isChecked()) {
+ mySelectGeomGroup->setChecked(false);
}
myCurrentLineEdit = mySubMeshLine;
setSelectionMode(4);
mySubMeshLine->setEnabled(on);
}
+
//=================================================================================
// function : (onSelectGroup)
// purpose : Called when selection in 3D view or ObjectBrowser is changed
if (mySelectSubMesh->isChecked()) {
mySelectSubMesh->setChecked(false);
}
+ else if (mySelectGeomGroup->isChecked()) {
+ mySelectGeomGroup->setChecked(false);
+ }
myCurrentLineEdit = myGroupLine;
setSelectionMode(5);
}
myGroupLine->setEnabled(on);
}
+
+//=================================================================================
+// function : (onSelectGeomGroup)
+// purpose : Called when selection in 3D view or ObjectBrowser is changed
+//=================================================================================
+void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
+{
+ if (on) {
+ if (mySelectSubMesh->isChecked()) {
+ mySelectSubMesh->setChecked(false);
+ }
+ else if (mySelectGroup->isChecked()) {
+ mySelectGroup->setChecked(false);
+ }
+ myCurrentLineEdit = myGeomGroupLine;
+ setSelectionMode(6);
+ }
+ else {
+ myGeomGroupLine->setText("");
+ myCurrentLineEdit = 0;
+ if (myTypeId != -1)
+ setSelectionMode(myTypeId);
+ }
+ myGeomGroupBtn->setEnabled(on);
+ myGeomGroupLine->setEnabled(on);
+}
+
+
//=================================================================================
// function : setCurrentSelection()
// purpose :
myCurrentLineEdit = myGroupLine;
onObjectSelectionChanged();
}
+ else if (send == myGeomGroupBtn) {
+ myCurrentLineEdit = myGeomGroupLine;
+ onObjectSelectionChanged();
+ }
}
case 3 : aType = SMESH::VOLUME; break;
default: return;
}
-
+
if ( myFilterDlg == 0 )
- myFilterDlg = new SMESHGUI_FilterDlg( this, aType, true );
+ {
+ myFilterDlg = new SMESHGUI_FilterDlg( (QWidget*)parent(), aType );
+ connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
+ }
else
myFilterDlg->Init( aType );
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( myElements );
- if ( myFilterDlg->exec() != QDialog::Accepted )
- return;
+ myFilterDlg->show();
+}
+//=================================================================================
+// function : onFilterAccepted()
+// purpose : SLOT. Called when Filter dlg closed with OK button.
+// Uncheck "Select submesh" and "Select group" checkboxes
+//=================================================================================
+void SMESHGUI_GroupDlg::onFilterAccepted()
+{
if ( mySelectSubMesh->isChecked() || mySelectGroup->isChecked() )
{
mySelectionMode = myTypeId;
void SMESHGUI_GroupDlg::onAdd()
{
int aNbSel = mySelection->IObjectCount();
- if (aNbSel == 0) return;
+ if (aNbSel == 0 || !myActor) return;
busy = true;
}
if (myCurrentLineEdit == 0) {
- if (aNbSel != 1) { busy = false; return; }
+ //if (aNbSel != 1) { busy = false; return; }
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
- aNbItems = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aListStr);
+ aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, myActor->getIO(), aListStr);
}
else {
- aNbItems = mySMESHGUI->GetNameOfSelectedElements(mySelection, aListStr);
+ aNbItems = SMESH::GetNameOfSelectedElements(mySelection, myActor->getIO(), aListStr);
}
if (aNbItems > 0) {
QStringList anElements = QStringList::split(" ", aListStr);
}
}
else if (myCurrentLineEdit == mySubMeshLine) {
- Standard_Boolean aRes;
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
for (; anIt.More(); anIt.Next()) {
- SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->ConvertIOinSubMesh(anIt.Value(), aRes);
- if (aRes && !aSubMesh->_is_nil()) {
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
+ if (!aSubMesh->_is_nil()) {
// check if mesh is the same
if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
- if (aType == SMESH::NODE) {
- try {
- SMESH::long_array_var anElements = aSubMesh->GetNodesId();
- int k = anElements->length();
- QListBoxItem* anItem = 0;
- for (int i = 0; i < k; i++) {
- QString aText = QString::number(anElements[i]);
- anItem = myElements->findItem(aText, Qt::ExactMatch);
- if (!anItem) {
- anItem = new QListBoxText(aText);
- myElements->insertItem(anItem);
- }
- myElements->setSelected(anItem, true);
- }
- }
- catch (const SALOME::SALOME_Exception& ex) {
- QtCatchCorbaException(ex);
- }
- }
- else {
- try {
- SMESH::long_array_var anElements = aSubMesh->GetElementsId();
- int k = anElements->length();
- QListBoxItem* anItem = 0;
- for (int i = 0; i < k; i++) {
- QString aText = QString::number(anElements[i]);
- anItem = myElements->findItem(aText, Qt::ExactMatch);
- if (!anItem) {
- anItem = new QListBoxText(aText);
- myElements->insertItem(anItem);
- }
- myElements->setSelected(anItem, true);
- }
- }
- catch (const SALOME::SALOME_Exception& ex) {
- QtCatchCorbaException(ex);
- }
- }
- }
+ try {
+ SMESH::long_array_var anElements = aSubMesh->GetElementsByType ( aType );
+ int k = anElements->length();
+ QListBoxItem* anItem = 0;
+ for (int i = 0; i < k; i++) {
+ QString aText = QString::number(anElements[i]);
+ anItem = myElements->findItem(aText, Qt::ExactMatch);
+ if (!anItem) {
+ anItem = new QListBoxText(aText);
+ myElements->insertItem(anItem);
+ }
+ myElements->setSelected(anItem, true);
+ }
+ }
+ catch (const SALOME::SALOME_Exception& ex) {
+ QtCatchCorbaException(ex);
+ }
+ }
}
}
mySelectSubMesh->setChecked(false);
onListSelectionChanged();
}
else if (myCurrentLineEdit == myGroupLine) {
- Standard_Boolean aRes;
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
for (; anIt.More(); anIt.Next()) {
- SMESH::SMESH_Group_var aGroup = mySMESHGUI->ConvertIOinSMESHGroup(anIt.Value(), aRes);
- if (aRes && !aGroup->_is_nil()) {
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
+ if (!aGroup->_is_nil()) {
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
SMESH::long_array_var anElements = aGroup->GetListOfID();
busy = false;
onListSelectionChanged();
}
+ else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
+
+ SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
+ GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
+ SMESH::ElementType aGroupType = SMESH::ALL;
+ switch(aGroupOp->GetType(myGeomGroup)) {
+ case 7: aGroupType = SMESH::NODE; break;
+ case 6: aGroupType = SMESH::EDGE; break;
+ case 4: aGroupType = SMESH::FACE; break;
+ case 2: aGroupType = SMESH::VOLUME; break;
+ default: return;
+ }
+
+ if (aGroupType == aType) {
+ SALOMEDS::SObject_var aGroupSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGeomGroup) );
+ // Construct filter
+ SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
+ SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
+ SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();;
+ aBelongToGeom->SetGeom(myGeomGroup);
+ aBelongToGeom->SetShapeName(aGroupSO->GetName());
+ aBelongToGeom->SetElementType(aType);
+ aFilter->SetPredicate( aBelongToGeom );
+
+ SMESH::long_array_var anElements = aFilter->GetElementsId( myMesh );
+
+ int k = anElements->length();
+ QListBoxItem* anItem = 0;
+ for (int i = 0; i < k; i++) {
+ QString aText = QString::number(anElements[i]);
+ anItem = myElements->findItem(aText, Qt::ExactMatch);
+ if (!anItem) {
+ anItem = new QListBoxText(aText);
+ myElements->insertItem(anItem);
+ }
+ myElements->setSelected(anItem, true);
+ }
+ }
+
+ mySelectGeomGroup->setChecked(false);
+ busy = false;
+ onListSelectionChanged();
+ }
busy = false;
// mySelection->ClearIObjects();
updateButtons();
}
if (myCurrentLineEdit == mySubMeshLine) {
- Standard_Boolean aRes;
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
for (; anIt.More(); anIt.Next()) {
- SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->ConvertIOinSubMesh(anIt.Value(), aRes);
- if (aRes && !aSubMesh->_is_nil()) {
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
+ if (!aSubMesh->_is_nil()) {
// check if mesh is the same
if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
if (aType == SMESH::NODE) {
Standard_Boolean aRes;
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
for (; anIt.More(); anIt.Next()) {
- SMESH::SMESH_Group_var aGroup = mySMESHGUI->ConvertIOinSMESHGroup(anIt.Value(), aRes);
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
if (aRes && !aGroup->_is_nil()) {
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
// purpose :
//=================================================================================
void SMESHGUI_GroupDlg::closeEvent( QCloseEvent* e )
+{
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_GroupDlg::onClose()
{
QAD_StudyFrame* aStudyFrame = mySMESHGUI->GetActiveStudy()->getActiveStudyFrame();
if (aStudyFrame->getTypeView() == VIEW_VTK) {
- mySMESHGUI->SetPickable();
- if (mySelectionMode == 0)
- mySMESHGUI->EraseSimulationActors();
+ SMESH::SetPointRepresentation(false);
+ SMESH::SetPickable();
// remove filters from viewer
- VTKViewer_InteractorStyleSALOME* aStyle = ((VTKViewer_ViewFrame*)aStudyFrame->getRightFrame()->getViewFrame())->getRWInteractor()->GetInteractorStyleSALOME();
- aStyle->RemoveEdgeFilter();
- aStyle->RemoveFaceFilter();
-
+ if(VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle()){
+ SMESH::RemoveFilter(SMESHGUI_EdgeFilter,aStyle);
+ SMESH::RemoveFilter(SMESHGUI_FaceFilter,aStyle);
+ }
}
mySelection->ClearIObjects();
mySelection->ClearFilters();
mySMESHGUI->ResetState();
- QDialog::closeEvent( e );
+ reject();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_GroupDlg::onDeactivate()
+{
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_GroupDlg::enterEvent( QEvent* )
+{
+ if ( !isEnabled() ) {
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ setEnabled( true );
+ mySelectionMode = -1;
+ setSelectionMode( myTypeId );
+ }
+}
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_GroupDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ onClose();
}
class QLineEdit;
class QButtonGroup;
+class QGroupBox;
class QListBox;
class QPushButton;
class QCheckBox;
void onOK();
void onClose();
bool onApply();
+ void onDeactivate();
void onListSelectionChanged();
void onObjectSelectionChanged();
void onSelectSubMesh(bool on);
void onSelectGroup(bool on);
+ void onSelectGeomGroup(bool on);
void setCurrentSelection();
void setFilters();
void onSort();
void onNameChanged(const QString& text);
+ void onFilterAccepted();
private:
void initDialog(SALOME_Selection* theSel, bool create);
void init(SMESH::SMESH_Mesh_ptr theMesh);
void init(SMESH::SMESH_Group_ptr theGroup);
void closeEvent(QCloseEvent* e);
+ void enterEvent ( QEvent * ) ;
+ void hideEvent ( QHideEvent * ); /* ESC key */
void setSelectionMode(int theMode);
void updateButtons();
QLineEdit* myName;
QListBox* myElements;
QPushButton* myFilter;
-
QCheckBox* mySelectSubMesh;
QPushButton* mySubMeshBtn;
QLineEdit* mySubMeshLine;
QPushButton* myGroupBtn;
QLineEdit* myGroupLine;
+ QCheckBox* mySelectGeomGroup;
+ QPushButton* myGeomGroupBtn;
+ QLineEdit* myGeomGroupLine;
+
SMESH::SMESH_Mesh_var myMesh;
SMESH::SMESH_Group_var myGroup;
QValueList<int> myIdList;
+ GEOM::GEOM_Object_var myGeomGroup;
int mySelectionMode;
Handle(SMESH_TypeFilter) mySubMeshFilter;
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_GroupOpDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_GroupOpDlg.h"
+
+#include "QAD_Desktop.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+#include <qframe.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qlineedit.h>
+#include <qmessagebox.h>
+
+#define SPACING 5
+#define MARGIN 10
+
+/*
+ Class : SMESHGUI_GroupOpDlg
+ Description : Perform boolean operations on groups
+*/
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const int theMode )
+: QDialog( theParent, "SMESHGUI_GroupOpDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ myMode = theMode;
+
+ if ( myMode == UNION ) setCaption( tr( "UNION_OF_TWO_GROUPS" ) );
+ else if ( myMode == INTERSECT ) setCaption( tr( "INTERSECTION_OF_TWO_GROUPS" ) );
+ else setCaption( tr( "CUT_OF_TWO_GROUPS" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
+
+ Init( theSelection );
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
+ aMainGrp->setFrameStyle( QFrame::NoFrame );
+ aMainGrp->setInsideMargin( 0 );
+
+ QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, tr( "NAME" ), aMainGrp );
+ new QLabel( tr( "RESULT_NAME" ), aNameGrp );
+ myNameEdit = new QLineEdit( aNameGrp );
+
+ QGroupBox* anArgGrp = new QGroupBox( 3, Qt::Horizontal, tr( "ARGUMENTS" ), aMainGrp );
+
+ new QLabel( myMode == CUT ? tr( "MAIN_OBJECT" ) :tr( "OBJECT_1" ), anArgGrp );
+ myBtn1 = new QPushButton( anArgGrp );
+ myEdit1 = new QLineEdit( anArgGrp );
+
+ new QLabel( myMode == CUT ? tr( "TOOL_OBJECT" ) :tr( "OBJECT_2" ), anArgGrp );
+ myBtn2 = new QPushButton( anArgGrp );
+ myEdit2 = new QLineEdit( anArgGrp );
+
+ myEdit1->setReadOnly( true );
+ myEdit2->setReadOnly( true );
+
+ QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
+ myBtn1->setPixmap( aPix );
+ myBtn2->setPixmap( aPix );
+
+ return aMainGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_GroupOpDlg::createButtonFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+
+ aLay->addWidget( myOkBtn );
+ aLay->addWidget( myApplyBtn );
+ aLay->addItem( aSpacer);
+ aLay->addWidget( myCloseBtn );
+
+ // connect signals and slots
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_GroupOpDlg::Init( SALOME_Selection* theSelection )
+{
+ mySelection = theSelection;
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+ myFocusWg = myEdit1;
+
+ myGroup1 = SMESH::SMESH_Group::_nil();
+ myGroup2 = SMESH::SMESH_Group::_nil();
+
+ // selection and SMESHGUI
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( ClickOnClose() ) );
+
+ connect( myBtn1, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
+ connect( myBtn2, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
+
+ int x, y ;
+ aSMESHGUI->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+ this->show();
+
+ // set selection mode
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+
+ return;
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::isValid
+// Purpose : Verify validity of input data
+//=======================================================================
+bool SMESHGUI_GroupOpDlg::isValid()
+{
+ // Verify validity of group name
+ if ( myNameEdit->text() == "" )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "EMPTY_NAME" ), QMessageBox::Ok );
+ return false;
+ }
+
+ // Verufy wheter arguments speciffiyed
+ if ( myGroup1->_is_nil() || myGroup2->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "INCORRECT_ARGUMENTS" ), QMessageBox::Ok );
+ return false;
+ }
+
+ // Verify whether arguments belongs to same mesh
+ SMESH::SMESH_Mesh_ptr aMesh1 = myGroup1->GetMesh();
+ SMESH::SMESH_Mesh_ptr aMesh2 = myGroup2->GetMesh();
+
+ int aMeshId1 = !aMesh1->_is_nil() ? aMesh1->GetId() : -1;
+ int aMeshId2 = !aMesh2->_is_nil() ? aMesh2->GetId() : -1;
+
+ if ( aMeshId1 != aMeshId2 || aMeshId1 == -1 )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_MESHES" ), QMessageBox::Ok );
+ return false;
+ }
+
+ // Verify whether groups have same types of entities
+ if ( myGroup1->GetType() != myGroup2->GetType() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_TYPES" ), QMessageBox::Ok );
+ return false;
+ }
+
+
+ return true;
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onApply
+// Purpose : SLOT called when "Apply" button pressed.
+//=======================================================================
+bool SMESHGUI_GroupOpDlg::onApply()
+{
+ if ( !isValid() || SMESHGUI::GetSMESHGUI()->ActiveStudyLocked() )
+ return false;
+
+ SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
+ QString aName = myNameEdit->text();
+ SMESH::SMESH_Group_ptr aNewGrp = SMESH::SMESH_Group::_nil();
+
+ if ( myMode == UNION ) aNewGrp = aMesh->UnionGroups( myGroup1, myGroup2, aName.latin1() );
+ else if ( myMode == INTERSECT ) aNewGrp = aMesh->IntersectGroups( myGroup1, myGroup2, aName.latin1() );
+ else aNewGrp = aMesh->CutGroups( myGroup1, myGroup2, aName.latin1() );
+
+ if ( !aNewGrp->_is_nil() )
+ {
+ SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
+ reset();
+ return true;
+ }
+ else
+ {
+ QMessageBox::critical( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), "OK" );
+ return false;
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+//=======================================================================
+void SMESHGUI_GroupOpDlg::onOk()
+{
+ if ( onApply() )
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_GroupOpDlg::onClose()
+{
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState();
+ mySelection->ClearFilters();
+ reject();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_GroupOpDlg::onSelectionDone()
+{
+ if ( myFocusWg == myEdit1 )
+ myGroup1 = SMESH::SMESH_Group::_nil();
+ else
+ myGroup2 = SMESH::SMESH_Group::_nil();
+
+ myFocusWg->setText( "" );
+
+ if ( mySelection->IObjectCount() == 1 )
+ {
+ SMESH::SMESH_Group_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_Group>( mySelection->firstIObject() );
+
+ if ( !aGroup->_is_nil() )
+ {
+ myFocusWg->setText( aGroup->GetName() );
+
+ if ( myFocusWg == myEdit1 )
+ myGroup1 = aGroup;
+ else
+ myGroup2 = aGroup;
+ }
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_GroupOpDlg::onDeactivate()
+{
+ setEnabled( false );
+ mySelection->ClearFilters();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_GroupOpDlg::enterEvent( QEvent* )
+{
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
+ setEnabled( true );
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_GroupOpDlg::closeEvent( QCloseEvent* )
+{
+ onClose() ;
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::onFocusChanged
+// Purpose : SLOT. Called when "Select" button pressed.
+//=======================================================================
+void SMESHGUI_GroupOpDlg::onFocusChanged()
+{
+ const QObject* aSender = sender();
+ myFocusWg = aSender == myBtn1 ? myEdit1 : myEdit2;
+ onSelectionDone();
+}
+
+//=======================================================================
+// name : SMESHGUI_GroupOpDlg::reset
+// Purpose : Rest state of dialog
+//=======================================================================
+void SMESHGUI_GroupOpDlg::reset()
+{
+ myNameEdit->setText( "" );
+ myEdit1->setText( "" );
+ myEdit2->setText( "" );
+ myFocusWg = myEdit1;
+ myNameEdit->setFocus();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_GroupOpDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_GroupOpDlg_H
+#define SMESHGUI_GroupOpDlg_H
+
+#include <qdialog.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+class QCloseEvent;
+class QLabel;
+class QFrame;
+class QPushButton;
+class SALOME_Selection;
+class QLineEdit;
+
+/*
+ Class : SMESHGUI_GroupOpDlg
+ Description : Perform boolean operations on groups
+*/
+
+class SMESHGUI_GroupOpDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ enum { UNION, INTERSECT, CUT };
+
+public:
+ SMESHGUI_GroupOpDlg( QWidget*, SALOME_Selection*, const int );
+ virtual ~SMESHGUI_GroupOpDlg();
+
+ void Init( SALOME_Selection* ) ;
+
+private:
+
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+
+private slots:
+
+ void onOk();
+ bool onApply();
+ void onClose();
+
+ void onDeactivate();
+ void onSelectionDone();
+ void onFocusChanged();
+
+private:
+
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid();
+ void reset();
+
+private:
+
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+
+ QLineEdit* myNameEdit;
+ QLineEdit* myEdit1;
+ QLineEdit* myEdit2;
+ QPushButton* myBtn1;
+ QPushButton* myBtn2;
+
+ SALOME_Selection* mySelection;
+ int myMode;
+
+ QLineEdit* myFocusWg;
+
+ SMESH::SMESH_Group_var myGroup1;
+ SMESH::SMESH_Group_var myGroup2;
+
+};
+
+#endif
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "QAD_Study.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+#include "SMESHGUI_GroupUtils.h"
+#include "SMESHGUI_Utils.h"
+
+namespace SMESH
+{
+
+ SMESH::SMESH_Group_var AddGroup( SMESH::SMESH_Mesh_ptr theMesh,
+ SMESH::ElementType theType,
+ const char* theGroupName )
+ {
+ SMESH::SMESH_Group_var aGroup;
+ try {
+ if ( !theMesh->_is_nil() )
+ aGroup = theMesh->CreateGroup( theType, theGroupName );
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ QtCatchCorbaException( S_ex );
+ }
+ GetActiveStudy()->updateObjBrowser( true );
+ return aGroup._retn();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_GroupUtils_HeaderFile
+#define SMESHGUI_GroupUtils_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+
+namespace SMESH{
+
+ SMESH::SMESH_Group_var AddGroup(SMESH::SMESH_Mesh_ptr theMesh,
+ SMESH::ElementType theType,
+ const char* theGroupName);
+}
+
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <map>
+#include <string>
+
+#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_Utils.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace SMESH{
+
+ using namespace std;
+
+ typedef map<string,HypothesisData*> THypothesisDataMap;
+ THypothesisDataMap myHypothesesMap;
+ THypothesisDataMap myAlgorithmsMap;
+
+ typedef map<string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
+ THypCreatorMap myHypCreatorMap;
+
+ void InitAvailableHypotheses()
+ {
+ QAD_WaitCursor wc;
+ if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) {
+ // Resource manager
+ QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
+ if (!resMgr) return;
+
+ // Find name of a resource XML file ("SMESH_Meshers.xml");
+ QString HypsXml;
+ char* cenv = getenv("SMESH_MeshersList");
+ if (cenv)
+ HypsXml.sprintf("%s", cenv);
+
+ QStringList HypsXmlList = QStringList::split( ":", HypsXml, false );
+ if (HypsXmlList.count() == 0)
+ {
+ QAD_MessageBox::error1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("MESHERS_FILE_NO_VARIABLE"),
+ tr("SMESH_BUT_OK"));
+ return;
+ }
+
+ // loop on files in HypsXml
+ QString aNoAccessFiles;
+ for ( int i = 0; i < HypsXmlList.count(); i++ ) {
+ QString HypsXml = HypsXmlList[ i ];
+
+ // Find full path to the resource XML file
+ QString xmlFile = HypsXml + ".xml";
+ xmlFile = QAD_Tools::addSlash(resMgr->findFile(xmlFile, HypsXml)) + xmlFile;
+
+ QFile file (QAD_Tools::unix2win(xmlFile));
+ if (file.exists() && file.open(IO_ReadOnly)) {
+ file.close();
+
+ SMESHGUI_XmlHandler* myXmlHandler = new SMESHGUI_XmlHandler();
+ ASSERT(myXmlHandler);
+
+ QXmlInputSource source (file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(myXmlHandler);
+ reader.setErrorHandler(myXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+ if (ok) {
+ addMap( myXmlHandler->myHypothesesMap, myHypothesesMap );
+ addMap( myXmlHandler->myAlgorithmsMap, myAlgorithmsMap );
+ }
+ else {
+ QAD_MessageBox::error1(myDesktop,
+ tr("INF_PARSE_ERROR"),
+ tr(myXmlHandler->errorProtocol()),
+ tr("SMESH_BUT_OK"));
+ }
+ }
+ else {
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }
+ } // end loop
+
+
+ if (!aNoAccessFiles.isEmpty()) {
+ QString aMess = tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
+ aMess += tr("MESHERS_FILE_CHECK_VARIABLE");
+ wc.stop();
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ aMess,
+ tr("SMESH_BUT_OK"));
+ wc.start();
+ }
+ }
+ }
+
+
+ GetAvailableHypotheses (const bool isAlgo)
+ {
+ QStringList aHypList;
+
+ // Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ // fill list of hypotheses/algorithms
+ THypothesisDataMap::iterator anIter;
+ if (isAlgo) {
+ anIter = myAlgorithmsMap.begin();
+ for (; anIter != myAlgorithmsMap.end(); anIter++) {
+ aHypList.append(((*anIter).first).c_str());
+ }
+ }
+ else {
+ anIter = myHypothesesMap.begin();
+ for (; anIter != myHypothesesMap.end(); anIter++) {
+ aHypList.append(((*anIter).first).c_str());
+ }
+ }
+
+ return aHypList;
+ }
+
+
+ HypothesisData* GetHypothesisData (const char* aHypType)
+ {
+ HypothesisData* aHypData = 0;
+
+ // Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ if (myHypothesesMap.find(aHypType) == myHypothesesMap.end()) {
+ if (myAlgorithmsMap.find(aHypType) != myAlgorithmsMap.end()) {
+ aHypData = myAlgorithmsMap[aHypType];
+ }
+ }
+ else {
+ aHypData = myHypothesesMap[aHypType];
+ }
+ return aHypData;
+ }
+
+
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator (const QString& aHypType)
+ {
+ const char* sHypType = aHypType.latin1();
+ if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << sHypType);
+
+ SMESHGUI_GenericHypothesisCreator* aCreator = 0;
+
+ // check, if creator for this hypothesis type already exists
+ if (myHypCreatorMap.find(sHypType) != myHypCreatorMap.end()) {
+ aCreator = myHypCreatorMap[sHypType];
+ }
+ else {
+ // 1. Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ // 2. Get names of plugin libraries
+ HypothesisData* aHypData = GetHypothesisData(sHypType);
+ if (!aHypData) {
+ return aCreator;
+ }
+ QString aClientLibName = aHypData->ClientLibName;
+ QString aServerLibName = aHypData->ServerLibName;
+
+ // 3. Load Client Plugin Library
+ try {
+ // load plugin library
+ if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
+ void* libHandle = dlopen (aClientLibName, RTLD_LAZY);
+ if (!libHandle) {
+ // report any error, if occured
+ const char* anError = dlerror();
+ if(MYDEBUG) MESSAGE(anError);
+ }
+ else {
+ // get method, returning hypothesis creator
+ if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
+ typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
+ (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
+ GetHypothesisCreator procHandle =
+ (GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
+ if (!procHandle) {
+ if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
+ dlclose(libHandle);
+ }
+ else {
+ // get hypothesis creator
+ if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType);
+ aCreator = procHandle(aHypType, aServerLibName, smeshGUI);
+ if (!aCreator) {
+ if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
+ }
+ else {
+ // map hypothesis creator to a hypothesis name
+ myHypCreatorMap[sHypType] = aCreator;
+ }
+ }
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
+
+ return aCreator;
+ }
+
+
+ SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const QString& aHypType,
+ const QString& aHypName,
+ const bool isAlgo = false)
+ {
+ if(MYDEBUG) MESSAGE("Create " << aHypType << " with name " << aHypName);
+
+ SMESH::SMESH_Hypothesis_var Hyp;
+
+ HypothesisData* aHypData = GetHypothesisData((char*)aHypType.latin1());
+ QString aServLib = aHypData->ServerLibName;
+
+ try {
+ Hyp = SMESH::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
+ if (!Hyp->_is_nil()) {
+ SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
+ if (!SHyp->_is_nil()) {
+ if ( !aHypName.isEmpty() )
+ SMESH::SetName( SHyp, aHypName );
+ myActiveStudy->updateObjBrowser(true);
+ return Hyp._retn();
+ }
+ }
+ }
+ catch (const SALOME::SALOME_Exception & S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+
+ return SMESH::SMESH_Hypothesis::_nil();
+ }
+
+
+ bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
+ {
+ if(MYDEBUG) MESSAGE ("SMESHGUI::AddHypothesisOnMesh");
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if ( !aMesh->_is_nil() ) {
+ SALOMEDS::SObject_var SM = SMESH::FindSObject( aMesh );
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
+ try {
+ res = aMesh->AddHypothesis( aShapeObject, aHyp );
+ if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
+ SALOMEDS::SObject_var SH = SMESH::FindSObject(aHyp);
+ if ( !SM->_is_nil() && !SH->_is_nil() ) {
+ SMESH::ModifiedMesh(SM, false);
+ }
+ }
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, aHyp, this, true );
+ wc.start();
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+
+ bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
+ {
+ if(MYDEBUG) MESSAGE( "SMESHGUI::AddHypothesisOnSubMesh() ");
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if ( !aSubMesh->_is_nil() && ! aHyp->_is_nil() ) {
+ try {
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ SALOMEDS::SObject_var SsubM = SMESH::FindSObject( aSubMesh );
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SsubM );
+ if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShapeObject->_is_nil() ) {
+ res = aMesh->AddHypothesis( aShapeObject, aHyp );
+ if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
+ SMESH::ModifiedMesh( SsubM, false );
+ }
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, aHyp, this, true );
+ wc.start();
+ }
+ }
+ else {
+ SCRUTE( aHyp->_is_nil() );
+ SCRUTE( aMesh->_is_nil() );
+ SCRUTE( SsubM->_is_nil() );
+ SCRUTE( aShapeObject->_is_nil() );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ else {
+ SCRUTE( aSubMesh->_is_nil() );
+ SCRUTE( aHyp->_is_nil() );
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject)
+ {
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if (IObject->hasReference()) {
+ try {
+ SMESH::SMESH_Hypothesis_var anHyp =
+ SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(IObject);
+ SALOMEDS::SObject_var SO_Applied_Hypothesis =
+ smeshGUI->myStudy->FindObjectID(IObject->getReference());
+ if (!SO_Applied_Hypothesis->_is_nil()) {
+ SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(SO_Applied_Hypothesis);
+ if (!MorSM->_is_nil()) {
+ GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShape->_is_nil()){
+ SMESH::SMESH_Mesh_var aMesh =
+ SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh =
+ SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if (!aSubMesh->_is_nil())
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShape, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, this, false );
+ wc.start();
+ }
+ }
+ }
+ }
+
+ SALOMEDS::SObject_var SO_Applied_Hypothesis =
+ smeshGUI->myStudy->FindObjectID(IObject->getReference());
+ if (!SO_Applied_Hypothesis->_is_nil()) {
+ SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(SO_Applied_Hypothesis);
+ if (!MorSM->_is_nil()) {
+ GEOM::GEOM_Object_var aShapeObject =SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShapeObject->_is_nil()){
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if (!aSubMesh->_is_nil())
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, this, false );
+ wc.start();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ else if (IObject->hasEntry()) {
+ if(MYDEBUG) MESSAGE("IObject entry " << IObject->getEntry());
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
+ SMESH::SMESH_Hypothesis_ptr anHyp)
+ {
+ SALOMEDS::SObject_var AHR, aRef;
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if (!MorSM->_is_nil()) {
+ try {
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShapeObject->_is_nil()) {
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if ( !aSubMesh->_is_nil() )
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, this, false );
+ wc.start();
+ }
+ }
+ }
+ } catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp )
+ {
+ SALOMEDS::Study::ListOfSObject_var listSOmesh =
+ new SALOMEDS::Study::ListOfSObject;
+ listSOmesh->length(0);
+ unsigned int index = 0;
+ if (!AlgoOrHyp->_is_nil()) {
+ SALOMEDS::SObject_var SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
+ if (!SO_Hypothesis->_is_nil()) {
+ SALOMEDS::Study::ListOfSObject_var listSO =
+ smeshGUI->myStudy->FindDependances(SO_Hypothesis);
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO->length());
+ for (unsigned int i = 0; i < listSO->length(); i++) {
+ SALOMEDS::SObject_ptr SO = listSO[i];
+ if (!SO->_is_nil()) {
+ SALOMEDS::SObject_var aFather = SO->GetFather();
+ if (!aFather->_is_nil()) {
+ SALOMEDS::SObject_var SOfatherFather = aFather->GetFather();
+ if (!SOfatherFather->_is_nil()) {
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
+ index++;
+ listSOmesh->length(index);
+ listSOmesh[index - 1] = SOfatherFather;
+ }
+ }
+ }
+ }
+ }
+ }
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
+ return listSOmesh._retn();
+ }
+
+}
#ifndef SMESHGUI_Hypotheses_HeaderFile
#define SMESHGUI_Hypotheses_HeaderFile
+#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
// QT Includes
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <map>
+#include <string>
+
+#include <dlfcn.h>
+
+#include "QAD.h"
+#include "QAD_Tools.h"
+#include "QAD_Config.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+#include "QAD_ResourceMgr.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+#include "SMESHGUI_HypothesesUtils.h"
+#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_XmlHandler.h"
+#include "SMESHGUI.h"
+
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_SMESHGenUtils.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace SMESH{
+
+ using namespace std;
+
+ typedef map<string,HypothesisData*> THypothesisDataMap;
+ THypothesisDataMap myHypothesesMap;
+ THypothesisDataMap myAlgorithmsMap;
+
+ typedef map<string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
+ THypCreatorMap myHypCreatorMap;
+
+ void addMap( const THypothesisDataMap& theMap,
+ THypothesisDataMap& toMap)
+ {
+ THypothesisDataMap::const_iterator it;
+ for ( it = theMap.begin(); it != theMap.end(); it++ )
+ toMap.insert( *it );
+ }
+
+
+ void processHypothesisStatus(const int theHypStatus,
+ SMESH::SMESH_Hypothesis_ptr theHyp,
+ const bool theIsAddition)
+ {
+ if ( theHypStatus > SMESH::HYP_OK ) {
+
+ // get Hyp name
+ QString aHypName ("NULL Hypothesis");
+ if ( !CORBA::is_nil( theHyp )) {
+ SALOMEDS::SObject_var Shyp = SMESH::FindSObject( theHyp );
+ if ( !CORBA::is_nil( Shyp ))
+ // name in study
+ aHypName = Shyp->GetName();
+ else
+ // label in xml file
+ aHypName = GetHypothesisData( theHyp->GetName() )->Label;
+ }
+
+ // message
+ bool isFatal = ( theHypStatus >= SMESH::HYP_UNKNOWN_FATAL );
+ QString aMsg;
+ if ( theIsAddition )
+ aMsg = ( isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
+ else
+ aMsg = ( isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
+
+ aMsg = QObject::tr( aMsg ).arg( aHypName ) +
+ QObject::tr( QString( "SMESH_HYP_%1" ).arg( theHypStatus ));
+
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ QObject::tr( "SMESH_WRN_WARNING" ),
+ aMsg,
+ QObject::tr( "SMESH_BUT_OK" ));
+ }
+ }
+
+
+ void InitAvailableHypotheses()
+ {
+ QAD_WaitCursor wc;
+ if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) {
+ // Resource manager
+ QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
+ if (!resMgr) return;
+
+ // Find name of a resource XML file ("SMESH_Meshers.xml");
+ QString HypsXml;
+ char* cenv = getenv("SMESH_MeshersList");
+ if (cenv)
+ HypsXml.sprintf("%s", cenv);
+
+ QStringList HypsXmlList = QStringList::split( ":", HypsXml, false );
+ if (HypsXmlList.count() == 0)
+ {
+ QAD_MessageBox::error1(QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("MESHERS_FILE_NO_VARIABLE"),
+ QObject::tr("SMESH_BUT_OK"));
+ return;
+ }
+
+ // loop on files in HypsXml
+ QString aNoAccessFiles;
+ for ( int i = 0; i < HypsXmlList.count(); i++ ) {
+ QString HypsXml = HypsXmlList[ i ];
+
+ // Find full path to the resource XML file
+ QString xmlFile = HypsXml + ".xml";
+ xmlFile = QAD_Tools::addSlash(resMgr->findFile(xmlFile, HypsXml)) + xmlFile;
+
+ QFile file (QAD_Tools::unix2win(xmlFile));
+ if (file.exists() && file.open(IO_ReadOnly)) {
+ file.close();
+
+ SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
+ ASSERT(aXmlHandler);
+
+ QXmlInputSource source (file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(aXmlHandler);
+ reader.setErrorHandler(aXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+ if (ok) {
+ addMap( aXmlHandler->myHypothesesMap, myHypothesesMap );
+ addMap( aXmlHandler->myAlgorithmsMap, myAlgorithmsMap );
+ }
+ else {
+ QAD_MessageBox::error1(QAD_Application::getDesktop(),
+ QObject::tr("INF_PARSE_ERROR"),
+ QObject::tr(aXmlHandler->errorProtocol()),
+ QObject::tr("SMESH_BUT_OK"));
+ }
+ }
+ else {
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }
+ } // end loop
+
+
+ if (!aNoAccessFiles.isEmpty()) {
+ QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
+ aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
+ wc.stop();
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ aMess,
+ QObject::tr("SMESH_BUT_OK"));
+ wc.start();
+ }
+ }
+ }
+
+
+ QStringList GetAvailableHypotheses(const bool isAlgo)
+ {
+ QStringList aHypList;
+
+ // Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ // fill list of hypotheses/algorithms
+ THypothesisDataMap::iterator anIter;
+ if (isAlgo) {
+ anIter = myAlgorithmsMap.begin();
+ for (; anIter != myAlgorithmsMap.end(); anIter++) {
+ aHypList.append(((*anIter).first).c_str());
+ }
+ }
+ else {
+ anIter = myHypothesesMap.begin();
+ for (; anIter != myHypothesesMap.end(); anIter++) {
+ aHypList.append(((*anIter).first).c_str());
+ }
+ }
+
+ return aHypList;
+ }
+
+
+ HypothesisData* GetHypothesisData (const char* aHypType)
+ {
+ HypothesisData* aHypData = 0;
+
+ // Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ if (myHypothesesMap.find(aHypType) == myHypothesesMap.end()) {
+ if (myAlgorithmsMap.find(aHypType) != myAlgorithmsMap.end()) {
+ aHypData = myAlgorithmsMap[aHypType];
+ }
+ }
+ else {
+ aHypData = myHypothesesMap[aHypType];
+ }
+ return aHypData;
+ }
+
+
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const char* aHypType)
+ {
+ if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType);
+
+ SMESHGUI_GenericHypothesisCreator* aCreator = 0;
+
+ // check, if creator for this hypothesis type already exists
+ if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
+ aCreator = myHypCreatorMap[aHypType];
+ }
+ else {
+ // 1. Init list of available hypotheses, if needed
+ InitAvailableHypotheses();
+
+ // 2. Get names of plugin libraries
+ HypothesisData* aHypData = GetHypothesisData(aHypType);
+ if (!aHypData) {
+ return aCreator;
+ }
+ QString aClientLibName = aHypData->ClientLibName;
+ QString aServerLibName = aHypData->ServerLibName;
+
+ // 3. Load Client Plugin Library
+ try {
+ // load plugin library
+ if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
+ void* libHandle = dlopen (aClientLibName, RTLD_LAZY);
+ if (!libHandle) {
+ // report any error, if occured
+ const char* anError = dlerror();
+ if(MYDEBUG) MESSAGE(anError);
+ }
+ else {
+ // get method, returning hypothesis creator
+ if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
+ typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
+ (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
+ GetHypothesisCreator procHandle =
+ (GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
+ if (!procHandle) {
+ if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
+ dlclose(libHandle);
+ }
+ else {
+ // get hypothesis creator
+ if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType);
+ aCreator = procHandle(aHypType, aServerLibName, SMESHGUI::GetSMESHGUI());
+ if (!aCreator) {
+ if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
+ }
+ else {
+ // map hypothesis creator to a hypothesis name
+ myHypCreatorMap[aHypType] = aCreator;
+ }
+ }
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ }
+
+ return aCreator;
+ }
+
+
+ SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* aHypType,
+ const char* aHypName,
+ const bool isAlgo)
+ {
+ if(MYDEBUG) MESSAGE("Create " << aHypType << " with name " << aHypName);
+
+ SMESH::SMESH_Hypothesis_var Hyp;
+
+ HypothesisData* aHypData = GetHypothesisData(aHypType);
+ QString aServLib = aHypData->ServerLibName;
+
+ try {
+ Hyp = SMESH::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
+ if (!Hyp->_is_nil()) {
+ SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
+ if (!SHyp->_is_nil()) {
+ if ( strcmp(aHypName,"") != 0 )
+ SMESH::SetName( SHyp, aHypName );
+ GetActiveStudy()->updateObjBrowser(true);
+ return Hyp._retn();
+ }
+ }
+ }
+ catch (const SALOME::SALOME_Exception & S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+
+ return SMESH::SMESH_Hypothesis::_nil();
+ }
+
+
+ bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
+ {
+ if(MYDEBUG) MESSAGE ("SMESHGUI::AddHypothesisOnMesh");
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if ( !aMesh->_is_nil() ) {
+ SALOMEDS::SObject_var SM = SMESH::FindSObject( aMesh );
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
+ try {
+ res = aMesh->AddHypothesis( aShapeObject, aHyp );
+ if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
+ SALOMEDS::SObject_var SH = SMESH::FindSObject(aHyp);
+ if ( !SM->_is_nil() && !SH->_is_nil() ) {
+ SMESH::ModifiedMesh(SM, false);
+ }
+ }
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, aHyp, true );
+ wc.start();
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+
+ bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
+ {
+ if(MYDEBUG) MESSAGE( "SMESHGUI::AddHypothesisOnSubMesh() ");
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if ( !aSubMesh->_is_nil() && ! aHyp->_is_nil() ) {
+ try {
+ SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+ SALOMEDS::SObject_var SsubM = SMESH::FindSObject( aSubMesh );
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SsubM );
+ if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShapeObject->_is_nil() ) {
+ res = aMesh->AddHypothesis( aShapeObject, aHyp );
+ if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
+ SMESH::ModifiedMesh( SsubM, false );
+ }
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, aHyp, true );
+ wc.start();
+ }
+ }
+ else {
+ SCRUTE( aHyp->_is_nil() );
+ SCRUTE( aMesh->_is_nil() );
+ SCRUTE( SsubM->_is_nil() );
+ SCRUTE( aShapeObject->_is_nil() );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ else {
+ SCRUTE( aSubMesh->_is_nil() );
+ SCRUTE( aHyp->_is_nil() );
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject)
+ {
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if (IObject->hasReference()) {
+ try {
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(IObject);
+ SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
+ if (!aHypSObj->_is_nil()) {
+ SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
+ if (!MorSM->_is_nil()) {
+ GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShape->_is_nil()){
+ SMESH::SMESH_Mesh_var aMesh =
+ SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh =
+ SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if (!aSubMesh->_is_nil())
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShape, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, false );
+ wc.start();
+ }
+ }
+ }
+ }
+
+ SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
+ if (!aHypSObj->_is_nil()) {
+ SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
+ if (!MorSM->_is_nil()) {
+ GEOM::GEOM_Object_var aShapeObject =SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShapeObject->_is_nil()){
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if (!aSubMesh->_is_nil())
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, false );
+ wc.start();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ else if (IObject->hasEntry()) {
+ if(MYDEBUG) MESSAGE("IObject entry " << IObject->getEntry());
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
+ SMESH::SMESH_Hypothesis_ptr anHyp)
+ {
+ SALOMEDS::SObject_var AHR, aRef;
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ int res = SMESH::HYP_UNKNOWN_FATAL;
+ QAD_WaitCursor wc;
+
+ if (!MorSM->_is_nil()) {
+ try {
+ GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
+ if (!aShapeObject->_is_nil()) {
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
+ if ( !aSubMesh->_is_nil() )
+ aMesh = aSubMesh->GetFather();
+
+ if (!aMesh->_is_nil()) {
+ res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
+ if ( res < SMESH::HYP_UNKNOWN_FATAL )
+ SMESH::ModifiedMesh(MorSM, false);
+ if ( res > SMESH::HYP_OK ) {
+ wc.stop();
+ processHypothesisStatus( res, anHyp, false );
+ wc.start();
+ }
+ }
+ }
+ } catch( const SALOME::SALOME_Exception& S_ex ) {
+ wc.stop();
+ QtCatchCorbaException( S_ex );
+ res = SMESH::HYP_UNKNOWN_FATAL;
+ }
+ }
+ return res < SMESH::HYP_UNKNOWN_FATAL;
+ }
+
+ SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp )
+ {
+ SALOMEDS::Study::ListOfSObject_var listSOmesh =
+ new SALOMEDS::Study::ListOfSObject;
+ listSOmesh->length(0);
+ unsigned int index = 0;
+ if (!AlgoOrHyp->_is_nil()) {
+ SALOMEDS::SObject_var SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
+ if (!SO_Hypothesis->_is_nil()) {
+ SALOMEDS::Study::ListOfSObject_var listSO =
+ GetActiveStudyDocument()->FindDependances(SO_Hypothesis);
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO->length());
+ for (unsigned int i = 0; i < listSO->length(); i++) {
+ SALOMEDS::SObject_ptr SO = listSO[i];
+ if (!SO->_is_nil()) {
+ SALOMEDS::SObject_var aFather = SO->GetFather();
+ if (!aFather->_is_nil()) {
+ SALOMEDS::SObject_var SOfatherFather = aFather->GetFather();
+ if (!SOfatherFather->_is_nil()) {
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
+ index++;
+ listSOmesh->length(index);
+ listSOmesh[index - 1] = SOfatherFather;
+ }
+ }
+ }
+ }
+ }
+ }
+ if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
+ return listSOmesh._retn();
+ }
+
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_Hypotheses.h
+// Author : Julia DOROVSKIKH
+// Module : SMESH
+// $Header$
+
+#ifndef SMESHGUI_HypothesesUtils_HeaderFile
+#define SMESHGUI_HypothesesUtils_HeaderFile
+
+#include <qstring.h>
+#include <qstringlist.h>
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
+
+class HypothesisData;
+class SMESHGUI_GenericHypothesisCreator;
+
+namespace SMESH{
+
+ void InitAvailableHypotheses();
+
+ QStringList GetAvailableHypotheses(const bool isAlgo);
+
+ HypothesisData* GetHypothesisData(const char* aHypType);
+
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const char* aHypType);
+
+ SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* aHypType,
+ const char* aHypName,
+ const bool isAlgo = false);
+
+ bool AddHypothesisOnMesh(SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
+
+ bool AddHypothesisOnSubMesh(SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
+
+ bool RemoveHypothesisOrAlgorithmOnMesh(const Handle(SALOME_InteractiveObject)& IObject);
+
+ bool RemoveHypothesisOrAlgorithmOnMesh(SALOMEDS::SObject_ptr MorSM,
+ SMESH::SMESH_Hypothesis_ptr anHyp);
+
+ SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
+
+}
+
+#endif
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_IdValidator.h
+// Author : Edward AGAPOV
+// Module : SMESH
+// $Header: /dn05/salome/PAL/SMESH/SMESH_SRC/src/SMESHGUI/SMESHGUI_IdValidator.h
+
+#ifndef SMESHGUI_IdValidator_HeaderFile
+#define SMESHGUI_IdValidator_HeaderFile
+
+#include <qvalidator.h>
+
+// validator for manual input of Ids
+
+class SMESHGUI_IdValidator: public QValidator
+{
+ public:
+
+ SMESHGUI_IdValidator(QWidget * parent, const char * name = 0, const int maxNbId = 0):
+ QValidator(parent,name), myMaxNbId(maxNbId) {}
+
+ State validate ( QString & text, int & pos) const
+ {
+ text.replace( QRegExp(" *[^0-9]+ *"), " " );
+ if ( myMaxNbId && text.length() > myMaxNbId) { // truncate extra ids
+ int ind = 0, nbId = 0;
+ while ( ind < text.length() ) {
+ if ( text.at( ind ) != ' ' ) {
+ if ( ++nbId > myMaxNbId ) {
+ text.truncate( ind );
+ break;
+ }
+ ind = text.find( ' ', ind );
+ if ( ind < 0 ) break;
+ }
+ ind++;
+ }
+ }
+ if ( pos > text.length() )
+ pos = text.length();
+ return Acceptable;
+ }
+
+ private:
+ int myMaxNbId;
+};
+
+#endif
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_InitMeshDlg.h"
+
#include "SMESHGUI.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_SMESHGenUtils.h"
+#include "SMESHGUI_HypothesesUtils.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_WaitCursor.h"
#include "QAD_Operation.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
#include "utilities.h"
// QT Includes
#include <qlayout.h>
#include <qpixmap.h>
+using namespace std;
+
+namespace SMESH{
+ SMESH::SMESH_Mesh_var InitMesh(GEOM::GEOM_Object_ptr theShapeObject,
+ const char* theMeshName)
+ {
+ SMESH::SMESH_Mesh_var aMesh;
+ try {
+ SMESH::SMESH_Gen_var aSMESHGen = SMESH::GetSMESHGen();
+ if ( !aSMESHGen->_is_nil() && !theShapeObject->_is_nil() ) {
+ aMesh = aSMESHGen->CreateMesh( theShapeObject );
+ if ( !aMesh->_is_nil() ) {
+ SALOMEDS::SObject_var aMeshSObject = SMESH::FindSObject( aMesh.in() );
+ SMESH::SetName( aMeshSObject, theMeshName );
+ }
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ QtCatchCorbaException( S_ex );
+ }
+ return aMesh._retn();
+ }
+}
+
//=================================================================================
// class : SMESHGUI_InitMeshDlg()
// purpose : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+ LineEditC1A1->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
SelectButtonC1A1Hyp->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 2, 1 );
LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
+ LineEditC1A1Hyp->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1Hyp, 2, 2 );
TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
SelectButtonC1A1Algo->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Algo, 3, 1 );
LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
+ LineEditC1A1Algo->setReadOnly( true );
GroupC1Layout->addWidget( LineEditC1A1Algo, 3, 2 );
SMESHGUI_InitMeshDlgLayout->addWidget( GroupC1, 1, 0 );
//=================================================================================
bool SMESHGUI_InitMeshDlg::ClickOnApply()
{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return false;
+
QString myNameMesh = LineEdit_NameMesh->text().stripWhiteSpace();
if ( myNameMesh.isEmpty() ) {
QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
op->start();
// create mesh
- SMESH::SMESH_Mesh_var aMesh = mySMESHGUI->InitMesh( myGeomShape, myNameMesh ) ;
+ SMESH::SMESH_Mesh_var aMesh = SMESH::InitMesh( myGeomShape, myNameMesh ) ;
if ( !aMesh->_is_nil() ) {
// assign hypotheses
for( int i = 0; i < HypoList.count(); i++ ) {
- SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( HypoList[i] );
+ SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID( HypoList[i] );
if ( !aHypSO->_is_nil() ) {
CORBA::Object_var anObject = aHypSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
if ( !aHyp->_is_nil() ) {
- if ( !mySMESHGUI->AddHypothesisOnMesh( aMesh, aHyp ) ) {
+ if ( !SMESH::AddHypothesisOnMesh( aMesh, aHyp ) ) {
// abort transaction
op->abort();
return false;
}
// assign algorithms
for( int i = 0; i < AlgoList.count(); i++ ) {
- SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( AlgoList[i] );
+ SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID( AlgoList[i] );
if ( !aHypSO->_is_nil() ) {
CORBA::Object_var anObject = aHypSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
if ( !aHyp->_is_nil() ) {
- if ( !mySMESHGUI->AddAlgorithmOnMesh( aMesh, aHyp ) ) {
+ if ( !SMESH::AddHypothesisOnMesh( aMesh, aHyp ) ) {
// abort transaction
op->abort();
return false;
{
QString aString = "";
- int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
if ( myEditCurrentArgument == LineEditC1A1 ) {
// geom shape
if ( nbSel != 1 ) {
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = GEOM::GEOM_Object::_nil();
aString = "";
}
else {
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
- if( !testResult ) {
- myGeomShape = GEOM::GEOM_Shape::_nil();
+ myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
+ if( myGeomShape->_is_nil() ) {
aString = "";
}
}
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SMESH_Gen)
class QGroupBox;
protected:
void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ;
+ void enterEvent( QEvent * ) ;
private:
void Init( SALOME_Selection* Sel ) ;
SMESHGUI* mySMESHGUI ;
SALOME_Selection* mySelection ;
- GEOM::GEOM_Shape_var myGeomShape ;
+ GEOM::GEOM_Object_var myGeomShape ;
QLineEdit* myEditCurrentArgument;
Handle(SALOME_TypeFilter) myGeomFilter;
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_MergeNodesDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_MergeNodesDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "GEOMBase.h"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qheader.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_MergeNodesDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_MERGE_NODES")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_MergeNodesDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_MERGE_NODES" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_MergeNodesDlgLayout = new QGridLayout( this );
+ SMESHGUI_MergeNodesDlgLayout->setSpacing( 6 );
+ SMESHGUI_MergeNodesDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+ GroupConstructors->setTitle( tr( "SMESH_MERGE_NODES" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ RBLayout->addWidget( RadioButton1);
+ GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
+ SMESHGUI_MergeNodesDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_MergeNodesDlgLayout->addWidget( GroupButtons, 4, 0 );
+
+ /***************************************************************/
+
+ // Controls for mesh defining
+ GroupMesh = new QGroupBox( this, "GroupMesh" );
+ GroupMesh->setTitle( tr( "SMESH_MESH" ) );
+ GroupMesh->setColumnLayout(0, Qt::Vertical );
+ GroupMesh->layout()->setSpacing( 0 );
+ GroupMesh->layout()->setMargin( 0 );
+ GroupMeshLayout = new QGridLayout( GroupMesh->layout() );
+ GroupMeshLayout->setAlignment( Qt::AlignTop );
+ GroupMeshLayout->setSpacing( 6 );
+ GroupMeshLayout->setMargin( 11 );
+
+ TextLabelName = new QLabel( GroupMesh, "TextLabelName" );
+ TextLabelName->setText( tr( "SMESH_NAME" ) );
+ GroupMeshLayout->addWidget( TextLabelName, 0, 0 );
+
+ SelectMeshButton = new QPushButton( GroupMesh, "SelectMeshButton" );
+ SelectMeshButton->setPixmap( image1 );
+ GroupMeshLayout->addWidget( SelectMeshButton, 0, 1 );
+
+ LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
+ LineEditMesh->setReadOnly(true);
+ GroupMeshLayout->addWidget( LineEditMesh, 0, 2 );
+
+ SMESHGUI_MergeNodesDlgLayout->addWidget( GroupMesh, 1, 0 );
+
+ // Controls for coincident nodes detecting
+ GroupCoincident = new QGroupBox( this, "GroupCoincident" );
+ GroupCoincident->setTitle( tr( "COINCIDENT_NODES" ) );
+ GroupCoincident->setColumnLayout(0, Qt::Vertical );
+ GroupCoincident->layout()->setSpacing( 0 );
+ GroupCoincident->layout()->setMargin( 0 );
+ QGridLayout* GroupCoincidentLayout = new QGridLayout( GroupCoincident->layout() );
+ GroupCoincidentLayout->setAlignment( Qt::AlignTop );
+ GroupCoincidentLayout->setSpacing( 6 );
+ GroupCoincidentLayout->setMargin( 11 );
+
+ TextLabelTolerance = new QLabel( GroupCoincident, "TextLabelTolerance" );
+ TextLabelTolerance->setText( tr( "SMESH_TOLERANCE" ) );
+ GroupCoincidentLayout->addWidget( TextLabelTolerance, 0, 0 );
+
+ SpinBoxTolerance = new SMESHGUI_SpinBox( GroupCoincident, "SpinBoxTolerance" );
+ GroupCoincidentLayout->addWidget( SpinBoxTolerance, 0, 1 );
+
+ QPushButton* DetectButton = new QPushButton( GroupCoincident, "DetectButton" );
+ DetectButton->setText( tr("DETECT") );
+ GroupCoincidentLayout->addWidget( DetectButton, 0, 2 );
+
+ ListCoincident = new QListView( GroupCoincident );
+ ListCoincident->setSorting( -1 );
+ ListCoincident->addColumn( "Nodes" );
+ ListCoincident->header()->hide();
+
+ GroupCoincidentLayout->addMultiCellWidget( ListCoincident, 1, 1, 0, 1 );
+
+ SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB");
+ SelectAllCB->setText(tr("SELECT_ALL"));
+ GroupCoincidentLayout->addWidget( SelectAllCB, 2, 0 );
+
+ SMESHGUI_MergeNodesDlgLayout->addWidget( GroupCoincident, 2, 0 );
+
+ // Controls for editing group of nodes
+ GroupEdit = new QGroupBox( this, "GroupEdit" );
+ GroupEdit->setTitle( tr( "EDIT_GROUP_OF_NODES" ) );
+ GroupEdit->setColumnLayout(0, Qt::Vertical );
+ GroupEdit->layout()->setSpacing( 0 );
+ GroupEdit->layout()->setMargin( 0 );
+ QGridLayout* GroupEditLayout = new QGridLayout( GroupEdit->layout() );
+ GroupEditLayout->setAlignment( Qt::AlignTop );
+ GroupEditLayout->setSpacing( 6 );
+ GroupEditLayout->setMargin( 11 );
+
+ ListEdit = new QListBox( GroupEdit, "ListEdit" );
+ ListEdit->setColumnMode(QListBox::FitToHeight);
+ ListEdit->setSelectionMode( QListBox::Extended );
+ GroupEditLayout->addMultiCellWidget( ListEdit, 0, 2, 0, 0 );
+
+ QPushButton* AddButton = new QPushButton( GroupEdit, "AddButton" );
+ AddButton->setText( tr("SMESH_BUT_ADD") );
+ GroupEditLayout->addWidget( AddButton, 0, 1 );
+
+ QPushButton* RemoveButton = new QPushButton( GroupEdit, "RemoveButton" );
+ RemoveButton->setText( tr("SMESH_BUT_REMOVE") );
+ GroupEditLayout->addWidget( RemoveButton, 1, 1 );
+
+ QSpacerItem* spacer = new QSpacerItem( 20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ GroupEditLayout->addItem( spacer, 2, 1 );
+
+ SMESHGUI_MergeNodesDlgLayout->addWidget( GroupEdit, 3, 0 );
+
+ /* Initialisations */
+ SpinBoxTolerance->RangeStepAndValidator( 0.0, 999999.999, 0.1, 3 );
+ SpinBoxTolerance->SetValue(1e-05);
+
+ RadioButton1->setChecked( TRUE );
+
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+
+ connect( SelectMeshButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( DetectButton, SIGNAL ( clicked() ), this, SLOT( onDetect() ) );
+ connect( ListCoincident, SIGNAL ( selectionChanged() ), this, SLOT( onSelectNodesGroup() ) );
+ connect( ListCoincident, SIGNAL ( pressed( QListViewItem* ) ), this, SLOT( updateControls() ) );
+ connect( ListCoincident, SIGNAL ( currentChanged( QListViewItem* ) ), this, SLOT( updateControls() ) );
+ connect( SelectAllCB, SIGNAL( toggled(bool) ), this, SLOT(onSelectAll(bool) ) );
+ connect( ListEdit, SIGNAL ( selectionChanged() ), this, SLOT( onSelectNodesFromGroup() ) );
+ connect( AddButton, SIGNAL ( clicked() ), this, SLOT( onAdd() ) );
+ connect( RemoveButton, SIGNAL ( clicked() ), this, SLOT( onRemove() ) );
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ resize(0,0);
+ buttonOk->setEnabled(false);
+ buttonApply->setEnabled(false);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_MergeNodesDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool SMESHGUI_MergeNodesDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked() || myMesh->_is_nil())
+ return false;
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
+ aGroupsOfNodes->length(ListCoincident->childCount());
+ QListViewItem* item = ListCoincident->firstChild();
+
+ int anArrayNum = 0;
+ while (item)
+ {
+ QStringList aListIds = QStringList("");
+ if (((QCheckListItem*) item)->isOn())
+ aListIds = QStringList::split( " ", item->text(0), false);
+
+ SMESH::long_array_var anIds = new SMESH::long_array;
+ anIds->length(aListIds.count());
+
+ for ( int i = 0; i < aListIds.count(); i++ )
+ anIds[i] = aListIds[i].toInt();
+
+ aGroupsOfNodes[anArrayNum++] = anIds.inout();
+
+ item = item->itemBelow();
+ }
+
+ aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+
+ onDetect();
+ return true;
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::ClickOnOk()
+{
+ if( ClickOnApply())
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+
+//=================================================================================
+// function : onEditNodesGroup()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onEditNodesGroup()
+{
+ if ( ListCoincident->childCount() < 1 )
+ return;
+
+ QString aNewIds = "";
+
+ QListBoxItem* anItem;
+ for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next())
+ aNewIds+=QString(" %1").arg(anItem->text());
+
+ ListCoincident->currentItem()->setText(0, aNewIds);
+}
+
+
+//=================================================================================
+// function : updateControls()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::updateControls()
+{
+ if ( ListCoincident->childCount() < 1 )
+ {
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ return;
+ }
+
+ bool hasChecked = false, hasUnchecked = false;
+
+ QListViewItem* item = ListCoincident->firstChild();
+
+ while (item && (!hasChecked || !hasUnchecked))
+ {
+ if (((QCheckListItem*) item)->isOn())
+ hasChecked = true;
+ else
+ hasUnchecked = true;
+
+ item = item->itemBelow();
+ }
+
+ if (hasUnchecked)
+ SelectAllCB->setChecked(false);
+
+ bool enable = !(myMesh->_is_nil()) && hasChecked;
+
+ buttonOk->setEnabled(enable);
+ buttonApply->setEnabled(enable);
+}
+
+
+//=================================================================================
+// function : onDetect()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onDetect()
+{
+ if(myMesh->_is_nil())
+ return;
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ ListCoincident->clear();
+ ListEdit->clear();
+
+ SMESH::array_of_long_array_var aNodeGroups;
+ aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
+
+ for ( int i = 0; i < aNodeGroups->length(); i++ )
+ {
+ SMESH::long_array& aGroup = aNodeGroups[i];
+
+ QString aNodeIds;
+ for ( int j = 0; j < aGroup.length(); j++ )
+ aNodeIds+=QString(" %1").arg(aGroup[j]);
+
+ new QCheckListItem ( ListCoincident, aNodeIds, QCheckListItem::CheckBox );
+ }
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ updateControls();
+}
+
+
+//=================================================================================
+// function : onSelectNodesGroup()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
+{
+ if(!myActor)
+ return;
+
+ myEditCurrentArgument = (QWidget*)ListCoincident;
+
+ QListViewItem* aSelectedItem = ListCoincident->selectedItem();
+ if (!aSelectedItem)
+ return;
+
+ QStringList aListId = QStringList::split( " ", aSelectedItem->text(0), false);
+
+ ListEdit->clear();
+ ListEdit->insertStringList(aListId);
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ ListEdit->selectAll(true);
+}
+
+
+//=================================================================================
+// function : onSelectAll()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onSelectAll(bool isToggled)
+{
+ if (isToggled)
+ {
+ int aNbItems = 0;
+ QListViewItem* item = ListCoincident->firstChild();
+ while (item)
+ {
+ aNbItems++;
+ if (!((QCheckListItem*) item)->isOn())
+ ((QCheckListItem*) item)->setOn(true);
+ item = item->itemBelow();
+ }
+
+ if (aNbItems)
+ {
+ buttonOk->setEnabled(true);
+ buttonApply->setEnabled(true);
+ }
+ }
+}
+
+
+//=================================================================================
+// function : onSelectNodesFromGroup()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
+{
+ if (!myActor)
+ return;
+
+ mySelection->ClearIObjects();
+
+ TColStd_MapOfInteger aIndexes;
+ QListBoxItem* anItem;
+ for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) {
+ if (anItem->isSelected()) {
+ int anId = anItem->text().toInt();
+ aIndexes.Add(anId);
+ }
+ }
+ mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
+ mySelection->AddIObject(myActor->getIO());
+}
+
+
+//=================================================================================
+// function : onAdd()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onAdd()
+{
+ if (!myActor)
+ return;
+
+ QString aListStr = "";
+ int aNbNnodes = 0;
+
+ aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelection, myActor->getIO(), aListStr);
+ if (aNbNnodes < 1)
+ return;
+
+ QStringList aNodes = QStringList::split(" ", aListStr);
+ QListBoxItem* anItem = 0;
+
+ for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) {
+ anItem = ListEdit->findItem(*it, Qt::ExactMatch);
+ if (!anItem) {
+ anItem = new QListBoxText(*it);
+ ListEdit->insertItem(anItem);
+ }
+ ListEdit->setSelected(anItem, true);
+ }
+
+ onEditNodesGroup();
+}
+
+
+//=================================================================================
+// function : onRemove()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::onRemove()
+{
+ if (myEditCurrentArgument != (QWidget*)ListCoincident)
+ return;
+
+ for (int i = ListEdit->count(); i > 0; i--)
+ {
+ if (ListEdit->isSelected(i-1))
+ ListEdit->removeItem(i-1);
+ }
+ onEditNodesGroup();
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectMeshButton)
+ {
+ myEditCurrentArgument = (QWidget*)LineEditMesh;
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
+{
+ if (myEditCurrentArgument == (QWidget*)LineEditMesh)
+ {
+ QString aString = "";
+ LineEditMesh->setText( aString );
+
+ ListCoincident->clear();
+ ListEdit->clear();
+
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+ if(myMesh->_is_nil() || !myActor)
+ return;
+
+ LineEditMesh->setText( aString );
+ }
+}
+
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupMesh->setEnabled(false);
+ GroupCoincident->setEnabled(false);
+ GroupEdit->setEnabled(false);
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupMesh->setEnabled(true);
+ GroupCoincident->setEnabled(true);
+ GroupEdit->setEnabled(true);
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_MergeNodesDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_MergeNodesDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_MergeNodesDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_MERGENODES_H
+#define DIALOGBOX_MERGENODES_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class QListView;
+class QListViewItem;
+class QListBox;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_MergeNodesDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_MergeNodesDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_MergeNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_MergeNodesDlg();
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ void onEditNodesGroup();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+
+ QWidget* myEditCurrentArgument;
+
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupMesh;
+ QGroupBox* GroupCoincident;
+ QGroupBox* GroupEdit;
+ QLabel* TextLabelName;
+ QLabel* TextLabelTolerance;
+ QLineEdit* LineEditMesh;
+ QPushButton* SelectMeshButton;
+ QPushButton* DetectButton;
+ QPushButton* AddButton;
+ QPushButton* RemoveButton;
+ QCheckBox* SelectAllCB;
+ QListView* ListCoincident;
+ QListBox* ListEdit;
+ SMESHGUI_SpinBox* SpinBoxTolerance;
+
+private slots:
+
+ void ClickOnOk();
+ void ClickOnCancel();
+ bool ClickOnApply();
+ void updateControls();
+ void onDetect();
+ void onSelectNodesGroup();
+ void onSelectAll(bool isToggled);
+ void onSelectNodesFromGroup();
+ void onAdd();
+ void onRemove();
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+
+protected:
+ QGridLayout* SMESHGUI_MergeNodesDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupMeshLayout;
+ QGridLayout* GroupCoincidentLayout;
+ QGridLayout* GroupEditLayout;
+};
+
+#endif // DIALOGBOX_MERGENODES_H
// Module : SMESH
// $Header$
-using namespace std;
-#include "SMESHGUI_MeshInfosDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-#include "utilities.h"
-
// QT Includes
#include <qgroupbox.h>
#include <qlabel.h>
#include <qmap.h>
#include <qpushbutton.h>
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_WaitCursor.h"
+
+#include "SMESHGUI_MeshInfosDlg.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI.h"
+
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+#include "utilities.h"
+
+using namespace std;
+
#define COLONIZE( str ) ( QString( str ).contains( ":" ) > 0 ? QString( str ) : QString( str ) + " :" )
//=================================================================================
myStartSelection = false;
mySelectLab->setText( "" );
Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject();
- SALOMEDS::SObject_var aSO = SMESHGUI::GetSMESHGUI()->GetStudy()->FindObjectID( IObject->getEntry() );
+ SALOMEDS::SObject_var aSO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
if ( !aSO->_is_nil() ) {
CORBA::Object_var anObject = aSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
myWGStack->raiseWidget( mySubMeshWidget );
setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_SUBMESH") +"]" );
mySubMeshName->setText( aSO->GetName() );
- mySubMeshNbNodes->setNum( (int)aSubMesh->GetNumberOfNodes() );
+ mySubMeshNbNodes->setNum( (int)aSubMesh->GetNumberOfNodes( true ) );
mySubMeshNbElements->setNum( (int)aSubMesh->GetNumberOfElements() );
mySubMeshNbEdges->setNum( (int)( aSubMesh->GetElementsByType( SMESH::EDGE )->length() ) );
mySubMeshNbFaces->setNum( (int)( aSubMesh->GetElementsByType( SMESH::FACE )->length() ) );
#ifndef SMESHGUI_MESHINFOSDLG_H
#define SMESHGUI_MESHINFOSDLG_H
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
// QT Includes
#include <qdialog.h>
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : SMESHGUI_MeshPatternDlg.cxx\r
+// Author : Sergey LITONIN\r
+// Module : SMESH\r
+\r
+#include "SMESHGUI_MeshPatternDlg.h"\r
+\r
+#include "QAD_Desktop.h"\r
+#include "QAD_FileDlg.h"\r
+\r
+#include "SMESHGUI_SpinBox.h"\r
+#include "SMESHGUI.h"\r
+#include "SALOME_Selection.h"\r
+#include "SMESH_NumberFilter.hxx"\r
+#include "SMESHGUI_Utils.h"\r
+#include "SMESHGUI_VTKUtils.h"\r
+#include "SMESHGUI_CreatePatternDlg.h"\r
+#include "SMESHGUI_PatternWidget.h"\r
+#include "SMESH_Actor.h"\r
+#include "SALOMEGUI_QtCatchCorbaException.hxx"\r
+#include "VTKViewer_ViewFrame.h"\r
+#include "SMESHGUI_PatternUtils.h"\r
+#include "SMESH_ActorUtils.h"\r
+\r
+#include <TColStd_MapOfInteger.hxx>\r
+\r
+#include <qframe.h>\r
+#include <qlayout.h>\r
+#include <qlineedit.h>\r
+#include <qpushbutton.h>\r
+#include <qgroupbox.h>\r
+#include <qlabel.h>\r
+#include <qradiobutton.h>\r
+#include <qcheckbox.h>\r
+#include <qbuttongroup.h>\r
+#include <qmessagebox.h>\r
+#include <qcstring.h>\r
+\r
+#include <vtkCell.h>\r
+#include <vtkIdList.h>\r
+#include <vtkIntArray.h>\r
+#include <vtkCellArray.h>\r
+#include <vtkUnsignedCharArray.h>\r
+#include <vtkUnstructuredGrid.h>\r
+#include <vtkDataSetMapper.h>\r
+\r
+#define SPACING 5\r
+#define MARGIN 10\r
+\r
+/*\r
+ Class : SMESHGUI_MeshPatternDlg\r
+ Description : Dialog to specify filters for VTK viewer\r
+*/\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg\r
+// Purpose : Constructor\r
+//=======================================================================\r
+SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget* theParent,\r
+ SALOME_Selection* theSelection,\r
+ const char* theName )\r
+: QDialog( theParent, theName, false,\r
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
+{\r
+ setCaption( tr( "CAPTION" ) );\r
+\r
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );\r
+\r
+ QFrame* aMainFrame = createMainFrame ( this );\r
+ QFrame* aBtnFrame = createButtonFrame( this );\r
+\r
+\r
+\r
+\r
+ aDlgLay->addWidget( aMainFrame );\r
+ aDlgLay->addWidget( aBtnFrame );\r
+\r
+ aDlgLay->setStretchFactor( aMainFrame, 1 );\r
+\r
+ myCreationDlg = 0;\r
+ Init( theSelection );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::createMainFrame\r
+// Purpose : Create frame containing dialog's input fields\r
+//=======================================================================\r
+QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )\r
+{\r
+ QPixmap iconSlct( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );\r
+ QPixmap icon2d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) );\r
+ QPixmap icon3d ( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) );\r
+ QPixmap iconOpen( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_FILE_OPEN" ) ) );\r
+\r
+ QPixmap iconSample2d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) );\r
+ QPixmap iconSample3d( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) );\r
+\r
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );\r
+ aMainGrp->setFrameStyle( QFrame::NoFrame );\r
+ aMainGrp->setInsideMargin( 0 );\r
+\r
+ // Pattern type group\r
+ \r
+ myTypeGrp = new QButtonGroup( 1, Qt::Vertical, tr( "PATTERN_TYPE" ), aMainGrp );\r
+ mySwitch2d = new QRadioButton( myTypeGrp );\r
+ mySwitch3d = new QRadioButton( myTypeGrp );\r
+ mySwitch2d->setPixmap( icon2d );\r
+ mySwitch3d->setPixmap( icon3d );\r
+ myTypeGrp->insert( mySwitch2d, Type_2d );\r
+ myTypeGrp->insert( mySwitch3d, Type_3d );\r
+\r
+\r
+ // Mesh group\r
+ \r
+ QGroupBox* aMeshGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MESH" ), aMainGrp );\r
+ new QLabel( tr( "SMESH_MESH" ), aMeshGrp );\r
+ mySelBtn[ Mesh ] = new QPushButton( aMeshGrp );\r
+ mySelBtn[ Mesh ]->setPixmap( iconSlct );\r
+ mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp );\r
+ mySelEdit[ Mesh ]->setReadOnly( true );\r
+\r
+ // Pattern group\r
+ \r
+ QGroupBox* aPatGrp = new QGroupBox( 1, Qt::Horizontal, tr( "PATTERN" ), aMainGrp );\r
+\r
+ // pattern name\r
+ QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, aPatGrp );\r
+ aNameGrp->setFrameStyle( QFrame::NoFrame );\r
+ aNameGrp->setInsideMargin( 0 );\r
+ new QLabel( tr( "PATTERN" ), aNameGrp );\r
+ myName = new QLineEdit( aNameGrp );\r
+ myName->setReadOnly( true );\r
+ myOpenBtn = new QPushButton( aNameGrp );\r
+ myOpenBtn->setPixmap( iconOpen );\r
+ myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );\r
+\r
+ // selection widgets\r
+ QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );\r
+ aGrp->setFrameStyle( QFrame::NoFrame );\r
+ aGrp->setInsideMargin( 0 );\r
+\r
+ for ( int i = Object; i <= Vertex2; i++ )\r
+ {\r
+ mySelLbl[ i ] = new QLabel( aGrp );\r
+ mySelBtn[ i ] = new QPushButton( aGrp );\r
+ mySelBtn[ i ]->setPixmap( iconSlct );\r
+ mySelEdit[ i ] = new QLineEdit( aGrp );\r
+ mySelEdit[ i ]->setReadOnly( true );\r
+ }\r
+\r
+ // reverse check box\r
+ myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );\r
+\r
+ // Pictures 2d and 3d\r
+ for ( int i = 0; i < 2; i++ )\r
+ {\r
+ QWidget* aPreview, *aPicture;\r
+ if ( i == 0 )\r
+ {\r
+ myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),\r
+ myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
+ }\r
+ else\r
+ {\r
+ myPicture3d = new QFrame( aPatGrp ),\r
+ myPreview3d = new QLabel( myPicture3d );\r
+ myPreview3d->setPixmap( iconSample3d );\r
+ QGridLayout* aLay = new QGridLayout( myPicture3d, 3, 3, 0, 0 );\r
+ QSpacerItem* aSpacerH1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
+ QSpacerItem* aSpacerH2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
+ QSpacerItem* aSpacerV1 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );\r
+ QSpacerItem* aSpacerV2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );\r
+ aLay->addItem( aSpacerH1, 1, 0 );\r
+ aLay->addItem( aSpacerH2, 1, 2 );\r
+ aLay->addItem( aSpacerV1, 0, 1 );\r
+ aLay->addItem( aSpacerV2, 2, 1 );\r
+ aLay->addWidget( myPreview3d, 1, 1 );\r
+ }\r
+ }\r
+\r
+ myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp );\r
+\r
+ // Connect signals and slots\r
+\r
+ connect( myTypeGrp, SIGNAL( clicked( int ) ), SLOT( onTypeChanged( int ) ) );\r
+ connect( myOpenBtn, SIGNAL( clicked() ), SLOT( onOpen() ) );\r
+ connect( myNewBtn, SIGNAL( clicked() ), SLOT( onNew() ) );\r
+ connect( myReverseChk, SIGNAL( toggled( bool ) ), SLOT( onReverse( bool ) ) );\r
+ connect( myPreviewChk, SIGNAL( toggled( bool ) ), SLOT( onPreview( bool ) ) );\r
+\r
+ QMap< int, QPushButton* >::iterator anIter;\r
+ for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )\r
+ connect( *anIter, SIGNAL( clicked() ), SLOT( onSelInputChanged() ) );\r
+\r
+ return aMainGrp;\r
+}\r
+\r
+//=======================================================================\r
+\r
+// name : SMESHGUI_MeshPatternDlg::createButtonFrame\r
+// Purpose : Create frame containing buttons\r
+//=======================================================================\r
+QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame( QWidget* theParent )\r
+{\r
+ QFrame* aFrame = new QFrame( theParent );\r
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
+\r
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );\r
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );\r
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );\r
+\r
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
+\r
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );\r
+\r
+ aLay->addWidget( myOkBtn );\r
+ aLay->addWidget( myApplyBtn );\r
+ aLay->addItem( aSpacer);\r
+ aLay->addWidget( myCloseBtn );\r
+\r
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );\r
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;\r
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );\r
+\r
+ return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg\r
+// Purpose : Destructor\r
+//=======================================================================\r
+SMESHGUI_MeshPatternDlg::~SMESHGUI_MeshPatternDlg()\r
+{\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::Init\r
+// Purpose : Init dialog fields, connect signals and slots, show dialog\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )\r
+{\r
+ myPattern = SMESH::GetPattern();\r
+ myPreviewActor = 0;\r
+ myIsCreateDlgOpen = false;\r
+ mySelInput = Mesh;\r
+ myType = -1;\r
+ myNbPoints = -1;\r
+ mySelection = theSelection;\r
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();\r
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this );\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+\r
+ myMeshShape = GEOM::GEOM_Object::_nil();\r
+ myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();\r
+ myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();\r
+ myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();\r
+\r
+ // selection and SMESHGUI\r
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );\r
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );\r
+\r
+ myTypeGrp->setButton( Type_2d );\r
+ onTypeChanged( Type_2d );\r
+\r
+ updateGeometry();\r
+\r
+ resize( minimumSize() );\r
+\r
+ activateSelection();\r
+ onSelectionDone();\r
+\r
+ int x, y ;\r
+ aSMESHGUI->DefineDlgPosition( this, x, y );\r
+ this->move( x, y );\r
+ this->show();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::isValid\r
+// Purpose : Verify validity of entry data\r
+//=======================================================================\r
+bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )\r
+{\r
+ if ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||\r
+ myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() )\r
+ {\r
+ if ( theMess )\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_INSUFFICIENT_DATA" ), tr( "SMESHGUI_INVALID_PARAMETERS" ), QMessageBox::Ok );\r
+ return false;\r
+ }\r
+ else\r
+ return true;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onApply\r
+// Purpose : SLOT called when "Apply" button pressed.\r
+//=======================================================================\r
+bool SMESHGUI_MeshPatternDlg::onApply()\r
+{\r
+ try\r
+ {\r
+ if ( !isValid() )\r
+ return false;\r
+\r
+ if ( myType == Type_2d )\r
+ myPattern->ApplyToFace(\r
+ myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );\r
+ else\r
+ myPattern->ApplyTo3DBlock(\r
+ myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );\r
+\r
+ if ( myPattern->MakeMesh( myMesh ) )\r
+ {\r
+ mySelection->ClearIObjects();\r
+ SMESH::UpdateView();\r
+ SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );\r
+ return true;\r
+ }\r
+ else\r
+ {\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), QMessageBox::Ok );\r
+ return false;\r
+ }\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex ); \r
+ }\r
+ catch( ... )\r
+ {\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onOk\r
+// Purpose : SLOT called when "Ok" button pressed.\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onOk()\r
+{\r
+ if ( onApply() )\r
+ onClose();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onClose\r
+// Purpose : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onClose()\r
+{\r
+ mySelection->ClearFilters();\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ disconnect( mySelection, 0, this, 0 );\r
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );\r
+ SMESHGUI::GetSMESHGUI()->ResetState();\r
+ erasePreview();\r
+ reject();\r
+}\r
+\r
+\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onSelectionDone\r
+// Purpose : SLOT called when selection changed\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onSelectionDone()\r
+{\r
+ try\r
+ {\r
+ if ( mySelection->IObjectCount() != 1 )\r
+ return;\r
+\r
+ if ( mySelInput == Mesh )\r
+ {\r
+ // Retrieve mesh from selection\r
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );\r
+ if ( aMesh->_is_nil() )\r
+ return;\r
+\r
+ // Get geom object corresponding to the mesh\r
+ SALOMEDS::Study_var aStudy =\r
+ SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getStudyDocument();\r
+\r
+ SALOMEDS::SObject_var aSO = SMESH::FindSObject( aMesh.in() );\r
+ if ( aSO->_is_nil() )\r
+ return;\r
+\r
+ bool isFound = false;\r
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );\r
+ for( ; anIter->More(); anIter->Next() )\r
+ {\r
+ SALOMEDS::SObject_var aSO = anIter->Value();\r
+ SALOMEDS::SObject_var aRefSO;\r
+\r
+ GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(\r
+ aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );\r
+\r
+ if ( !aMeshShape->_is_nil() )\r
+ {\r
+ isFound = true;\r
+ myMeshShape = aMeshShape;\r
+ break;\r
+\r
+ }\r
+ }\r
+\r
+ if ( !isFound )\r
+ return;\r
+\r
+ // Clear fields of geom objects if mesh was changed\r
+ if ( myMesh != aMesh )\r
+ {\r
+ for ( int i = Object; i <= Vertex2; i++ )\r
+ {\r
+ myGeomObj[ i ] = GEOM::GEOM_Object::_nil();\r
+ mySelEdit[ i ]->setText( "" );\r
+ }\r
+ }\r
+\r
+ myMesh = aMesh;\r
+\r
+ // Set name of mesh in line edit\r
+ QString aName;\r
+ SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
+ mySelEdit[ Mesh ]->setText( aName );\r
+ }\r
+ else\r
+ {\r
+ // Get geom object from selection\r
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();\r
+ GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );\r
+ if ( anObj->_is_nil() )\r
+ return;\r
+\r
+ // Clear fields of vertexes if face or 3d block was changed\r
+ if ( anObj != myGeomObj[ mySelInput ] && mySelInput == Object )\r
+ {\r
+ for ( int i = Vertex1; i <= Vertex2; i++ )\r
+ {\r
+ myGeomObj[ i ] = GEOM::GEOM_Object::_nil();\r
+ mySelEdit[ i ]->setText( "" );\r
+ }\r
+ }\r
+\r
+ myGeomObj[ mySelInput ] = anObj;\r
+\r
+ // Set name of geom object in line edit\r
+ QString aName;\r
+ SMESH::GetNameOfSelectedIObjects( mySelection, aName );\r
+ mySelEdit[ mySelInput ]->setText( aName );\r
+ }\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ resetSelInput();\r
+ }\r
+ catch( ... )\r
+ {\r
+ resetSelInput();\r
+ }\r
+\r
+ updateWgState();\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::resetSelInput\r
+// Purpose : Reset fields corresponding to the current selection input\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::resetSelInput()\r
+{\r
+ if ( mySelInput == Mesh )\r
+ {\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ myMeshShape = GEOM::GEOM_Object::_nil();\r
+ }\r
+\r
+ else\r
+ myGeomObj[ mySelInput ] = GEOM::GEOM_Object::_nil();\r
+\r
+ mySelEdit[ mySelInput ]->setText( "" );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onDeactivate\r
+// Purpose : SLOT called when dialog must be deativated\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onDeactivate()\r
+{\r
+ mySelection->ClearFilters();\r
+ //if ( myReverseChk->isChecked() )\r
+ // erasePreview();\r
+ disconnect( mySelection, 0, this, 0 );\r
+ setEnabled( false );\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::enterEvent\r
+// Purpose : Event filter\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )\r
+{\r
+ if ( myIsCreateDlgOpen )\r
+ return;\r
+ \r
+ if ( myReverseChk->isChecked() )\r
+ displayPreview();\r
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;\r
+ setEnabled( true );\r
+ activateSelection();\r
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );\r
+}\r
+\r
+\r
+//=================================================================================\r
+// function : closeEvent()\r
+// purpose :\r
+//=================================================================================\r
+void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )\r
+{\r
+ onClose() ;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onSelInputChanged\r
+// Purpose : SLOT. Called when -> button clicked.\r
+// Change current selection input field\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onSelInputChanged()\r
+{\r
+ const QObject* aSender = sender();\r
+ for ( int i = Mesh; i <= Vertex2; i++ )\r
+ if ( aSender == mySelBtn[ i ] )\r
+ mySelInput = i;\r
+\r
+ activateSelection();\r
+ onSelectionDone();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::prepareFilters\r
+// Purpose : Prepare filters for dialog\r
+//=======================================================================\r
+\r
+QStringList SMESHGUI_MeshPatternDlg::prepareFilters() const\r
+{\r
+ static QStringList aList;\r
+ if ( aList.isEmpty() )\r
+ {\r
+ aList.append( tr( "PATTERN_FILT" ) );\r
+ //aList.append( tr( "ALL_FILES_FILTER" ) );\r
+ }\r
+\r
+ return aList;\r
+}\r
+\r
+//================================================================\r
+\r
+// Function : SMESHGUI_MeshPatternDlg::autoExtension\r
+// Purpose : Append extension to the file name\r
+//================================================================\r
+QString SMESHGUI_MeshPatternDlg::autoExtension( const QString& theFileName ) const\r
+{\r
+ QString anExt = theFileName.section( '.', -1 );\r
+ return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onOpen\r
+// Purpose : SLOT. Called when "Open" button clicked.\r
+// Displays file open dialog\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onOpen()\r
+{\r
+ QAD_FileDlg* aDlg = new QAD_FileDlg( this, true );\r
+ aDlg->setCaption( tr( "LOAD_PATTERN" ) );\r
+ aDlg->setMode( QFileDialogP::ExistingFile );\r
+ aDlg->setFilters( prepareFilters() );\r
+ if ( myName->text() != "" )\r
+ aDlg->setSelection( myName->text() + ".smp" );\r
+ QPushButton* anOkBtn = ( QPushButton* )aDlg->child( "OK", "QPushButton" );\r
+ if ( anOkBtn != 0 )\r
+ anOkBtn->setText( tr( "SMESH_BUT_OK" ) );\r
+\r
+ if ( aDlg->exec() != Accepted )\r
+ return;\r
+\r
+ QString fName = aDlg->selectedFile();\r
+ if ( fName.isEmpty() )\r
+ return;\r
+\r
+ if ( QFileInfo( fName ).extension().isEmpty() )\r
+ fName = autoExtension( fName );\r
+\r
+ fName = QDir::convertSeparators( fName );\r
+ \r
+ QString prev = QDir::convertSeparators( myName->text() );\r
+ if ( prev == fName )\r
+ return;\r
+\r
+ // Read string from file\r
+ QFile aFile( fName );\r
+ if ( !aFile.open( IO_ReadOnly ) )\r
+ {\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_OPENING" ), QMessageBox::Ok );\r
+ return;\r
+ }\r
+ \r
+ QByteArray aDataArray = aFile.readAll();\r
+ const char* aData = aDataArray.data();\r
+ if ( aData == 0 )\r
+ {\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_READING" ), QMessageBox::Ok );\r
+ return;\r
+ }\r
+ \r
+ if ( loadFromFile( aData ) )\r
+ myName->setText( QFileInfo( fName ).baseName() );\r
+ \r
+ updateWgState();\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onCloseCreationDlg\r
+// Purpose : SLOT. Called when "Pattern creation" dialog closed with "Close"\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onCloseCreationDlg()\r
+{\r
+ setEnabled( true );\r
+ myIsCreateDlgOpen = false;\r
+}\r
+\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onOkCreationDlg\r
+// Purpose : SLOT. Called when "Pattern creation" dialog closed with OK\r
+// or SAVE buttons. Initialize myPattern field. Redisplay preview\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onOkCreationDlg()\r
+{\r
+ myPattern = SMESH::SMESH_Pattern::_duplicate( myCreationDlg->GetPattern() );\r
+ myName->setText( myCreationDlg->GetPatternName() );\r
+ displayPreview();\r
+ setEnabled( true );\r
+ myIsCreateDlgOpen = false;\r
+}\r
+\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onNew\r
+// Purpose : SLOT. Called when "New..." button clicked. Create new pattern\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onNew()\r
+{\r
+ setEnabled( false );\r
+ myIsCreateDlgOpen = true;\r
+ if ( myCreationDlg == 0 )\r
+ {\r
+ myCreationDlg = new SMESHGUI_CreatePatternDlg( this, mySelection, myType );\r
+ connect( myCreationDlg, SIGNAL( NewPattern() ), SLOT( onOkCreationDlg() ) );\r
+ connect( myCreationDlg, SIGNAL( Close() ), SLOT( onCloseCreationDlg() ) );\r
+ }\r
+ else\r
+ myCreationDlg->Init( mySelection, myType );\r
+\r
+ myCreationDlg->SetMesh( myMesh );\r
+ myCreationDlg->show();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onReverse\r
+// Purpose : SLOT. Called when state of "Reverse order..." checkbox chaged\r
+// Calculate new points of the mesh to be created. Redisplay preview\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onReverse( bool )\r
+{\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+\r
+// name : SMESHGUI_MeshPatternDlg::onPreview\r
+// Purpose : SLOT. Called when state of "Preview" checkbox changed\r
+// Display/Erase preview\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onPreview( bool )\r
+{\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::displayPreview\r
+// Purpose : Display preview\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::displayPreview()\r
+{\r
+ try\r
+ {\r
+ // Redisplay preview in dialog\r
+\r
+ SMESH::point_array_var pnts = myPattern->GetPoints();\r
+ SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
+ SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();\r
+\r
+ if ( pnts->length() == 0 ||\r
+ keyPoints->length() == 0 ||\r
+ elemPoints->length() == 0 )\r
+ {\r
+ erasePreview();\r
+ return;\r
+ }\r
+\r
+ else\r
+ {\r
+ PointVector aPoints( pnts->length() );\r
+ QValueVector<int> aKeyPoints( keyPoints->length() );\r
+ ConnectivityVector anElemPoints( elemPoints->length() );\r
+\r
+ for ( int i = 0, n = pnts->length(); i < n; i++ )\r
+ aPoints[ i ] = pnts[ i ];\r
+\r
+ for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ )\r
+ aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
+\r
+ for ( int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++ )\r
+ {\r
+ QValueVector<int> aVec( elemPoints[ i3 ].length() );\r
+ for ( int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++ )\r
+ aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
+\r
+ anElemPoints[ i3 ] = aVec;\r
+ }\r
+\r
+ myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints );\r
+ }\r
+\r
+\r
+ // Redisplay preview in 3D viewer\r
+\r
+ if ( myPreviewActor != 0 )\r
+ {\r
+ if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )\r
+ {\r
+ vf->RemoveActor(myPreviewActor);\r
+ vf->Repaint();\r
+ }\r
+ myPreviewActor->Delete();\r
+ myPreviewActor = 0;\r
+ }\r
+\r
+ if ( !myPreviewChk->isChecked() || !isValid( false ) )\r
+ return;\r
+\r
+ vtkUnstructuredGrid* aGrid = getGrid();\r
+ if ( aGrid == 0 )\r
+ return;\r
+\r
+ // Create and display actor\r
+ vtkDataSetMapper* aMapper = vtkDataSetMapper::New();\r
+ aMapper->SetInput( aGrid );\r
+\r
+ myPreviewActor = SALOME_Actor::New();\r
+ myPreviewActor->PickableOff();\r
+ myPreviewActor->SetMapper( aMapper );\r
+\r
+ vtkProperty* aProp = vtkProperty::New();\r
+ aProp->SetRepresentationToWireframe();\r
+ aProp->SetColor( 250, 0, 250 );\r
+ if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh ) )\r
+ aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );\r
+ else\r
+ aProp->SetLineWidth( 1 );\r
+ myPreviewActor->SetProperty( aProp );\r
+\r
+ myPreviewActor->SetRepresentation( 3 );\r
+\r
+ SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );\r
+ SMESH::GetCurrentVtkView()->Repaint();\r
+\r
+ aProp->Delete();\r
+ aGrid->Delete();\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ erasePreview();\r
+ }\r
+ catch( ... )\r
+ {\r
+ erasePreview();\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::erasePreview\r
+// Purpose : Erase preview\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::erasePreview()\r
+{\r
+ // Erase preview in 2D viewer\r
+ myPicture2d->SetPoints( PointVector(), QValueVector<int>(), ConnectivityVector() );\r
+\r
+ // Erase preview in 3D viewer\r
+ if ( myPreviewActor == 0 )\r
+ return;\r
+\r
+\r
+ if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )\r
+ {\r
+ vf->RemoveActor(myPreviewActor);\r
+ vf->Repaint();\r
+ }\r
+ myPreviewActor->Delete();\r
+ myPreviewActor = 0;\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::updateWgState\r
+// Purpose : Enable/disable selection widgets\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::updateWgState()\r
+{\r
+ if ( myMesh->_is_nil() )\r
+ {\r
+ for ( int i = Object; i <= Vertex2; i++ )\r
+ {\r
+ mySelBtn [ i ]->setEnabled( false );\r
+ mySelEdit[ i ]->setEnabled( false );\r
+ mySelEdit[ i ]->setText( "" );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ mySelBtn [ Object ]->setEnabled( true );\r
+ mySelEdit[ Object ]->setEnabled( true );\r
+ \r
+ if ( myGeomObj[ Object ]->_is_nil() )\r
+ {\r
+ for ( int i = Vertex1; i <= Vertex2; i++ )\r
+ {\r
+ mySelBtn [ i ]->setEnabled( false );\r
+ mySelEdit[ i ]->setEnabled( false );\r
+ mySelEdit[ i ]->setText( "" );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for ( int i = Object; i <= Vertex2; i++ )\r
+ {\r
+ mySelBtn [ i ]->setEnabled( true );\r
+ mySelEdit[ i ]->setEnabled( true );\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::activateSelection\r
+// Purpose : Activate selection in accordance with current selection input\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::activateSelection()\r
+{\r
+ mySelection->ClearFilters();\r
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );\r
+ \r
+ if ( mySelInput == Object && !myMeshShape->_is_nil() )\r
+ {\r
+ if ( myType == Type_2d )\r
+ {\r
+ if ( myNbPoints > 0 )\r
+ mySelection->AddFilter( new SMESH_NumberFilter( \r
+\r
+ "GEOM", TopAbs_VERTEX, myNbPoints, TopAbs_FACE, myMeshShape ) );\r
+ else\r
+ mySelection->AddFilter( new SMESH_NumberFilter(\r
+ "GEOM", TopAbs_SHAPE, myNbPoints, TopAbs_FACE, myMeshShape ) );\r
+ }\r
+ else\r
+ {\r
+ TColStd_MapOfInteger aTypes;\r
+ aTypes.Add( TopAbs_SHELL );\r
+ aTypes.Add( TopAbs_SOLID );\r
+ mySelection->AddFilter( new SMESH_NumberFilter(\r
+ "GEOM", TopAbs_FACE, 6, aTypes, myMeshShape, true ) );\r
+ }\r
+ }\r
+ else if ( ( mySelInput == Vertex1 || mySelInput == Vertex2 ) && !myGeomObj[ Object ]->_is_nil() )\r
+ {\r
+ mySelection->AddFilter( new SMESH_NumberFilter(\r
+ "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX, myGeomObj[ Object ] ) );\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::loadFromFile\r
+// Purpose : Load pattern from file\r
+//=======================================================================\r
+bool SMESHGUI_MeshPatternDlg::loadFromFile( const QString& theName )\r
+{\r
+ try\r
+ {\r
+ SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern();\r
+\r
+ if ( !aPattern->LoadFromFile( theName.latin1() ) ||\r
+ myType == Type_2d && !aPattern->Is2D())\r
+ {\r
+ SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode();\r
+ QString aMess;\r
+ if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NB_POINTS ) aMess = tr( "ERR_READ_NB_POINTS" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_POINT_COORDS ) aMess = tr( "ERR_READ_POINT_COORDS" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_TOO_FEW_POINTS ) aMess = tr( "ERR_READ_TOO_FEW_POINTS" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_3D_COORD ) aMess = tr( "ERR_READ_3D_COORD" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_KEYPOINT ) aMess = tr( "ERR_READ_NO_KEYPOINT" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_INDEX ) aMess = tr( "ERR_READ_BAD_INDEX" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_ELEM_POINTS ) aMess = tr( "ERR_READ_ELEM_POINTS" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_NO_ELEMS ) aMess = tr( "ERR_READ_NO_ELEMS" );\r
+ else if ( aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr( "ERR_READ_BAD_KEY_POINT" );\r
+ else aMess = tr( "ERROR_OF_LOADING" );\r
+\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), aMess, QMessageBox::Ok );\r
+ return false;\r
+ }\r
+ else\r
+ {\r
+ myPattern = aPattern;\r
+ return true;\r
+ }\r
+ }\r
+ catch( const SALOME::SALOME_Exception& S_ex )\r
+ {\r
+ QtCatchCorbaException( S_ex );\r
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),\r
+ tr( "SMESH_ERROR" ), tr( "ERROR_OF_LOADING" ), QMessageBox::Ok );\r
+ return false;\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::onTypeChanged\r
+\r
+// Purpose : SLOT. Called when pattern type changed.\r
+// Change dialog's look and feel\r
+//=======================================================================\r
+void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )\r
+{\r
+ if ( myType == theType )\r
+ return;\r
+\r
+ myType = theType;\r
+\r
+ myNbPoints = -1;\r
+ myGeomObj[ Object ] = GEOM::GEOM_Object::_nil();\r
+ myGeomObj[ Vertex1 ] = GEOM::GEOM_Object::_nil();\r
+ myGeomObj[ Vertex2 ] = GEOM::GEOM_Object::_nil();\r
+ myPattern = SMESH::GetPattern();\r
+\r
+ myName->setText( "" );\r
+ mySelEdit[ Object ]->setText( "" );\r
+ mySelEdit[ Vertex1 ]->setText( "" );\r
+ mySelEdit[ Vertex2 ]->setText( "" );\r
+\r
+ if ( theType == Type_2d )\r
+ {\r
+ mySelLbl [ Vertex2 ]->hide();\r
+ mySelBtn [ Vertex2 ]->hide();\r
+ mySelEdit[ Vertex2 ]->hide();\r
+ myReverseChk->show();\r
+ myPicture2d->show();\r
+ myPicture3d->hide();\r
+ mySelLbl[ Object ]->setText( tr( "FACE" ) );\r
+ mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );\r
+ }\r
+ else\r
+ {\r
+ mySelLbl [ Vertex2 ]->show();\r
+ mySelBtn [ Vertex2 ]->show();\r
+ mySelEdit[ Vertex2 ]->show();\r
+ myReverseChk->hide();\r
+ myPicture2d->hide();\r
+ myPicture3d->show();\r
+ mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) );\r
+ mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );\r
+ mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );\r
+ }\r
+\r
+ mySelInput = Mesh;\r
+ activateSelection();\r
+ updateWgState();\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// name : SMESHGUI_MeshPatternDlg::getGrid\r
+// Purpose : Get unstructured grid for pattern\r
+//=======================================================================\r
+vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()\r
+{\r
+ try\r
+ {\r
+ // Get points from pattern\r
+ SMESH::point_array_var pnts = myType == Type_2d\r
+ ? myPattern->ApplyToFace( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )\r
+ : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );\r
+\r
+ SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();\r
+\r
+ if ( pnts->length() == 0 || elemPoints->length() == 0 )\r
+ return 0;\r
+\r
+ \r
+\r
+ // to do : to be removed /////////////////////////////////////////////\r
+\r
+#ifdef DEB_SLN\r
+ for ( int i1 = 0, n1 = pnts->length(); i1 < n1; i1++ )\r
+ printf( "%d: %g %g %g\n", i1, pnts[ i1 ].x, pnts[ i1 ].y, pnts[ i1 ].z );\r
+\r
+ printf( "\nELEMENTS : \n" );\r
+ for ( int i2 = 0, n2 = elemPoints->length(); i2 < n2; i2++ )\r
+ {\r
+\r
+ printf( "%d: ", i2 );\r
+ for ( int i3 = 0, n3 = elemPoints[ i2 ].length(); i3 < n3; i3++ )\r
+ printf( "%d ", elemPoints[ i2 ][ i3 ] );\r
+\r
+ printf( "\n" );\r
+\r
+ }\r
+#endif\r
+ //////////////////////////////////////////////////////////////////////\r
+\r
+ // Calculate number of points used for cell\r
+ vtkIdType aNbCells = elemPoints->length();\r
+ vtkIdType aCellsSize = 0;\r
+ for ( int i = 0, n = elemPoints->length(); i < n; i++ )\r
+ aCellsSize += elemPoints[ i ].length();\r
+\r
+ // Create unstructured grid and other usefull arrays\r
+ vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();\r
+\r
+ vtkCellArray* aConnectivity = vtkCellArray::New();\r
+ aConnectivity->Allocate( aCellsSize, 0 );\r
+\r
+ vtkPoints* aPoints = vtkPoints::New();\r
+ aPoints->SetNumberOfPoints( pnts->length() );\r
+\r
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();\r
+ aCellTypesArray->SetNumberOfComponents( 1 );\r
+ aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );\r
+\r
+ vtkIdList *anIdList = vtkIdList::New();\r
+\r
+ // Fill array of points\r
+ for ( int p = 0, nbPnt = pnts->length(); p < nbPnt; p++ )\r
+ aPoints->SetPoint( p, pnts[ p ].x, pnts[ p ].y, pnts[ p ].z );\r
+\r
+ for ( int e = 0, nbElem = elemPoints->length(); e < nbElem; e++ )\r
+ {\r
+ int nbPoints = elemPoints[ e ].length();\r
+ anIdList->SetNumberOfIds( nbPoints );\r
+ for ( int i = 0; i < nbPoints; i++ )\r
+ anIdList->SetId( i, elemPoints[ e ][ i ] );\r
+\r
+ aConnectivity->InsertNextCell( anIdList );\r
+\r
+ if ( nbPoints == 3 ) aCellTypesArray->InsertNextValue( VTK_TRIANGLE );\r
+ else if ( nbPoints == 5 ) aCellTypesArray->InsertNextValue( VTK_PYRAMID );\r
+ else if ( nbPoints == 6 ) aCellTypesArray->InsertNextValue( VTK_WEDGE );\r
+ else if ( nbPoints == 8 ) aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );\r
+ else if ( nbPoints == 4 && myType == Type_2d ) aCellTypesArray->InsertNextValue( VTK_QUAD );\r
+ else if ( nbPoints == 4 && myType == Type_3d ) aCellTypesArray->InsertNextValue( VTK_TETRA );\r
+ else aCellTypesArray->InsertNextValue( VTK_EMPTY_CELL );\r
+ }\r
+\r
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();\r
+ aCellLocationsArray->SetNumberOfComponents( 1 );\r
+ aCellLocationsArray->SetNumberOfTuples( aNbCells );\r
+\r
+ aConnectivity->InitTraversal();\r
+ for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )\r
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );\r
+\r
+ aGrid->SetPoints( aPoints );\r
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );\r
+\r
+ aConnectivity->Delete();\r
+ aPoints->Delete();\r
+ aCellTypesArray->Delete();\r
+ anIdList->Delete();\r
+ aCellLocationsArray->Delete();\r
+\r
+ return aGrid;\r
+ }\r
+ catch( ... )\r
+ {\r
+ return 0;\r
+ }\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : SMESHGUI_MeshPatternDlg.h\r
+// Author : Sergey LITONIN\r
+// Module : SMESH\r
+\r
+\r
+#ifndef SMESHGUI_MeshPatternDlg_H\r
+#define SMESHGUI_MeshPatternDlg_H\r
+\r
+#include <qdialog.h>\r
+\r
+// IDL Headers\r
+#include <SALOMEconfig.h>\r
+#include CORBA_SERVER_HEADER(GEOM_Gen)\r
+#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
+#include CORBA_SERVER_HEADER(SMESH_Pattern)\r
+\r
+class QCloseEvent;\r
+class QFrame;\r
+class QLineEdit;\r
+class SMESHGUI_SpinBox;\r
+class QPushButton;\r
+class SALOME_Selection;\r
+class QRadioButton;\r
+class QCheckBox;\r
+class QButtonGroup;\r
+class QLabel;\r
+class SMESHGUI_CreatePatternDlg;\r
+class SMESHGUI_PatternWidget;\r
+class vtkUnstructuredGrid;\r
+class SALOME_Actor;\r
+\r
+/*\r
+ Class : SMESHGUI_MeshPatternDlg\r
+ Description : Dialog to specify filters for VTK viewer\r
+*/\r
+\r
+class SMESHGUI_MeshPatternDlg : public QDialog\r
+{\r
+ Q_OBJECT\r
+\r
+ // Pattern type\r
+ enum { Type_2d, Type_3d };\r
+\r
+ // selection input\r
+ enum { Mesh, Object, Vertex1, Vertex2 };\r
+\r
+public:\r
+ SMESHGUI_MeshPatternDlg( QWidget*,\r
+ SALOME_Selection*,\r
+ const char* = 0 );\r
+ virtual ~SMESHGUI_MeshPatternDlg();\r
+\r
+ void Init( SALOME_Selection* );\r
+ \r
+private slots:\r
+\r
+ void onOk();\r
+ bool onApply();\r
+ void onClose();\r
+\r
+ void onDeactivate();\r
+\r
+ void onSelectionDone();\r
+ void onSelInputChanged();\r
+\r
+ void onTypeChanged( int );\r
+ void onOpen();\r
+ void onNew();\r
+ void onReverse( bool );\r
+ void onPreview( bool );\r
+ void onOkCreationDlg();\r
+ void onCloseCreationDlg();\r
+\r
+private:\r
+\r
+ QFrame* createButtonFrame( QWidget* );\r
+ QFrame* createMainFrame ( QWidget* );\r
+ void displayPreview();\r
+ vtkUnstructuredGrid* getGrid();\r
+ void erasePreview();\r
+ void updateWgState();\r
+ bool loadFromFile( const QString& );\r
+ void activateSelection();\r
+ QStringList prepareFilters() const;\r
+ QString autoExtension( const QString& theFileName ) const;\r
+ void closeEvent( QCloseEvent* e ) ;\r
+ void enterEvent ( QEvent * ) ;\r
+ bool isValid( const bool theMess = true );\r
+ void resetSelInput();\r
+\r
+private:\r
+\r
+ QPushButton* myOkBtn;\r
+ QPushButton* myApplyBtn;\r
+ QPushButton* myCloseBtn;\r
+\r
+ QButtonGroup* myTypeGrp;\r
+ QRadioButton* mySwitch2d;\r
+ QRadioButton* mySwitch3d;\r
+\r
+ QMap< int, QPushButton* > mySelBtn;\r
+ QMap< int, QLineEdit* > mySelEdit;\r
+ QMap< int, QLabel* > mySelLbl;\r
+\r
+ QLineEdit* myName;\r
+ QPushButton* myOpenBtn;\r
+ QPushButton* myNewBtn;\r
+\r
+ QCheckBox* myReverseChk;\r
+ SMESHGUI_PatternWidget* myPicture2d;\r
+ QFrame* myPicture3d;\r
+ QLabel* myPreview3d;\r
+\r
+ QCheckBox* myPreviewChk;\r
+ \r
+ SALOME_Selection* mySelection;\r
+ int mySelInput;\r
+ int myNbPoints;\r
+ int myType;\r
+ bool myIsCreateDlgOpen;\r
+\r
+ SMESH::SMESH_Mesh_var myMesh;\r
+ GEOM::GEOM_Object_var myMeshShape;\r
+ QMap< int, GEOM::GEOM_Object_var > myGeomObj;\r
+ \r
+ SMESHGUI_CreatePatternDlg* myCreationDlg;\r
+ SMESH::SMESH_Pattern_var myPattern;\r
+ SALOME_Actor* myPreviewActor;\r
+};\r
+\r
+#endif\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_Utils.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+namespace SMESH
+{
+
+ SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ CORBA::Object_var anObj = IObjectToObject(theIO);
+ if(!CORBA::is_nil(anObj)){
+ SMESH_Mesh_var aMesh = SMESH_Mesh::_narrow(anObj);
+ if(!CORBA::is_nil(aMesh))
+ return aMesh;
+ SMESH_Group_var aGroup = SMESH_Group::_narrow(anObj);
+ if(!CORBA::is_nil(aGroup))
+ return aGroup->GetMesh();
+ SMESH_subMesh_var aSubMesh = SMESH_subMesh::_narrow(anObj);
+ if(!CORBA::is_nil(aSubMesh))
+ return aSubMesh->GetFather();
+ }
+ return SMESH_Mesh::_nil();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_MeshUtils_HeaderFile
+#define SMESHGUI_MeshUtils_HeaderFile
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+namespace SMESH{
+
+ SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+}
+
+
+#endif
// $Header$
#include "SMESHGUI_MoveNodesDlg.h"
+
+#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_IdValidator.h"
+
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+
#include "SMESH_Actor.h"
-#include "SMESHGUI.h"
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshNode.hxx"
-#include "QAD_Application.h"
+#include "SALOME_Selection.h"
+#include "VTKViewer_ViewFrame.h"
#include "QAD_Desktop.h"
+#include "QAD_RightFrame.h"
#include "QAD_MessageBox.h"
+
#include "utilities.h"
-// QT Includes
-#include <qbuttongroup.h>
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
#include <qpixmap.h>
+#include <qmessagebox.h>
+#include <qbuttongroup.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
-// Open CASCADE Include
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#define MARGIN 10
+#define SPACING 5
-using namespace std;
//=================================================================================
// class : SMESHGUI_MoveNodesDlg()
// purpose :
//=================================================================================
-SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+
+: QDialog( theParent, theName, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MOVE_NODE")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_MoveNodesDlg" );
- resize( 303, 185 );
- setCaption( tr( "SMESH_MOVE_NODES_TITLE" ) );
- setSizeGripEnabled( TRUE );
- SMESHGUI_MoveNodesDlgLayout = new QGridLayout( this );
- SMESHGUI_MoveNodesDlgLayout->setSpacing( 6 );
- SMESHGUI_MoveNodesDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_NODES" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_MoveNodesDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_MoveNodesDlgLayout->addWidget( GroupButtons, 3, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_MOVE" ) );
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
-
- SMESHGUI_MoveNodesDlgLayout->addWidget( GroupC1, 1, 0 );
-
- /***************************************************************/
- GroupCoordinates = new QGroupBox( this, "GroupCoordinates" );
- GroupCoordinates->setTitle( tr( "SMESH_COORDINATES" ) );
- GroupCoordinates->setColumnLayout(0, Qt::Vertical );
- GroupCoordinates->layout()->setSpacing( 0 );
- GroupCoordinates->layout()->setMargin( 0 );
- GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() );
- GroupCoordinatesLayout->setAlignment( Qt::AlignTop );
- GroupCoordinatesLayout->setSpacing( 6 );
- GroupCoordinatesLayout->setMargin( 11 );
- TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" );
- TextLabel_X->setText( tr( "SMESH_X" ) );
- GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 );
- TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" );
- TextLabel_Y->setText( tr( "SMESH_Y" ) );
- GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 );
+ myPreviewActor = 0;
+ myBusy = false;
+ mySelection = 0;
- SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_X" ) ;
- GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 );
-
- SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Y" ) ;
- GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 );
-
- SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Z" ) ;
- GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 );
+ setCaption( tr( "CAPTION" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
- TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" );
- TextLabel_Z->setText( tr( "SMESH_Z" ) );
- GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 );
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
- SMESHGUI_MoveNodesDlgLayout->addWidget( GroupCoordinates, 2, 0 );
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
- Init(Sel) ; /* Initialisations */
+ Init( theSelection ) ;
}
-//=================================================================================
-// function : ~SMESHGUI_MoveNodesDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame( QWidget* theParent )
{
- // no need to delete child widgets, Qt does it all for us
-}
+ QFrame* aFrame = new QFrame( theParent );
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::Init( SALOME_Selection* Sel )
-{
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
- /* Get setting of step value from file configuration */
- double step ;
- // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO
- // step = St.toDouble() ; TODO
- step = 25.0 ;
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkNodes = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* min, max, step and decimals for spin boxes */
- SpinBox_X->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
- SpinBox_Y->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
- SpinBox_Z->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
- SpinBox_X->SetValue( 0.0 ) ;
- SpinBox_Y->SetValue( 0.0 ) ;
- SpinBox_Z->SetValue( 0.0 ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
- SelectionIntoArgument();
-
- return ;
-}
+ aLay->addWidget( myOkBtn );
+ aLay->addWidget( myApplyBtn );
+ aLay->addItem( aSpacer);
+ aLay->addWidget( myCloseBtn );
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ConstructorsClicked(int constructorId)
-{
- return ;
+ return aFrame;
}
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_MoveNodesDlg::createMainFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+
+ QPixmap iconMoveNode(
+ QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_DLG_MOVE_NODE" ) ) );
+ QPixmap iconSelect(
+ QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
+
+ QButtonGroup* aPixGrp = new QButtonGroup( 1, Qt::Vertical, tr( "MESH_NODE" ), aFrame );
+ aPixGrp->setExclusive( TRUE );
+ QRadioButton* aRBut = new QRadioButton( aPixGrp );
+ aRBut->setPixmap( iconMoveNode );
+ aRBut->setChecked( TRUE );
+
+ QGroupBox* anIdGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_MOVE" ), aFrame );
+ new QLabel( tr( "NODE_ID" ), anIdGrp );
+ ( new QPushButton( anIdGrp ) )->setPixmap( iconSelect );
+ myId = new QLineEdit( anIdGrp );
+ myId->setValidator( new SMESHGUI_IdValidator( this, "validator", 1 ));
+
+ QGroupBox* aCoordGrp = new QGroupBox( 1, Qt::Vertical, tr( "SMESH_COORDINATES" ), aFrame );
+ new QLabel( tr( "SMESH_X" ), aCoordGrp );
+ myX = new SMESHGUI_SpinBox( aCoordGrp );
+ new QLabel( tr( "SMESH_Y" ), aCoordGrp );
+ myY = new SMESHGUI_SpinBox( aCoordGrp );
+ new QLabel( tr( "SMESH_Z" ), aCoordGrp );
+ myZ = new SMESHGUI_SpinBox( aCoordGrp );
+
+ myX->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );
+ myY->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );
+ myZ->RangeStepAndValidator( -999999.999, +999999.999, 25.0, 3 );
+
+ QVBoxLayout* aLay = new QVBoxLayout( aFrame );
+ aLay->addWidget( aPixGrp );
+ aLay->addWidget( anIdGrp );
+ aLay->addWidget( aCoordGrp );
+
+ // connect signale and slots
+ connect( myX, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
+ connect( myY, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
+ connect( myZ, SIGNAL ( valueChanged( double) ), this, SLOT( redisplayPreview() ) );
+ connect( myId, SIGNAL( textChanged(const QString&) ), SLOT( onTextChange(const QString&) ));
+
+ return aFrame;
+}
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ClickOnApply()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
+// Purpose :
+//=======================================================================
+SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkNodes) {
- mySMESHGUI->EraseSimulationActors();
-// mySMESHGUI->MoveNode( myMesh, myIdnode, LineEdit_X->text().toFloat(), LineEdit_Y->text().toFloat(), LineEdit_Z->text().toFloat() ) ;
-// mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
+ erasePreview();
}
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ClickOnOk()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::Init
+// Purpose : Init dialog fields
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::Init( SALOME_Selection* theSelection )
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
+ myPreviewActor = 0;
+ myMeshActor = 0;
+ myBusy = false;
+ mySelection = theSelection;
+
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
- return ;
+ // selection and SMESHGUI
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+ reset();
+ setEnabled( true );
+
+ int x, y ;
+ aSMESHGUI->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+ this->show();
+
+ // set selection mode
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ onSelectionDone();
}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ClickOnCancel()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::isValid
+// Purpose : Verify validity of entry information
+//=======================================================================
+bool SMESHGUI_MoveNodesDlg::isValid( const bool theMess ) const
{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- mySMESHGUI->EraseSimulationActors();
- reject() ;
- return ;
+ if ( myId->text().isEmpty() )
+ {
+ if ( theMess )
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_WARNING" ), tr( "NODE_ID_IS_NOT_DEFINED" ), QMessageBox::Ok );
+ return false;
+ }
+ return true;
}
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::SelectionIntoArgument()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::reset
+// Purpose : Reset the dialog state
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::reset()
{
+ myId->clear();
+ myX->SetValue( 0 );
+ myY->SetValue( 0 );
+ myZ->SetValue( 0 );
+ redisplayPreview();
+ updateButtons();
+}
- disconnect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- disconnect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- disconnect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- mySMESHGUI->EraseSimulationActors();
-
- myEditCurrentArgument->setText("") ;
- myOkNodes = false;
- QString aString = "";
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::nApply
+// Purpose : SLOT called when "Apply" button pressed.
+//=======================================================================
+bool SMESHGUI_MoveNodesDlg::onApply()
+{
+ if (SMESHGUI::GetSMESHGUI()->ActiveStudyLocked())
+ return false;
+
+ if ( !isValid( true ) )
+ return false;
+
+ SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( myMeshActor->getIO() );
+ if(aMesh->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "SMESHG_NO_MESH" ), QMessageBox::Ok );
+ return false;
+ }
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return ;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+ if ( aMeshEditor->_is_nil() )
+ return false;
- int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes != 1) {
- SpinBox_X->SetValue(0.0) ;
- SpinBox_Y->SetValue(0.0) ;
- SpinBox_Z->SetValue(0.0) ;
- return ;
+ int anId = myId->text().toInt();
+ bool aResult = false;
+ try
+ {
+ aResult = aMeshEditor->MoveNode( anId, myX->GetValue(), myY->GetValue(), myZ->GetValue() );
}
-
- if ( mySelection->SelectionMode() != NodeSelection ){
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
- return;
+ catch( ... )
+ {
}
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ reset();
+ }
+
+ return aResult;
+}
- SMESH_Actor* ac = mySMESHGUI->FindActorByEntry( mySelection->firstIObject()->getEntry(), res, false );
- if ( !res )
- return ;
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::onOk()
+{
+ if ( onApply() )
+ onClose();
+}
- TColStd_MapIteratorOfMapOfInteger ite( myMapIndex );
- if ( ite.More() ) {
- myIdnode = ite.Key();
- mySimulationActor = mySMESHGUI->SimulationMoveNode( ac, myIdnode );
- } else
- return ;
- MESSAGE ( " myIdnode " << myIdnode );
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::onClose()
+{
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState();
+ reject();
+}
- float *pt = ac->GetMapper()->GetInput()->GetPoint(myIdnode);
- MESSAGE ( " pt " << pt[0] << ";" << pt[1] << ";" << pt[2] )
- SpinBox_X->SetValue( (double)pt[0] ) ;
- SpinBox_Y->SetValue( (double)pt[1] ) ;
- SpinBox_Z->SetValue( (double)pt[2] ) ;
- connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
- myOkNodes = true ;
- return ;
+void SMESHGUI_MoveNodesDlg::onTextChange(const QString& theNewText)
+{
+ if ( myBusy ) return;
+
+ myOkBtn->setEnabled( false );
+ myApplyBtn->setEnabled( false );
+ erasePreview();
+
+ // select entered node
+ SMDS_Mesh* aMesh = 0;
+ if ( myMeshActor )
+ aMesh = myMeshActor->GetObject()->GetMesh();
+ if ( aMesh ) {
+
+ myBusy = true;
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myMeshActor->getIO() );
+ myBusy = false;
+
+ const SMDS_MeshElement * e = aMesh->FindElement( theNewText.toInt() );
+ if ( e )
+ mySelection->AddOrRemoveIndex (myMeshActor->getIO(), e->GetID(), true);
+ }
}
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::SetEditCurrentArgument()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::onSelectionDone()
{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
+ if ( myBusy ) return;
+ myMeshActor = 0;
+
+ if ( mySelection->IObjectCount() == 1 ) {
+ myMeshActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
+ if ( myMeshActor )
{
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
+ QString aText;
+ if ( SMESH::GetNameOfSelectedNodes( mySelection, aText ) == 1 ) {
+ if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
+ if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
+ myBusy = true;
+ myId->setText( aText );
+ myX->SetValue( aNode->X() );
+ myY->SetValue( aNode->Y() );
+ myZ->SetValue( aNode->Z() );
+ myBusy = false;
+ erasePreview(); // avoid overlapping of a selection and a preview
+ updateButtons();
+ return;
+ }
+ }
}
}
- return ;
+ }
+
+ reset();
}
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::DeactivateActiveDialog()
+
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::onDeactivate()
{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- mySMESHGUI->EraseSimulationActors() ;
- mySMESHGUI->ResetState() ;
- mySMESHGUI->SetActiveDialogBox(0) ;
- }
- return ;
+ setEnabled( false );
+ erasePreview();
}
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ActivateThisDialog()
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::enterEvent( QEvent* )
{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
+ if ( !isEnabled() )
+ {
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+
+ // set selection mode
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ redisplayPreview();
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
- return ;
+ setEnabled( true );
+ }
}
//=================================================================================
-// function : enterEvent()
+// function : closeEvent()
// purpose :
//=================================================================================
-void SMESHGUI_MoveNodesDlg::enterEvent(QEvent* e)
+void SMESHGUI_MoveNodesDlg::closeEvent( QCloseEvent* e )
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ onClose() ;
+ SMESH::GetCurrentVtkView()->Repaint();
}
+//=======================================================================
+//function : hideEvent
+//purpose : may be caused by ESC key
+//=======================================================================
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::closeEvent( QCloseEvent* e )
+void SMESHGUI_MoveNodesDlg::hideEvent ( QHideEvent * e )
{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
+ if ( !isMinimized() )
+ onClose();
}
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::updateButtons
+// Purpose : Update buttons state
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::updateButtons()
+{
+ bool isEnabled = isValid( false );
+ myOkBtn->setEnabled( isEnabled );
+ myApplyBtn->setEnabled( isEnabled );
+}
-//=================================================================================
-// function : ValueChangedInSpinBox()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::ValueChangedInSpinBox( double newValue )
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::erasePreview
+// Purpose : Erase preview
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::erasePreview()
+{
+ if ( myPreviewActor == 0 )
+ return;
+
+ if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
+ vf->RemoveActor(myPreviewActor);
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+ SMESH::GetCurrentVtkView()->Repaint();
+}
+
+//=======================================================================
+// name : SMESHGUI_MoveNodesDlg::redisplayPreview
+// Purpose : Redisplay preview
+//=======================================================================
+void SMESHGUI_MoveNodesDlg::redisplayPreview()
{
- double vx = SpinBox_X->GetValue() ;
- double vy = SpinBox_Y->GetValue() ;
- double vz = SpinBox_Z->GetValue() ;
+ if ( myBusy )
+ return;
+
+ if ( myPreviewActor != 0 )
+ erasePreview();
+
+ if ( !isValid( false ) )
+ return;
+
+ vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
- mySMESHGUI->DisplaySimulationMoveNode( mySimulationActor, myIdnode, vx, vy , vz );
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints( 1 );
+ aPoints->SetPoint( 0, myX->GetValue(), myY->GetValue(), myZ->GetValue() );
+
+ // Create cells
+
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds( 1 );
+
+ vtkCellArray *aCells = vtkCellArray::New();
+ aCells->Allocate( 2, 0 );
+
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents( 1 );
+ aCellTypesArray->Allocate( 1 );
+
+ anIdList->SetId( 0, 0 );
+ aCells->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_VERTEX );
+
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ aCellLocationsArray->SetNumberOfComponents( 1 );
+ aCellLocationsArray->SetNumberOfTuples( 1 );
+
+ aCells->InitTraversal();
+ vtkIdType npts;
+ aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
+
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
+
+ aGrid->SetPoints( aPoints );
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aCells );
+
+ // Create and display actor
+ vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+ aMapper->SetInput( aGrid );
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->PickableOff();
+ myPreviewActor->SetMapper( aMapper );
+
+ vtkProperty* aProp = vtkProperty::New();
+ aProp->SetRepresentationToWireframe();
+ aProp->SetColor( 250, 0, 250 );
+ aProp->SetPointSize( 5 );
+ myPreviewActor->SetProperty( aProp );
+
+ SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
+ SMESH::GetCurrentVtkView()->Repaint();
+
+ aProp->Delete();
+ aCellLocationsArray->Delete();
+ aCellTypesArray->Delete();
+ aCells->Delete();
+ anIdList->Delete();
+ aPoints->Delete();
+ aGrid->Delete();
}
+
#ifndef DIALOGBOX_MOVE_NODES_H
#define DIALOGBOX_MOVE_NODES_H
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
#include <qdialog.h>
+#include "SALOME_Selection.h"
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
class QLineEdit;
class QPushButton;
-class QRadioButton;
-class SMESHGUI;
class SMESHGUI_SpinBox;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-// VTK Include
-#include <vtkActor.h>
+class SALOME_Actor;
+class QFrame;
+class SMESH_Actor;
//=================================================================================
// class : SMESHGUI_MoveNodesDlg
//=================================================================================
class SMESHGUI_MoveNodesDlg : public QDialog
{
- Q_OBJECT
+ Q_OBJECT
public:
- SMESHGUI_MoveNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_MoveNodesDlg();
+
+ SMESHGUI_MoveNodesDlg( QWidget*,
+ SALOME_Selection*,
+ const char* = 0 );
+ virtual ~SMESHGUI_MoveNodesDlg();
+
+ void Init( SALOME_Selection* ) ;
+
+private slots:
+
+ void onOk();
+ bool onApply();
+ void onClose();
+
+ void onDeactivate();
+
+ void onSelectionDone();
+ void redisplayPreview();
+ void onTextChange(const QString&);
private:
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkNodes ; /* to check when arguments is defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- int myIdnode;
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- vtkActor *mySimulationActor;
-
- QGroupBox* GroupCoordinates;
- QLabel* TextLabel_X;
- QLabel* TextLabel_Y;
- QLabel* TextLabel_Z;
- SMESHGUI_SpinBox* SpinBox_X;
- SMESHGUI_SpinBox* SpinBox_Y;
- SMESHGUI_SpinBox* SpinBox_Z;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+ void hideEvent ( QHideEvent * );
+ void erasePreview();
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid( const bool ) const;
+ void reset();
+ void updateButtons();
-private slots:
+private:
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
- void ValueChangedInSpinBox( double newValue ) ;
-
-protected:
- QGridLayout* SMESHGUI_MoveNodesDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
- QGridLayout* GroupCoordinatesLayout;
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+
+ QLineEdit* myId;
+ SMESHGUI_SpinBox* myX;
+ SMESHGUI_SpinBox* myY;
+ SMESHGUI_SpinBox* myZ;
+
+ SALOME_Selection* mySelection;
+
+ SALOME_Actor* myPreviewActor;
+ SMESH_Actor* myMeshActor;
+ bool myBusy;
};
#endif // DIALOGBOX_MOVE_NODES_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_MultiEditDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_MultiEditDlg.h"
+#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_Filter.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+
+#include "QAD_Desktop.h"
+#include "QAD_RightFrame.h"
+
+#include "VTKViewer_ViewFrame.h"
+
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshElement.hxx"
+
+#include "SALOME_Selection.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "VTKViewer_InteractorStyleSALOME.h"
+
+#include <vtkCell.h>
+#include <vtkIdList.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <Precision.hxx>
+#include <TColStd_DataMapOfIntegerInteger.hxx>
+
+#include <qcheckbox.h>
+#include <qframe.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+
+#define SPACING 5
+#define MARGIN 10
+
+/*
+ Class : SMESHGUI_MultiEditDlg
+ Description : Description : Inversion of the diagonal of a pseudo-quadrangle formed by
+ 2 neighboring triangles with 1 common edge
+*/
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const int theMode,
+ const char* theName )
+: QDialog( theParent, theName, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ myFilterDlg = 0;
+ mySubmeshFilter = new SMESH_TypeFilter( SUBMESH );
+ myGroupFilter = new SMESH_TypeFilter( GROUP );
+
+ myFilterType = theMode;
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
+ aDlgLay->setStretchFactor( aBtnFrame, 0 );
+ Init( theSelection ) ;
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_MultiEditDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
+ aMainGrp->setFrameStyle( QFrame::NoFrame );
+ aMainGrp->setInsideMargin( 0 );
+
+ QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
+
+ // "Selected cells" group
+ mySelGrp = new QGroupBox( 1, Qt::Horizontal, aMainGrp );
+ QFrame* aFrame = new QFrame( mySelGrp );
+
+ myListBox = new QListBox( aFrame );
+ myListBox->setSelectionMode( QListBox::Extended );
+ myListBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
+// myListBox->setColumnMode( QListBox::FitToHeight );
+
+ myFilterBtn = new QPushButton( tr( "FILTER" ) , aFrame );
+ myAddBtn = new QPushButton( tr( "ADD" ) , aFrame );
+ myRemoveBtn = new QPushButton( tr( "REMOVE" ) , aFrame );
+ mySortBtn = new QPushButton( tr( "SORT_LIST" ), aFrame );
+
+ QGridLayout* aLay = new QGridLayout( aFrame, 5, 2, 0, 5 );
+ aLay->addMultiCellWidget( myListBox, 0, 4, 0, 0 );
+ aLay->addWidget( myFilterBtn, 0, 1 );
+ aLay->addWidget( myAddBtn, 1, 1 );
+ aLay->addWidget( myRemoveBtn, 2, 1 );
+ aLay->addWidget( mySortBtn, 3, 1 );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ aLay->addItem( aSpacer, 4, 1 );
+
+ myToAllChk = new QCheckBox( tr( "TO_ALL" ), mySelGrp );
+
+ // "Select from" group
+ QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, tr( "SELECT_FROM" ), aMainGrp );
+
+ mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp );
+ mySubmeshBtn = new QPushButton( aGrp );
+ mySubmesh = new QLineEdit( aGrp );
+ mySubmeshBtn->setPixmap( aPix );
+
+ myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp );
+ myGroupBtn = new QPushButton( aGrp );
+ myGroup = new QLineEdit( aGrp );
+ myGroupBtn->setPixmap( aPix );
+
+ return aMainGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_MultiEditDlg::createButtonFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+
+ aLay->addWidget( myOkBtn );
+ aLay->addWidget( myApplyBtn );
+ aLay->addItem( aSpacer);
+ aLay->addWidget( myCloseBtn );
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::isValid
+// Purpose : Verify validity of input data
+//=======================================================================
+bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) const
+{
+ return (!myMesh->_is_nil() &&
+ (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg()
+{
+ if ( myFilterDlg != 0 )
+ {
+ myFilterDlg->reparent( 0, QPoint() );
+ delete myFilterDlg;
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_MultiEditDlg::Init( SALOME_Selection* theSelection )
+{
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ mySelection = theSelection;
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+ myListBox->clear();
+ myIds.Clear();
+ myBusy = false;
+ myActor = 0;
+ emit ListContensChanged();
+
+ // main buttons
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ // selection and SMESHGUI
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+ // dialog controls
+ connect( myFilterBtn, SIGNAL( clicked() ), SLOT( onFilterBtn() ) );
+ connect( myAddBtn , SIGNAL( clicked() ), SLOT( onAddBtn() ) );
+ connect( myRemoveBtn, SIGNAL( clicked() ), SLOT( onRemoveBtn() ) );
+ connect( mySortBtn , SIGNAL( clicked() ), SLOT( onSortListBtn() ) );
+
+ connect( mySubmeshChk, SIGNAL( stateChanged( int ) ), SLOT( onSubmeshChk() ) );
+ connect( myGroupChk , SIGNAL( stateChanged( int ) ), SLOT( onGroupChk() ) );
+ connect( myToAllChk , SIGNAL( stateChanged( int ) ), SLOT( onToAllChk() ) );
+
+ connect( myListBox, SIGNAL( selectionChanged() ), SLOT( onListSelectionChanged() ) );
+
+ onSelectionDone();
+
+ // set selection mode
+ setSelectionMode();
+ updateButtons();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+// Assign filters VTK viewer and close dialog
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onOk()
+{
+ if ( onApply() )
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::getIds
+// Purpose : Retrive identifiers from list box
+//=======================================================================
+SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
+{
+ SMESH::long_array_var anIds = new SMESH::long_array;
+
+ if ( myToAllChk->isChecked() )
+ {
+ myIds.Clear();
+ if ( myActor != 0 )
+ {
+ TVisualObjPtr aVisualObj = myActor->GetObject();
+ vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
+ if ( aGrid != 0 )
+ {
+ for ( int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++ )
+ {
+ vtkCell* aCell = aGrid->GetCell( i );
+ if ( aCell != 0 )
+ {
+ int nbNodes = aCell->GetNumberOfPoints();
+ if ( nbNodes == 3 && myFilterType == SMESHGUI_TriaFilter ||
+ nbNodes == 4 && myFilterType == SMESHGUI_QuadFilter ||
+ ( nbNodes == 4 || nbNodes == 3 ) && myFilterType == SMESHGUI_UnknownFilter )
+ {
+ int anObjId = aVisualObj->GetElemObjId( i );
+ myIds.Add( anObjId );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ anIds->length( myIds.Extent() );
+ TColStd_MapIteratorOfMapOfInteger anIter( myIds );
+ for ( int i = 0; anIter.More(); anIter.Next() )
+ {
+ anIds[ i++ ] = anIter.Key();
+ }
+ return anIds._retn();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onClose()
+{
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState();
+
+ SMESH::RemoveFilter(SMESHGUI_EdgeFilter);
+ SMESH::RemoveFilter(SMESHGUI_FaceFilter);
+ SMESH::RemoveFilter(SMESHGUI_QuadFilter);
+ SMESH::RemoveFilter(SMESHGUI_TriaFilter);
+ SMESH::SetPickable();
+
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ reject();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onSelectionDone()
+{
+ if ( myBusy || !isEnabled() ) return;
+ myBusy = true;
+
+ int nbSel = mySelection->IObjectCount();
+ myListBox->clearSelection();
+
+ if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() )
+ {
+ QLineEdit* aNameEdit = mySubmeshChk->isChecked() ? mySubmesh : myGroup;
+ int nbSel = mySelection->IObjectCount();
+ if ( nbSel == 1 )
+ {
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ anIO.IsNull() ? aNameEdit->clear() : aNameEdit->setText( anIO->getName() );
+
+ if ( mySubmeshChk->isChecked() )
+ {
+ SMESH::SMESH_subMesh_var aSubMesh =
+ SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIO );
+ if ( !aSubMesh->_is_nil() )
+ myMesh = aSubMesh->GetFather();
+ }
+ else
+ {
+ SMESH::SMESH_Group_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_Group>( anIO );
+ if ( !aGroup->_is_nil() )
+ myMesh = aGroup->GetMesh();
+ }
+ }
+ else if ( nbSel > 1 )
+ {
+ QString aStr = mySubmeshChk->isChecked() ?
+ tr( "SMESH_SUBMESH_SELECTED" ) : tr( "SMESH_GROUP_SELECTED" );
+ aNameEdit->setText( aStr.arg( nbSel ) );
+ }
+ else
+ aNameEdit->clear();
+ }
+ else if ( nbSel == 1 )
+ {
+ QString aListStr = "";
+ int aNbItems = SMESH::GetNameOfSelectedElements(mySelection, aListStr);
+ if ( aNbItems > 0 )
+ {
+ QStringList anElements = QStringList::split(" ", aListStr);
+ QListBoxItem* anItem = 0;
+ for ( QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it)
+ {
+ anItem = myListBox->findItem( *it, Qt::ExactMatch );
+ if (anItem) myListBox->setSelected( anItem, true );
+ }
+ }
+
+ myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+ }
+
+ if ( nbSel == 1 ) {
+ myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
+ //myActor = SMESH::FindActorByObject( myMesh );
+ VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
+ Handle(VTKViewer_Filter) aFilter1 = aStyle->GetFilter( myFilterType );
+ Handle(VTKViewer_Filter) aFilter2 = aStyle->GetFilter( SMESHGUI_FaceFilter );
+ if ( !aFilter1.IsNull() )
+ aFilter1->SetActor( myActor );
+ if ( !aFilter2.IsNull() )
+ aFilter2->SetActor( myActor );
+ if ( myActor )
+ SMESH::SetPickable(myActor);
+ }
+ myBusy = false;
+
+ updateButtons();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onDeactivate()
+{
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_MultiEditDlg::enterEvent( QEvent* )
+{
+ if ( !isEnabled() ) {
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ setEnabled( true );
+ setSelectionMode();
+ }
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_MultiEditDlg::closeEvent( QCloseEvent* e )
+{
+ onClose() ;
+}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_MultiEditDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onFilterBtn
+// Purpose : SLOT. Called when "Filter" button pressed.
+// Start "Selection filters" dialog
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onFilterBtn()
+{
+ if ( myFilterDlg == 0 )
+ {
+ myFilterDlg = new SMESHGUI_FilterDlg( (QWidget*)parent(), SMESH::FACE );
+ connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
+ }
+ else
+ myFilterDlg->Init( SMESH::FACE );
+
+ myFilterDlg->SetSelection( mySelection );
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( myListBox );
+
+ myFilterDlg->show();
+}
+
+//=================================================================================
+// function : onFilterAccepted()
+// purpose : SLOT. Called when Filter dlg closed with OK button.
+// Uncheck "Select submesh" and "Select group" checkboxes
+//=================================================================================
+void SMESHGUI_MultiEditDlg::onFilterAccepted()
+{
+ myIds.Clear();
+ for ( int i = 0, n = myListBox->count(); i < n; i++ )
+ myIds.Add( myListBox->text( i ).toInt() );
+
+ emit ListContensChanged();
+
+ if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() )
+ {
+ mySubmeshChk->blockSignals( true );
+ myGroupChk->blockSignals( true );
+ mySubmeshChk->setChecked( false );
+ myGroupChk->setChecked( false );
+ mySubmeshChk->blockSignals( false );
+ myGroupChk->blockSignals( false );
+ }
+ updateButtons();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onAddBtn
+// Purpose : Verify whether Id of element satisfies to filters from viewer
+//=======================================================================
+bool SMESHGUI_MultiEditDlg::isIdValid( const int theId ) const
+{
+ VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
+ Handle(SMESHGUI_Filter) aFilter1 =
+ Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( myFilterType ) );
+ Handle(SMESHGUI_Filter) aFilter2 =
+ Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( SMESHGUI_FaceFilter ) );
+ return ( aFilter1.IsNull() || aFilter1->IsObjValid( theId ) ) &&
+ ( aFilter2.IsNull() || aFilter2->IsObjValid( theId ) );
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onAddBtn
+// Purpose : SLOT. Called when "Add" button pressed.
+// Add selected in viewer entities in list box
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onAddBtn()
+{
+ int nbSelected = mySelection->IObjectCount();
+ if ( nbSelected == 0 )
+ return;
+
+ TColStd_IndexedMapOfInteger toBeAdded;
+
+ if ( !mySubmeshChk->isChecked() && !myGroupChk->isChecked() )
+ {
+ if ( nbSelected == 1 )
+ SMESH::GetSelected( mySelection, toBeAdded );
+ }
+ else if ( mySubmeshChk->isChecked() )
+ {
+ SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Value() );
+ if ( !aSubMesh->_is_nil() )
+ {
+ if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
+ {
+ SMESH::long_array_var anIds = aSubMesh->GetElementsId();
+ for ( int i = 0, n = anIds->length(); i < n; i++ )
+ {
+ if ( isIdValid( anIds[ i ] ) )
+ toBeAdded.Add( anIds[ i ] );
+ }
+ }
+ }
+ }
+ }
+ else if ( myGroupChk->isChecked() )
+ {
+ SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>( anIter.Value() );
+ if ( !aGroup->_is_nil() && aGroup->GetType() == SMESH::FACE )
+ {
+ if ( aGroup->GetMesh()->GetId() == myMesh->GetId() )
+ {
+ SMESH::long_array_var anIds = aGroup->GetListOfID();
+ for ( int i = 0, n = anIds->length(); i < n; i++ )
+ {
+ if ( isIdValid( anIds[ i ] ) )
+ toBeAdded.Add( anIds[ i ] );
+ }
+ }
+ }
+ }
+ }
+
+ myBusy = true;
+ bool isGroupOrSubmesh = ( mySubmeshChk->isChecked() || myGroupChk->isChecked() );
+ mySubmeshChk->setChecked( false );
+ myGroupChk->setChecked( false );
+ for( int i = 1; i <= toBeAdded.Extent(); i++ )
+ if ( myIds.Add( toBeAdded(i) ) ) {
+ QListBoxItem * item = new QListBoxText( QString( "%1" ).arg( toBeAdded(i) ));
+ myListBox->insertItem( item );
+ myListBox->setSelected( item, true );
+ }
+ myBusy = false;
+
+ emit ListContensChanged();
+
+ if ( isGroupOrSubmesh )
+ onListSelectionChanged();
+
+ updateButtons();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::updateButtons
+// Purpose : Enable/disable buttons of dialog in accordance with current state
+//=======================================================================
+void SMESHGUI_MultiEditDlg::updateButtons()
+{
+ bool isOk = isValid(false);
+ myOkBtn->setEnabled( isOk );
+ myApplyBtn->setEnabled( isOk );
+
+ bool isListBoxNonEmpty = myListBox->count() > 0;
+ bool isToAll = myToAllChk->isChecked();
+ myFilterBtn->setEnabled( !isToAll );
+ myRemoveBtn->setEnabled( isListBoxNonEmpty && !isToAll );
+ mySortBtn->setEnabled( isListBoxNonEmpty &&!isToAll );
+
+ if ( isToAll ||
+ myMesh->_is_nil() ||
+ mySelection->IObjectCount() != 1 ||
+ (SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( mySelection->firstIObject() )->_is_nil() &&
+ SMESH::IObjectToInterface<SMESH::SMESH_Group>( mySelection->firstIObject() )->_is_nil() &&
+ SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( mySelection->firstIObject() )->_is_nil()) )
+ myAddBtn->setEnabled( false );
+ else
+ myAddBtn->setEnabled( true );
+
+ mySubmeshChk->setEnabled( !isToAll );
+ mySubmeshBtn->setEnabled( mySubmeshChk->isChecked() );
+ mySubmesh->setEnabled( mySubmeshChk->isChecked() );
+
+ myGroupChk->setEnabled( !isToAll );
+ myGroupBtn->setEnabled( myGroupChk->isChecked() );
+ myGroup->setEnabled( myGroupChk->isChecked() );
+
+ if ( !mySubmeshChk->isChecked() )
+ mySubmesh->clear();
+ if ( !myGroupChk->isChecked() )
+ myGroup->clear();
+
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onRemoveBtn
+// Purpose : SLOT. Called when "Remove" button pressed.
+// Remove selected in list box entities
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onRemoveBtn()
+{
+ myBusy = true;
+
+ for ( int i = 0, n = myListBox->count(); i < n; i++ )
+ {
+ for ( int i = myListBox->count(); i > 0; i--) {
+ if ( myListBox->isSelected( i - 1 ) )
+ {
+ int anId = myListBox->text( i - 1 ).toInt();
+ myIds.Remove( anId );
+ myIds.Remove( anId );
+ myListBox->removeItem( i-1 );
+ }
+ }
+ }
+ myBusy = false;
+
+ emit ListContensChanged();
+ updateButtons();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onSortListBtn
+// Purpose : SLOT. Called when "Sort list" button pressed.
+// Sort entities of list box
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onSortListBtn()
+{
+ myBusy = true;
+
+ int i, k = myListBox->count();
+ if ( k > 0 )
+ {
+ QStringList aSelected;
+ std::vector<int> anArray( k );
+ QListBoxItem* anItem;
+ for ( anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++)
+ {
+ anArray[ i ] = anItem->text().toInt();
+ if ( anItem->isSelected() )
+ aSelected.append( anItem->text() );
+ }
+
+ std::sort( anArray.begin(), anArray.end() );
+ myListBox->clear();
+ for ( i = 0; i < k; i++ )
+ myListBox->insertItem( QString::number( anArray[ i ] ) );
+
+ for ( QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it )
+ {
+ anItem = myListBox->findItem( *it, Qt::ExactMatch );
+ if ( anItem )
+ myListBox->setSelected( anItem, true );
+ }
+ }
+ myBusy = false;
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onListSelectionChanged
+// Purpose : SLOT. Called when selection in list box changed.
+// Highlight in selected entities
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onListSelectionChanged()
+{
+ if ( myActor == 0 || myBusy )
+ return;
+
+ if ( mySubmeshChk->isChecked() || myGroupChk->isChecked() )
+ return;
+
+ SMESH_Actor * anActor = SMESH::FindActorByObject( myMesh );
+ if ( !anActor )
+ anActor = myActor;
+ TVisualObjPtr anObj = anActor->GetObject();
+
+ TColStd_MapOfInteger anIndexes;
+ for ( QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next() )
+ {
+ if ( anItem->isSelected() )
+ {
+ int anId = anItem->text().toInt();
+ if ( anObj->GetElemVTKId( anId ) >= 0 ) // avoid exception in hilight
+ anIndexes.Add(anId);
+ }
+ }
+
+ mySelection->ClearIObjects();
+ mySelection->AddOrRemoveIndex( anActor->getIO(), anIndexes, false, false );
+ mySelection->AddIObject( anActor->getIO() );
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onSubmeshChk
+// Purpose : SLOT. Called when state of "SubMesh" check box changed.
+// Activate/deactivate selection of submeshes
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onSubmeshChk()
+{
+ bool isChecked = mySubmeshChk->isChecked();
+ mySubmeshBtn->setEnabled( isChecked );
+ mySubmesh->setEnabled( isChecked );
+ if ( !isChecked )
+ mySubmesh->clear();
+ if ( isChecked && myGroupChk->isChecked() )
+ myGroupChk->setChecked( false );
+
+ setSelectionMode();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onGroupChk
+// Purpose : SLOT. Called when state of "Group" check box changed.
+// Activate/deactivate selection of groupes
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onGroupChk()
+{
+ bool isChecked = myGroupChk->isChecked();
+ myGroupBtn->setEnabled( isChecked );
+ myGroup->setEnabled( isChecked );
+ if ( !isChecked )
+ myGroup->clear();
+ if ( isChecked && mySubmeshChk->isChecked() )
+ mySubmeshChk->setChecked( false );
+
+ setSelectionMode();
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onToAllChk
+// Purpose : SLOT. Called when state of "Apply to all" check box changed.
+// Activate/deactivate selection
+//=======================================================================
+void SMESHGUI_MultiEditDlg::onToAllChk()
+{
+ bool isChecked = myToAllChk->isChecked();
+
+ if ( isChecked )
+ myListBox->clear();
+
+ myIds.Clear();
+
+ emit ListContensChanged();
+
+ updateButtons();
+ setSelectionMode();
+
+ if ( myActor )
+ mySelection->AddIObject( myActor->getIO(), true );
+}
+
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::setSelectionMode
+// Purpose : Set selection mode
+//=======================================================================
+void SMESHGUI_MultiEditDlg::setSelectionMode()
+{
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if ( mySubmeshChk->isChecked() )
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( mySubmeshFilter );
+ }
+ else if ( myGroupChk->isChecked() )
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
+ mySelection->AddFilter( myGroupFilter );
+ }
+ else
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+ if ( myFilterType == SMESHGUI_TriaFilter )
+ SMESH::SetFilter( new SMESHGUI_TriangleFilter() );
+ else if ( myFilterType == SMESHGUI_QuadFilter )
+ SMESH::SetFilter( new SMESHGUI_QuadrangleFilter() );
+ }
+}
+
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::onApply
+// Purpose : SLOT. Called when "Apply" button clicked.
+//=======================================================================
+bool SMESHGUI_MultiEditDlg::onApply()
+{
+ if ( SMESHGUI::GetSMESHGUI()->ActiveStudyLocked() )
+ return false;
+ if ( !isValid( true ) )
+ return false;
+
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ if ( aMeshEditor->_is_nil() )
+ return false;
+
+ SMESH::long_array_var anIds = getIds();
+
+ bool aResult = process( aMeshEditor, anIds.inout() );
+ if ( aResult )
+ {
+ if ( myActor )
+ {
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( myActor->getIO(), false );
+ }
+
+ myListBox->clear();
+ myIds.Clear();
+ emit ListContensChanged();
+
+ updateButtons();
+ }
+
+ return aResult;
+}
+
+/*
+ Class : SMESHGUI_ChangeOrientationDlg
+ Description : Modification of orientation of faces
+*/
+
+SMESHGUI_ChangeOrientationDlg::SMESHGUI_ChangeOrientationDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_UnknownFilter, theName )
+{
+ setCaption( tr( "CAPTION" ) );
+}
+
+SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
+{
+}
+
+bool SMESHGUI_ChangeOrientationDlg::process( SMESH::SMESH_MeshEditor_ptr theEditor,
+ const SMESH::long_array& theIds )
+{
+ return theEditor->Reorient( theIds );
+}
+
+/*
+ Class : SMESHGUI_UnionOfTrianglesDlg
+ Description : Construction of quadrangles by automatic association of triangles
+*/
+
+SMESHGUI_UnionOfTrianglesDlg::SMESHGUI_UnionOfTrianglesDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_TriaFilter, theName )
+{
+ setCaption( tr( "CAPTION" ) );
+}
+
+SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
+{
+}
+
+bool SMESHGUI_UnionOfTrianglesDlg::process( SMESH::SMESH_MeshEditor_ptr theEditor,
+ const SMESH::long_array& theIds )
+{
+ return theEditor->TriToQuad(theIds, SMESH::NumericalFunctor::_nil(), 1. );
+}
+
+/*
+ Class : SMESHGUI_CuttingOfQuadsDlg
+ Description : Construction of quadrangles by automatic association of triangles
+*/
+
+SMESHGUI_CuttingOfQuadsDlg::SMESHGUI_CuttingOfQuadsDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: SMESHGUI_MultiEditDlg( theParent, theSelection, SMESHGUI_QuadFilter, theName )
+{
+
+ setCaption( tr( "CAPTION" ) );
+ myPreviewActor = 0;
+
+ myUseDiagChk = new QCheckBox( tr( "USE_DIAGONAL_2_4" ), mySelGrp );
+ myPreviewChk = new QCheckBox( tr( "PREVIEW" ), mySelGrp );
+
+ connect( myPreviewChk, SIGNAL( stateChanged( int ) ), this, SLOT( onPreviewChk() ) );
+ connect( myUseDiagChk, SIGNAL( stateChanged( int ) ), this, SLOT( onPreviewChk() ) );
+ connect( this, SIGNAL( ListContensChanged() ), this, SLOT( onPreviewChk() ) );
+}
+
+SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
+{
+}
+
+void SMESHGUI_CuttingOfQuadsDlg::onClose()
+{
+ erasePreview();
+ SMESHGUI_MultiEditDlg::onClose();
+}
+
+bool SMESHGUI_CuttingOfQuadsDlg::process( SMESH::SMESH_MeshEditor_ptr theEditor,
+ const SMESH::long_array& theIds )
+{
+ return theEditor->SplitQuad( theIds, !myUseDiagChk->isChecked() );
+}
+
+void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
+{
+ myPreviewChk->isChecked() ? displayPreview() : erasePreview();
+}
+
+void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
+{
+ if ( myPreviewActor == 0 )
+ return;
+
+ if ( VTKViewer_ViewFrame* vf = SMESH::GetCurrentVtkView() )
+ {
+ vf->RemoveActor(myPreviewActor);
+ vf->Repaint();
+ }
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+}
+
+void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
+{
+ if ( myActor == 0 )
+ return;
+
+ if ( myPreviewActor != 0 )
+ erasePreview();
+
+ // get Ids of elements
+ SMESH::long_array_var anElemIds = getIds();
+ if ( getIds()->length() == 0 )
+ return;
+
+ SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+ if ( aMesh == 0 )
+ return;
+
+ bool isDiag24 = myUseDiagChk->isChecked();
+
+ //Create grid
+ vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
+
+ vtkIdType aNbCells = anElemIds->length() * 2;
+ vtkIdType aCellsSize = 4 * aNbCells;
+ vtkCellArray* aConnectivity = vtkCellArray::New();
+ aConnectivity->Allocate( aCellsSize, 0 );
+
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints( anElemIds->length() * 4 );
+
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents( 1 );
+ aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds( 3 );
+
+ TColStd_DataMapOfIntegerInteger anIdToVtk;
+
+ int aNodes[ 4 ];
+ int nbPoints = -1;
+ for ( int i = 0, n = anElemIds->length(); i < n; i++ )
+ {
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anElemIds[ i ] );
+ if ( anElem == 0 || anElem->NbNodes() != 4 )
+ continue;
+
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ int k = 0;
+ while( anIter->more() )
+ if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() )
+ {
+ if ( !anIdToVtk.IsBound( aNode->GetID() ) )
+ {
+ aPoints->SetPoint( ++nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
+ anIdToVtk.Bind( aNode->GetID(), nbPoints );
+ }
+
+ aNodes[ k++ ] = aNode->GetID();
+ }
+
+ if ( k != 4 )
+ continue;
+
+ if ( !isDiag24 )
+ {
+ anIdList->SetId( 0, anIdToVtk( aNodes[ 0 ] ) );
+ anIdList->SetId( 1, anIdToVtk( aNodes[ 1 ] ) );
+ anIdList->SetId( 2, anIdToVtk( aNodes[ 2 ] ) );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+
+ anIdList->SetId( 0, anIdToVtk( aNodes[ 2 ] ) );
+ anIdList->SetId( 1, anIdToVtk( aNodes[ 3 ] ) );
+ anIdList->SetId( 2, anIdToVtk( aNodes[ 0 ] ) );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+ }
+ else
+ {
+ anIdList->SetId( 0, anIdToVtk( aNodes[ 1 ] ) );
+ anIdList->SetId( 1, anIdToVtk( aNodes[ 2 ] ) );
+ anIdList->SetId( 2, anIdToVtk( aNodes[ 3 ] ) );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+
+ anIdList->SetId( 0, anIdToVtk( aNodes[ 3 ] ) );
+ anIdList->SetId( 1, anIdToVtk( aNodes[ 0 ] ) );
+ anIdList->SetId( 2, anIdToVtk( aNodes[ 1 ] ) );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_TRIANGLE );
+ }
+ }
+
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ aCellLocationsArray->SetNumberOfComponents( 1 );
+ aCellLocationsArray->SetNumberOfTuples( aNbCells );
+
+ aConnectivity->InitTraversal();
+ for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+ aGrid->SetPoints( aPoints );
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+
+ // Create and display actor
+ vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+ aMapper->SetInput( aGrid );
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->PickableOff();
+ myPreviewActor->SetMapper( aMapper );
+
+ vtkProperty* aProp = vtkProperty::New();
+ aProp->SetRepresentationToWireframe();
+ aProp->SetColor( 250, 0, 250 );
+ aProp->SetLineWidth( myActor->GetLineWidth() + 1 );
+ myPreviewActor->SetProperty( aProp );
+
+ SMESH::GetCurrentVtkView()->AddActor( myPreviewActor );
+ SMESH::GetCurrentVtkView()->Repaint();
+
+ aProp->Delete();
+ aPoints->Delete();
+ aConnectivity->Delete();
+ aGrid->Delete();
+ aMapper->Delete();
+ anIdList->Delete();
+ aCellTypesArray->Delete();
+ aCellLocationsArray->Delete();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_MultiEditDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_MultiEditDlg_H
+#define SMESHGUI_MultiEditDlg_H
+
+#include <qdialog.h>
+#include "SMESH_TypeFilter.hxx"
+#include <TColStd_MapOfInteger.hxx>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+class QCloseEvent;
+class SMESHGUI_FilterDlg;
+class QCheckBox;
+class QGroupBox;
+class QListBox;
+class QFrame;
+class QLineEdit;
+class SMESHGUI_SpinBox;
+class QPushButton;
+class SALOME_Selection;
+class SMESH_Actor;
+class SALOME_Actor;
+
+/*
+ Class : SMESHGUI_MultiEditDlg
+ Description : Base class for dialogs of diagonal inversion and
+ union of two neighboring triangles
+*/
+
+class SMESHGUI_MultiEditDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_MultiEditDlg( QWidget*,
+ SALOME_Selection*,
+ const int,
+ const char* = 0 );
+ virtual ~SMESHGUI_MultiEditDlg();
+
+ void Init( SALOME_Selection* ) ;
+
+signals:
+ void ListContensChanged();
+
+protected slots:
+
+ void onOk();
+ virtual bool onApply();
+ virtual void onClose();
+
+ void onDeactivate();
+ void onSelectionDone();
+
+ void onFilterBtn();
+ void onAddBtn();
+ void onRemoveBtn();
+ void onSortListBtn();
+ void onListSelectionChanged();
+ void onSubmeshChk();
+ void onGroupChk();
+ virtual void onToAllChk();
+ void onFilterAccepted();
+
+protected:
+
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid( const bool ) const;
+ SMESH::long_array_var getIds();
+ void updateButtons();
+ void setSelectionMode();
+ virtual bool isIdValid( const int theID ) const;
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0;
+
+protected:
+
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+ SALOME_Selection* mySelection;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+
+ QGroupBox* mySelGrp;
+
+ QListBox* myListBox;
+ QPushButton* myFilterBtn;
+ QPushButton* myAddBtn;
+ QPushButton* myRemoveBtn;
+ QPushButton* mySortBtn;
+
+ QCheckBox* myToAllChk;
+
+ QCheckBox* mySubmeshChk;
+ QPushButton* mySubmeshBtn;
+ QLineEdit* mySubmesh;
+
+ QCheckBox* myGroupChk;
+ QPushButton* myGroupBtn;
+ QLineEdit* myGroup;
+
+ SMESHGUI_FilterDlg* myFilterDlg;
+ TColStd_MapOfInteger myIds;
+ int myFilterType;
+ Handle(SMESH_TypeFilter) mySubmeshFilter;
+ Handle(SMESH_TypeFilter) myGroupFilter;
+ bool myBusy;
+};
+
+/*
+ Class : SMESHGUI_ChangeOrientationDlg
+ Description : Modification of orientation of faces
+*/
+class SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_ChangeOrientationDlg( QWidget*,
+ SALOME_Selection*,
+ const char* = 0 );
+ virtual ~SMESHGUI_ChangeOrientationDlg();
+
+protected:
+
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+};
+
+/*
+ Class : SMESHGUI_UnionOfTrianglesDlg
+ Description : Construction of quadrangles by automatic association of triangles
+*/
+class SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_UnionOfTrianglesDlg( QWidget*,
+ SALOME_Selection*,
+ const char* = 0 );
+ virtual ~SMESHGUI_UnionOfTrianglesDlg();
+
+protected:
+
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+};
+
+/*
+ Class : SMESHGUI_CuttingOfQuadsDlg
+ Description : Construction of quadrangles by automatic association of triangles
+*/
+class SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_CuttingOfQuadsDlg( QWidget*,
+ SALOME_Selection*,
+ const char* = 0 );
+ virtual ~SMESHGUI_CuttingOfQuadsDlg();
+
+protected:
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+
+protected slots:
+ virtual void onClose();
+ void onPreviewChk();
+
+private:
+ void displayPreview();
+ void erasePreview();
+
+private:
+ QCheckBox* myUseDiagChk;
+ SALOME_Actor* myPreviewActor;
+ QCheckBox* myPreviewChk;
+};
+
+#endif
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_NodesDlg.h"
+
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_MeshUtils.h"
+
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESH_ActorUtils.h"
+
+#include "VTKViewer_ViewFrame.h"
+#include "SALOME_Actor.h"
+
#include "SMESHGUI_SpinBox.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
-#include "utilities.h"
+#include "QAD_WaitCursor.h"
#include "QAD_MessageBox.h"
#include "SMESH_Actor.h"
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshNode.hxx"
// VTK Includes
-#include <vtkPoints.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkDataSetMapper.h>
+#include <vtkCell.h>
#include <vtkIdList.h>
-#include <vtkVertex.h>
+#include <vtkIntArray.h>
+#include <vtkCellArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
// QT Includes
#include <qbuttongroup.h>
#include <qvalidator.h>
#include <qevent.h>
+#include "utilities.h"
+
+using namespace std;
+
+
+namespace SMESH{
+
+ void AddNode(SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z){
+ QAD_WaitCursor wc;
+ try{
+ SALOMEDS::SObject_var aSobj = SMESH::FindSObject(theMesh);
+ CORBA::String_var anEntry = aSobj->GetID();
+ SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
+ aMeshEditor->AddNode(x,y,z);
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ CORBA::Long anId = aStudy->StudyId();
+ if(TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,anEntry.in())){
+ aVisualObj->Update(true);
+ }
+ }catch(SALOME::SALOME_Exception& exc) {
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(const std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
+
+
+ class TNodeSimulation{
+ QAD_Study* myStudy;
+ QAD_StudyFrame* myStudyFrame;
+ VTKViewer_ViewFrame* myViewFrame;
+
+ SALOME_Actor *myPreviewActor;
+ vtkDataSetMapper* myMapper;
+ vtkPoints* myPoints;
+
+ public:
+
+ TNodeSimulation(QAD_Study* theStudy):
+ myStudy(theStudy),
+ myStudyFrame(theStudy->getActiveStudyFrame()),
+ myViewFrame(GetVtkViewFrame(theStudy->getActiveStudyFrame()))
+ {
+ vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
+
+ // Create points
+ myPoints = vtkPoints::New();
+ myPoints->SetNumberOfPoints( 1 );
+ myPoints->SetPoint(0,0.0,0.0,0.0);
+
+ // Create cells
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds( 1 );
+
+ vtkCellArray *aCells = vtkCellArray::New();
+ aCells->Allocate( 2, 0 );
+
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents( 1 );
+ aCellTypesArray->Allocate( 1 );
+
+ anIdList->SetId( 0, 0 );
+ aCells->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_VERTEX );
+
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ aCellLocationsArray->SetNumberOfComponents( 1 );
+ aCellLocationsArray->SetNumberOfTuples( 1 );
+
+ aCells->InitTraversal();
+ vtkIdType npts;
+ aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
+
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
+
+ aGrid->SetPoints( myPoints );
+ aGrid->SetCells( aCellTypesArray, aCellLocationsArray,aCells );
+ aCellLocationsArray->Delete();
+ aCellTypesArray->Delete();
+ aCells->Delete();
+ anIdList->Delete();
+
+ // Create and display actor
+ myMapper = vtkDataSetMapper::New();
+ myMapper->SetInput( aGrid );
+ aGrid->Delete();
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->SetInfinitive(true);
+ myPreviewActor->VisibilityOff();
+ myPreviewActor->PickableOff();
+ myPreviewActor->SetMapper( myMapper );
+
+ vtkProperty* aProp = vtkProperty::New();
+ aProp->SetRepresentationToPoints();
+
+ float anRGB[3];
+ anRGB[0] = GetFloat("SMESH:SettingsNodeColorRed",0)/255.;
+ anRGB[1] = GetFloat("SMESH:SettingsNodeColorGreen",255)/255.;
+ anRGB[2] = GetFloat("SMESH:SettingsNodeColorBlue",0)/255.;
+ aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ float aPointSize = GetFloat("SMESH:SettingsNodesSize",3);
+ aProp->SetPointSize(aPointSize);
+
+ myPreviewActor->SetProperty( aProp );
+ aProp->Delete();
+
+ myViewFrame->AddActor( myPreviewActor );
+
+ }
+
+
+ void SetPosition(float x, float y, float z){
+ myPoints->SetPoint(0,x,y,z);
+ myPoints->Modified();
+ SetVisibility(true);
+ }
+
+
+ void SetVisibility(bool theVisibility){
+ myPreviewActor->SetVisibility(theVisibility);
+ RepaintCurrentView();
+ }
+
+
+ ~TNodeSimulation(){
+ if(FindVtkViewFrame(myStudy,myStudyFrame)){
+ myViewFrame->RemoveActor(myPreviewActor);
+ }
+ myPreviewActor->Delete();
+
+ myMapper->RemoveAllInputs();
+ myMapper->Delete();
+
+ myPoints->Delete();
+ }
+
+ };
+
+}
+
//=================================================================================
// class : SMESHGUI_NodesDlg()
SALOME_Selection* Sel,
bool modal,
WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
{
-
+ mySimulation = new SMESH::TNodeSimulation(SMESH::GetActiveStudy());
+
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_NODE")));
if ( !name )
setName( "SMESHGUI_NodesDlg" );
// purpose : Destructor
//=======================================================================
SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
-{}
+{
+ delete mySimulation;
+}
//=================================================================================
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
- connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
-
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- connect( myMeshGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- /* to close dialog if study change */
- connect( myMeshGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( SpinBox_X, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
+ connect( SpinBox_Y, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
+ connect( SpinBox_Z, SIGNAL ( valueChanged(double) ), SLOT( ValueChangedInSpinBox(double) )) ;
+
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ));
+ connect( myMeshGUI, SIGNAL ( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() )) ;
+ /* to close dialog if study frame change */
+ connect( myMeshGUI, SIGNAL ( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
this->move( x, y ) ;
this->show() ;
+ // set selection mode
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
SelectionIntoArgument();
}
//=================================================================================
void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
{
- double vx = SpinBox_X->GetValue() ;
- double vy = SpinBox_Y->GetValue() ;
- double vz = SpinBox_Z->GetValue() ;
- myMeshGUI->DisplaySimulationNode( myMesh, vx, vy, vz );
- //myMeshGUI->ViewNodes();
+ if(!myMesh->_is_nil()){
+ double vx = SpinBox_X->GetValue() ;
+ double vy = SpinBox_Y->GetValue() ;
+ double vz = SpinBox_Z->GetValue() ;
+ mySimulation->SetPosition(vx,vy,vz);
+ }
return ;
}
//=================================================================================
void SMESHGUI_NodesDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ if ( ClickOnApply() )
+ ClickOnCancel() ;
}
//=======================================================================
// function : ClickOnApply()
// purpose :
//=======================================================================
-void SMESHGUI_NodesDlg::ClickOnApply()
+bool SMESHGUI_NodesDlg::ClickOnApply()
{
- if ( myMeshGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) {
- return;
+ if (myMeshGUI->ActiveStudyLocked())
+ return false;
+
+ if ( myMesh->_is_nil() ) {
+ QAD_MessageBox::warn1(QAD_Application::getDesktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("MESH_IS_NOT_SELECTED"),
+ tr("SMESH_BUT_OK"));
+ return false;
}
-
- if ( Constructor1->isChecked() ) {
- /* Recup args and call method */
- double x = SpinBox_X->GetValue() ;
- double y = SpinBox_Y->GetValue() ;
- double z = SpinBox_Z->GetValue() ;
- myMeshGUI->EraseSimulationActors() ;
- myMeshGUI->AddNode( myMesh, x, y, z ) ;
- myMeshGUI->ViewNodes();
- mySelection->ClearIObjects();
+
+ /* Recup args and call method */
+ double x = SpinBox_X->GetValue() ;
+ double y = SpinBox_Y->GetValue() ;
+ double z = SpinBox_Z->GetValue() ;
+ mySimulation->SetVisibility(false);
+ SMESH::AddNode(myMesh,x,y,z) ;
+ SMESH::SetPointRepresentation(true);
+
+ // select myMesh
+ if ( mySelection->IObjectCount() != 1 ) {
+ if(VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView()) {
+ vtkActorCollection *aCollection = aViewFrame->getRenderer()->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct))
+ if(anActor->hasIO())
+ if(SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get()))
+ if(myMesh->_is_equivalent( aMeshObj->GetMeshServer() ))
+ {
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( anActor->getIO(), false );
+ break;
+ }
+ }
+ }
}
+ return true;
}
//=======================================================================
void SMESHGUI_NodesDlg::ClickOnCancel()
{
+ mySelection->ClearIObjects();
+ mySimulation->SetVisibility(false);
+ SMESH::SetPointRepresentation(false);
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 );
- myMeshGUI->ResetState() ;
- myMeshGUI->EraseSimulationActors() ;
+ myMeshGUI->ResetState();
reject() ;
return ;
}
//=================================================================================
void SMESHGUI_NodesDlg::SelectionIntoArgument()
{
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1) {
- SpinBox_X->SetValue(0.0) ;
- SpinBox_Y->SetValue(0.0) ;
- SpinBox_Z->SetValue(0.0) ;
- return;
- }
-
- Standard_Boolean res;
- myMesh = myMeshGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res) {
- SpinBox_X->SetValue(0.0) ;
- SpinBox_Y->SetValue(0.0) ;
- SpinBox_Z->SetValue(0.0) ;
- return ;
- }
-
- if ( mySelection->SelectionMode() != NodeSelection ) {
- SpinBox_X->SetValue(0.0) ;
- SpinBox_Y->SetValue(0.0) ;
- SpinBox_Z->SetValue(0.0) ;
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
+ if ( !GroupConstructors->isEnabled() )
return;
- }
- QString aString = "";
- int nbNodes = myMeshGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes != 1) {
- SpinBox_X->SetValue(0.0) ;
- SpinBox_Y->SetValue(0.0) ;
- SpinBox_Z->SetValue(0.0) ;
- return ;
- }
-
- if ( nbNodes == 1 ) {
- TColStd_MapOfInteger myMapIndex;
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
- TColStd_MapIteratorOfMapOfInteger ite( myMapIndex );
- int idNodes[1];
- for ( ; ite.More(); ite.Next() ) {
- idNodes[0] = ite.Key();
+ mySimulation->SetVisibility(false);
+ SMESH::SetPointRepresentation(true);
+
+ if(mySelection->IObjectCount() == 1){
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ if(anIO->hasEntry()){
+ myMesh = SMESH::GetMeshByIO(anIO);
+ if(myMesh->_is_nil()) return;
+ QString aText;
+ if(SMESH::GetNameOfSelectedNodes( mySelection, aText ) == 1){
+ if(SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())){
+ if(SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()){
+ if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())){
+ SpinBox_X->SetValue( aNode->X() );
+ SpinBox_Y->SetValue( aNode->Y() ) ;
+ SpinBox_Z->SetValue( aNode->Z() ) ;
+ }
+ }
+ }
+ }
+ mySimulation->SetPosition(SpinBox_X->GetValue(),
+ SpinBox_Y->GetValue(),
+ SpinBox_Z->GetValue());
}
-
- Standard_Boolean result;
- SMESH_Actor* ac = myMeshGUI->FindActor( myMesh, result, true );
- vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->GetUnstructuredGrid() );
- float *p0 = ugrid->GetPoint(idNodes[0]);
-
- SpinBox_X->SetValue( p0[0] ) ;
- SpinBox_Y->SetValue( p0[1] ) ;
- SpinBox_Z->SetValue( p0[2] ) ;
-
- myMeshGUI->DisplaySimulationNode( myMesh, p0[0], p0[1], p0[2] );
- // myMeshGUI->ViewNodes();
- }
-
- return ;
+ }
}
void SMESHGUI_NodesDlg::closeEvent(QCloseEvent* e)
{
this->ClickOnCancel() ; /* same than click on cancel button */
- return ;
}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_NodesDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
//=================================================================================
// function : enterEvent()
//=================================================================================
void SMESHGUI_NodesDlg::enterEvent( QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ if ( !GroupConstructors->isEnabled() )
+ ActivateThisDialog() ;
}
GroupConstructors->setEnabled(false) ;
GroupCoordinates->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
- myMeshGUI->EraseSimulationActors() ;
+ mySimulation->SetVisibility(false) ;
myMeshGUI->ResetState() ;
myMeshGUI->SetActiveDialogBox(0) ;
}
- return ;
}
GroupConstructors->setEnabled(true) ;
GroupCoordinates->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
- return ;
+
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ SelectionIntoArgument();
}
class SMESHGUI;
class SMESHGUI_SpinBox;
+namespace SMESH{
+ struct TNodeSimulation;
+}
+
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
SMESHGUI* myMeshGUI ;
SMESH::SMESH_Mesh_var myMesh;
+ SMESH::TNodeSimulation* mySimulation;
void Init(SALOME_Selection* Sel) ;
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e) ;
+ void hideEvent ( QHideEvent * ); /* ESC key */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
void ClickOnOk();
void ClickOnCancel();
- void ClickOnApply();
+ bool ClickOnApply();
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void SelectionIntoArgument() ;
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_OrientationElementsDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "SMESHGUI_OrientationElementsDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
-
-// QT Includes
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
-
-//=================================================================================
-// class : SMESHGUI_OrientationElementsDlg()
-// purpose :
-//=================================================================================
-SMESHGUI_OrientationElementsDlg::SMESHGUI_OrientationElementsDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
- bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MESH_ORIENTATION")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
-
- if ( !name )
- setName( "SMESHGUI_OrientationElementsDlg" );
- resize( 303, 185 );
- setCaption( tr( "SMESH_ORIENTATION_ELEMENTS_TITLE" ) );
- setSizeGripEnabled( TRUE );
- SMESHGUI_OrientationElementsDlgLayout = new QGridLayout( this );
- SMESHGUI_OrientationElementsDlgLayout->setSpacing( 6 );
- SMESHGUI_OrientationElementsDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
- GroupConstructors->setTitle( tr( "SMESH_ELEMENTS" ) );
- GroupConstructors->setExclusive( TRUE );
- GroupConstructors->setColumnLayout(0, Qt::Vertical );
- GroupConstructors->layout()->setSpacing( 0 );
- GroupConstructors->layout()->setMargin( 0 );
- GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
- GroupConstructorsLayout->setAlignment( Qt::AlignTop );
- GroupConstructorsLayout->setSpacing( 6 );
- GroupConstructorsLayout->setMargin( 11 );
- Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
- Constructor1->setText( tr( "" ) );
- Constructor1->setPixmap( image0 );
- Constructor1->setChecked( TRUE );
- Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
- Constructor1->setMinimumSize( QSize( 50, 0 ) );
- GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupConstructorsLayout->addItem( spacer, 0, 1 );
- SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupConstructors, 0, 0 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer_9, 0, 2 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupButtons, 2, 0 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ORIENTATION" ) );
- GroupC1->setMinimumSize( QSize( 0, 0 ) );
- GroupC1->setFrameShape( QGroupBox::Box );
- GroupC1->setFrameShadow( QGroupBox::Sunken );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
- TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
- TextLabelC1A1->setText( tr( "SMESH_ID_ELEMENTS" ) );
- TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
- TextLabelC1A1->setFrameShape( QLabel::NoFrame );
- TextLabelC1A1->setFrameShadow( QLabel::Plain );
- GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
- SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
- SelectButtonC1A1->setText( tr( "" ) );
- SelectButtonC1A1->setPixmap( image1 );
- SelectButtonC1A1->setToggleButton( FALSE );
- GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
- LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
- GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
- SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupC1, 1, 0 );
-
- Init(Sel) ; /* Initialisations */
-}
-
-//=================================================================================
-// function : ~SMESHGUI_OrientationElementsDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-SMESHGUI_OrientationElementsDlg::~SMESHGUI_OrientationElementsDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::Init( SALOME_Selection* Sel )
-{
-
- GroupC1->show();
- myConstructorId = 0 ;
- Constructor1->setChecked( TRUE );
- myEditCurrentArgument = LineEditC1A1 ;
- mySelection = Sel;
- this->myOkElements = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
- connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
-
- connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- /* to close dialog if study change */
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-
- SelectionIntoArgument();
-
- return ;
-}
-
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::ConstructorsClicked(int constructorId)
-{
- return ;
-}
-
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::ClickOnApply()
-{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkElements) {
- mySMESHGUI->OrientationElements( myMesh, myMapIndex ) ;
- mySelection->ClearIObjects();
- }
- break ;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::ClickOnOk()
-{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::ClickOnCancel()
-{
- QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
- disconnect( mySelection, 0, this, 0 );
- mySMESHGUI->ResetState() ;
- reject() ;
- return ;
-}
-
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::SelectionIntoArgument()
-{
- myEditCurrentArgument->setText("") ;
- myOkElements = false;
- QString aString = "";
-
- int nbSel = mySelection->IObjectCount();
- if(nbSel != 1)
- return;
-
- int nbElements = mySMESHGUI->GetNameOfSelectedElements(mySelection, aString) ;
- if(nbElements < 1)
- return ;
-
- if ( mySelection->SelectionMode() != FaceSelection ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_ELEMENTS"), tr ("SMESH_BUT_OK") );
- return;
- }
-
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
- return ;
-
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
- myOkElements = true ;
- return ;
-}
-
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::SetEditCurrentArgument()
-{
- QPushButton* send = (QPushButton*)sender();
- switch (myConstructorId)
- {
- case 0: /* default constructor */
- {
- if(send == SelectButtonC1A1) {
- LineEditC1A1->setFocus() ;
- myEditCurrentArgument = LineEditC1A1;
- }
- SelectionIntoArgument() ;
- break;
- }
- }
- return ;
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::DeactivateActiveDialog()
-{
- if ( GroupConstructors->isEnabled() ) {
- GroupConstructors->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
- }
- return ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate the active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- GroupConstructors->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
- return ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::enterEvent(QEvent* e)
-{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_OrientationElementsDlg::closeEvent( QCloseEvent* e )
-{
- /* same than click on cancel button */
- this->ClickOnCancel() ;
- return ;
-}
-
-
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_OrientationElementsDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_ORIENTATION_ELEMENTS_H
-#define DIALOGBOX_ORIENTATION_ELEMENTS_H
-
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qvariant.h>
-#include <qdialog.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-//=================================================================================
-// class : SMESHGUI_OrientationElementsDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_OrientationElementsDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_OrientationElementsDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SMESHGUI_OrientationElementsDlg();
-
-private:
-
- void Init( SALOME_Selection* Sel ) ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
-
- SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
- SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkElements ; /* to check when arguments is defined */
- int myConstructorId ; /* Current constructor id = radio button id */
- QLineEdit* myEditCurrentArgument; /* Current LineEdit */
-
- SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
-
- QButtonGroup* GroupConstructors;
- QRadioButton* Constructor1;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QPushButton* buttonApply;
- QGroupBox* GroupC1;
- QLabel* TextLabelC1A1;
- QPushButton* SelectButtonC1A1;
- QLineEdit* LineEditC1A1;
-
-private slots:
-
- void ConstructorsClicked(int constructorId);
- void ClickOnOk();
- void ClickOnCancel();
- void ClickOnApply();
- void SetEditCurrentArgument() ;
- void SelectionIntoArgument() ;
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-
-protected:
- QGridLayout* SMESHGUI_OrientationElementsDlgLayout;
- QGridLayout* GroupConstructorsLayout;
- QGridLayout* GroupButtonsLayout;
- QGridLayout* GroupC1Layout;
-};
-
-#endif // DIALOGBOX_ORIENTATION_ELEMENTS_H
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_SMESHGenUtils.h"
+
+
+namespace SMESH{
+
+ SMESH::SMESH_Pattern_var GetPattern()
+ {
+ return GetSMESHGen()->GetPattern();
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_PatternUtils_HeaderFile
+#define SMESHGUI_PatternUtils_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Pattern)
+
+
+namespace SMESH{
+
+ SMESH::SMESH_Pattern_var GetPattern();
+
+}
+
+
+#endif
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_PatternWidget.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_PatternWidget.h"
+
+//Qt includes
+#include <qpainter.h>
+#include <qpoint.h>
+
+
+//=================================================================================
+// class : SMESHGUI_PatternWidget()
+// purpose :
+//=================================================================================
+SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent, const char* name, WFlags fl )
+ : QFrame( parent, name, WStyle_Customize)
+{
+ myMinU = myMinV = myMaxU = myMaxV = 0;
+ setMinimumHeight(150);
+ repaint();
+}
+
+
+
+//=================================================================================
+// function : ~SMESHGUI_PatternWidget()
+// purpose :
+//=================================================================================
+SMESHGUI_PatternWidget::~SMESHGUI_PatternWidget()
+{
+}
+
+
+//=================================================================================
+// function : SMESHGUI_PatternWidget::SetPoints
+// purpose :
+//=================================================================================
+void SMESHGUI_PatternWidget::SetPoints( PointVector thePoints, QValueVector<int> theKeys, ConnectivityVector theConnections )
+{
+ myPoints = thePoints;
+ myKeys = theKeys;
+ myConnections = theConnections;
+
+ if (!thePoints.size())
+ return;
+
+ myMinU = myMaxU = (thePoints[0]).x;
+ myMinV = myMaxV = (thePoints[0]).y;
+ double x, y;
+
+ for (int i = 1; i < thePoints.size(); i++)
+ {
+ x = (thePoints[i]).x;
+ y = (thePoints[i]).y;
+
+ if ( myMinU > x )
+ myMinU = x;
+ if ( myMaxU < x)
+ myMaxU = x;
+ if ( myMinV > y )
+ myMinV = y;
+ if ( myMaxV < y)
+ myMaxV = y;
+ }
+
+ repaint();
+}
+
+static const int Shift = 4; // shift of the point number from point
+static const int Border = 20;
+
+//=================================================================================
+// function : SMESHGUI_PatternWidget::paintEvent
+// purpose :
+//=================================================================================
+void SMESHGUI_PatternWidget::paintEvent( QPaintEvent * )
+{
+ QPainter paint( this );
+ paint.setBrush (Qt::SolidPattern );
+
+ //Draw points
+ const int aRadius = 3; // radius of a point
+
+ for (int i = 0; i < myKeys.size() && i < myPoints.size(); i++)
+ {
+ SMESH::PointStruct aPoint = myPoints[ myKeys[i] ];
+ QPoint aQPnt = MapCoords( aPoint.x, aPoint.y);
+
+ paint.drawPie( aQPnt.x() - aRadius, aQPnt.y() - aRadius, aRadius*2, aRadius*2, 5760, 5760 );
+ paint.drawText( aQPnt.x() + Shift, aQPnt.y() - Shift, QString::number( i+1 ) );
+ }
+
+ //Draw lines
+ for (int i = 0; i < myConnections.size(); i++)
+ {
+ QValueVector<int> aCVector = myConnections[i];
+
+ if ( aCVector.size() == 0 )
+ continue;
+
+ SMESH::PointStruct aPoint = myPoints[ aCVector[0] ];
+ const QPoint aBeginPnt = MapCoords( aPoint.x, aPoint.y);
+ QPoint aFirstPnt = aBeginPnt, aSecondPnt;
+
+ for (int j = 1; j < aCVector.size(); j++)
+ {
+ aPoint = myPoints[ aCVector[j] ];
+ aSecondPnt = MapCoords( aPoint.x, aPoint.y);
+ paint.drawLine(aFirstPnt, aSecondPnt);
+ aFirstPnt = aSecondPnt;
+ }
+
+ paint.drawLine(aBeginPnt, aSecondPnt);
+ }
+}
+
+
+//=================================================================================
+// function : SMESHGUI_PatternWidget::MapCoords
+// purpose :
+//=================================================================================
+QPoint SMESHGUI_PatternWidget::MapCoords( const double u, const double v )
+{
+ int aWidth = width() - 2*Border;
+ int aHeight = height() - 2*Border;
+
+ double aUBound = myMaxU - myMinU;
+ double aVBound = myMaxV - myMinV;
+
+ double aUScale = aWidth/aUBound;
+ double aVScale = aHeight/aVBound;
+
+ double aScale;
+ aUScale <= aVScale ? aScale = aUScale : aScale = aVScale;
+
+ double aUMiddle = ( myMaxU + myMinU )/2;
+ double aVMiddle = ( myMaxV + myMinV )/2;
+
+ int x = int( aWidth/2 + (u - aUMiddle)*aScale + Border - Shift);
+
+ int y = int( aHeight/2 + (aVMiddle - v)*aScale + Border + Shift);
+
+ QPoint aPoint = QPoint(x, y);
+
+ return aPoint;
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_PatternWidget.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef WIDGET_PATTERN_H
+#define WIDGET_PATTERN_H
+
+#include <qframe.h>
+#include <qvaluevector.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+typedef QValueVector<SMESH::PointStruct> PointVector;
+typedef QValueVector< QValueVector<int> > ConnectivityVector;
+
+class QPoint;
+
+//=================================================================================
+// class : SMESHGUI_PatternWidget
+// purpose :
+//=================================================================================
+class SMESHGUI_PatternWidget : public QFrame
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_PatternWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ ~SMESHGUI_PatternWidget();
+
+ void SetPoints( PointVector thePoints, QValueVector<int> theKeys, ConnectivityVector theConnections );
+
+private :
+ PointVector myPoints;
+ QValueVector<int> myKeys;
+ ConnectivityVector myConnections;
+
+ double myMinU, myMaxU, myMinV, myMaxV;
+
+private slots:
+
+protected:
+ void paintEvent( QPaintEvent * );
+ QPoint MapCoords( const double u, const double v );
+};
+
+#endif // WIDGET_PATTERN_H
+
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_PrecisionDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_PrecisionDlg.h"
+#include "QAD_Config.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_VTKUtils.h"
+
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+
+#define SPACING 5
+#define MARGIN 10
+#define DEFAULT_VAL 10
+#define RANGE 128
+
+/*
+ Class : SMESHGUI_PrecisionDlg
+ Description : Dialog to specify precision of mesh quality controls
+*/
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg( QWidget* theParent )
+: QDialog( theParent, "SMESHGUI_PrecisionDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr( "CAPTION" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
+
+ setMinimumWidth( (int)( QFontMetrics( font() ).width( tr( "CAPTION" ) ) * 1.5 ) );
+
+ Init();
+
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::~SMESHGUI_PrecisionDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_PrecisionDlg::~SMESHGUI_PrecisionDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_PrecisionDlg::createButtonFrame( QWidget* theParent )
+{
+ QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+ aGrp->setFrameStyle( QFrame::NoFrame );
+ aGrp->setInsideMargin( 0 );
+
+ myOKBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aGrp );
+
+ QLabel* aLbl = new QLabel( aGrp );
+ aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ myCancelBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+
+ connect( myOKBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
+
+ return aGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg:: createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_PrecisionDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, theParent );
+ new QLabel( tr( "PRECISION" ), aGrp );
+ mySpinBox = new QSpinBox( 0, RANGE, 1, aGrp );
+ myNotUseChk = new QCheckBox( tr( "NOT_USE" ), aGrp );
+
+ connect( myNotUseChk, SIGNAL( toggled( bool ) ), SLOT( onNotUse() ) );
+
+ return aGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::Init
+// Purpose : Initialize dialog fields
+//=======================================================================
+void SMESHGUI_PrecisionDlg::Init()
+{
+ if ( QAD_CONFIG->hasSetting( "SMESH:ControlsPrecision" ) )
+ {
+ QString aStr = QAD_CONFIG->getSetting( "SMESH:ControlsPrecision" );
+ bool isOk = false;
+ int aVal = aStr.toInt( &isOk );
+ mySpinBox->setValue( isOk ? aVal : DEFAULT_VAL );
+ myNotUseChk->setChecked( !isOk );
+ }
+ else
+ {
+ mySpinBox->setValue( DEFAULT_VAL );
+ myNotUseChk->setChecked( true );
+ }
+
+ onNotUse();
+
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::onOk
+// Purpose : SLOT. Called when OK button pressed
+//=======================================================================
+void SMESHGUI_PrecisionDlg::onOk()
+{
+ if ( myNotUseChk->isChecked() )
+ {
+ QAD_CONFIG->removeSettings( "SMESH:ControlsPrecision" );
+ SMESH::SetControlsPrecision( -1 );
+ }
+ else
+ {
+ mySpinBox->clearFocus();
+ int aVal = mySpinBox->value();
+ QAD_CONFIG->addSetting( "SMESH:ControlsPrecision", QString( "%1" ).arg( aVal ) );
+ SMESH::SetControlsPrecision( aVal );
+ }
+
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState() ;
+ accept();
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::onClose
+// Purpose : SLOT. Called when "Cancel" button pressed
+//=======================================================================
+void SMESHGUI_PrecisionDlg::onClose()
+{
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ reject();
+}
+
+//=================================================================================
+// function : SMESHGUI_PrecisionDlg::closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_PrecisionDlg::closeEvent( QCloseEvent* )
+{
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_PrecisionDlg::onClose
+// Purpose : SLOT. Called when state of "Do not use" check box changed
+//=======================================================================
+void SMESHGUI_PrecisionDlg::onNotUse()
+{
+ mySpinBox->setEnabled( !myNotUseChk->isChecked() );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_PrecisionDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_PrecisionDlg_H
+#define SMESHGUI_PrecisionDlg_H
+
+#include <qdialog.h>
+
+class QSpinBox;
+class QPushButton;
+class QCheckBox;
+class QFrame;
+
+/*
+ Class : SMESHGUI_PrecisionDlg
+ Description : Dialog to specify precision of mesh quality controls
+*/
+
+class SMESHGUI_PrecisionDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_PrecisionDlg( QWidget* parent );
+
+ virtual ~SMESHGUI_PrecisionDlg();
+
+ void Init();
+
+private slots:
+
+ void onOk();
+ void onClose();
+ void onNotUse();
+
+private:
+
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame( QWidget* );
+ void closeEvent( QCloseEvent* );
+
+private:
+
+ QSpinBox* mySpinBox;
+ QPushButton* myOKBtn;
+ QPushButton* myCancelBtn;
+ QCheckBox* myNotUseChk;
+
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_Preferences_ScalarBarDlg.h"
+
#include "SMESHGUI.h"
+#include "SMESHGUI_VTKUtils.h"
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <vtkTextProperty.h>
#include <vtkScalarBarActor.h>
+#include <vtkScalarsToColors.h>
#include "QAD_SpinBoxDbl.h"
#include "QAD_Config.h"
#define DEF_HOR_H 0.12
#define DEF_HOR_W 0.60
+using namespace std;
+
// Only one instance is allowed
SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0;
double aMin = myMinEdit->text().toDouble();
double aMax = myMaxEdit->text().toDouble();
myScalarBarActor->GetLookupTable()->SetRange( aMin, aMax );
- SMESHGUI::GetSMESHGUI()->UpdateView();
+ SMESH::RepaintCurrentView();
}
else {
// Scalar Bar preferences
if ( mySelection->IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
if( anIO->hasEntry() ) {
- Standard_Boolean isOk;
- SMESH_Actor* anActor = SMESHGUI::GetSMESHGUI()->FindActorByEntry( anIO->getEntry(), isOk, true );
- if ( isOk && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry());
+ if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
myActor = anActor;
vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_Preferences_SelectionDlg.h"
#include "SMESHGUI.h"
#include <qpalette.h>
#include <qcolordialog.h>
+using namespace std;
+
//=================================================================================
// class : SMESHGUI_LineEdit
// purpose :
double SMESHGUI_Preferences_SelectionDlg::GetPrecision(int type)
{
if (type > 0 && type <= 2)
- return myPrecision[type-1]->text().toDouble();
+ return myPrecision[type-1]->text().toDouble();
+ return 0;
}
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_RemoveElementsDlg.h"
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_MessageBox.h"
#include <qimage.h>
#include <qpixmap.h>
+using namespace std;
//=================================================================================
// class : SMESHGUI_RemoveElementsDlg()
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+ LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupC1, 1, 0 );
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
+
mySelection = Sel;
- this->myOkElements = false ;
+ myNbOkElements = false ;
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+ myActor = 0;
+ myBusy = false;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( myEditCurrentArgument, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
/* Move widget on the botton right corner of main widget */
int x, y ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
- return ;
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+
+ SelectionIntoArgument();
}
//=================================================================================
void SMESHGUI_RemoveElementsDlg::ClickOnApply()
{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkElements) {
- mySMESHGUI->RemoveElements( myMesh, myMapIndex ) ;
- mySelection->ClearIObjects();
- }
- break ;
- }
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+ if ( myNbOkElements ) {
+ QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+ SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
+ anArrayOfIdeces->length( aListId.count() );
+ for ( int i = 0; i < aListId.count(); i++ )
+ anArrayOfIdeces[i] = aListId[ i ].toInt();
+
+ bool aResult = false;
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout()) ;
}
- return ;
+ catch( ... )
+ {
+ }
+
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ }
+ }
}
//=================================================================================
//=================================================================================
void SMESHGUI_RemoveElementsDlg::ClickOnCancel()
{
+ mySelection->ClearIObjects();
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ;
}
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
+{
+ if ( myBusy ) return;
+ myBusy = true;
+
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+
+ if ( myNbOkElements ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ }
+
+ myBusy = false;
+}
+
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText("") ;
- myOkElements = false;
- QString aString = "";
+ if ( myBusy ) return;
+
+ // clear
+
+ myNbOkElements = false;
+ myActor = 0;
+
+ myBusy = true;
+ myEditCurrentArgument->setText( "" );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected mesh
int nbSel = mySelection->IObjectCount();
if(nbSel != 1)
return;
- int nbElements = mySMESHGUI->GetNameOfSelectedElements(mySelection, aString) ;
- if(nbElements < 1)
- return ;
-
- if ( mySelection->SelectionMode() != CellSelection ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_ELEMENTS"), tr ("SMESH_BUT_OK") );
+ myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+ if ( myMesh->_is_nil() )
return;
- }
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+ if ( !myActor )
+ return;
+
+ // get selected nodes
+
+ QString aString = "";
+ int nbElems = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+ if(nbElems < 1)
return ;
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
- myOkElements = true ;
- return ;
+ // OK
+
+ myNbOkElements = nbElems;
+
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
}
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog() ;
+
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
- return ;
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
}
//=================================================================================
void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent* e)
{
- if ( GroupConstructors->isEnabled() )
- return ;
- ActivateThisDialog() ;
- return ;
+ if ( !GroupConstructors->isEnabled() )
+ ActivateThisDialog() ;
}
return ;
}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+void SMESHGUI_RemoveElementsDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
#include <qvariant.h>
#include <qdialog.h>
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QPushButton;
class QRadioButton;
class SMESHGUI;
+class SMESH_Actor;
// IDL Headers
#include <SALOMEconfig.h>
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkElements ; /* to check when arguments is defined */
+ int myNbOkElements ; /* to check when arguments is defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+ bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
+ SMESH_Actor* myActor;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
+ void onTextChange(const QString&);
protected:
QGridLayout* SMESHGUI_RemoveElementsDlgLayout;
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_RemoveNodesDlg.h"
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_MessageBox.h"
#include <qimage.h>
#include <qpixmap.h>
+using namespace std;
//=================================================================================
// class : SMESHGUI_RemoveNodesDlg()
//=================================================================================
SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose),
+ myBusy( false )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_REM_NODE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
+ LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupC1, 1, 0 );
//=================================================================================
void SMESHGUI_RemoveNodesDlg::Init( SALOME_Selection* Sel )
{
+ myBusy = false;
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
- this->myOkNodes = false ;
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ myNbOkNodes = 0 ;
+ myActor = 0;
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( myEditCurrentArgument, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
/* Move widget on the botton right corner of main widget */
int x, y ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
SelectionIntoArgument();
return ;
}
//=================================================================================
void SMESHGUI_RemoveNodesDlg::ClickOnApply()
{
- switch(myConstructorId)
- {
- case 0 :
- {
- if(myOkNodes) {
- mySMESHGUI->EraseSimulationActors();
- mySMESHGUI->RemoveNodes( myMesh, myMapIndex ) ;
- mySMESHGUI->ViewNodes();
- mySelection->ClearIObjects();
- }
- break ;
- }
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkNodes )
+ {
+ QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
+ SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
+ anArrayOfIdeces->length( aListId.count() );
+ for ( int i = 0; i < aListId.count(); i++ )
+ anArrayOfIdeces[i] = aListId[ i ].toInt();
+
+ bool aResult = false;
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout()) ;
}
- return ;
+ catch( ... )
+ {
+ }
+
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ }
+
+ SMESH::SetPointRepresentation(true);
+ }
}
//=================================================================================
//=================================================================================
void SMESHGUI_RemoveNodesDlg::ClickOnCancel()
{
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ;
- mySMESHGUI->EraseSimulationActors();
reject() ;
return ;
}
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
+{
+ if ( myBusy ) return;
+ myBusy = true;
+
+ myNbOkNodes = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered nodes
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+ myNbOkNodes++;
+ }
+ }
+
+ if ( myNbOkNodes ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ }
+
+ myBusy = false;
+}
//=================================================================================
// function : SelectionIntoArgument()
//=================================================================================
void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
{
- myEditCurrentArgument->setText("") ;
- myOkNodes = false;
- QString aString = "";
+ if ( myBusy ) return;
+
+ // clear
+
+ myNbOkNodes = false;
+ myActor = 0;
+
+ myBusy = true;
+ myEditCurrentArgument->setText( "" );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected mesh
int nbSel = mySelection->IObjectCount();
if(nbSel != 1)
- return ;
+ return;
- int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ;
- if(nbNodes < 1)
- return ;
-
- if ( mySelection->SelectionMode() != NodeSelection ){
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
- tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
+ myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+ if ( myMesh->_is_nil() )
return;
- }
- myEditCurrentArgument->setText(aString) ;
- Standard_Boolean res;
- myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res );
- if (!res)
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+ if ( !myActor )
+ return;
+
+ // get selected nodes
+
+ QString aString = "";
+ int nbNodes = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+ if(nbNodes < 1)
return ;
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
- mySelection->GetIndex( mySelection->firstIObject(), myMapIndex);
+ // OK
- myOkNodes = true ;
- return ;
+ myNbOkNodes = true;
+
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
}
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
- mySMESHGUI->EraseSimulationActors() ;
mySMESHGUI->ResetState() ;
mySMESHGUI->SetActiveDialogBox(0) ;
}
GroupButtons->setEnabled(true) ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
- return ;
+
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ SelectionIntoArgument();
}
}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_RemoveNodesDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
#include <qdialog.h>
// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
class QVBoxLayout;
class QHBoxLayout;
class QPushButton;
class QRadioButton;
class SMESHGUI;
+class SMESH_Actor;
// IDL Headers
#include <SALOMEconfig.h>
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
- bool myOkNodes ; /* to check when arguments is defined */
+ int myNbOkNodes ; /* to check when arguments is defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+ bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
- TColStd_MapOfInteger myMapIndex;
+ SMESH_Actor* myActor;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
+ void onTextChange(const QString&);
protected:
QGridLayout* SMESHGUI_RemoveNodesDlgLayout;
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RenumberingDlg.cxx
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#include "SMESHGUI_RenumberingDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_RenumberingDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ const int unit, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ myUnit = unit;
+
+ if ( !name )
+ setName( "SMESHGUI_RenumberingDlg" );
+ resize( 303, 185 );
+
+
+ QPixmap image0;
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if (unit == 0) {
+ image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_RENUMBERING_NODES")));
+ setCaption( tr( "SMESH_RENUMBERING_NODES_TITLE" ) );
+ }
+ else if (unit == 1) {
+ image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_RENUMBERING_ELEMENTS")));
+ setCaption( tr( "SMESH_RENUMBERING_ELEMENTS_TITLE" ) );
+ }
+
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_RenumberingDlgLayout = new QGridLayout( this );
+ SMESHGUI_RenumberingDlgLayout->setSpacing( 6 );
+ SMESHGUI_RenumberingDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ if (unit == 0)
+ GroupConstructors->setTitle( tr( "SMESH_NODES" ) );
+ else if (unit == 1)
+ GroupConstructors->setTitle( tr( "SMESH_ELEMENTS" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
+ Constructor1->setText( tr( "" ) );
+ Constructor1->setPixmap( image0 );
+ Constructor1->setChecked( TRUE );
+ Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
+ Constructor1->setMinimumSize( QSize( 50, 0 ) );
+ GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupConstructorsLayout->addItem( spacer, 0, 1 );
+ SMESHGUI_RenumberingDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_RenumberingDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupMesh = new QGroupBox( this, "GroupMesh" );
+ GroupMesh->setTitle( tr( "SMESH_RENUMBERING" ) );
+ GroupMesh->setMinimumSize( QSize( 0, 0 ) );
+ GroupMesh->setFrameShape( QGroupBox::Box );
+ GroupMesh->setFrameShadow( QGroupBox::Sunken );
+ GroupMesh->setColumnLayout(0, Qt::Vertical );
+ GroupMesh->layout()->setSpacing( 0 );
+ GroupMesh->layout()->setMargin( 0 );
+ GroupMeshLayout = new QGridLayout( GroupMesh->layout() );
+ GroupMeshLayout->setAlignment( Qt::AlignTop );
+ GroupMeshLayout->setSpacing( 6 );
+ GroupMeshLayout->setMargin( 11 );
+ TextLabelMesh = new QLabel( GroupMesh, "TextLabelMesh" );
+ TextLabelMesh->setText( tr( "SMESH_MESH" ) );
+ TextLabelMesh->setMinimumSize( QSize( 50, 0 ) );
+ TextLabelMesh->setFrameShape( QLabel::NoFrame );
+ TextLabelMesh->setFrameShadow( QLabel::Plain );
+ GroupMeshLayout->addWidget( TextLabelMesh, 0, 0 );
+ SelectButton = new QPushButton( GroupMesh, "SelectButton" );
+ SelectButton->setText( tr( "" ) );
+ SelectButton->setPixmap( image1 );
+ SelectButton->setToggleButton( FALSE );
+ GroupMeshLayout->addWidget( SelectButton, 0, 1 );
+ LineEditMesh = new QLineEdit( GroupMesh, "LineEditMesh" );
+ LineEditMesh->setReadOnly( true );
+ GroupMeshLayout->addWidget( LineEditMesh, 0, 2 );
+ SMESHGUI_RenumberingDlgLayout->addWidget( GroupMesh, 1, 0 );
+
+ Init(Sel) ; /* Initialisations */
+}
+
+//=================================================================================
+// function : ~SMESHGUI_RenumberingDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::Init( SALOME_Selection* Sel )
+{
+
+ GroupMesh->show();
+ myConstructorId = 0 ;
+ Constructor1->setChecked( TRUE );
+ mySelection = Sel;
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
+
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ myMeshFilter = new SMESH_TypeFilter( MESH );
+
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ myEditCurrentArgument = LineEditMesh ;
+ LineEditMesh->setFocus();
+ mySelection->ClearFilters() ;
+ mySelection->AddFilter( myMeshFilter ) ;
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_RenumberingDlg::ConstructorsClicked(int constructorId)
+{
+ return ;
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( !myMesh->_is_nil())
+ {
+ bool aResult = false;
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
+ bool isUnitsLabeled = false;
+
+ if (myUnit == 0 && anActor) {
+ isUnitsLabeled = anActor->GetPointsLabeled();
+ if (isUnitsLabeled) anActor->SetPointsLabeled(false);
+ }
+ else if (myUnit == 1 && anActor) {
+ isUnitsLabeled = anActor->GetCellsLabeled();
+ if (isUnitsLabeled) anActor->SetCellsLabeled(false);
+ }
+
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ if (myUnit == 0) {
+ aMeshEditor->RenumberNodes();
+ if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true);
+ }
+ else if (myUnit == 1) {
+ aMeshEditor->RenumberElements();
+ if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true);
+ }
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::ClickOnOk()
+{
+ ClickOnApply() ;
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::ClickOnCancel()
+{
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_RenumberingDlg::SelectionIntoArgument()
+{
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ QString aString = "";
+
+ int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
+
+ if ( myEditCurrentArgument == LineEditMesh ) {
+ // mesh
+ if ( nbSel != 1 ) {
+ myMesh = SMESH::SMESH_Mesh::_nil();
+ aString = "";
+ }
+ else {
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ if( myMesh->_is_nil() )
+ aString = "";
+ }
+ }
+
+ myEditCurrentArgument->setText(aString) ;
+
+ bool isEnabled = (!myMesh->_is_nil());
+ buttonOk->setEnabled( isEnabled );
+ buttonApply->setEnabled( isEnabled );
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+ switch (myConstructorId)
+ {
+ case 0: /* default constructor */
+ {
+ if(send == SelectButton) {
+ LineEditMesh->setFocus() ;
+ myEditCurrentArgument = LineEditMesh;
+ }
+ SelectionIntoArgument() ;
+ break;
+ }
+ }
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupMesh->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupMesh->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RenumberingDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_RenumberingDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RenumberingDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_RENUMBERING_H
+#define DIALOGBOX_RENUMBERING_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+
+// Open CASCADE Includes
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class SMESHGUI;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+//=================================================================================
+// class : SMESHGUI_RenumberingDlg
+// purpose : If the unit == 0 nodes will be renumbered, if the unit == 1 the elements will.
+//=================================================================================
+class SMESHGUI_RenumberingDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_RenumberingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, const int unit = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_RenumberingDlg();
+
+private:
+
+ void Init( SALOME_Selection* Sel ) ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myConstructorId ; /* Current constructor id = radio button id */
+ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+
+ int myUnit;
+ SMESH::SMESH_Mesh_var myMesh;
+ Handle(SMESH_TypeFilter) myMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* Constructor1;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupMesh;
+ QLabel* TextLabelMesh;
+ QPushButton* SelectButton;
+ QLineEdit* LineEditMesh;
+
+private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+
+protected:
+ QGridLayout* SMESHGUI_RenumberingDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupMeshLayout;
+};
+
+#endif // DIALOGBOX_RENUMBERING_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RevolutionDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_RevolutionDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qvalidator.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_RevolutionDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_RevolutionDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "REVOLUTION_AROUND_AXIS" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_RevolutionDlgLayout = new QGridLayout( this );
+ SMESHGUI_RevolutionDlgLayout->setSpacing( 6 );
+ SMESHGUI_RevolutionDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setTitle( tr( "SMESH_REVOLUTION" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
+ RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+ RadioButton2->setText( tr( "" ) );
+ RadioButton2->setPixmap( image1 );
+ GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
+ SMESHGUI_RevolutionDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_RevolutionDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "REVOLUTION_1D" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image2 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+
+ // Controls for axis defining
+ GroupAxis = new QGroupBox( GroupArguments, "GroupAxis" );
+ GroupAxis->setTitle( tr( "SMESH_AXIS" ) );
+ GroupAxis->setColumnLayout(0, Qt::Vertical );
+ GroupAxis->layout()->setSpacing( 0 );
+ GroupAxis->layout()->setMargin( 0 );
+ QGridLayout* GroupAxisLayout = new QGridLayout( GroupAxis->layout() );
+ GroupAxisLayout->setAlignment( Qt::AlignTop );
+ GroupAxisLayout->setSpacing( 6 );
+ GroupAxisLayout->setMargin( 11 );
+
+ TextLabelPoint = new QLabel( GroupAxis, "TextLabelPoint" );
+ TextLabelPoint->setText( tr( "SMESH_POINT" ) );
+ GroupAxisLayout->addWidget( TextLabelPoint, 0, 0 );
+
+ SelectPointButton = new QPushButton( GroupAxis, "SelectPointButton" );
+ SelectPointButton->setPixmap( image2 );
+ GroupAxisLayout->addWidget( SelectPointButton, 0, 1 );
+
+ TextLabelX = new QLabel( GroupAxis, "TextLabelX" );
+ TextLabelX->setText( tr( "SMESH_X" ) );
+ GroupAxisLayout->addWidget( TextLabelX, 0, 2 );
+
+ SpinBox_X = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_X");
+ GroupAxisLayout->addWidget( SpinBox_X, 0, 3 );
+
+ TextLabelY = new QLabel( GroupAxis, "TextLabelY" );
+ TextLabelY->setText( tr( "SMESH_Y" ) );
+ GroupAxisLayout->addWidget( TextLabelY, 0, 4 );
+
+ SpinBox_Y = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Y");
+ GroupAxisLayout->addWidget( SpinBox_Y, 0, 5 );
+
+ TextLabelZ = new QLabel( GroupAxis, "TextLabelZ" );
+ TextLabelZ->setText( tr( "SMESH_Z" ) );
+ GroupAxisLayout->addWidget( TextLabelZ, 0, 6 );
+
+ SpinBox_Z = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Z");
+ GroupAxisLayout->addWidget( SpinBox_Z, 0, 7 );
+
+ TextLabelVector = new QLabel( GroupAxis, "TextLabelVector" );
+ TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
+ GroupAxisLayout->addWidget( TextLabelVector, 1, 0 );
+
+ SelectVectorButton = new QPushButton( GroupAxis, "SelectVectorButton" );
+ SelectVectorButton->setPixmap( image2 );
+ GroupAxisLayout->addWidget( SelectVectorButton, 1, 1 );
+
+ TextLabelDX = new QLabel( GroupAxis, "TextLabelDX" );
+ TextLabelDX->setText( tr( "SMESH_DX" ) );
+ GroupAxisLayout->addWidget( TextLabelDX, 1, 2 );
+
+ SpinBox_DX = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DX");
+ GroupAxisLayout->addWidget( SpinBox_DX, 1, 3 );
+
+ TextLabelDY = new QLabel( GroupAxis, "TextLabelDY" );
+ TextLabelDY->setText( tr( "SMESH_DY" ) );
+ GroupAxisLayout->addWidget( TextLabelDY, 1, 4 );
+
+ SpinBox_DY = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DY");
+ GroupAxisLayout->addWidget( SpinBox_DY, 1, 5 );
+
+ TextLabelDZ = new QLabel( GroupAxis, "TextLabelDZ" );
+ TextLabelDZ->setText( tr( "SMESH_DZ" ) );
+ GroupAxisLayout->addWidget( TextLabelDZ, 1, 6 );
+
+ SpinBox_DZ = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DZ");
+ GroupAxisLayout->addWidget( SpinBox_DZ, 1, 7 );
+
+ GroupArgumentsLayout->addMultiCellWidget( GroupAxis, 1, 1, 0, 3 );
+
+ // Controls for angle defining
+ TextLabelAngle = new QLabel( GroupArguments, "TextLabelAngle" );
+ TextLabelAngle->setText( tr( "SMESH_ANGLE" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelAngle, 2, 2, 0, 1 );
+
+ SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
+ GroupArgumentsLayout->addWidget( SpinBox_Angle, 2, 2 );
+
+ // Controls for nb. steps defining
+ TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
+ TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 3, 3, 0, 1 );
+
+ SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
+ GroupArgumentsLayout->addWidget( SpinBox_NbSteps, 3, 2 );
+
+ // Controls for tolerance defining
+ TextLabelTolerance = new QLabel( GroupArguments, "TextLabelTolerance" );
+ TextLabelTolerance->setText( tr( "SMESH_TOLERANCE" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelTolerance, 4, 4, 0, 1 );
+
+ SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
+ GroupArgumentsLayout->addWidget( SpinBox_Tolerance, 4, 2 );
+
+ SMESHGUI_RevolutionDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+
+ SpinBox_Angle->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
+
+ QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
+ SpinBox_NbSteps->setValidator(anIntValidator);
+ SpinBox_NbSteps->setRange( 1, 999999 );
+
+ SpinBox_Tolerance->RangeStepAndValidator( 0.0, +999999.999, 0.1, 6 );
+
+ GroupArguments->show();
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectPointButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectVectorButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+ connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_RevolutionDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::Init()
+{
+ myBusy = false;
+
+ SpinBox_X->SetValue(0.0);
+ SpinBox_Y->SetValue(0.0);
+ SpinBox_Z->SetValue(0.0);
+ SpinBox_DX->SetValue(0.0);
+ SpinBox_DY->SetValue(0.0);
+ SpinBox_DZ->SetValue(0.0);
+
+ SpinBox_Angle->SetValue(45);
+ SpinBox_NbSteps->setValue(1);
+ SpinBox_Tolerance->SetValue(1e-05);
+
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ LineEditElements->setFocus();
+ myNbOkElements = 0 ;
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ConstructorsClicked(int constructorId)
+{
+ disconnect(mySelection, 0, this, 0);
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+ myNbOkElements = 0 ;
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ LineEditElements->setText("");
+ LineEditElements->setFocus();
+
+ switch(constructorId)
+ {
+ case 0 :
+ {
+ GroupArguments->setTitle( tr( "REVOLUTION_1D" ) );
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+ break;
+ }
+ case 1 :
+ {
+ GroupArguments->setTitle( tr( "REVOLUTION_2D" ) );
+ QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+ break;
+ }
+ }
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements && IsAxisOk())
+ {
+ QStringList aListElementsId = QStringList::split( " ", LineEditElements->text(), false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::AxisStruct anAxis;
+
+ anAxis.x = SpinBox_X->GetValue();
+ anAxis.y = SpinBox_Y->GetValue();
+ anAxis.z = SpinBox_Z->GetValue();;
+ anAxis.vx = SpinBox_DX->GetValue();
+ anAxis.vy = SpinBox_DY->GetValue();
+ anAxis.vz = SpinBox_DZ->GetValue();
+
+ double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+ long aNbSteps = (long)SpinBox_NbSteps->value();
+ double aTolerance = SpinBox_Tolerance->GetValue();
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ Init();
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ClickOnOk()
+{
+ this->ClickOnApply() ;
+ this->ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_RevolutionDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ }
+ }
+
+ if ( myNbOkElements && IsAxisOk() ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+
+ myActor = 0;
+ QString aString = "";
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ LineEditElements->setText( aString );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ // get selected mesh
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ if (myMesh->_is_nil() || !myActor)
+ return;
+
+ int aNbUnits = 0;
+
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected elements
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString);
+ if(aNbUnits < 1)
+ return ;
+ LineEditElements->setText( aString );
+ }
+ else
+ {
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
+ if(aNbUnits != 1)
+ return;
+
+ SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+ if (!aMesh)
+ return;
+
+ const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
+ if ( !n )
+ return;
+
+ double x = n->X();
+ double y = n->Y();
+ double z = n->Z();
+
+ if (myEditCurrentArgument == (QWidget*)SpinBox_X)
+ {
+ SpinBox_X->SetValue(x);
+ SpinBox_Y->SetValue(y);
+ SpinBox_Z->SetValue(z);
+ }
+ else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
+ {
+ SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+ SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+ SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
+ }
+ }
+
+ // OK
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ myNbOkElements = true;
+
+ if(myNbOkElements && IsAxisOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ SMESH::SetPointRepresentation(false);
+ int aConstructorId = GetConstructorId();
+ if (aConstructorId == 0)
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
+ else if (aConstructorId == 1)
+ QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
+ }
+ else if (send == SelectPointButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_X;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ else if (send == SelectVectorButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_DX;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+ return ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ ConstructorsClicked(GetConstructorId());
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+ return ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+ return ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_RevolutionDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+int SMESHGUI_RevolutionDlg::GetConstructorId()
+{
+ if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+ return GroupConstructors->id( GroupConstructors->selected() );
+ return -1;
+}
+
+
+//=================================================================================
+// function : IsAxisOk()
+// purpose :
+//=================================================================================
+bool SMESHGUI_RevolutionDlg::IsAxisOk()
+{
+ return (SpinBox_DX->GetValue() != 0 ||
+ SpinBox_DY->GetValue() != 0 ||
+ SpinBox_DZ->GetValue() != 0);
+}
+
+
+//=================================================================================
+// function : onVectorChanged()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onVectorChanged()
+{
+ if (IsAxisOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ else
+ {
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+}
+
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RevolutionDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_REVOLUTION_H
+#define DIALOGBOX_REVOLUTION_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QSpinBox;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+class SMESHGUI_SpinBox;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_RevolutionDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_RevolutionDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_RevolutionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_RevolutionDlg();
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ int GetConstructorId();
+ bool IsAxisOk();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myNbOkElements ; /* to check when elements are defined */
+ QWidget* myEditCurrentArgument; /* Current argument */
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QRadioButton* RadioButton2;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QGroupBox* GroupAxis;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+
+ QLabel* TextLabelPoint;
+ QPushButton* SelectPointButton;
+ QLabel* TextLabelX;
+ SMESHGUI_SpinBox* SpinBox_X;
+ QLabel* TextLabelY;
+ SMESHGUI_SpinBox* SpinBox_Y;
+ QLabel* TextLabelZ;
+ SMESHGUI_SpinBox* SpinBox_Z;
+ QLabel* TextLabelVector;
+ QPushButton* SelectVectorButton;
+ QLabel* TextLabelDX;
+ SMESHGUI_SpinBox* SpinBox_DX;
+ QLabel* TextLabelDY;
+ SMESHGUI_SpinBox* SpinBox_DY;
+ QLabel* TextLabelDZ;
+ SMESHGUI_SpinBox* SpinBox_DZ;
+
+ QLabel* TextLabelAngle;
+ SMESHGUI_SpinBox* SpinBox_Angle;
+ QLabel* TextLabelNbSteps;
+ QSpinBox* SpinBox_NbSteps;
+ QLabel* TextLabelTolerance;
+ SMESHGUI_SpinBox* SpinBox_Tolerance;
+
+ private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+ void onVectorChanged();
+
+protected:
+ QGridLayout* SMESHGUI_RevolutionDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_REVOLUTION_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RotationDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_RotationDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_RotationDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ROTATION")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_RotationDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_ROTATION_TITLE" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_RotationDlgLayout = new QGridLayout( this );
+ SMESHGUI_RotationDlgLayout->setSpacing( 6 );
+ SMESHGUI_RotationDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+ GroupConstructors->setTitle( tr( "SMESH_ROTATION" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ RadioButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, RadioButton1->sizePolicy().hasHeightForWidth() ) );
+ RadioButton1->setMinimumSize( QSize( 50, 0 ) );
+ GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupConstructorsLayout->addItem( spacer, 0, 1 );
+ SMESHGUI_RotationDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_RotationDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ TextLabelElements->setFixedWidth(74);
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image1 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+
+ // Control for the whole mesh selection
+ CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
+ CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
+
+ // Controls for axis defining
+ GroupAxis = new QGroupBox( GroupArguments, "GroupAxis" );
+ GroupAxis->setTitle( tr( "SMESH_AXIS" ) );
+ GroupAxis->setColumnLayout(0, Qt::Vertical );
+ GroupAxis->layout()->setSpacing( 0 );
+ GroupAxis->layout()->setMargin( 0 );
+ QGridLayout* GroupAxisLayout = new QGridLayout( GroupAxis->layout() );
+ GroupAxisLayout->setAlignment( Qt::AlignTop );
+ GroupAxisLayout->setSpacing( 6 );
+ GroupAxisLayout->setMargin( 11 );
+
+ TextLabelPoint = new QLabel( GroupAxis, "TextLabelPoint" );
+ TextLabelPoint->setText( tr( "SMESH_POINT" ) );
+ GroupAxisLayout->addWidget( TextLabelPoint, 0, 0 );
+
+ SelectPointButton = new QPushButton( GroupAxis, "SelectPointButton" );
+ SelectPointButton->setPixmap( image1 );
+ GroupAxisLayout->addWidget( SelectPointButton, 0, 1 );
+
+ TextLabelX = new QLabel( GroupAxis, "TextLabelX" );
+ TextLabelX->setText( tr( "SMESH_X" ) );
+ GroupAxisLayout->addWidget( TextLabelX, 0, 2 );
+
+ SpinBox_X = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_X");
+ GroupAxisLayout->addWidget( SpinBox_X, 0, 3 );
+
+ TextLabelY = new QLabel( GroupAxis, "TextLabelY" );
+ TextLabelY->setText( tr( "SMESH_Y" ) );
+ GroupAxisLayout->addWidget( TextLabelY, 0, 4 );
+
+ SpinBox_Y = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Y");
+ GroupAxisLayout->addWidget( SpinBox_Y, 0, 5 );
+
+ TextLabelZ = new QLabel( GroupAxis, "TextLabelZ" );
+ TextLabelZ->setText( tr( "SMESH_Z" ) );
+ GroupAxisLayout->addWidget( TextLabelZ, 0, 6 );
+
+ SpinBox_Z = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_Z");
+ GroupAxisLayout->addWidget( SpinBox_Z, 0, 7 );
+
+ TextLabelVector = new QLabel( GroupAxis, "TextLabelVector" );
+ TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
+ GroupAxisLayout->addWidget( TextLabelVector, 1, 0 );
+
+ SelectVectorButton = new QPushButton( GroupAxis, "SelectVectorButton" );
+ SelectVectorButton->setPixmap( image1 );
+ GroupAxisLayout->addWidget( SelectVectorButton, 1, 1 );
+
+ TextLabelDX = new QLabel( GroupAxis, "TextLabelDX" );
+ TextLabelDX->setText( tr( "SMESH_DX" ) );
+ GroupAxisLayout->addWidget( TextLabelDX, 1, 2 );
+
+ SpinBox_DX = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DX");
+ GroupAxisLayout->addWidget( SpinBox_DX, 1, 3 );
+
+ TextLabelDY = new QLabel( GroupAxis, "TextLabelDY" );
+ TextLabelDY->setText( tr( "SMESH_DY" ) );
+ GroupAxisLayout->addWidget( TextLabelDY, 1, 4 );
+
+ SpinBox_DY = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DY");
+ GroupAxisLayout->addWidget( SpinBox_DY, 1, 5 );
+
+ TextLabelDZ = new QLabel( GroupAxis, "TextLabelDZ" );
+ TextLabelDZ->setText( tr( "SMESH_DZ" ) );
+ GroupAxisLayout->addWidget( TextLabelDZ, 1, 6 );
+
+ SpinBox_DZ = new SMESHGUI_SpinBox( GroupAxis, "SpinBox_DZ");
+ GroupAxisLayout->addWidget( SpinBox_DZ, 1, 7 );
+
+ GroupArgumentsLayout->addMultiCellWidget( GroupAxis, 2, 2, 0, 2 );
+
+ // Controls for angle defining
+ TextLabelAngle = new QLabel( GroupArguments, "TextLabelAngle" );
+ TextLabelAngle->setText( tr( "SMESH_ANGLE" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelAngle, 3, 3, 0, 1 );
+
+ SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
+ GroupArgumentsLayout->addWidget( SpinBox_Angle, 3, 2 );
+
+ // Controls for "Create a copy" option
+ CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
+ CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 4, 4, 0, 2 );
+
+
+ SMESHGUI_RotationDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+
+ SpinBox_Angle->RangeStepAndValidator( -999999.999, +999999.999, 5.0, 3 );
+
+ GroupArguments->show();
+ myConstructorId = 0 ;
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectPointButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectVectorButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+ connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+ connect( CheckBoxMesh, SIGNAL( toggled( bool )),
+ SLOT( onSelectMesh( bool )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+ resize(0,0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_RotationDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::Init( bool ResetControls )
+{
+ myBusy = false;
+
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ LineEditElements->setFocus();
+ myElementsId = "";
+ myNbOkElements = 0 ;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ if( ResetControls )
+ {
+ SpinBox_X->SetValue(0.0);
+ SpinBox_Y->SetValue(0.0);
+ SpinBox_Z->SetValue(0.0);
+ SpinBox_DX->SetValue(0.0);
+ SpinBox_DY->SetValue(0.0);
+ SpinBox_DZ->SetValue(0.0);
+
+ SpinBox_Angle->SetValue(45);
+
+ CheckBoxCopy->setChecked(false);
+ CheckBoxMesh->setChecked(false);
+ }
+
+ onSelectMesh(CheckBoxMesh->isChecked());
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_RotationDlg::ConstructorsClicked(int constructorId)
+{
+ return ;
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements && IsAxisOk())
+ {
+ QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::AxisStruct anAxis;
+
+ anAxis.x = SpinBox_X->GetValue();
+ anAxis.y = SpinBox_Y->GetValue();
+ anAxis.z = SpinBox_Z->GetValue();;
+ anAxis.vx = SpinBox_DX->GetValue();
+ anAxis.vy = SpinBox_DY->GetValue();
+ anAxis.vz = SpinBox_DZ->GetValue();
+
+ double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+ bool toCreateCopy = CheckBoxCopy->isChecked();
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ Init( false );
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::ClickOnOk()
+{
+ ClickOnApply();
+ ClickOnCancel();
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_RotationDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ myElementsId = theNewText;
+ }
+ }
+
+ if ( myNbOkElements && IsAxisOk()) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_RotationDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+
+ myActor = 0;
+ QString aString = "";
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ LineEditElements->setText( aString );
+ myNbOkElements = 0;
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ // get selected mesh
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ int aNbUnits = 0;
+
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ myElementsId = "";
+
+ // get selected elements
+ if (CheckBoxMesh->isChecked())
+ {
+ SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(!myMesh->_is_nil())
+ {
+ if (!myActor)
+ return;
+
+ // get IDs from mesh
+ SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+ if (!aSMDSMesh)
+ return;
+ for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
+ {
+ const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
+ if ( e ) {
+ myElementsId += QString(" %1").arg(i);
+ aNbUnits++;
+ }
+ }
+ }
+ else
+ {
+ // get IDs from submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(aSubMesh->_is_nil())
+ return;
+
+ myMesh = aSubMesh->GetFather();
+ if(myMesh->_is_nil())
+ return;
+
+ myActor = SMESH::FindActorByObject(myMesh);
+ if (!myActor)
+ return;
+
+ SMESH::long_array_var anElementsIds = new SMESH::long_array;
+ anElementsIds = aSubMesh->GetElementsId();
+ for ( int i = 0; i < anElementsIds->length(); i++ )
+ myElementsId += QString(" %1").arg(anElementsIds[i]);
+ aNbUnits = anElementsIds->length();
+ }
+ }
+ else
+ {
+ if(myMesh->_is_nil())
+ {
+ // get submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(!aSubMesh->_is_nil())
+ myMesh = aSubMesh->GetFather(); // get mesh from submesh
+ else
+ {
+ // get group
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
+ if ( !aGroup->_is_nil() )
+ myMesh = aGroup->GetMesh(); // get mesh from group
+ }
+
+ if(myMesh->_is_nil())
+ return;
+
+ // get mesh actor
+ myActor = SMESH::FindActorByObject(myMesh);
+ }
+
+ if (!myActor)
+ return;
+
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+ myElementsId = aString;
+ }
+
+ if(aNbUnits < 1)
+ return ;
+
+ myNbOkElements = true;
+ }
+ else
+ {
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
+ if(aNbUnits != 1)
+ return;
+
+ SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+ if (!aMesh)
+ return;
+
+ const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
+ if ( !n )
+ return;
+
+ double x = n->X();
+ double y = n->Y();
+ double z = n->Z();
+
+ if (myEditCurrentArgument == (QWidget*)SpinBox_X)
+ {
+ SpinBox_X->SetValue(x);
+ SpinBox_Y->SetValue(y);
+ SpinBox_Z->SetValue(z);
+ }
+ else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
+ {
+ SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+ SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+ SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
+ }
+ }
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ LineEditElements->setText( aString );
+ myBusy = false;
+
+ // OK
+
+ if(myNbOkElements && IsAxisOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ switch (myConstructorId)
+ {
+ case 0: /* default constructor */
+ {
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ SMESH::SetPointRepresentation(false);
+ if (CheckBoxMesh->isChecked())
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+ }
+ else
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+ else if (send == SelectPointButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_X;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ else if (send == SelectVectorButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_DX;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ break;
+ }
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_RotationDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=======================================================================
+//function : onSelectMesh
+//purpose :
+//=======================================================================
+void SMESHGUI_RotationDlg::onSelectMesh ( bool toSelectMesh )
+{
+ if (toSelectMesh)
+ TextLabelElements->setText( tr( "SMESH_NAME" ) );
+ else
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+
+ if (myEditCurrentArgument != LineEditElements)
+ {
+ LineEditElements->clear();
+ return;
+ }
+
+ mySelection->ClearFilters() ;
+ SMESH::SetPointRepresentation(false);
+
+ if (toSelectMesh)
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter);
+ LineEditElements->setReadOnly(true);
+ }
+ else
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ LineEditElements->setReadOnly(false);
+ onTextChange(LineEditElements->text());
+ }
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : IsAxisOk()
+// purpose :
+//=================================================================================
+bool SMESHGUI_RotationDlg::IsAxisOk()
+{
+ return (SpinBox_DX->GetValue() != 0 ||
+ SpinBox_DY->GetValue() != 0 ||
+ SpinBox_DZ->GetValue() != 0);
+}
+
+
+//=================================================================================
+// function : onVectorChanged()
+// purpose :
+//=================================================================================
+void SMESHGUI_RotationDlg::onVectorChanged()
+{
+ if (IsAxisOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ else
+ {
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_RotationDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_ROTATION_H
+#define DIALOGBOX_ROTATION_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+class SMESHGUI_SpinBox;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_RotationDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_RotationDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_RotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_RotationDlg();
+
+private:
+
+ void Init( bool ResetControls = true ) ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ bool IsAxisOk();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myNbOkElements ; /* to check when elements are defined */
+ QString myElementsId;
+
+ QWidget* myEditCurrentArgument; /* Current LineEdit */
+ int myConstructorId;
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QGroupBox* GroupAxis;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+ QCheckBox* CheckBoxMesh;
+
+ QLabel* TextLabelPoint;
+ QPushButton* SelectPointButton;
+ QLabel* TextLabelX;
+ SMESHGUI_SpinBox* SpinBox_X;
+ QLabel* TextLabelY;
+ SMESHGUI_SpinBox* SpinBox_Y;
+ QLabel* TextLabelZ;
+ SMESHGUI_SpinBox* SpinBox_Z;
+ QLabel* TextLabelVector;
+ QPushButton* SelectVectorButton;
+ QLabel* TextLabelDX;
+ SMESHGUI_SpinBox* SpinBox_DX;
+ QLabel* TextLabelDY;
+ SMESHGUI_SpinBox* SpinBox_DY;
+ QLabel* TextLabelDZ;
+ SMESHGUI_SpinBox* SpinBox_DZ;
+
+ QLabel* TextLabelAngle;
+ SMESHGUI_SpinBox* SpinBox_Angle;
+ QCheckBox* CheckBoxCopy;
+
+ private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+ void onSelectMesh(bool toSelectMesh);
+ void onVectorChanged();
+
+protected:
+ QGridLayout* SMESHGUI_RotationDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_ROTATION_H
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "QAD_Desktop.h"
+
+#include "SMESHGUI_SMESHGenUtils.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+namespace SMESH
+{
+
+ SMESH::SMESH_Gen_var GetSMESHGen()
+ {
+ static SMESH::SMESH_Gen_var aSMESHGen;
+ if(CORBA::is_nil(aSMESHGen)){
+ if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
+ Engines::Component_var aComponent = aDesktop->getEngine("FactoryServer","SMESH");
+ aSMESHGen = SMESH::SMESH_Gen::_narrow(aComponent);
+ }
+ }
+ return aSMESHGen;
+ }
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_SMESHGenUtils_HeaderFile
+#define SMESHGUI_SMESHGenUtils_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Gen)
+
+
+namespace SMESH
+{
+
+ SMESH::SMESH_Gen_var GetSMESHGen();
+
+}
+
+
+#endif
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SewingDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_SewingDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "GEOMBase.h"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_SewingDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_FREEBORDERS")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
+ QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
+ QPixmap image4(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_SewingDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_SEWING" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_SewingDlgLayout = new QGridLayout( this );
+ SMESHGUI_SewingDlgLayout->setSpacing( 6 );
+ SMESHGUI_SewingDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+ GroupConstructors->setTitle( tr( "SMESH_SEWING" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ RBLayout->addWidget( RadioButton1);
+ RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+ RadioButton2->setText( tr( "" ) );
+ RadioButton2->setPixmap( image1 );
+ RBLayout->addWidget( RadioButton2);
+ RadioButton3= new QRadioButton( GroupConstructors, "RadioButton3" );
+ RadioButton3->setText( tr( "" ) );
+ RadioButton3->setPixmap( image2 );
+ RBLayout->addWidget( RadioButton3);
+ RadioButton4= new QRadioButton( GroupConstructors, "RadioButton4" );
+ RadioButton4->setText( tr( "" ) );
+ RadioButton4->setPixmap( image3 );
+ RBLayout->addWidget( RadioButton4);
+ GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
+ SMESHGUI_SewingDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_SewingDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // First subgroup
+ SubGroup1 = new QGroupBox( GroupArguments, "SubGroup1" );
+ SubGroup1->setColumnLayout(0, Qt::Vertical );
+ SubGroup1->layout()->setSpacing( 0 );
+ SubGroup1->layout()->setMargin( 0 );
+ QGridLayout* SubGroup1Layout = new QGridLayout( SubGroup1->layout() );
+ SubGroup1Layout->setAlignment( Qt::AlignTop );
+ SubGroup1Layout->setSpacing( 6 );
+ SubGroup1Layout->setMargin( 11 );
+
+ // Controls of the first subgroup
+ TextLabel1 = new QLabel( SubGroup1, "TextLabel1" );
+ TextLabel1->setFixedWidth(104);
+ SubGroup1Layout->addWidget( TextLabel1, 0, 0 );
+
+ SelectButton1 = new QPushButton( SubGroup1, "SelectButton1" );
+ SelectButton1->setPixmap( image4 );
+ SubGroup1Layout->addWidget( SelectButton1, 0, 1 );
+
+ LineEdit1 = new QLineEdit( SubGroup1, "LineEdit1" );
+ SubGroup1Layout->addWidget( LineEdit1, 0, 2 );
+
+ TextLabel2 = new QLabel( SubGroup1, "TextLabel2" );
+ SubGroup1Layout->addWidget( TextLabel2, 1, 0 );
+
+ SelectButton2 = new QPushButton( SubGroup1, "SelectButton2" );
+ SelectButton2->setPixmap( image4 );
+ SubGroup1Layout->addWidget( SelectButton2, 1, 1 );
+
+ LineEdit2 = new QLineEdit( SubGroup1, "LineEdit2" );
+ SubGroup1Layout->addWidget( LineEdit2, 1, 2 );
+
+ TextLabel3 = new QLabel( SubGroup1, "TextLabel3" );
+ SubGroup1Layout->addWidget( TextLabel3, 2, 0 );
+
+ SelectButton3 = new QPushButton( SubGroup1, "SelectButton3" );
+ SelectButton3->setPixmap( image4 );
+ SubGroup1Layout->addWidget( SelectButton3, 2, 1 );
+
+ LineEdit3 = new QLineEdit( SubGroup1, "LineEdit3" );
+ SubGroup1Layout->addWidget( LineEdit3, 2, 2 );
+
+
+ // Second subgroup
+ SubGroup2 = new QGroupBox( GroupArguments, "SubGroup2" );
+ SubGroup2->setColumnLayout(0, Qt::Vertical );
+ SubGroup2->layout()->setSpacing( 0 );
+ SubGroup2->layout()->setMargin( 0 );
+ QGridLayout* SubGroup2Layout = new QGridLayout( SubGroup2->layout() );
+ SubGroup2Layout->setAlignment( Qt::AlignTop );
+ SubGroup2Layout->setSpacing( 6 );
+ SubGroup2Layout->setMargin( 11 );
+
+ // Controls of the first subgroup
+ TextLabel4 = new QLabel( SubGroup2, "TextLabel4" );
+ SubGroup2Layout->addWidget( TextLabel4, 0, 0 );
+
+ SelectButton4 = new QPushButton( SubGroup2, "SelectButton4" );
+ SelectButton4->setPixmap( image4 );
+ SubGroup2Layout->addWidget( SelectButton4, 0, 1 );
+
+ LineEdit4 = new QLineEdit( SubGroup2, "LineEdit4" );
+ SubGroup2Layout->addWidget( LineEdit4, 0, 2 );
+
+ TextLabel5 = new QLabel( SubGroup2, "TextLabel5" );
+ SubGroup2Layout->addWidget( TextLabel5, 1, 0 );
+
+ SelectButton5 = new QPushButton( SubGroup2, "SelectButton5" );
+ SelectButton5->setPixmap( image4 );
+ SubGroup2Layout->addWidget( SelectButton5, 1, 1 );
+
+ LineEdit5 = new QLineEdit( SubGroup2, "LineEdit5" );
+ SubGroup2Layout->addWidget( LineEdit5, 1, 2 );
+
+ TextLabel6 = new QLabel( SubGroup2, "TextLabel6" );
+ SubGroup2Layout->addWidget( TextLabel6, 2, 0 );
+
+ SelectButton6 = new QPushButton( SubGroup2, "SelectButton6" );
+ SelectButton6->setPixmap( image4 );
+ SubGroup2Layout->addWidget( SelectButton6, 2, 1 );
+
+ LineEdit6 = new QLineEdit( SubGroup2, "LineEdit6" );
+ SubGroup2Layout->addWidget( LineEdit6, 2, 2 );
+
+
+ // Add subgroups to the group of arguments
+ GroupArgumentsLayout->addWidget( SubGroup1, 0, 0 );
+ GroupArgumentsLayout->addWidget( SubGroup2, 1, 0 );
+
+ // Control for the merging equal elements
+ CheckBoxMerge = new QCheckBox( GroupArguments, "CheckBoxMerge" );
+ CheckBoxMerge->setText( tr( "MERGE_EQUAL_ELEMENTS" ) );
+ GroupArgumentsLayout->addWidget( CheckBoxMerge, 2, 0 );
+
+
+ SMESHGUI_SewingDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ GroupArguments->show();
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ LineEdit2->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+ LineEdit3->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+ LineEdit5->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+ LineEdit6->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectButton1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton4, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton5, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton6, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+ connect( LineEdit1, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+ connect( LineEdit2, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+ connect( LineEdit3, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+ connect( LineEdit4, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+ connect( LineEdit5, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+ connect( LineEdit6, SIGNAL( textChanged( const QString& )), SLOT( onTextChange( const QString& )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+ resize(0,0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_SewingDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_SewingDlg::~SMESHGUI_SewingDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::Init()
+{
+ myBusy = false;
+
+ myEditCurrentArgument = LineEdit1;
+ LineEdit1->setFocus();
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+ CheckBoxMerge->setChecked(false);
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
+{
+ disconnect(mySelection, 0, this, 0);
+ mySelection->ClearIObjects();
+ LineEdit1->setText("");
+ LineEdit2->setText("");
+ LineEdit3->setText("");
+ LineEdit4->setText("");
+ LineEdit5->setText("");
+ LineEdit6->setText("");
+ myOk1 = myOk2 = myOk3 = myOk4 = myOk5 = myOk6 = false;
+ myEditCurrentArgument = LineEdit1;
+ myEditCurrentArgument->setFocus();
+
+ if (!TextLabel5->isEnabled())
+ {
+ TextLabel5->setEnabled(true);
+ SelectButton5->setEnabled(true);
+ LineEdit5->setEnabled(true);
+ }
+ else if (!TextLabel6->isEnabled())
+ {
+ TextLabel6->setEnabled(true);
+ SelectButton6->setEnabled(true);
+ LineEdit6->setEnabled(true);
+ }
+
+ switch(constructorId)
+ {
+ case 0 :
+ {
+ GroupArguments->setTitle( tr( "SEW_FREE_BORDERS" ) );
+ SubGroup1->setTitle( tr( "BORDER_1" ) );
+ SubGroup2->setTitle( tr( "BORDER_2" ) );
+
+ break;
+ }
+ case 1 :
+ {
+ GroupArguments->setTitle( tr( "SEW_CONFORM_FREE_BORDERS" ) );
+ SubGroup1->setTitle( tr( "BORDER_1" ) );
+ SubGroup2->setTitle( tr( "BORDER_2" ) );
+
+ TextLabel6->setEnabled(false);
+ SelectButton6->setEnabled(false);
+ LineEdit6->setEnabled(false);
+
+ myOk6 = true;
+
+ break;
+ }
+ case 2 :
+ {
+ GroupArguments->setTitle( tr( "SEW_BORDER_TO_SIDE" ) );
+ SubGroup1->setTitle( tr( "BORDER" ) );
+ SubGroup2->setTitle( tr( "SIDE" ) );
+
+ TextLabel5->setEnabled(false);
+ SelectButton5->setEnabled(false);
+ LineEdit5->setEnabled(false);
+
+ myOk5 = true;
+
+ break;
+ }
+ case 3 :
+ {
+ GroupArguments->setTitle( tr( "SEW_SIDE_ELEMENTS" ) );
+ SubGroup1->setTitle( tr( "SIDE_1" ) );
+ SubGroup2->setTitle( tr( "SIDE_2" ) );
+
+ TextLabel1->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ TextLabel2->setText( tr( "NODE1_TO_MERGE" ) );
+ TextLabel3->setText( tr( "NODE2_TO_MERGE" ) );
+ TextLabel4->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ TextLabel5->setText( tr( "NODE1_TO_MERGE" ) );
+ TextLabel6->setText( tr( "NODE2_TO_MERGE" ) );
+
+ LineEdit1->setValidator( new SMESHGUI_IdValidator( this, "validator"));
+ LineEdit4->setValidator( new SMESHGUI_IdValidator( this, "validator"));
+
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ break;
+ }
+ }
+
+ if (constructorId != 3)
+ {
+ TextLabel1->setText( tr( "FIRST_NODE_ID" ) );
+ TextLabel2->setText( tr( "SECOND_NODE_ID" ) );
+ TextLabel3->setText( tr( "LAST_NODE_ID" ) );
+ TextLabel4->setText( tr( "FIRST_NODE_ID" ) );
+ TextLabel5->setText( tr( "SECOND_NODE_ID" ) );
+ TextLabel6->setText( tr( "LAST_NODE_ID" ) );
+
+ LineEdit1->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+ LineEdit4->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
+
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool SMESHGUI_SewingDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return false;
+
+ bool aResult = false;
+
+ if ( IsValid() )
+ {
+ bool toMerge = CheckBoxMerge->isChecked();
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+
+ int aConstructorId = GetConstructorId();
+
+ if (aConstructorId == 0)
+ aResult = aMeshEditor->SewFreeBorders(LineEdit1->text().toLong(),
+ LineEdit2->text().toLong(),
+ LineEdit3->text().toLong(),
+ LineEdit4->text().toLong(),
+ LineEdit5->text().toLong(),
+ LineEdit6->text().toLong());
+ else if (aConstructorId == 1)
+ aResult = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
+ LineEdit2->text().toLong(),
+ LineEdit3->text().toLong(),
+ LineEdit4->text().toLong(),
+ LineEdit5->text().toLong());
+ else if (aConstructorId == 2)
+ aResult = aMeshEditor->SewBorderToSide(LineEdit1->text().toLong(),
+ LineEdit2->text().toLong(),
+ LineEdit3->text().toLong(),
+ LineEdit4->text().toLong(),
+ LineEdit6->text().toLong());
+ else if (aConstructorId == 3)
+ {
+ QStringList aListElementsId1 = QStringList::split( " ", LineEdit1->text(), false);
+ QStringList aListElementsId2 = QStringList::split( " ", LineEdit4->text(), false);
+
+ SMESH::long_array_var anElementsId1 = new SMESH::long_array;
+ SMESH::long_array_var anElementsId2 = new SMESH::long_array;
+
+ anElementsId1->length( aListElementsId1.count() );
+ anElementsId2->length( aListElementsId2.count() );
+
+ for ( int i = 0; i < aListElementsId1.count(); i++ )
+ anElementsId1[i] = aListElementsId1[i].toInt();
+ for ( int i = 0; i < aListElementsId2.count(); i++ )
+ anElementsId2[i] = aListElementsId2[i].toInt();
+
+ aResult = aMeshEditor->SewSideElements(anElementsId1.inout(),
+ anElementsId2.inout(),
+ LineEdit2->text().toLong(),
+ LineEdit5->text().toLong(),
+ LineEdit3->text().toLong(),
+ LineEdit6->text().toLong());
+ }
+
+ if (toMerge && aResult)
+ aMeshEditor->MergeEqualElements();
+
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ Init();
+ ConstructorsClicked(GetConstructorId());
+ }
+ }
+
+ return aResult;
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::ClickOnOk()
+{
+ if( ClickOnApply())
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::ClickOnCancel()
+{
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_SewingDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send)
+ myEditCurrentArgument = send;
+
+ if (send == LineEdit1)
+ myOk1 = false;
+ else if (send == LineEdit2)
+ myOk2 = false;
+ else if (send == LineEdit3)
+ myOk3 = false;
+ else if (send == LineEdit4)
+ myOk4 = false;
+ else if (send == LineEdit5)
+ myOk5 = false;
+ else if (send == LineEdit6)
+ myOk6 = false;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements/nodes
+ SMDS_Mesh* aMesh = 0;
+
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ else
+ send->clear();
+
+ if ( aMesh ) {
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4))
+ {
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+
+ const SMDS_MeshNode * n = aMesh->FindNode( theNewText.toInt() );
+ if ( n ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+
+ if (send == LineEdit1)
+ myOk1 = true;
+ else if (send == LineEdit2)
+ myOk2 = true;
+ else if (send == LineEdit3)
+ myOk3 = true;
+ else if (send == LineEdit4)
+ myOk4 = true;
+ else if (send == LineEdit5)
+ myOk5 = true;
+ else if (send == LineEdit6)
+ myOk6 = true;
+ }
+ }
+ else
+ {
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ bool isEvenOneExists = false;
+
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ if (!isEvenOneExists)
+ isEvenOneExists = true;
+ }
+ }
+
+ if (isEvenOneExists)
+ {
+ if (send == LineEdit1)
+ myOk1 = true;
+ else if(send == LineEdit4)
+ myOk4 = true;
+ }
+ else
+ send->clear();
+ }
+ }
+
+ if ( IsValid() ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_SewingDlg::SelectionIntoArgument(bool isSelectionChanged)
+{
+ if ( myBusy ) return;
+
+ // clear
+ if (isSelectionChanged)
+ myActor = 0;
+
+ QString aString = "";
+
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected mesh
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ if (myMesh->_is_nil() || !myActor)
+ return;
+
+ // get selected elements/nodes
+
+ int aNbUnits = 0;
+
+ if (GetConstructorId() != 3 || (myEditCurrentArgument != LineEdit1 && myEditCurrentArgument != LineEdit4))
+ {
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
+ if(aNbUnits != 1)
+ return;
+ }
+ else
+ {
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString);
+ if(aNbUnits < 1)
+ return;
+ }
+
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+
+ // OK
+ if (myEditCurrentArgument == LineEdit1)
+ myOk1 = true;
+ else if(myEditCurrentArgument == LineEdit2)
+ myOk2 = true;
+ else if(myEditCurrentArgument == LineEdit3)
+ myOk3 = true;
+ else if(myEditCurrentArgument == LineEdit4)
+ myOk4 = true;
+ else if(myEditCurrentArgument == LineEdit5)
+ myOk5 = true;
+ else if(myEditCurrentArgument == LineEdit6)
+ myOk6 = true;
+
+ if(IsValid())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+
+ if(send == SelectButton1) {
+ myEditCurrentArgument = LineEdit1;
+ myOk1 = false;
+ }
+ else if (send == SelectButton2) {
+ myEditCurrentArgument = LineEdit2;
+ myOk2 = false;
+ }
+ else if (send == SelectButton3) {
+ myEditCurrentArgument = LineEdit3;
+ myOk3 = false;
+ }
+ else if (send == SelectButton4) {
+ myEditCurrentArgument = LineEdit4;
+ myOk4 = false;
+ }
+ else if (send == SelectButton5) {
+ myEditCurrentArgument = LineEdit5;
+ myOk5 = false;
+ }
+ else if (send == SelectButton6) {
+ myEditCurrentArgument = LineEdit6;
+ myOk6 = false;
+ }
+
+ if (GetConstructorId() != 3 || (send != SelectButton1 && send != SelectButton4))
+ {
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ else
+ {
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument(false) ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ ConstructorsClicked(GetConstructorId());
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SewingDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_SewingDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+int SMESHGUI_SewingDlg::GetConstructorId()
+{
+ if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+ return GroupConstructors->id( GroupConstructors->selected() );
+ return -1;
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+bool SMESHGUI_SewingDlg::IsValid()
+{
+ return (myOk1 && myOk2 && myOk3 && myOk4 && myOk5 && myOk6);
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SewingDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_SEWING_H
+#define DIALOGBOX_SEWING_H
+
+#include "SALOME_Selection.h"
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_SewingDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_SewingDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_SewingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_SewingDlg();
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ int GetConstructorId();
+ bool IsValid();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myOk1, myOk2, myOk3, myOk4, myOk5, myOk6;
+ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QRadioButton* RadioButton2;
+ QRadioButton* RadioButton3;
+ QRadioButton* RadioButton4;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QGroupBox* SubGroup1;
+ QGroupBox* SubGroup2;
+ QLabel* TextLabel1;
+ QLabel* TextLabel2;
+ QLabel* TextLabel3;
+ QLabel* TextLabel4;
+ QLabel* TextLabel5;
+ QLabel* TextLabel6;
+ QPushButton* SelectButton1;
+ QPushButton* SelectButton2;
+ QPushButton* SelectButton3;
+ QPushButton* SelectButton4;
+ QPushButton* SelectButton5;
+ QPushButton* SelectButton6;
+ QLineEdit* LineEdit1;
+ QLineEdit* LineEdit2;
+ QLineEdit* LineEdit3;
+ QLineEdit* LineEdit4;
+ QLineEdit* LineEdit5;
+ QLineEdit* LineEdit6;
+ QCheckBox* CheckBoxMerge;
+
+private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ bool ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument(bool isSelectionChanged = true) ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+
+protected:
+ QGridLayout* SMESHGUI_SewingDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_SEWING_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SingleEditDlg.cxx
+// Author : Sergey LITONIN
+// Module : SMESH
+
+#include "SMESHGUI_SingleEditDlg.h"
+
+#include "QAD_Desktop.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+
+#include "SMESHGUI_SpinBox.h"
+
+#include "utilities.h"
+#include "SALOME_Selection.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include <qframe.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+#include <qvalidator.h>
+
+
+#define SPACING 5
+#define MARGIN 10
+
+
+/*
+ Class : SMESHGUI_DiagValidator
+ Description : validate munual input of edge like "id1-id2"
+*/
+class SMESHGUI_DiagValidator: public QValidator
+{
+ public:
+
+ SMESHGUI_DiagValidator(QWidget * parent, const char * name = 0):
+ QValidator(parent,name) {}
+
+ State validate ( QString & text, int & pos) const
+ {
+ text.stripWhiteSpace();
+ text.replace( QRegExp("[^0-9]+"), "-" );
+ if ( text == "-" )
+ text = "";
+ int ind = text.find( QRegExp("-[0-9]+-"));
+ if ( ind > 0 ) { // leave only two ids
+ ind = text.find( '-', ind + 1 );
+ if ( ind > 0 )
+ text.truncate( ind );
+ }
+ if ( pos > text.length() )
+ pos = text.length();
+ return Acceptable;
+ }
+};
+
+/*
+ Class : SMESHGUI_SingleEditDlg
+ Description : Inversion of the diagonal of a pseudo-quadrangle formed by
+ 2 neighboring triangles with 1 common edge
+*/
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::SMESHGUI_SingleEditDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_SingleEditDlg::SMESHGUI_SingleEditDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: QDialog( theParent, theName, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ //setCaption( tr( "CAPTION" ) );
+
+ QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+ QFrame* aMainFrame = createMainFrame ( this );
+ QFrame* aBtnFrame = createButtonFrame( this );
+
+ aDlgLay->addWidget( aMainFrame );
+ aDlgLay->addWidget( aBtnFrame );
+
+ aDlgLay->setStretchFactor( aMainFrame, 1 );
+
+ Init( theSelection ) ;
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_SingleEditDlg::createMainFrame( QWidget* theParent )
+{
+ QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Vertical, tr( "EDGE_BETWEEN" ), theParent );
+
+ QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
+
+ new QLabel( tr( "SMESH_EDGE" ), aMainGrp );
+ ( new QPushButton( aMainGrp ) )->setPixmap( aPix );
+ myEdge = new QLineEdit( aMainGrp );
+ myEdge->setValidator( new SMESHGUI_DiagValidator( this, "validator" ));
+
+ return aMainGrp;
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_SingleEditDlg::createButtonFrame( QWidget* theParent )
+{
+ QFrame* aFrame = new QFrame( theParent );
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
+ myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
+ myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
+
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
+
+ aLay->addWidget( myOkBtn );
+ aLay->addWidget( myApplyBtn );
+ aLay->addItem( aSpacer);
+ aLay->addWidget( myCloseBtn );
+
+ return aFrame;
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::isValid
+// Purpose : Verify validity of input data
+//=======================================================================
+bool SMESHGUI_SingleEditDlg::isValid( const bool theMess ) const
+{
+ int id1, id2;
+ return getNodeIds( myEdge->text(), id1, id2 );
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::getNodeIds
+// Purpose : Retrieve node ids from string
+//=======================================================================
+bool SMESHGUI_SingleEditDlg::getNodeIds( const QString& theStr, int& theId1, int& theId2 ) const
+{
+ if ( !theStr.contains( '-' ) )
+ return false;
+
+ bool ok1, ok2;
+ QString str1 = theStr.section( '-', 0, 0, QString::SectionSkipEmpty );
+ QString str2 = theStr.section( '-', 1, 1, QString::SectionSkipEmpty );
+ theId1 = str1.toInt( &ok1 );
+ theId2 = str2.toInt( &ok2 );
+
+ return ok1 & ok2;
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::~SMESHGUI_SingleEditDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_SingleEditDlg::~SMESHGUI_SingleEditDlg()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_SingleEditDlg::Init( SALOME_Selection* theSelection )
+{
+ mySelection = theSelection;
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+ myBusy = false;
+ myActor = 0;
+
+ // main buttons
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+ // selection and SMESHGUI
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+ connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+ connect( myEdge, SIGNAL( textChanged(const QString&)), SLOT( onTextChange(const QString&)));
+
+ myOkBtn->setEnabled( false );
+ myApplyBtn->setEnabled( false );
+ setEnabled( true );
+
+ int x, y ;
+ aSMESHGUI->DefineDlgPosition( this, x, y );
+ this->move( x, y );
+ this->show();
+
+ // set selection mode
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeOfCellSelection, true );
+
+ onSelectionDone();
+
+ return;
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed.
+// Assign filters VTK viewer and close dialog
+//=======================================================================
+void SMESHGUI_SingleEditDlg::onOk()
+{
+ if ( onApply() )
+ onClose();
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_SingleEditDlg::onClose()
+{
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->ClearIObjects();
+ disconnect( mySelection, 0, this, 0 );
+ disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
+ SMESHGUI::GetSMESHGUI()->ResetState() ;
+ reject();
+}
+
+//=======================================================================
+//function : findTriangles
+//purpose : find triangles sharing theNode1-theNode2 link
+// THIS IS A PIECE OF SMESH_MeshEditor.cxx
+// TO DO: make it available in SMDS for ex.
+//=======================================================================
+
+static bool findTriangles(const SMDS_MeshNode * theNode1,
+ const SMDS_MeshNode * theNode2,
+ const SMDS_MeshElement*& theTria1,
+ const SMDS_MeshElement*& theTria2)
+{
+ if ( !theNode1 || !theNode2 ) return false;
+
+ theTria1 = theTria2 = 0;
+
+ set< const SMDS_MeshElement* > emap;
+ SMDS_ElemIteratorPtr it = theNode1->GetInverseElementIterator();
+ while (it->more()) {
+ const SMDS_MeshElement* elem = it->next();
+ if ( elem->GetType() == SMDSAbs_Face && elem->NbNodes() == 3 )
+ emap.insert( elem );
+ }
+ it = theNode2->GetInverseElementIterator();
+ while (it->more()) {
+ const SMDS_MeshElement* elem = it->next();
+ if ( elem->GetType() == SMDSAbs_Face &&
+ emap.find( elem ) != emap.end() )
+ if ( theTria1 ) {
+ theTria2 = elem;
+ break;
+ } else {
+ theTria1 = elem;
+ }
+ }
+ return ( theTria1 && theTria2 );
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_SingleEditDlg::onTextChange( const QString& theNewText )
+{
+ if ( myBusy ) return;
+
+ myOkBtn->setEnabled( false );
+ myApplyBtn->setEnabled( false );
+
+ // hilight entered edge
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ if ( aMesh ) {
+
+ myBusy = true; // block onSelectionDone()
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+ myBusy = false;
+
+ QStringList aListId = QStringList::split( "-", theNewText, false);
+ if ( aListId.count() != 2 )
+ return;
+ const SMDS_MeshNode* a2Nodes[2];
+ bool allOk = true;
+ int i;
+ for ( i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n )
+ a2Nodes[ i ] = n;
+ else
+ allOk = false;
+ }
+
+ // find a triangle and an edge nb
+ const SMDS_MeshElement* tria[2];
+ if (allOk &&
+ a2Nodes[0] != a2Nodes[1] &&
+ findTriangles( a2Nodes[0],
+ a2Nodes[1],
+ tria[0],
+ tria[1])) {
+ myBusy = true; // block onSelectionDone()
+ mySelection->AddOrRemoveIndex (myActor->getIO(), tria[0]->GetID(), true, false);
+
+ const SMDS_MeshNode* a3Nodes [3];
+ SMDS_ElemIteratorPtr it;
+ int edgeInd = 2;
+ for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++ ) {
+ a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
+ if ( i > 0 )
+ if (( a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ] ) ||
+ ( a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ] ) ) {
+ edgeInd = i - 1;
+ break;
+ }
+ }
+
+ mySelection->AddOrRemoveIndex( myActor->getIO(), -edgeInd-1, true, true );
+ myBusy = false;
+
+ myOkBtn->setEnabled( true );
+ myApplyBtn->setEnabled( true );
+ }
+ }
+}
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::onSelectionDone
+// Purpose : SLOT called when selection changed
+//=======================================================================
+void SMESHGUI_SingleEditDlg::onSelectionDone()
+{
+ if ( myBusy ) return;
+
+ int anId1 = 0, anId2 = 0;
+
+ myOkBtn->setEnabled( false );
+ myApplyBtn->setEnabled( false );
+
+ if ( mySelection->IObjectCount() != 1 )
+ {
+ myEdge->clear();
+ return;
+ }
+
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+ if ( !aMesh )
+ return;
+
+ if (SMESH::GetEdgeNodes( mySelection, anId1, anId2 ) >= 1 ) {
+ QString aText = QString( "%1-%2" ).arg( anId1 ).arg( anId2 );
+ myBusy = true;
+ myEdge->setText( aText );
+ myBusy = false;
+
+ const SMDS_MeshElement* tria[2];
+ if ( findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1]))
+ {
+ myOkBtn->setEnabled( true );
+ myApplyBtn->setEnabled( true );
+ }
+ }
+ else
+ myEdge->clear();
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_SingleEditDlg::onDeactivate()
+{
+ setEnabled( false );
+}
+
+//=======================================================================
+// name : SMESHGUI_SingleEditDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_SingleEditDlg::enterEvent( QEvent* )
+{
+ if ( !isEnabled() ) {
+ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ // set selection mode
+ QAD_Application::getDesktop()->SetSelectionMode( EdgeOfCellSelection, true );
+ setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SingleEditDlg::closeEvent( QCloseEvent* e )
+{
+ onClose() ;
+}
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_SingleEditDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ onClose();
+}
+
+//=================================================================================
+// function : onApply
+// purpose : SLOT. Called when apply button is pressed
+//=================================================================================
+bool SMESHGUI_SingleEditDlg::onApply()
+{
+ if (SMESHGUI::GetSMESHGUI()->ActiveStudyLocked())
+ return false;
+ // verify validity of input data
+ if ( !isValid( true ) )
+ return false;
+
+ // get mesh, actor and nodes
+ SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
+
+ if ( aMesh->_is_nil() )
+ {
+ QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
+ tr( "SMESH_ERROR" ), tr( "SMESHG_NO_MESH" ), QMessageBox::Ok );
+ return false;
+ }
+
+ SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+ int anId1= 0, anId2 = 0;
+ if ( aMeshEditor->_is_nil() || !getNodeIds( myEdge->text(), anId1, anId2 ) )
+ return false;
+
+ // perform operation
+ bool aResult = process( aMeshEditor.in(), anId1, anId2 );
+
+ // update actor
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ }
+
+ return aResult;
+}
+
+/*
+ Class : SMESHGUI_TrianglesInversionDlg
+ Description : Inversion of the diagonal of a pseudo-quadrangle formed by
+ 2 neighboring triangles with 1 common edge
+*/
+
+SMESHGUI_TrianglesInversionDlg::SMESHGUI_TrianglesInversionDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: SMESHGUI_SingleEditDlg( theParent, theSelection, theName )
+{
+ setCaption( tr( "CAPTION" ) );
+}
+
+SMESHGUI_TrianglesInversionDlg::~SMESHGUI_TrianglesInversionDlg()
+{
+}
+
+bool SMESHGUI_TrianglesInversionDlg::process(
+ SMESH::SMESH_MeshEditor_ptr theMeshEditor, const int theId1, const int theId2 )
+{
+ return theMeshEditor->InverseDiag( theId1, theId2 );
+}
+
+/*
+ Class : SMESHGUI_UnionOfTwoTrianglesDlg
+ Description : Construction of a quadrangle by deletion of the
+ common border of 2 neighboring triangles
+*/
+
+SMESHGUI_UnionOfTwoTrianglesDlg::SMESHGUI_UnionOfTwoTrianglesDlg( QWidget* theParent,
+ SALOME_Selection* theSelection,
+ const char* theName )
+: SMESHGUI_SingleEditDlg( theParent, theSelection, theName )
+{
+ setCaption( tr( "CAPTION" ) );
+}
+
+SMESHGUI_UnionOfTwoTrianglesDlg::~SMESHGUI_UnionOfTwoTrianglesDlg()
+{
+}
+
+bool SMESHGUI_UnionOfTwoTrianglesDlg::process(
+ SMESH::SMESH_MeshEditor_ptr theMeshEditor, const int theId1, const int theId2 )
+{
+ return theMeshEditor->DeleteDiag( theId1, theId2 );
+}
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SingleEditDlg.h
+// Author : Sergey LITONIN
+// Module : SMESH
+
+
+#ifndef SMESHGUI_SingleEditDlg_H
+#define SMESHGUI_SingleEditDlg_H
+
+#include <qdialog.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+class QCloseEvent;
+class QFrame;
+class QLineEdit;
+class SMESHGUI_SpinBox;
+class QPushButton;
+class SALOME_Selection;
+class SMESH_Actor;
+
+/*
+ Class : SMESHGUI_SingleEditDlg
+ Description : Base class for dialogs of diagonal inversion and
+ union of two neighboring triangles
+*/
+
+class SMESHGUI_SingleEditDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_SingleEditDlg( QWidget*, SALOME_Selection*, const char* = 0 );
+ virtual ~SMESHGUI_SingleEditDlg();
+
+ void Init( SALOME_Selection* ) ;
+
+protected slots:
+
+ void onOk();
+ virtual bool onApply();
+ void onClose();
+
+ void onDeactivate();
+
+ void onSelectionDone();
+ void onTextChange(const QString&);
+
+protected:
+
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ QFrame* createButtonFrame( QWidget* );
+ QFrame* createMainFrame ( QWidget* );
+ bool isValid( const bool ) const;
+ bool getNodeIds( const QString&, int&, int& ) const;
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int ) = 0;
+
+protected:
+
+ bool myBusy;
+ QPushButton* myOkBtn;
+ QPushButton* myApplyBtn;
+ QPushButton* myCloseBtn;
+ QLineEdit* myEdge;
+ SALOME_Selection* mySelection;
+ SMESH_Actor* myActor;
+
+};
+
+/*
+ Class : SMESHGUI_TrianglesInversionDlg
+ Description : Inversion of the diagonal of a pseudo-quadrangle formed by
+ 2 neighboring triangles with 1 common edge
+*/
+class SMESHGUI_TrianglesInversionDlg : public SMESHGUI_SingleEditDlg
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_TrianglesInversionDlg( QWidget*, SALOME_Selection*, const char* = 0 );
+ virtual ~SMESHGUI_TrianglesInversionDlg();
+
+protected:
+
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int );
+};
+
+/*
+ Class : SMESHGUI_UnionOfTwoTrianglesDlg
+ Description : Construction of a quadrangle by deletion of the
+ common border of 2 neighboring triangles
+*/
+class SMESHGUI_UnionOfTwoTrianglesDlg : public SMESHGUI_SingleEditDlg
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_UnionOfTwoTrianglesDlg( QWidget*, SALOME_Selection*, const char* = 0 );
+ virtual ~SMESHGUI_UnionOfTwoTrianglesDlg();
+
+protected:
+
+ virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int );
+};
+
+#endif
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SmoothingDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_SmoothingDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qvalidator.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_SmoothingDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_SMOOTHING")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_SmoothingDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_SMOOTHING" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_SmoothingDlgLayout = new QGridLayout( this );
+ SMESHGUI_SmoothingDlgLayout->setSpacing( 6 );
+ SMESHGUI_SmoothingDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setTitle( tr( "SMESH_SMOOTHING" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
+ Constructor1->setText( tr( "" ) );
+ Constructor1->setPixmap( image0 );
+ Constructor1->setChecked( TRUE );
+ Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
+ Constructor1->setMinimumSize( QSize( 50, 0 ) );
+ GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupConstructorsLayout->addItem( spacer, 0, 1 );
+ SMESHGUI_SmoothingDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_SmoothingDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image1 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+
+ // Control for the whole mesh selection
+ CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
+ CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
+
+ // Controls for nodes selection
+ TextLabelNodes = new QLabel( GroupArguments, "TextLabelNodes" );
+ TextLabelNodes->setText( tr( "FIXED_NODES_IDS" ) );
+ GroupArgumentsLayout->addWidget( TextLabelNodes, 2, 0 );
+
+ SelectNodesButton = new QPushButton( GroupArguments, "SelectNodesButton" );
+ SelectNodesButton->setText( tr( "" ) );
+ SelectNodesButton->setPixmap( image1 );
+ SelectNodesButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectNodesButton, 2, 1 );
+
+ LineEditNodes = new QLineEdit( GroupArguments, "LineEditNodes" );
+ LineEditNodes->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addWidget( LineEditNodes, 2, 2 );
+
+ // Controls for method selection
+ TextLabelMethod = new QLabel( GroupArguments, "TextLabelMethod" );
+ TextLabelMethod->setText( tr( "METHOD" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelMethod, 3, 3, 0, 1 );
+
+ ComboBoxMethod = new QComboBox( GroupArguments, "ComboBoxMethod" );
+ GroupArgumentsLayout->addWidget( ComboBoxMethod, 3, 2 );
+
+ // Controls for iteration limit defining
+ TextLabelLimit = new QLabel( GroupArguments, "TextLabelLimit" );
+ TextLabelLimit->setText( tr( "ITERATION_LIMIT" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelLimit, 4, 4, 0, 1 );
+
+ SpinBox_IterationLimit = new QSpinBox(GroupArguments, "SpinBox_IterationLimit");
+ GroupArgumentsLayout->addWidget( SpinBox_IterationLimit, 4, 2 );
+
+ // Controls for max. aspect ratio defining
+ TextLabelAspectRatio = new QLabel( GroupArguments, "TextLabelAspectRatio" );
+ TextLabelAspectRatio->setText( tr( "MAX_ASPECT_RATIO" ) );
+ GroupArgumentsLayout->addMultiCellWidget( TextLabelAspectRatio, 5, 5, 0, 1 );
+
+ SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_AspectRatio");
+ GroupArgumentsLayout->addWidget( SpinBox_AspectRatio, 5, 2 );
+
+
+ SMESHGUI_SmoothingDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ ComboBoxMethod->insertItem(tr("LAPLACIAN"));
+ ComboBoxMethod->insertItem(tr("CENTROIDAL"));
+
+ QIntValidator* anIntValidator = new QIntValidator(SpinBox_IterationLimit);
+ SpinBox_IterationLimit->setValidator(anIntValidator);
+ SpinBox_IterationLimit->setRange( 1, 999999 );
+ SpinBox_AspectRatio->RangeStepAndValidator( 0.0, +999999.999, 0.1, 3 );
+
+ GroupArguments->show();
+ myConstructorId = 0 ;
+ Constructor1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectNodesButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+ connect( LineEditNodes, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+ connect( CheckBoxMesh, SIGNAL( toggled( bool )),
+ SLOT( onSelectMesh( bool )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+}
+
+//=================================================================================
+// function : ~SMESHGUI_SmoothingDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::Init()
+{
+ myBusy = false;
+
+ ComboBoxMethod->setCurrentItem(0);
+
+ SpinBox_IterationLimit->setValue(20);
+ SpinBox_AspectRatio->SetValue(1.1);
+
+ myEditCurrentArgument = LineEditElements;
+ LineEditElements->setFocus();
+ myElementsId = "";
+ myNbOkElements = 0 ;
+ myNbOkNodes = 0 ;
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ CheckBoxMesh->setChecked(false);
+ onSelectMesh( false );
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_SmoothingDlg::ConstructorsClicked(int constructorId)
+{
+ return ;
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()))
+ {
+ QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
+ QStringList aListNodesId = QStringList::split( " ", LineEditNodes->text(), false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+ SMESH::long_array_var aNodesId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ if (myNbOkNodes)
+ {
+ aNodesId->length( aListNodesId.count() );
+ for ( int i = 0; i < aListNodesId.count(); i++ )
+ aNodesId[i] = aListNodesId[i].toInt();
+ }
+ else
+ anElementsId->length(0);
+
+ long anIterationLimit = (long)SpinBox_IterationLimit->value();
+ double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
+
+ SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
+ if (ComboBoxMethod->currentItem() > 0)
+ aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
+
+ bool aResult = false;
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ if ( aResult )
+ {
+ Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ mySelection->AddIObject( anIO, false );
+ Init();
+ }
+ }
+
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::ClickOnOk()
+{
+ ClickOnApply() ;
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_SmoothingDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+ else if (send == LineEditNodes)
+ myNbOkNodes = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements/nodes
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ myElementsId = theNewText;
+ }
+ else if (send == LineEditNodes) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
+ myNbOkNodes++;
+ }
+ }
+ }
+ }
+
+ if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()) ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+ myActor = 0;
+
+ myBusy = true;
+ myEditCurrentArgument->setText( "" );
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // get selected mesh
+ QString aString = "";
+
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ // get selected elements/nodes
+
+ int aNbUnits = 0;
+
+ if (myEditCurrentArgument == LineEditElements)
+ {
+ myElementsId = "";
+
+ if (CheckBoxMesh->isChecked())
+ {
+ SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(!myMesh->_is_nil())
+ {
+ if (!myActor)
+ return;
+
+ // get IDs from mesh
+ SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+ if (!aSMDSMesh)
+ return;
+ for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
+ {
+ const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
+ if ( e ) {
+ myElementsId += QString(" %1").arg(i);
+ aNbUnits++;
+ }
+ }
+ }
+ else
+ {
+ // get submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(aSubMesh->_is_nil())
+ return;
+
+ myMesh = aSubMesh->GetFather();
+ if(myMesh->_is_nil())
+ return;
+
+ myActor = SMESH::FindActorByObject(myMesh);
+ if (!myActor)
+ return;
+
+ SMESH::long_array_var anElementsIds = new SMESH::long_array;
+ anElementsIds = aSubMesh->GetElementsId();
+ for ( int i = 0; i < anElementsIds->length(); i++ )
+ myElementsId += QString(" %1").arg(anElementsIds[i]);
+ aNbUnits = anElementsIds->length();
+ }
+ }
+ else if(!myMesh->_is_nil() && myActor)
+ {
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+ myElementsId = aString;
+ }
+ }
+ else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor)
+ {
+ myNbOkNodes = 0;
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
+ }
+
+ if(aNbUnits < 1)
+ return ;
+
+ myBusy = true;
+ myEditCurrentArgument->setText( aString );
+ myBusy = false;
+
+ // OK
+
+ if (myEditCurrentArgument == LineEditElements)
+ myNbOkElements = true;
+ else if (myEditCurrentArgument == LineEditNodes)
+ myNbOkNodes = true;
+
+ if (myNbOkElements)
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ switch (myConstructorId)
+ {
+ case 0: /* default constructor */
+ {
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = LineEditElements;
+ SMESH::SetPointRepresentation(false);
+ if (CheckBoxMesh->isChecked())
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+ }
+ else
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+ else if (send == SelectNodesButton)
+ {
+ myEditCurrentArgument = LineEditNodes;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+ break;
+ }
+ }
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SmoothingDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_SmoothingDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=======================================================================
+//function : onSelectMesh
+//purpose :
+//=======================================================================
+void SMESHGUI_SmoothingDlg::onSelectMesh ( bool toSelectMesh )
+{
+ mySelection->ClearFilters() ;
+
+ if (toSelectMesh)
+ {
+ TextLabelElements->setText( tr( "SMESH_NAME" ) );
+
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter);
+ LineEditElements->setReadOnly(true);
+ }
+ else
+ {
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ LineEditElements->setReadOnly(false);
+ onTextChange(LineEditElements->text());
+ }
+
+ SelectionIntoArgument();
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SmoothingDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_SMOOTHING_H
+#define DIALOGBOX_SMOOTHING_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QComboBox;
+class QCheckBox;
+class QSpinBox;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_SmoothingDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_SmoothingDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_SmoothingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_SmoothingDlg();
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ QString myElementsId;
+ int myNbOkElements ; /* to check when elements are defined */
+ int myNbOkNodes ; /* to check when fixed nodes are defined */
+ int myConstructorId ; /* Current constructor id = radio button id */
+ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* Constructor1;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+ QCheckBox* CheckBoxMesh;
+ QLabel* TextLabelNodes;
+ QPushButton* SelectNodesButton;
+ QLineEdit* LineEditNodes;
+ QLabel* TextLabelMethod;
+ QComboBox* ComboBoxMethod;
+ QLabel* TextLabelLimit;
+ QSpinBox* SpinBox_IterationLimit;
+ QLabel* TextLabelAspectRatio;
+ SMESHGUI_SpinBox* SpinBox_AspectRatio;
+
+private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+ void onSelectMesh(bool toSelectMesh);
+
+protected:
+ QGridLayout* SMESHGUI_SmoothingDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_SMOOTHING_H
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI.h"
+
#include <qvalidator.h>
+using namespace std;
+
//=================================================================================
// class : SMESHGUI_SpinBox()
// purpose : constructor of specific widget accepting floats in double precision.
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_StudyAPI.cxx
-// Author : Yves FRICAUD
-// Module : SMESH
-// $Header:
-
-using namespace std;
-#include "SMESHGUI_StudyAPI.h"
-#include "utilities.h"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-
-#include "QAD_MessageBox.h"
-#include "QAD_Desktop.h"
-#include "QAD_Application.h"
-
-// QT Includes
-#include <qobject.h>
-
-// Open CASCADE Includes
-#include "Standard_CString.hxx"
-
-static CORBA::ORB_var _orb;
-
-// Tags definition
-long Tag_HypothesisRoot = 1;
-long Tag_AlgorithmsRoot = 2;
-
-long Tag_RefOnShape = 1;
-long Tag_RefOnAppliedHypothesis = 2;
-long Tag_RefOnAppliedAlgorithms = 3;
-
-long Tag_SubMeshOnVertex = 4;
-long Tag_SubMeshOnEdge = 5;
-long Tag_SubMeshOnFace = 6;
-long Tag_SubMeshOnSolid = 7;
-long Tag_SubMeshOnCompound = 8;
-
-
-
-static char* IORToString (CORBA::Object_ptr obj)
-{
- // MESSAGE ( " IORToString " << _orb->object_to_string(obj) )
- return _orb->object_to_string(obj);
-}
-
-CORBA::Object_ptr SMESHGUI_StudyAPI::StringToIOR (const char* IOR)
-{
- // MESSAGE ( " StringToIOR " << _orb->string_to_object(IOR) )
- return _orb->string_to_object(IOR);
-}
-//=======================================================================
-// function :
-// purpose : Constructor
-//=======================================================================
-SMESHGUI_StudyAPI::SMESHGUI_StudyAPI ()
-{
-}
-
-SMESHGUI_StudyAPI::SMESHGUI_StudyAPI ( SALOMEDS::Study_ptr aStudy,
- SMESH::SMESH_Gen_ptr CompMesh)
-{
- setOrb();
- Update( aStudy );
-}
-
-//=======================================================================
-// function :
-// purpose : Destructor
-//=======================================================================
-SMESHGUI_StudyAPI::~SMESHGUI_StudyAPI ()
-{
-}
-
-//=======================================================================
-// function :
-// purpose : Update
-//=======================================================================
-void SMESHGUI_StudyAPI::Update(SALOMEDS::Study_ptr aStudy)
-{
- myStudy = SALOMEDS::Study::_duplicate( aStudy );
- myStudyBuilder = aStudy->NewBuilder();
-}
-
-//=======================================================================
-// function : SetShape
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::SetShape (SALOMEDS::SObject_ptr SO_MorSM,
- SALOMEDS::SObject_ptr SO_GeomShape )
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
- SALOMEDS::SObject_var SO = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnShape);
- myStudyBuilder->Addreference (SO,SO_GeomShape);
-}
-
-//=======================================================================
-// function : GetShapeOnMeshOrSubMesh
-// purpose :
-//=======================================================================
-GEOM::GEOM_Shape_ptr SMESHGUI_StudyAPI::GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return GEOM::GEOM_Shape::_nil();
- }
- // NRI
-
- if ( SO_Mesh_Or_SubMesh->_is_nil() )
- return GEOM::GEOM_Shape::_nil();
-
- GEOM::GEOM_Shape_var Shape;
- SALOMEDS::SObject_var aSO, aGeom;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- if ( SO_Mesh_Or_SubMesh->FindSubObject( Tag_RefOnShape, aSO ) ) {
- if ( aSO->ReferencedObject(aGeom) ) {
- if (aGeom->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- return GEOM::GEOM_Shape::_narrow( _orb->string_to_object(anIOR->Value()) );
- }
- }
- }
- return GEOM::GEOM_Shape::_nil();
-}
-
-//=======================================================================
-// function : AddSubMeshOnShape
-// purpose :
-//=======================================================================
-SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh,
- SMESH::SMESH_subMesh_ptr SM,
- GEOM::shape_type ST)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return SALOMEDS::SObject::_nil();
- }
- // NRI
-
- long Tag_Shape ;
- Standard_CString Name;
-
- if (ST == GEOM::SOLID) {Tag_Shape = Tag_SubMeshOnSolid; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnSolid"));}
- else if (ST == GEOM::FACE) {Tag_Shape = Tag_SubMeshOnFace; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnFace"));}
- else if (ST == GEOM::EDGE) {Tag_Shape = Tag_SubMeshOnEdge; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnEdge"));}
- else if (ST == GEOM::VERTEX){Tag_Shape = Tag_SubMeshOnVertex; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnVertex"));}
- else {
- Tag_Shape = Tag_SubMeshOnCompound; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnCompound"));
- }
-
- SALOMEDS::SObject_var SubmeshesRoot;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
- SALOMEDS::AttributeSelectable_var aSelAttr;
-
- if (!SO_Mesh->FindSubObject (Tag_Shape,SubmeshesRoot )) {
- SubmeshesRoot = myStudyBuilder->NewObjectToTag (SO_Mesh, Tag_Shape);
- anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(Name);
- anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
- SALOMEDS::SObject_var SO = myStudyBuilder->NewObject (SubmeshesRoot);
- anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeIOR");
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- anIOR->SetValue(IORToString(SM));
- return SALOMEDS::SObject::_narrow( SO );
-}
-
-//=======================================================================
-// function : AddSubMeshOnShape
-// purpose :
-//=======================================================================
-SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh,
- SALOMEDS::SObject_ptr SO_GeomShape,
- SMESH::SMESH_subMesh_ptr SM,
- GEOM::shape_type ST)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return SALOMEDS::SObject::_nil();
- }
- // NRI
-
- SALOMEDS::SObject_var SO_SM = AddSubMeshOnShape (SO_Mesh,SM,ST);
- SetShape (SO_SM,SO_GeomShape);
- // SetShapeOnSubMesh (SO_SM,SO_GeomShape);
- return SALOMEDS::SObject::_narrow( SO_SM );
-}
-
-
-//=======================================================================
-// function : SetHypothesis
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::SetHypothesis (SALOMEDS::SObject_ptr SO_MorSM,
- SALOMEDS::SObject_ptr SO_Hypothesis)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
-
- //Find or Create Applied Hypothesis root
- SALOMEDS::SObject_var AHR;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeSelectable_var aSelAttr;
- SALOMEDS::AttributePixMap_var aPixmap;
-
- if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedHypothesis, AHR)) {
- AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis);
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"));
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" );
- }
- SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR);
- myStudyBuilder->Addreference (SO,SO_Hypothesis);
-}
-
-//=======================================================================
-// function : SetAlgorithms
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::SetAlgorithms (SALOMEDS::SObject_ptr SO_MorSM,
- SALOMEDS::SObject_ptr SO_Algorithms)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
-
- //Find or Create Applied Algorithms root
- SALOMEDS::SObject_var AHR;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeSelectable_var aSelAttr;
- SALOMEDS::AttributePixMap_var aPixmap;
-
- if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedAlgorithms, AHR)) {
- AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms);
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"));
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" );
- }
- SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR);
- myStudyBuilder->Addreference (SO,SO_Algorithms);
-}
-
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::FindObject( CORBA::Object_ptr theObject )
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return SALOMEDS::SObject::_nil();
- }
- // NRI
- if ( !CORBA::is_nil ( theObject ) ) {
- string anIOR = IORToString( theObject );
- if ( anIOR != "" )
- return myStudy->FindObjectIOR( anIOR.c_str() );
- }
- return SALOMEDS::SObject::_nil();
-}
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::setOrb()
-{
- try {
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- _orb = init( 0 , 0 );
- } catch (...) {
- INFOS("internal error : orb not found");
- _orb = 0;
- }
- ASSERT(! CORBA::is_nil(_orb));
-}
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::SetName( SALOMEDS::SObject_ptr SO, const char* Name )
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
-
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(Name);
-}
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::UnSetHypothesis (SALOMEDS::SObject_ptr SO_Applied_Hypothesis)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
- myStudyBuilder->RemoveObject(SO_Applied_Hypothesis);
-}
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-void SMESHGUI_StudyAPI::UnSetAlgorithm (SALOMEDS::SObject_ptr SO_Applied_Algorithm)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return;
- }
- // NRI
- myStudyBuilder->RemoveObject(SO_Applied_Algorithm);
-}
-
-//=======================================================================
-// function :
-// purpose :
-//=======================================================================
-SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::GetMeshOrSubmesh (SALOMEDS::SObject_ptr SO)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return SALOMEDS::SObject::_nil();
- }
- // NRI
-
- SALOMEDS::SObject_var MorSM,SB;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- if (SO->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- GEOM::GEOM_Shape_var Shape = GEOM::GEOM_Shape::_narrow( _orb->string_to_object(anIOR->Value()) );
- if (!Shape->_is_nil()) {
- //It s a shape
- MorSM = SO->GetFather();
- // MESSAGE ( " MorSM shape " << MorSM->GetID() )
- return SALOMEDS::SObject::_narrow( MorSM);
- }
- }
-
- if (SO->ReferencedObject(SB)) {
- //It's Reference on Hypothesis or Algorithm
- MorSM = SO->GetFather()->GetFather();
- // MESSAGE ( " MorSM reference " << MorSM->GetID() )
- return SALOMEDS::SObject::_narrow( MorSM);
- }
- // It's SMESH_MEN_APPLIED_HYPOTHESIS or SMESH_MEN_APPLIED_ALGORITHMS or SubMeshesOnFace etc...
- MorSM = SO->GetFather();
- // MESSAGE ( " MorSM banniere " << MorSM->GetID() )
- return SALOMEDS::SObject::_narrow( MorSM);
-}
-
-void SMESHGUI_StudyAPI::ModifiedMesh( SALOMEDS::SObject_ptr MorSM, bool right)
-{
- // NRI : Temporary added
- if ( myStudy->GetProperties()->IsLocked() ) {
- return ;
- }
- // NRI
-
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributePixMap_var aPixmap;
-
- anAttr = myStudyBuilder->FindOrCreateAttribute(MorSM, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if (right) {
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
- } else {
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_WARN" );
- }
-
- int i = 1;
- SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(MorSM);
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var Obj = it->Value();
- if ( i >= 4 ) {
- int j = 1;
- SALOMEDS::ChildIterator_var it1 = myStudy->NewChildIterator(Obj);
- for (; it1->More();it1->Next()) {
- SALOMEDS::SObject_var Obj1 = it1->Value();
- anAttr = myStudyBuilder->FindOrCreateAttribute(Obj1, "AttributePixMap");
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if (right) {
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
- } else {
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_WARN" );
- }
- }
- }
- i++;
- }
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_StudyAPI.h
-// Author : Yves FRICAUD
-// Module : SMESH
-// $Header:
-
-#ifndef _INCLUDE_SMESHGUI_StudyAPI_
-#define _INCLUDE_SMESHGUI_StudyAPI_
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Gen)
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-#include CORBA_SERVER_HEADER(SALOME_GenericObj)
-
-class SMESH_subMesh_ptr;
-
-class SMESHGUI_StudyAPI {
-
- public:
-
- SMESHGUI_StudyAPI ();
-
- SMESHGUI_StudyAPI ( SALOMEDS::Study_ptr aStudy, SMESH::SMESH_Gen_ptr Gen);
-
- ~SMESHGUI_StudyAPI ();
-
- // Adding in Study
- CORBA::Object_ptr StringToIOR(const char* IOR);
-
- SALOMEDS::SObject_ptr AddNewMesh (SMESH::SMESH_Mesh_ptr M);
-
- SALOMEDS::SObject_ptr AddNewHypothesis (SMESH::SMESH_Hypothesis_ptr H);
- SALOMEDS::SObject_ptr AddNewAlgorithms (SMESH::SMESH_Hypothesis_ptr H);
-
- SALOMEDS::SObject_ptr AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, SMESH::SMESH_subMesh_ptr SM, GEOM::shape_type ST);
-
- SALOMEDS::SObject_ptr AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, SALOMEDS::SObject_ptr SO_GeomShape, SMESH::SMESH_subMesh_ptr SM, GEOM::shape_type ST);
-
- void Update(SALOMEDS::Study_ptr aStudy);
-
- void ModifiedMesh( SALOMEDS::SObject_ptr MorSM, bool right);
-
-
- void SetShape (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_GeomShape);
- GEOM::GEOM_Shape_ptr GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh);
-
- void SetHypothesis (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_Hypothesis);
- void SetAlgorithms (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_Algorithms);
-
- void UnSetHypothesis (SALOMEDS::SObject_ptr SO_Applied_Hypothesis);
- void UnSetAlgorithm (SALOMEDS::SObject_ptr SO_Applied_Algorithm);
-
- void SetTagHypothesisRoot();
-
- void SetName( SALOMEDS::SObject_ptr SO, const char* Name ) ;
-
- //Exploration
-
- SALOMEDS::SObject_ptr GetMeshOrSubmesh (SALOMEDS::SObject_ptr SO);
-
- SALOMEDS::SObject_ptr FindObject(CORBA::Object_ptr theObject);
-
- static void setOrb();
-
- private:
- //fields
- SALOMEDS::Study_var myStudy;
- SALOMEDS::StudyBuilder_var myStudyBuilder;
-};
-#endif
-
#include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
static CORBA::ORB_var _orb;
SALOMEDS::AttributeName_var aName;
SALOMEDS::AttributePixMap_var aPixmap;
- SALOMEDS::SComponent_var father = myStudy->FindComponent("MESH");
+ // See return value of SMESH::SMESH_Gen::ComponentDataType()
+ SALOMEDS::SComponent_var father = myStudy->FindComponent("SMESH");
if (father->_is_nil()) {
bool aLocked = myStudy->GetProperties()->IsLocked();
if (aLocked) myStudy->GetProperties()->SetLocked(false);
- father = myStudyBuilder->NewComponent("MESH");
+ father = myStudyBuilder->NewComponent("SMESH");
anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
//NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT"));
aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
aSelAttr->SetSelectable(false);
}
+
+ free(Name);
+
SALOMEDS::SObject_var SO = myStudyBuilder->NewObject (SubmeshesRoot);
anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeIOR");
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SymmetryDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_SymmetryDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_SymmetryDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_POINT")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_AXIS")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_SYMMETRY_PLANE")));
+ QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_SymmetryDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_SYMMETRY" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_SymmetryDlgLayout = new QGridLayout( this );
+ SMESHGUI_SymmetryDlgLayout->setSpacing( 6 );
+ SMESHGUI_SymmetryDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+ GroupConstructors->setTitle( tr( "SMESH_SYMMETRY" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ QHBoxLayout* RBLayout = new QHBoxLayout( 0, 0, 6, "Layout2");
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ RBLayout->addWidget( RadioButton1);
+ RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+ RadioButton2->setText( tr( "" ) );
+ RadioButton2->setPixmap( image1 );
+ RBLayout->addWidget( RadioButton2);
+ RadioButton3= new QRadioButton( GroupConstructors, "RadioButton3" );
+ RadioButton3->setText( tr( "" ) );
+ RadioButton3->setPixmap( image2 );
+ RBLayout->addWidget( RadioButton3);
+ GroupConstructorsLayout->addLayout( RBLayout, 0, 0 );
+ SMESHGUI_SymmetryDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_SymmetryDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ TextLabelElements->setFixedWidth(74);
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image3 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
+
+ // Control for the whole mesh selection
+ CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
+ CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
+
+ // Controls for mirror selection
+ GroupMirror = new QGroupBox( GroupArguments, "GroupMirror" );
+ GroupMirror->setColumnLayout(0, Qt::Vertical );
+ GroupMirror->layout()->setSpacing( 0 );
+ GroupMirror->layout()->setMargin( 0 );
+ QGridLayout* GroupMirrorLayout = new QGridLayout( GroupMirror->layout() );
+ GroupMirrorLayout->setAlignment( Qt::AlignTop );
+ GroupMirrorLayout->setSpacing( 6 );
+ GroupMirrorLayout->setMargin( 11 );
+
+ TextLabelPoint = new QLabel( GroupMirror, "TextLabelPoint" );
+ TextLabelPoint->setText( tr( "SMESH_POINT" ) );
+ GroupMirrorLayout->addWidget( TextLabelPoint, 0, 0 );
+
+ SelectPointButton = new QPushButton( GroupMirror, "SelectPointButton" );
+ SelectPointButton->setPixmap( image3 );
+ GroupMirrorLayout->addWidget( SelectPointButton, 0, 1 );
+
+ TextLabelX = new QLabel( GroupMirror, "TextLabelX" );
+ TextLabelX->setText( tr( "SMESH_X" ) );
+ GroupMirrorLayout->addWidget( TextLabelX, 0, 2 );
+
+ SpinBox_X = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_X");
+ GroupMirrorLayout->addWidget( SpinBox_X, 0, 3 );
+
+ TextLabelY = new QLabel( GroupMirror, "TextLabelY" );
+ TextLabelY->setText( tr( "SMESH_Y" ) );
+ GroupMirrorLayout->addWidget( TextLabelY, 0, 4 );
+
+ SpinBox_Y = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_Y");
+ GroupMirrorLayout->addWidget( SpinBox_Y, 0, 5 );
+
+ TextLabelZ = new QLabel( GroupMirror, "TextLabelZ" );
+ TextLabelZ->setText( tr( "SMESH_Z" ) );
+ GroupMirrorLayout->addWidget( TextLabelZ, 0, 6 );
+
+ SpinBox_Z = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_Z");
+ GroupMirrorLayout->addWidget( SpinBox_Z, 0, 7 );
+
+ TextLabelVector = new QLabel( GroupMirror, "TextLabelVector" );
+ GroupMirrorLayout->addWidget( TextLabelVector, 1, 0 );
+
+ SelectVectorButton = new QPushButton( GroupMirror, "SelectVectorButton" );
+ SelectVectorButton->setPixmap( image3 );
+ GroupMirrorLayout->addWidget( SelectVectorButton, 1, 1 );
+
+ TextLabelDX = new QLabel( GroupMirror, "TextLabelDX" );
+ TextLabelDX->setText( tr( "SMESH_DX" ) );
+ GroupMirrorLayout->addWidget( TextLabelDX, 1, 2 );
+
+ SpinBox_DX = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DX");
+ GroupMirrorLayout->addWidget( SpinBox_DX, 1, 3 );
+
+ TextLabelDY = new QLabel( GroupMirror, "TextLabelDY" );
+ TextLabelDY->setText( tr( "SMESH_DY" ) );
+ GroupMirrorLayout->addWidget( TextLabelDY, 1, 4 );
+
+ SpinBox_DY = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DY");
+ GroupMirrorLayout->addWidget( SpinBox_DY, 1, 5 );
+
+ TextLabelDZ = new QLabel( GroupMirror, "TextLabelDZ" );
+ TextLabelDZ->setText( tr( "SMESH_DZ" ) );
+ GroupMirrorLayout->addWidget( TextLabelDZ, 1, 6 );
+
+ SpinBox_DZ = new SMESHGUI_SpinBox( GroupMirror, "SpinBox_DZ");
+ GroupMirrorLayout->addWidget( SpinBox_DZ, 1, 7 );
+
+ GroupArgumentsLayout->addMultiCellWidget( GroupMirror, 2, 2, 0, 2 );
+
+ // Controls for "Create a copy" option
+ CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
+ CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 3, 3, 0, 2 );
+
+
+ SMESHGUI_SymmetryDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ SpinBox_X->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Y->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_Z->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DX->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DY->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox_DZ->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+
+ GroupArguments->show();
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+
+ Init();
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectPointButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectVectorButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+ connect( SpinBox_DX, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DY, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+ connect( SpinBox_DZ, SIGNAL( valueChanged( double )), this, SLOT(onVectorChanged() ) );
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+ connect( CheckBoxMesh, SIGNAL( toggled( bool )),
+ SLOT( onSelectMesh( bool )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+ resize(0,0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_SymmetryDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_SymmetryDlg::~SMESHGUI_SymmetryDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::Init( bool ResetControls )
+{
+ myBusy = false;
+
+ myEditCurrentArgument = 0;
+ LineEditElements->clear();
+ myElementsId = "";
+ myNbOkElements = 0 ;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ if( ResetControls )
+ {
+ SpinBox_X->SetValue(0.0);
+ SpinBox_Y->SetValue(0.0);
+ SpinBox_Z->SetValue(0.0);
+ SpinBox_DX->SetValue(0.0);
+ SpinBox_DY->SetValue(0.0);
+ SpinBox_DZ->SetValue(0.0);
+
+ CheckBoxCopy->setChecked(false);
+ CheckBoxMesh->setChecked(false);
+ onSelectMesh( false );
+ }
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_SymmetryDlg::ConstructorsClicked(int constructorId)
+{
+ disconnect(mySelection, 0, this, 0);
+
+ if (constructorId!=0 && !TextLabelVector->isVisible())
+ {
+ TextLabelVector->show();
+ SelectVectorButton->show();
+ TextLabelDX->show();
+ SpinBox_DX->show();
+ TextLabelDY->show();
+ SpinBox_DY->show();
+ TextLabelDZ->show();
+ SpinBox_DZ->show();
+ }
+
+ switch(constructorId)
+ {
+ case 0 :
+ {
+ GroupMirror->setTitle( tr( "SMESH_POINT" ) );
+
+ TextLabelVector->hide();
+ SelectVectorButton->hide();
+ TextLabelDX->hide();
+ SpinBox_DX->hide();
+ TextLabelDY->hide();
+ SpinBox_DY->hide();
+ TextLabelDZ->hide();
+ SpinBox_DZ->hide();
+ break;
+ }
+ case 1 :
+ {
+ GroupMirror->setTitle( tr( "SMESH_AXIS" ) );
+ TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
+ break;
+ }
+ case 2 :
+ {
+ GroupMirror->setTitle( tr( "SMESH_PLANE" ) );
+ TextLabelVector->setText( tr( "SMESH_NORMAL" ) );
+ break;
+ }
+ }
+
+ if (myEditCurrentArgument != (QWidget*)LineEditElements)
+ {
+ SMESH::SetPointRepresentation(false);
+ if (!CheckBoxMesh->isChecked())
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ LineEditElements->setFocus();
+
+ if (CheckBoxMesh->isChecked())
+ onSelectMesh(true);
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements && IsMirrorOk() )
+ {
+ QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::AxisStruct aMirror;
+
+ aMirror.x = SpinBox_X->GetValue();
+ aMirror.y = SpinBox_Y->GetValue();
+ aMirror.z = SpinBox_Z->GetValue();
+ if (GetConstructorId() == 0)
+ aMirror.vx = aMirror.vy = aMirror.vz = 0;
+ else
+ {
+ aMirror.vx = SpinBox_DX->GetValue();
+ aMirror.vy = SpinBox_DY->GetValue();
+ aMirror.vz = SpinBox_DZ->GetValue();
+ }
+
+ bool toCreateCopy = CheckBoxCopy->isChecked();
+
+ SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
+
+ if (GetConstructorId() == 0)
+ aMirrorType = SMESH::SMESH_MeshEditor::POINT;
+ if (GetConstructorId() == 1)
+ aMirrorType = SMESH::SMESH_MeshEditor::AXIS;
+ if (GetConstructorId() == 2)
+ aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ Init( false );
+ ConstructorsClicked( GetConstructorId() );
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::ClickOnOk()
+{
+ ClickOnApply() ;
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_SymmetryDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ myElementsId = theNewText;
+ }
+ }
+
+ if ( myNbOkElements && IsMirrorOk() ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+
+ myActor = 0;
+ QString aString = "";
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ LineEditElements->setText( aString );
+ myNbOkElements = 0;
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ // get selected mesh
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ int aNbUnits = 0;
+
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ myElementsId = "";
+
+ // get selected elements
+ if (CheckBoxMesh->isChecked())
+ {
+ SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(!myMesh->_is_nil())
+ {
+ if (!myActor)
+ return;
+
+ // get IDs from mesh
+ SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+ if (!aSMDSMesh)
+ return;
+ for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
+ {
+ const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
+ if ( e ) {
+ myElementsId += QString(" %1").arg(i);
+ aNbUnits++;
+ }
+ }
+ }
+ else
+ {
+ // get IDs from submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(aSubMesh->_is_nil())
+ return;
+
+ myMesh = aSubMesh->GetFather();
+ if(myMesh->_is_nil())
+ return;
+
+ myActor = SMESH::FindActorByObject(myMesh);
+ if (!myActor)
+ return;
+
+ SMESH::long_array_var anElementsIds = new SMESH::long_array;
+ anElementsIds = aSubMesh->GetElementsId();
+ for ( int i = 0; i < anElementsIds->length(); i++ )
+ myElementsId += QString(" %1").arg(anElementsIds[i]);
+ aNbUnits = anElementsIds->length();
+ }
+ }
+ else
+ {
+ if(myMesh->_is_nil())
+ {
+ // get submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(!aSubMesh->_is_nil())
+ myMesh = aSubMesh->GetFather(); // get mesh from submesh
+ else
+ {
+ // get group
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
+ if ( !aGroup->_is_nil() )
+ myMesh = aGroup->GetMesh(); // get mesh from group
+ }
+
+ if(myMesh->_is_nil())
+ return;
+
+ // get mesh actor
+ myActor = SMESH::FindActorByObject(myMesh);
+ }
+
+ if (!myActor)
+ return;
+
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+ myElementsId = aString;
+ }
+
+ if(aNbUnits < 1)
+ return ;
+
+ myNbOkElements = true;
+ }
+ else
+ {
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
+ if(aNbUnits != 1)
+ return;
+
+ SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+ if (!aMesh)
+ return;
+
+ const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
+ if ( !n )
+ return;
+
+ double x = n->X();
+ double y = n->Y();
+ double z = n->Z();
+
+ if (myEditCurrentArgument == (QWidget*)SpinBox_X)
+ {
+ SpinBox_X->SetValue(x);
+ SpinBox_Y->SetValue(y);
+ SpinBox_Z->SetValue(z);
+ }
+ else if (myEditCurrentArgument == (QWidget*)SpinBox_DX)
+ {
+ SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
+ SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
+ SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
+ }
+ }
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ LineEditElements->setText( aString );
+ myBusy = false;
+
+ // OK
+ if(myNbOkElements && IsMirrorOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ SMESH::SetPointRepresentation(false);
+ if (CheckBoxMesh->isChecked())
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+ }
+ else
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+ else if (send == SelectPointButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_X;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ else if (send == SelectVectorButton)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox_DX;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_SymmetryDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=======================================================================
+//function : onSelectMesh
+//purpose :
+//=======================================================================
+void SMESHGUI_SymmetryDlg::onSelectMesh ( bool toSelectMesh )
+{
+ if (toSelectMesh)
+ TextLabelElements->setText( tr( "SMESH_NAME" ) );
+ else
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+
+ if (myEditCurrentArgument != LineEditElements)
+ {
+ LineEditElements->clear();
+ return;
+ }
+
+ mySelection->ClearFilters() ;
+ SMESH::SetPointRepresentation(false);
+
+ if (toSelectMesh)
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter);
+ LineEditElements->setReadOnly(true);
+ }
+ else
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ LineEditElements->setReadOnly(false);
+ onTextChange(LineEditElements->text());
+ }
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+int SMESHGUI_SymmetryDlg::GetConstructorId()
+{
+ if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+ return GroupConstructors->id( GroupConstructors->selected() );
+ return -1;
+}
+
+
+//=================================================================================
+// function : IsAxisOk()
+// purpose :
+//=================================================================================
+bool SMESHGUI_SymmetryDlg::IsMirrorOk()
+{
+ bool isOk = true;
+
+ if (GetConstructorId() != 0)
+ isOk = SpinBox_DX->GetValue() != 0 || SpinBox_DY->GetValue() != 0 || SpinBox_DZ->GetValue() != 0;
+
+ return isOk;
+}
+
+
+//=================================================================================
+// function : onVectorChanged()
+// purpose :
+//=================================================================================
+void SMESHGUI_SymmetryDlg::onVectorChanged()
+{
+ if (IsMirrorOk())
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ else
+ {
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_SymmetryDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_SYMMETRY_H
+#define DIALOGBOX_SYMMETRY_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QHBoxLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI_SpinBox;
+class SMESHGUI;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_SymmetryDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_SymmetryDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_SymmetryDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_SymmetryDlg();
+
+private:
+
+ void Init( bool ResetControls = true ) ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ int GetConstructorId();
+ bool IsMirrorOk();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ int myNbOkElements ; /* to check when elements are defined */
+ QString myElementsId;
+
+ QWidget* myEditCurrentArgument; /* Current LineEdit */
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QRadioButton* RadioButton2;
+ QRadioButton* RadioButton3;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QGroupBox* GroupMirror;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+ QCheckBox* CheckBoxMesh;
+
+ QLabel* TextLabelPoint;
+ QPushButton* SelectPointButton;
+ QLabel* TextLabelX;
+ SMESHGUI_SpinBox* SpinBox_X;
+ QLabel* TextLabelY;
+ SMESHGUI_SpinBox* SpinBox_Y;
+ QLabel* TextLabelZ;
+ SMESHGUI_SpinBox* SpinBox_Z;
+ QLabel* TextLabelVector;
+ QPushButton* SelectVectorButton;
+ QLabel* TextLabelDX;
+ SMESHGUI_SpinBox* SpinBox_DX;
+ QLabel* TextLabelDY;
+ SMESHGUI_SpinBox* SpinBox_DY;
+ QLabel* TextLabelDZ;
+ SMESHGUI_SpinBox* SpinBox_DZ;
+
+ QCheckBox* CheckBoxCopy;
+
+ private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+ void onSelectMesh(bool toSelectMesh);
+ void onVectorChanged();
+
+protected:
+ QGridLayout* SMESHGUI_SymmetryDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_SYMMETRY_H
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_TranslationDlg.cxx
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#include "SMESHGUI_TranslationDlg.h"
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESH_Actor.h"
+#include "SMDS_Mesh.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qpixmap.h>
+
+using namespace std;
+
+//=================================================================================
+// class : SMESHGUI_TranslationDlg()
+// purpose :
+//=================================================================================
+SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
+ bool modal, WFlags fl )
+ : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
+ Qt::WDestructiveClose)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_TRANSLATION_POINTS")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SMESH_TRANSLATION_VECTOR")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+ if ( !name )
+ setName( "SMESHGUI_TranslationDlg" );
+ resize( 303, 185 );
+ setCaption( tr( "SMESH_TRANSLATION" ) );
+ setSizeGripEnabled( TRUE );
+ SMESHGUI_TranslationDlgLayout = new QGridLayout( this );
+ SMESHGUI_TranslationDlgLayout->setSpacing( 6 );
+ SMESHGUI_TranslationDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
+ GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
+ GroupConstructors->setTitle( tr( "SMESH_TRANSLATION" ) );
+ GroupConstructors->setExclusive( TRUE );
+ GroupConstructors->setColumnLayout(0, Qt::Vertical );
+ GroupConstructors->layout()->setSpacing( 0 );
+ GroupConstructors->layout()->setMargin( 0 );
+ GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
+ GroupConstructorsLayout->setAlignment( Qt::AlignTop );
+ GroupConstructorsLayout->setSpacing( 6 );
+ GroupConstructorsLayout->setMargin( 11 );
+ RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
+ RadioButton1->setText( tr( "" ) );
+ RadioButton1->setPixmap( image0 );
+ GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
+ RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
+ RadioButton2->setText( tr( "" ) );
+ RadioButton2->setPixmap( image1 );
+ GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
+ SMESHGUI_TranslationDlgLayout->addWidget( GroupConstructors, 0, 0 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ SMESHGUI_TranslationDlgLayout->addWidget( GroupButtons, 2, 0 );
+
+ /***************************************************************/
+ GroupArguments = new QGroupBox( this, "GroupArguments" );
+ GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
+ GroupArguments->setColumnLayout(0, Qt::Vertical );
+ GroupArguments->layout()->setSpacing( 0 );
+ GroupArguments->layout()->setMargin( 0 );
+ GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
+ GroupArgumentsLayout->setAlignment( Qt::AlignTop );
+ GroupArgumentsLayout->setSpacing( 6 );
+ GroupArgumentsLayout->setMargin( 11 );
+
+ // Controls for elements selection
+ TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+ TextLabelElements->setFixedWidth(74);
+ GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
+
+ SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
+ SelectElementsButton->setText( tr( "" ) );
+ SelectElementsButton->setPixmap( image2 );
+ SelectElementsButton->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
+
+ LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
+ LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
+ GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
+
+ // Control for the whole mesh selection
+ CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
+ CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 7 );
+
+ // Controls for vector and points selection
+ TextLabel1 = new QLabel( GroupArguments, "TextLabel1" );
+ GroupArgumentsLayout->addWidget( TextLabel1, 2, 0 );
+
+ SelectButton1 = new QPushButton( GroupArguments, "SelectButton1" );
+ SelectButton1->setText( tr( "" ) );
+ SelectButton1->setPixmap( image2 );
+ SelectButton1->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectButton1, 2, 1 );
+
+ TextLabel1_1 = new QLabel( GroupArguments, "TextLabel1_1" );
+ GroupArgumentsLayout->addWidget( TextLabel1_1, 2, 2 );
+
+ SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_1");
+ GroupArgumentsLayout->addWidget( SpinBox1_1, 2, 3 );
+
+ TextLabel1_2 = new QLabel( GroupArguments, "TextLabel1_2" );
+ GroupArgumentsLayout->addWidget( TextLabel1_2, 2, 4 );
+
+ SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_2");
+ GroupArgumentsLayout->addWidget( SpinBox1_2, 2, 5 );
+
+ TextLabel1_3 = new QLabel( GroupArguments, "TextLabel1_3" );
+ GroupArgumentsLayout->addWidget( TextLabel1_3, 2, 6 );
+
+ SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_3");
+ GroupArgumentsLayout->addWidget( SpinBox1_3, 2, 7 );
+
+ TextLabel2 = new QLabel( GroupArguments, "TextLabel2" );
+ TextLabel2->setText( tr( "SMESH_POINT_2" ) );
+ GroupArgumentsLayout->addWidget( TextLabel2, 3, 0 );
+
+ SelectButton2 = new QPushButton( GroupArguments, "SelectButton2" );
+ SelectButton2->setText( tr( "" ) );
+ SelectButton2->setPixmap( image2 );
+ SelectButton2->setToggleButton( FALSE );
+ GroupArgumentsLayout->addWidget( SelectButton2, 3, 1 );
+
+ TextLabel2_1 = new QLabel( GroupArguments, "TextLabel2_1" );
+ TextLabel2_1->setText( tr( "SMESH_X" ) );
+ GroupArgumentsLayout->addWidget( TextLabel2_1, 3, 2 );
+
+ SpinBox2_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_1");
+ GroupArgumentsLayout->addWidget( SpinBox2_1, 3, 3 );
+
+ TextLabel2_2 = new QLabel( GroupArguments, "TextLabel2_2" );
+ TextLabel2_2->setText( tr( "SMESH_Y" ) );
+ GroupArgumentsLayout->addWidget( TextLabel2_2, 3, 4 );
+
+ SpinBox2_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_2");
+ GroupArgumentsLayout->addWidget( SpinBox2_2, 3, 5 );
+
+ TextLabel2_3 = new QLabel( GroupArguments, "TextLabel2_3" );
+ TextLabel2_3->setText( tr( "SMESH_Z" ) );
+ GroupArgumentsLayout->addWidget( TextLabel2_3, 3, 6 );
+
+ SpinBox2_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_3");
+ GroupArgumentsLayout->addWidget( SpinBox2_3, 3, 7 );
+
+ // Controls for "Create a copy" option
+ CheckBoxCopy = new QCheckBox( GroupArguments, "CheckBoxCopy" );
+ CheckBoxCopy->setText( tr( "SMESH_CREATE_COPY" ) );
+ GroupArgumentsLayout->addMultiCellWidget( CheckBoxCopy, 4, 4, 0, 2 );
+
+
+ SMESHGUI_TranslationDlgLayout->addWidget( GroupArguments, 1, 0 );
+
+ /* Initialisations */
+ SpinBox1_1->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox1_2->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox1_3->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox2_1->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox2_2->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+ SpinBox2_3->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
+
+ GroupArguments->show();
+ RadioButton1->setChecked( TRUE );
+ mySelection = Sel;
+
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
+
+ Init();
+
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
+ connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
+
+ connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+ connect( SelectButton2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ /* to close dialog if study change */
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+ connect( LineEditElements, SIGNAL( textChanged( const QString& )),
+ SLOT( onTextChange( const QString& )));
+ connect( CheckBoxMesh, SIGNAL( toggled( bool )),
+ SLOT( onSelectMesh( bool )));
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+
+ ConstructorsClicked(0);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_TranslationDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_TranslationDlg::~SMESHGUI_TranslationDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::Init( bool ResetControls )
+{
+ myBusy = false;
+
+ myEditCurrentArgument = 0;
+ LineEditElements->clear();
+ myElementsId = "";
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
+
+ if( ResetControls )
+ {
+ SpinBox1_1->SetValue(0.0);
+ SpinBox1_2->SetValue(0.0);
+ SpinBox1_3->SetValue(0.0);
+ SpinBox2_1->SetValue(0.0);
+ SpinBox2_2->SetValue(0.0);
+ SpinBox2_3->SetValue(0.0);
+
+ CheckBoxCopy->setChecked(false);
+ CheckBoxMesh->setChecked(false);
+ onSelectMesh( false );
+ }
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void SMESHGUI_TranslationDlg::ConstructorsClicked(int constructorId)
+{
+ disconnect(mySelection, 0, this, 0);
+
+ switch(constructorId)
+ {
+ case 0 :
+ {
+ TextLabel1->setText( tr( "SMESH_POINT_1" ) );
+ TextLabel1_1->setText( tr( "SMESH_X" ) );
+ TextLabel1_2->setText( tr( "SMESH_Y" ) );
+ TextLabel1_3->setText( tr( "SMESH_Z" ) );
+
+ SelectButton1->show();
+ TextLabel2->show();
+ SelectButton2->show();
+ TextLabel2_1->show();
+ SpinBox2_1->show();
+ TextLabel2_2->show();
+ SpinBox2_2->show();
+ TextLabel2_3->show();
+ SpinBox2_3->show();
+ break;
+ }
+ case 1 :
+ {
+ TextLabel1->setText( tr( "SMESH_VECTOR" ) );
+ TextLabel1_1->setText( tr( "SMESH_DX" ) );
+ TextLabel1_2->setText( tr( "SMESH_DY" ) );
+ TextLabel1_3->setText( tr( "SMESH_DZ" ) );
+
+ SelectButton1->hide();
+ TextLabel2->hide();
+ SelectButton2->hide();
+ TextLabel2_1->hide();
+ SpinBox2_1->hide();
+ TextLabel2_2->hide();
+ SpinBox2_2->hide();
+ TextLabel2_3->hide();
+ SpinBox2_3->hide();
+ break;
+ }
+ }
+
+ if (myEditCurrentArgument != (QWidget*)LineEditElements)
+ {
+ SMESH::SetPointRepresentation(false);
+ if (!CheckBoxMesh->isChecked())
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ LineEditElements->setFocus();
+
+ if (CheckBoxMesh->isChecked())
+ onSelectMesh(true);
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::ClickOnApply()
+{
+ if (mySMESHGUI->ActiveStudyLocked())
+ return;
+
+ if ( myNbOkElements)
+ {
+ QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length( aListElementsId.count() );
+ for ( int i = 0; i < aListElementsId.count(); i++ )
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::DirStruct aVector;
+ if(GetConstructorId() == 0)
+ {
+ aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
+ aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
+ aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
+ }
+ else if(GetConstructorId() == 1)
+ {
+ aVector.PS.x = SpinBox1_1->GetValue();
+ aVector.PS.y = SpinBox1_2->GetValue();
+ aVector.PS.z = SpinBox1_3->GetValue();
+ }
+
+ bool toCreateCopy = CheckBoxCopy->isChecked();
+
+ try
+ {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
+ QApplication::restoreOverrideCursor();
+ }
+ catch( ... )
+ {
+ }
+
+ mySelection->ClearIObjects();
+ SMESH::UpdateView();
+ Init( false );
+ ConstructorsClicked( GetConstructorId() );
+ }
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::ClickOnOk()
+{
+ ClickOnApply() ;
+ ClickOnCancel() ;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::ClickOnCancel()
+{
+ mySelection->ClearFilters();
+ mySelection->ClearIObjects();
+ SMESH::SetPointRepresentation(false);
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ disconnect( mySelection, 0, this, 0 );
+ mySMESHGUI->ResetState() ;
+ reject() ;
+}
+
+//=======================================================================
+//function : onTextChange
+//purpose :
+//=======================================================================
+
+void SMESHGUI_TranslationDlg::onTextChange(const QString& theNewText)
+{
+ QLineEdit* send = (QLineEdit*)sender();
+
+ if ( myBusy ) return;
+ myBusy = true;
+
+ if (send == LineEditElements)
+ myNbOkElements = 0;
+
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+
+ // hilight entered elements
+ SMDS_Mesh* aMesh = 0;
+ if ( myActor )
+ aMesh = myActor->GetObject()->GetMesh();
+
+ if ( aMesh ) {
+
+ mySelection->ClearIObjects();
+ mySelection->AddIObject( myActor->getIO() );
+
+ QStringList aListId = QStringList::split( " ", theNewText, false);
+
+ if (send == LineEditElements) {
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
+ mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
+ myNbOkElements++;
+ }
+ }
+ myElementsId = theNewText;
+ }
+ }
+
+ if ( myNbOkElements ) {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+
+ myBusy = false;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void SMESHGUI_TranslationDlg::SelectionIntoArgument()
+{
+ if ( myBusy ) return;
+
+ // clear
+ myActor = 0;
+ QString aString = "";
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ LineEditElements->setText( aString );
+ myNbOkElements = 0;
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+ myBusy = false;
+
+ if ( !GroupButtons->isEnabled() ) // inactive
+ return;
+
+ // get selected mesh
+
+ int nbSel = mySelection->IObjectCount();
+ if(nbSel != 1)
+ return;
+
+ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
+ myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
+
+ int aNbUnits = 0;
+
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
+ myElementsId = "";
+
+ if (CheckBoxMesh->isChecked())
+ {
+ SMESH::GetNameOfSelectedIObjects(mySelection, aString);
+ if(!myMesh->_is_nil())
+ {
+ if (!myActor)
+ return;
+
+ // get IDs from mesh
+ SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
+ if (!aSMDSMesh)
+ return;
+
+ for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
+ {
+ const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
+ if ( e ) {
+ myElementsId += QString(" %1").arg(i);
+ aNbUnits++;
+ }
+ }
+ }
+ else
+ {
+ // get submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(aSubMesh->_is_nil())
+ return;
+
+ myMesh = aSubMesh->GetFather();
+ if(myMesh->_is_nil())
+ return;
+
+ myActor = SMESH::FindActorByObject(myMesh);
+ if (!myActor)
+ return;
+
+ // get IDs from submesh
+ SMESH::long_array_var anElementsIds = new SMESH::long_array;
+ anElementsIds = aSubMesh->GetElementsId();
+ for ( int i = 0; i < anElementsIds->length(); i++ )
+ myElementsId += QString(" %1").arg(anElementsIds[i]);
+ aNbUnits = anElementsIds->length();
+ }
+ }
+ else
+ {
+ if(myMesh->_is_nil())
+ {
+ // get submesh
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
+ if(!aSubMesh->_is_nil())
+ myMesh = aSubMesh->GetFather(); // get mesh from submesh
+ else
+ {
+ // get group
+ SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
+ if ( !aGroup->_is_nil() )
+ myMesh = aGroup->GetMesh(); // get mesh from group
+ }
+
+ if(myMesh->_is_nil())
+ return;
+
+ // get mesh actor
+ myActor = SMESH::FindActorByObject(myMesh);
+ }
+
+ if (!myActor)
+ return;
+
+ aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
+ myElementsId = aString;
+ }
+
+ if(aNbUnits < 1)
+ return ;
+
+ myNbOkElements = true;
+ }
+ else {
+ aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString);
+ if(aNbUnits != 1)
+ return;
+
+ SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+ if (!aMesh)
+ return;
+
+ const SMDS_MeshNode * n = aMesh->FindNode( aString.toInt() );
+ if ( !n )
+ return;
+
+ double x = n->X();
+ double y = n->Y();
+ double z = n->Z();
+
+ if (myEditCurrentArgument == (QWidget*)SpinBox1_1)
+ {
+ SpinBox1_1->SetValue(x);
+ SpinBox1_2->SetValue(y);
+ SpinBox2_3->SetValue(z);
+ }
+ else if (myEditCurrentArgument == (QWidget*)SpinBox2_1)
+ {
+ SpinBox2_1->SetValue(x);
+ SpinBox2_2->SetValue(y);
+ SpinBox2_3->SetValue(z);
+ }
+ }
+
+ myBusy = true;
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ LineEditElements->setText( aString );
+ myBusy = false;
+
+ // OK
+
+ if(myNbOkElements)
+ {
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ disconnect( mySelection, 0, this, 0 );
+ mySelection->ClearIObjects();
+ mySelection->ClearFilters();
+
+ if(send == SelectElementsButton) {
+ myEditCurrentArgument = (QWidget*)LineEditElements;
+ SMESH::SetPointRepresentation(false);
+ if (CheckBoxMesh->isChecked())
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter) ;
+ }
+ else
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ }
+ else if (send == SelectButton1)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox1_1;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+ else if (send == SelectButton2)
+ {
+ myEditCurrentArgument = (QWidget*)SpinBox2_1;
+ SMESH::SetPointRepresentation(true);
+ QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
+ }
+
+ myEditCurrentArgument->setFocus();
+ connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SelectionIntoArgument() ;
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::DeactivateActiveDialog()
+{
+ if ( GroupConstructors->isEnabled() ) {
+ GroupConstructors->setEnabled(false) ;
+ GroupArguments->setEnabled(false) ;
+ GroupButtons->setEnabled(false) ;
+ mySMESHGUI->ResetState() ;
+ mySMESHGUI->SetActiveDialogBox(0) ;
+ }
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+ GroupConstructors->setEnabled(true) ;
+ GroupArguments->setEnabled(true) ;
+ GroupButtons->setEnabled(true) ;
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::enterEvent(QEvent* e)
+{
+ if ( GroupConstructors->isEnabled() )
+ return ;
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_TranslationDlg::closeEvent( QCloseEvent* e )
+{
+ /* same than click on cancel button */
+ this->ClickOnCancel() ;
+}
+
+
+//=======================================================================
+//function : hideEvent
+//purpose : caused by ESC key
+//=======================================================================
+
+void SMESHGUI_TranslationDlg::hideEvent ( QHideEvent * e )
+{
+ if ( !isMinimized() )
+ ClickOnCancel();
+}
+
+
+//=======================================================================
+//function : onSelectMesh
+//purpose :
+//=======================================================================
+void SMESHGUI_TranslationDlg::onSelectMesh ( bool toSelectMesh )
+{
+ if (toSelectMesh)
+ TextLabelElements->setText( tr( "SMESH_NAME" ) );
+ else
+ TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
+
+ if (myEditCurrentArgument != LineEditElements)
+ {
+ LineEditElements->clear();
+ return;
+ }
+
+ mySelection->ClearFilters() ;
+ SMESH::SetPointRepresentation(false);
+
+ if (toSelectMesh)
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
+ mySelection->AddFilter(myMeshOrSubMeshFilter);
+ LineEditElements->setReadOnly(true);
+ }
+ else
+ {
+ QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
+ LineEditElements->setReadOnly(false);
+ onTextChange(LineEditElements->text());
+ }
+
+ SelectionIntoArgument();
+}
+
+
+//=================================================================================
+// function : GetConstructorId()
+// purpose :
+//=================================================================================
+int SMESHGUI_TranslationDlg::GetConstructorId()
+{
+ if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+ return GroupConstructors->id( GroupConstructors->selected() );
+ return -1;
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_TranslationDlg.h
+// Author : Michael ZORIN
+// Module : SMESH
+// $Header:
+
+#ifndef DIALOGBOX_TRANSLATION_H
+#define DIALOGBOX_TRANSLATION_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+
+class QGridLayout;
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QCheckBox;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+class SMESH_Actor;
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+
+//=================================================================================
+// class : SMESHGUI_TranslationDlg
+// purpose :
+//=================================================================================
+class SMESHGUI_TranslationDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_TranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SMESHGUI_TranslationDlg();
+
+private:
+
+ void Init( bool ResetControls = true ) ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
+ void hideEvent ( QHideEvent * ); /* ESC key */
+ int GetConstructorId();
+
+ SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
+ SALOME_Selection* mySelection ; /* User shape selection */
+ QString myElementsId;
+ int myNbOkElements ; /* to check when elements are defined */
+
+ QWidget* myEditCurrentArgument;
+
+ bool myBusy;
+ SMESH::SMESH_Mesh_var myMesh;
+ SMESH_Actor* myActor;
+ Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
+
+ QButtonGroup* GroupConstructors;
+ QRadioButton* RadioButton1;
+ QRadioButton* RadioButton2;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QPushButton* buttonApply;
+ QGroupBox* GroupArguments;
+ QLabel* TextLabelElements;
+ QPushButton* SelectElementsButton;
+ QLineEdit* LineEditElements;
+ QCheckBox* CheckBoxMesh;
+ QLabel* TextLabel1;
+ QPushButton* SelectButton1;
+ QLabel* TextLabel1_1;
+ SMESHGUI_SpinBox* SpinBox1_1;
+ QLabel* TextLabel1_2;
+ SMESHGUI_SpinBox* SpinBox1_2;
+ QLabel* TextLabel1_3;
+ SMESHGUI_SpinBox* SpinBox1_3;
+ QLabel* TextLabel2;
+ QPushButton* SelectButton2;
+ QLabel* TextLabel2_1;
+ SMESHGUI_SpinBox* SpinBox2_1;
+ QLabel* TextLabel2_2;
+ SMESHGUI_SpinBox* SpinBox2_2;
+ QLabel* TextLabel2_3;
+ SMESHGUI_SpinBox* SpinBox2_3;
+ QCheckBox* CheckBoxCopy;
+
+ private slots:
+
+ void ConstructorsClicked(int constructorId);
+ void ClickOnOk();
+ void ClickOnCancel();
+ void ClickOnApply();
+ void SetEditCurrentArgument() ;
+ void SelectionIntoArgument() ;
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+ void onTextChange(const QString&);
+ void onSelectMesh(bool toSelectMesh);
+
+protected:
+ QGridLayout* SMESHGUI_TranslationDlgLayout;
+ QGridLayout* GroupConstructorsLayout;
+ QGridLayout* GroupButtonsLayout;
+ QGridLayout* GroupArgumentsLayout;
+};
+
+#endif // DIALOGBOX_TRANSLATION_H
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESHGUI_TransparencyDlg.h"
+
#include "SMESHGUI.h"
+#include "SMESHGUI_VTKUtils.h"
// QT Includes
#include <qlabel.h>
#include <qgroupbox.h>
#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindowInteractor.h"
#include "QAD_RightFrame.h"
#include "QAD_WaitCursor.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_Selection.h"
#include "SALOME_InteractiveObject.hxx"
-static SMESH_Actor* FindActorByEntry(const char* theEntry)
-{
- QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
- QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
- VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>( aStudyFrame->getRightFrame()->getViewFrame() );
-
- if(aViewFrame){
- vtkRenderer *aRenderer = aViewFrame->getRenderer();
- vtkActorCollection *aCollection = aRenderer->GetActors();
- aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
- if(anActor->hasIO()){
- Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
- if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
- return anActor;
- }
- }
- }
- }
- }
- return NULL;
-}
+using namespace std;
//=================================================================================
// class : SMESHGUI_TransparencyDlg()
SALOME_ListIteratorOfListIO It( mySelection->StoredIObjects() );
for( ;It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IOS = It.Value();
- SMESH_Actor* anActor = FindActorByEntry(IOS->getEntry());
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(IOS->getEntry());
if ( anActor )
anActor->SetOpacity( opacity );
}
if ( mySelection->IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) FirstIOS = mySelection->firstIObject();
if( !FirstIOS.IsNull() ) {
- SMESH_Actor* anActor = FindActorByEntry( FirstIOS->getEntry() );
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() );
if ( anActor )
opacity = int( anActor->GetOpacity() * 100. + 0.5 );
}
for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IO = It.Value();
if( !IO.IsNull() ) {
- SMESH_Actor* anActor = FindActorByEntry( IO->getEntry() );
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if ( anActor ) {
int op = int( anActor->GetOpacity() * 100. + 0.5 );
if ( setOp < 0 )
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include <qstring.h>
+
+#include "SMESHGUI_Utils.h"
+
+#include "QAD_Desktop.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+#include "utilities.h"
+
+using namespace std;
+
+namespace SMESH{
+
+ QAD_Study* GetActiveStudy(){
+ if(QAD_Desktop* aDesktop = QAD_Application::getDesktop())
+ return aDesktop->getActiveStudy();
+ return NULL;
+ }
+
+
+ QAD_StudyFrame* GetActiveStudyFrame(){
+ if(QAD_Study* aStudy = GetActiveStudy())
+ return aStudy->getActiveStudyFrame();
+ return NULL;
+ }
+
+
+ SALOMEDS::Study_var GetActiveStudyDocument(){
+ if(QAD_Study* aStudy = GetActiveStudy())
+ return aStudy->getStudyDocument();
+ return SALOMEDS::Study::_nil();
+ }
+
+
+ SALOMEDS::SObject_var FindSObject(CORBA::Object_ptr theObject){
+ if(!CORBA::is_nil(theObject)){
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ CORBA::String_var anIOR = aStudy->ConvertObjectToIOR(theObject);
+ if(strcmp(anIOR.in(),"") != 0)
+ return aStudy->FindObjectIOR(anIOR);
+ }
+ return SALOMEDS::SObject::_nil();
+ }
+
+
+ void SetName(SALOMEDS::SObject_ptr theSObject, const char* theName){
+ using namespace SALOMEDS;
+ Study_var aStudy = GetActiveStudyDocument();
+ if(aStudy->GetProperties()->IsLocked())
+ return;
+ StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(theSObject,"AttributeName");
+ AttributeName_var aName = AttributeName::_narrow(anAttr);
+ if(!aName->_is_nil())
+ aName->SetValue(theName);
+ }
+
+ void SetValue(SALOMEDS::SObject_ptr theSObject, const char* theValue){
+ using namespace SALOMEDS;
+ Study_var aStudy = GetActiveStudyDocument();
+ if(aStudy->GetProperties()->IsLocked())
+ return;
+ StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute(theSObject,"AttributeComment");
+ AttributeComment_var aComment = AttributeComment::_narrow(anAttr);
+ if(!aComment->_is_nil())
+ aComment->SetValue(theValue);
+ }
+
+
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject,
+ SALOMEDS::Study_ptr theStudy)
+ {
+ if(!theSObject->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ CORBA::String_var aVal = anIOR->Value();
+ return theStudy->ConvertIORToObject(aVal.in());
+ }
+ }
+ return CORBA::Object::_nil();
+ }
+
+
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject){
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ return SObjectToObject(theSObject,aStudy);
+ }
+
+
+ CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO){
+ if(!theIO.IsNull()){
+ if(theIO->hasEntry()){
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ SALOMEDS::SObject_var anObj = aStudy->FindObjectID(theIO->getEntry());
+ return SObjectToObject(anObj,aStudy);
+ }
+ }
+ return CORBA::Object::_nil();
+ }
+
+
+ CORBA::Object_var IORToObject(const char* theIOR){
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ return aStudy->ConvertIORToObject(theIOR);
+ }
+
+
+ int GetNameOfSelectedIObjects(SALOME_Selection* theSel, QString& theName)
+ {
+ int aNbSel = theSel->IObjectCount();
+ if (aNbSel == 1) {
+ Handle(SALOME_InteractiveObject) anIObject = theSel->firstIObject();
+ theName = anIObject->getName();
+ }else{
+ theName = QObject::tr("SMESH_OBJECTS_SELECTED").arg(aNbSel);
+ }
+ return aNbSel;
+ }
+
+
+ SALOMEDS::SObject_var GetMeshOrSubmesh(SALOMEDS::SObject_ptr theSObject){
+ GEOM::GEOM_Object_var aShape = SObjectToInterface<GEOM::GEOM_Object>(theSObject);
+ if(!aShape->_is_nil()){ //It s a shape
+ return theSObject->GetFather();
+ }
+ SALOMEDS::SObject_var aSObject;
+ if(theSObject->ReferencedObject(aSObject)){
+ aSObject = theSObject->GetFather();
+ return aSObject->GetFather();
+ }
+ return theSObject->GetFather();
+ }
+
+
+ void ModifiedMesh(SALOMEDS::SObject_ptr theSObject, bool theIsRight)
+ {
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ if(aStudy->GetProperties()->IsLocked())
+ return ;
+
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr =
+ aBuilder->FindOrCreateAttribute(theSObject,"AttributePixMap");
+ SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ if(theIsRight){
+ aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
+ }else{
+ aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN");
+ }
+
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theSObject);
+ for (int i = 1; anIter->More(); anIter->Next(), i++) {
+ SALOMEDS::SObject_var aSObj = anIter->Value();
+ if(i >= 4){
+ SALOMEDS::ChildIterator_var anIter1 = aStudy->NewChildIterator(aSObj);
+ for(; anIter1->More(); anIter1->Next()){
+ SALOMEDS::SObject_var aSObj1 = anIter1->Value();
+ anAttr = aBuilder->FindOrCreateAttribute(aSObj1,"AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+ if(theIsRight){
+ aPixmap->SetPixMap("ICON_SMESH_TREE_MESH");
+ }else{
+ aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN");
+ }
+ }
+ }
+ }
+ }
+
+
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_Utils_HeaderFile
+#define SMESHGUI_Utils_HeaderFile
+
+#include "SALOME_InteractiveObject.hxx"
+
+class QString;
+
+class QAD_Study;
+class QAD_StudyFrame;
+class SALOME_Selection;
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+
+namespace SMESH{
+
+ QAD_Study* GetActiveStudy();
+
+ QAD_StudyFrame* GetActiveStudyFrame();
+
+ SALOMEDS::Study_var GetActiveStudyDocument();
+
+ SALOMEDS::SObject_var FindSObject(CORBA::Object_ptr theObject);
+
+
+ void SetName(SALOMEDS::SObject_ptr theSObject, const char* theName);
+ void SetValue(SALOMEDS::SObject_ptr theSObject, const char* theValue);
+
+
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject,
+ SALOMEDS::Study_ptr theStudy);
+
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
+
+
+ template<class TInterface> typename TInterface::_var_type
+ SObjectToInterface(SALOMEDS::SObject_ptr theSObject)
+ {
+ CORBA::Object_var anObj = SObjectToObject(theSObject);
+ if(!CORBA::is_nil(anObj))
+ return TInterface::_narrow(anObj);
+ return TInterface::_nil();
+ }
+
+
+ CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO);
+
+ template<class TInterface> typename TInterface::_var_type
+ IObjectToInterface(const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ CORBA::Object_var anObj = IObjectToObject(theIO);
+ if(!CORBA::is_nil(anObj))
+ return TInterface::_narrow(anObj);
+ return TInterface::_nil();
+ }
+
+
+ CORBA::Object_var IORToObject(const char* theIOR);
+
+ template<class TInterface> typename TInterface::_var_type
+ IORToInterface(const char* theIOR)
+ {
+ CORBA::Object_var anObj = IORToObject(theIOR);
+ if(!CORBA::is_nil(anObj))
+ return TInterface::_narrow(anObj);
+ return TInterface::_nil();
+ }
+
+
+ int GetNameOfSelectedIObjects(SALOME_Selection* theSel, QString& theName);
+
+ SALOMEDS::SObject_var GetMeshOrSubmesh(SALOMEDS::SObject_ptr theSObject);
+
+ void ModifiedMesh(SALOMEDS::SObject_ptr theSObject, bool theIsRight);
+
+}
+
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
+
+#include <vtkRenderer.h>
+#include <vtkActorCollection.h>
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#include "QAD_Config.h"
+#include "QAD_Desktop.h"
+#include "QAD_Study.h"
+#include "QAD_Settings.h"
+#include "QAD_RightFrame.h"
+
+#include "SALOME_Selection.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+
+#include "utilities.h"
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SMESH_Gen)
+#include CORBA_CLIENT_HEADER(SMESH_Mesh)
+#include CORBA_CLIENT_HEADER(SMESH_Group)
+#include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+#include "SMESH_Actor.h"
+
+using namespace std;
+
+namespace SMESH{
+
+ typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
+ static TVisualObjCont VISUAL_OBJ_CONT;
+
+ TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
+ TVisualObjPtr aVisualObj;
+ try{
+ TVisualObjCont::key_type aKey(theStudyId,theEntry);
+ TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
+ if(anIter != VISUAL_OBJ_CONT.end()){
+ aVisualObj = anIter->second;
+ }else{
+ SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+ SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theEntry);
+ if(!CORBA::is_nil(aSObj)){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ CORBA::String_var aVal = anIOR->Value();
+ CORBA::Object_var anObj = aStudy->ConvertIORToObject(aVal.in());
+ if(!CORBA::is_nil(anObj)){
+ //Try narrow to SMESH_Mesh interafce
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
+ if(!aMesh->_is_nil()){
+ aVisualObj.reset(new SMESH_MeshObj(aMesh));
+ aVisualObj->Update();
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ return aVisualObj;
+ }
+ //Try narrow to SMESH_Group interafce
+ SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow(anObj);
+ if(!aGroup->_is_nil()){
+ SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
+ if(aFatherSObj->_is_nil()) return aVisualObj;
+ aFatherSObj = aFatherSObj->GetFather();
+ if(aFatherSObj->_is_nil()) return aVisualObj;
+ CORBA::String_var anEntry = aFatherSObj->GetID();
+ TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+ if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
+ aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
+ aVisualObj->Update();
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ return aVisualObj;
+ }
+ }
+ //Try narrow to SMESH_subMesh interafce
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
+ if(!aSubMesh->_is_nil()){
+ SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
+ if(aFatherSObj->_is_nil()) return aVisualObj;
+ aFatherSObj = aFatherSObj->GetFather();
+ if(aFatherSObj->_is_nil()) return aVisualObj;
+ CORBA::String_var anEntry = aFatherSObj->GetID();
+ TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
+ if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
+ aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
+ aVisualObj->Update();
+ TVisualObjCont::value_type aValue(aKey,aVisualObj);
+ VISUAL_OBJ_CONT.insert(aValue);
+ return aVisualObj;
+ }
+ }
+ }
+ }
+ }
+ }
+ }catch(...){
+ INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
+ }
+ return aVisualObj;
+ }
+
+
+ VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
+ QAD_StudyFrame* theStudyFrame)
+ {
+ QList<QAD_Study>& aStudies =
+ QAD_Application::getDesktop()->getActiveApp()->getStudies();
+ if(aStudies.containsRef(theStudy)){
+ const QList<QAD_StudyFrame>& aStudyFrames = theStudy->getStudyFrames();
+ if(aStudyFrames.containsRef(theStudyFrame)){
+ return GetVtkViewFrame(theStudyFrame);
+ }
+ }
+ return NULL;
+ }
+
+
+ VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame){
+ QAD_ViewFrame* aViewFrame = theStudyFrame->getRightFrame()->getViewFrame();
+ return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
+ }
+
+
+ VTKViewer_ViewFrame* GetCurrentVtkView(){
+ return GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame());
+ }
+
+
+ SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
+ const char* theEntry)
+ {
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
+ vtkRenderer *aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->hasIO()){
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
+ return anActor;
+ }
+ }
+ }
+ }
+ }
+ return NULL;
+ }
+
+
+ SMESH_Actor* FindActorByEntry(const char* theEntry){
+ return FindActorByEntry(GetActiveStudy()->getActiveStudyFrame(),theEntry);
+ }
+
+
+ SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject){
+ if(!CORBA::is_nil(theObject)){
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ CORBA::String_var anIOR = aStudy->ConvertObjectToIOR(theObject);
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectIOR(anIOR.in());
+ if(!aSObject->_is_nil()){
+ CORBA::String_var anEntry = aSObject->GetID();
+ return FindActorByEntry(anEntry.in());
+ }
+ }
+ return NULL;
+ }
+
+
+ SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
+ const char* theEntry,
+ int theIsClear)
+ {
+ SMESH_Actor *anActor = NULL;
+ CORBA::Long anId = theStudy->StudyId();
+ if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
+ SALOMEDS::SObject_var aSObj = theStudy->FindObjectID(theEntry);
+ if(!aSObj->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(aSObj->FindAttribute(anAttr,"AttributeName")){
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ CORBA::String_var aVal = aName->Value();
+ string aNameVal = aVal.in();
+ anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
+ }
+ }
+ }
+ return anActor;
+ }
+
+
+ void DisplayActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
+ aViewFrame->AddActor(theActor);
+ aViewFrame->Repaint();
+ }
+ }
+
+
+ void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
+ aViewFrame->RemoveActor(theActor);
+ aViewFrame->Repaint();
+ }
+ }
+
+
+ void FitAll(){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
+ aViewFrame->onViewFitAll();
+ aViewFrame->Repaint();
+ }
+ }
+
+ vtkRenderer* GetCurrentRenderer(){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame()))
+ return aViewFrame->getRenderer();
+ return NULL;
+ }
+
+ void RepaintCurrentView(){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
+ aViewFrame->getRW()->getRenderWindow()->Render();
+ //aViewFrame->Repaint();
+ }
+ }
+
+
+ void UpdateView(QAD_StudyFrame *theStudyFrame, EDisplaing theAction, const char* theEntry)
+ {
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
+ vtkRenderer *aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ switch(theAction){
+ case eDisplayAll: {
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ anActor->SetVisibility(true);
+ }
+ }
+ break;
+ }
+ case eDisplayOnly:
+ case eEraseAll: {
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ anActor->SetVisibility(false);
+ }
+ }
+ }
+ default: {
+ if(SMESH_Actor *anActor = FindActorByEntry(theStudyFrame,theEntry)){
+ switch(theAction) {
+ case eDisplay:
+ case eDisplayOnly:
+ anActor->SetVisibility(true);
+ break;
+ case eErase:
+ anActor->SetVisibility(false);
+ break;
+ }
+ } else {
+ switch(theAction){
+ case eDisplay:
+ case eDisplayOnly:{
+ QAD_Study* aStudy = theStudyFrame->getStudy();
+ SALOMEDS::Study_var aDocument = aStudy->getStudyDocument();
+ if((anActor = CreateActor(aDocument,theEntry,true))) {
+ DisplayActor(theStudyFrame,anActor);
+ FitAll();
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ void UpdateView(EDisplaing theAction, const char* theEntry){
+ QAD_Study* aStudy = GetActiveStudy();
+ QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
+ UpdateView(aStudyFrame,theAction,theEntry);
+ }
+
+ void UpdateView(){
+ if(VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView()){
+ SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
+ if(aSel->IObjectCount() == 0){
+ vtkRenderer* aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->hasIO())
+ Update(anActor->getIO(),anActor->GetVisibility());
+ }
+ }
+ }else{
+ SALOME_ListIteratorOfListIO anIter(aSel->StoredIObjects());
+ for(; anIter.More(); anIter.Next()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ Update(anIO,true);
+ }
+ }
+ RepaintCurrentView();
+ }
+ }
+
+
+ void Update(const Handle(SALOME_InteractiveObject)& theIO,
+ bool theDisplay)
+ {
+ SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
+ CORBA::Long anId = aStudy->StudyId();
+ TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
+ aVisualObj->Update();
+ if ( theDisplay )
+ UpdateView(SMESH::eDisplay,theIO->getEntry());
+ }
+
+
+ void UpdateSelectionProp() {
+ QAD_Study* aStudy = GetActiveStudy();
+ QList<QAD_StudyFrame> aFrameList = aStudy->getStudyFrames();
+
+ QString SCr, SCg, SCb;
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
+ QColor aHiColor = Qt::white;
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aHiColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
+ QColor aSelColor = Qt::yellow;
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aSelColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ QString SW = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
+ if (SW.isEmpty()) SW = "5";
+
+ SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
+ SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
+ SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
+ QColor aPreColor = Qt::cyan;
+ if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
+ aPreColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
+ QString PW = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
+ if (PW.isEmpty()) PW = "5";
+
+ QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
+ if (SP1.isEmpty()) SP1 = "0.025";
+ QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
+ if (SP2.isEmpty()) SP2 = "0.001";
+
+ for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
+ if (aStudyFrame->getTypeView() == VIEW_VTK) {
+ VTKViewer_ViewFrame* aVtkViewFrame = GetVtkViewFrame(aStudyFrame);
+ if (!aVtkViewFrame) continue;
+ // update VTK viewer properties
+ VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
+ if (anInteractor) {
+ // mesh element selection
+ anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
+ aSelColor.blue()/255., SW.toInt());
+
+ // tolerances
+ anInteractor->SetSelectionTolerance(SP1.toDouble(), SP2.toDouble());
+
+ // pre-selection
+ VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
+ if (aStyle) {
+ aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
+ aPreColor.blue()/255., PW.toInt());
+ }
+ }
+ // update actors
+ vtkRenderer* aRenderer = aVtkViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
+ aHiColor.blue()/255.);
+ anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
+ aPreColor.blue()/255.);
+ }
+ }
+ }
+ }
+ }
+
+
+ //----------------------------------------------------------------------------
+ VTKViewer_InteractorStyleSALOME* GetInteractorStyle(QAD_StudyFrame *theStudyFrame){
+ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
+ if(VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor()){
+ return anInteractor->GetInteractorStyleSALOME();
+ }
+ }
+ return NULL;
+ }
+
+ void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
+ VTKViewer_InteractorStyleSALOME* theStyle)
+ {
+ theStyle->SetFilter(theFilter);
+ }
+
+ Handle(VTKViewer_Filter) GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
+ {
+ return theStyle->GetFilter(theId);
+ }
+
+ bool IsFilterPresent(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
+ {
+ return theStyle->IsFilterPresent(theId);
+ }
+
+ void RemoveFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle){
+ theStyle->RemoveFilter(theId);
+ }
+
+ bool IsValid(SALOME_Actor* theActor, int theCellId,
+ VTKViewer_InteractorStyleSALOME* theStyle)
+ {
+ return theStyle->IsValid(theActor,theCellId);
+ }
+
+
+ //----------------------------------------------------------------------------
+ void SetPointRepresentation(bool theIsVisible){
+ if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
+ vtkRenderer *aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
+ if(anActor->GetVisibility()){
+ anActor->SetPointRepresentation(theIsVisible);
+ }
+ }
+ }
+ RepaintCurrentView();
+ }
+ }
+
+
+ void SetPickable(SMESH_Actor* theActor){
+ if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
+ int anIsAllPickable = (theActor == NULL);
+ vtkRenderer *aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+ if(anActor->GetVisibility()){
+ anActor->SetPickable(anIsAllPickable);
+ }
+ }
+ }
+ if(theActor)
+ theActor->SetPickable(!anIsAllPickable);
+ RepaintCurrentView();
+ }
+ }
+
+
+ int GetNameOfSelectedNodes(SALOME_Selection *theSel,
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
+ {
+ theName = "";
+ if(theIO->hasEntry()){
+ if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){
+ TColStd_IndexedMapOfInteger aMapIndex;
+ theSel->GetIndex(theIO,aMapIndex);
+ for(int i = 1; i <= aMapIndex.Extent(); i++){
+ theName += QString(" %1").arg(aMapIndex(i));
+ }
+ return aMapIndex.Extent();
+ }
+ }
+ return -1;
+ }
+
+
+ int GetNameOfSelectedNodes(SALOME_Selection *theSel, QString& theName){
+ theName = "";
+ if(theSel->IObjectCount() == 1){
+ Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+ return GetNameOfSelectedNodes(theSel,anIO,theName);
+ }
+ return -1;
+ }
+
+
+ int GetNameOfSelectedElements(SALOME_Selection *theSel,
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName)
+ {
+ theName = "";
+ if(theIO->hasEntry()){
+ if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){
+ TColStd_IndexedMapOfInteger aMapIndex;
+ theSel->GetIndex(theIO,aMapIndex);
+ typedef std::set<int> TIdContainer;
+ TIdContainer anIdContainer;
+ for( int i = 1; i <= aMapIndex.Extent(); i++)
+ anIdContainer.insert(aMapIndex(i));
+ TIdContainer::const_iterator anIter = anIdContainer.begin();
+ for(; anIter != anIdContainer.end(); anIter++){
+ theName += QString(" %1").arg(*anIter);
+ }
+ return aMapIndex.Extent();
+ }
+ }
+ return -1;
+ }
+
+
+ int GetNameOfSelectedElements(SALOME_Selection *theSel, QString& theName)
+ {
+ theName = "";
+ if(theSel->IObjectCount() == 1){
+ Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+ return GetNameOfSelectedElements(theSel,anIO,theName);
+ }
+ return -1;
+ }
+
+
+ int GetSelected(SALOME_Selection* theSel,
+ TColStd_IndexedMapOfInteger& theMap,
+ const bool theIsElement)
+ {
+ theMap.Clear();
+
+ if ( theSel->IObjectCount() == 1 )
+ {
+ Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+ if ( anIO->hasEntry() ) {
+ theSel->GetIndex( anIO, theMap );
+ }
+ }
+ return theMap.Extent();
+ }
+
+
+ int GetEdgeNodes( SALOME_Selection* theSel, int& theId1, int& theId2 )
+ {
+ if ( theSel->IObjectCount() != 1 )
+ return -1;
+
+ Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
+ if ( anIO.IsNull() || !anIO->hasEntry() )
+ return -1;
+
+ SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry() );
+ if ( anActor == 0 )
+ return -1;
+
+ TColStd_IndexedMapOfInteger aMapIndex;
+ theSel->GetIndex( anIO, aMapIndex );
+ if ( aMapIndex.Extent() != 2 )
+ return -1;
+
+ int anObjId = -1, anEdgeNum = -1;
+ for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
+ int aVal = aMapIndex( i );
+ if ( aVal > 0 )
+ anObjId = aVal;
+ else
+ anEdgeNum = abs( aVal );
+ }
+
+ if ( anObjId == -1 || anEdgeNum == -1 )
+ return -1;
+
+ return anActor->GetObject()->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
+ }
+
+ void SetControlsPrecision( const long theVal )
+ {
+ if( VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView() )
+ {
+ vtkRenderer *aRenderer = aViewFrame->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+
+ while ( vtkActor *anAct = aCollection->GetNextActor())
+ {
+ if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) )
+ {
+ anActor->SetControlsPrecision( theVal );
+ anActor->SetControlMode( anActor->GetControlMode() );
+ }
+ }
+
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef SMESHGUI_VTKUtils_HeaderFile
+#define SMESHGUI_VTKUtils_HeaderFile
+
+class QString;
+class vtkRenderer;
+class TColStd_IndexedMapOfInteger;
+
+#include "SALOME_InteractiveObject.hxx"
+#include "VTKViewer_Filter.h"
+
+class QAD_Study;
+class QAD_StudyFrame;
+class SALOME_Selection;
+class VTKViewer_ViewFrame;
+class VTKViewer_InteractorStyleSALOME;
+
+#include <CORBA.h>
+
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+#include <boost/shared_ptr.hpp>
+#include "SMESH_Object.h"
+
+class SALOME_Actor;
+class SMESH_Actor;
+
+namespace SMESH{
+
+ //----------------------------------------------------------------------------
+ typedef pair<int,string> TKeyOfVisualObj;
+
+ TVisualObjPtr GetVisualObj(int theStudyId,
+ const char* theEntry);
+
+
+ //----------------------------------------------------------------------------
+ QAD_StudyFrame* GetActiveStudyFrame();
+
+ VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
+ QAD_StudyFrame* theStudyFrame);
+
+ VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame);
+
+ VTKViewer_ViewFrame* GetCurrentVtkView();
+
+
+ //----------------------------------------------------------------------------
+ SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
+ const char* theEntry);
+ SMESH_Actor* FindActorByEntry(const char* theEntry);
+
+ SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject);
+
+
+ //----------------------------------------------------------------------------
+ SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
+ const char* theEntry,
+ int theIsClear = false);
+
+ void DisplayActor(QAD_StudyFrame *theStudyFrame,
+ SMESH_Actor* theActor);
+ void RemoveActor(QAD_StudyFrame *theStudyFrame,
+ SMESH_Actor* theActor);
+
+
+ //----------------------------------------------------------------------------
+ enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
+ void UpdateView(QAD_StudyFrame *theStudyFrame,
+ EDisplaing theAction,
+ const char* theEntry = "");
+ void UpdateView(EDisplaing theAction,
+ const char* theEntry = "");
+
+ void UpdateView();
+
+ void Update(const Handle(SALOME_InteractiveObject)& theIO,
+ bool theDisplay);
+
+
+ //----------------------------------------------------------------------------
+ void FitAll();
+
+ void RepaintCurrentView();
+
+ vtkRenderer* GetCurrentRenderer();
+
+
+ //----------------------------------------------------------------------------
+ void SetPointRepresentation(bool theIsVisible);
+
+ void SetPickable(SMESH_Actor* theActor = NULL);
+
+ void UpdateSelectionProp();
+
+
+ //----------------------------------------------------------------------------
+ VTKViewer_InteractorStyleSALOME*
+ GetInteractorStyle(QAD_StudyFrame *theStudyFrame = GetActiveStudyFrame());
+
+ void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
+ VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+
+ Handle(VTKViewer_Filter)
+ GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+
+ bool IsFilterPresent(int theId,
+ VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+
+ void RemoveFilter(int theId,
+ VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+
+ bool IsValid(SALOME_Actor* theActor, int theCellId,
+ VTKViewer_InteractorStyleSALOME* theStyle = GetInteractorStyle());
+
+ //----------------------------------------------------------------------------
+ int GetNameOfSelectedNodes(SALOME_Selection *theSel,
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName);
+
+ int GetNameOfSelectedNodes(SALOME_Selection *theSel,
+ QString& aName);
+
+ int GetNameOfSelectedElements(SALOME_Selection *theSel,
+ const Handle(SALOME_InteractiveObject)& theIO,
+ QString& theName);
+
+ int GetNameOfSelectedElements(SALOME_Selection *theSel,
+ QString& aName);
+
+ int GetSelected(SALOME_Selection* theSel,
+ TColStd_IndexedMapOfInteger& theMap,
+ const bool theIsElement = true );
+
+ int GetEdgeNodes(SALOME_Selection* theSel, int& theId1, int& theId2);
+
+ void SetControlsPrecision( const long theVal );
+
+};
+
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
// Module : SMESH
// $Header$
-using namespace std;
#define INCLUDE_MENUITEM_DEF
-#include "SMESHGUI_XmlHandler.h"
-
// QT Include
-//#include <qaccel.h>
#include <qfileinfo.h>
+#include "QAD_ResourceMgr.h"
+#include "QAD_Desktop.h"
+
+#include "SMESHGUI_XmlHandler.h"
+#include "SMESHGUI_Hypotheses.h"
+
+#include "utilities.h"
+
+using namespace std;
+
/*!
Constructor
*/
// Module : SMESH
// $Header$
-#include "SMESHGUI.h"
+#ifndef SMESHGUI_XmlHandler_HeaderFile
+#define SMESHGUI_XmlHandler_HeaderFile
+
+#include "SMESHGUI_Hypotheses.h"
#include <qxml.h>
#include <map>
bool fatalError (const QXmlParseException& exception);
public:
- map<string, HypothesisData*> myHypothesesMap;
- map<string, HypothesisData*> myAlgorithmsMap;
+ std::map<std::string, HypothesisData*> myHypothesesMap;
+ std::map<std::string, HypothesisData*> myAlgorithmsMap;
private:
QString myErrorProt;
QString myServerLib;
QString myClientLib;
};
+
+
+#endif
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_aParameter.cxx
+// Module : SMESH
+// $Header$
+
+#include "SMESHGUI_aParameter.h"
+
+#include <qspinbox.h>
+#include <qvalidator.h>
+#include "QAD_SpinBoxDbl.h"
+
+SMESHGUI_aParameter::~SMESHGUI_aParameter() {}
+
+//=================================================================================
+// class : SMESHGUI_intParameter
+// purpose :
+//=================================================================================
+SMESHGUI_intParameter::SMESHGUI_intParameter(const int theInitValue,
+ const QString& theLabel,
+ const int theBottom,
+ const int theTop)
+ :SMESHGUI_aParameter(theLabel),
+ _top(theTop), _bottom(theBottom), _initValue( theInitValue )
+{
+}
+SMESHGUI_aParameter::Type SMESHGUI_intParameter::GetType() const
+{
+ return SMESHGUI_aParameter::INT;
+}
+bool SMESHGUI_intParameter::GetNewInt( int & theValue ) const
+{
+ theValue = _newValue;
+ return _newValue != _initValue;
+}
+bool SMESHGUI_intParameter::GetNewDouble( double & Value ) const
+{
+ return false;
+}
+void SMESHGUI_intParameter::InitializeWidget( QWidget* theQWidget) const
+{
+ QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
+ if ( aSpin ) {
+ aSpin->setMinValue( _bottom );
+ aSpin->setMaxValue( _top );
+ aSpin->setValue( _initValue );
+ }
+}
+void SMESHGUI_intParameter::TakeValue( QWidget* theQWidget)
+{
+ QSpinBox * aSpin = dynamic_cast< QSpinBox *>( theQWidget );
+ if ( aSpin )
+ _newValue = aSpin->value();
+}
+//=================================================================================
+// class : SMESHGUI_doubleParameter
+// purpose :
+//=================================================================================
+SMESHGUI_doubleParameter::SMESHGUI_doubleParameter(const double theInitValue,
+ const QString& theLabel,
+ const double theBottom,
+ const double theTop,
+ const double theStep,
+ const int theDecimals)
+ :SMESHGUI_aParameter( theLabel ),
+ _top( theTop ), _bottom( theBottom ), _step( theStep ),
+ _initValue( theInitValue ), _decimals( theDecimals )
+{
+}
+SMESHGUI_aParameter::Type SMESHGUI_doubleParameter::GetType() const
+{
+ return SMESHGUI_aParameter::DOUBLE;
+}
+bool SMESHGUI_doubleParameter::GetNewInt( int & theValue ) const
+{
+ return false;
+}
+bool SMESHGUI_doubleParameter::GetNewDouble( double & Value ) const
+{
+ Value = _newValue;
+ return _newValue != _initValue;
+}
+void SMESHGUI_doubleParameter::InitializeWidget( QWidget* theQWidget) const
+{
+ QAD_SpinBoxDbl * aSpin = dynamic_cast< QAD_SpinBoxDbl *>( theQWidget );
+ if ( aSpin ) {
+ aSpin->setRange( _bottom, _top );
+ ((QDoubleValidator*)(aSpin->validator()))->setRange( _bottom, _top, _decimals );
+ aSpin->setValue( _initValue );
+ aSpin->setLineStep( _step );
+ }
+}
+void SMESHGUI_doubleParameter::TakeValue( QWidget* theQWidget)
+{
+ QAD_SpinBoxDbl * aSpin = dynamic_cast< QAD_SpinBoxDbl *>( theQWidget );
+ if ( aSpin )
+ _newValue = aSpin->value();
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESHGUI_aParameter.h
+// Module : SMESH
+// $Header$
+
+#ifndef SMESHGUI_aParameter_H
+#define SMESHGUI_aParameter_H
+
+#include <boost/shared_ptr.hpp>
+#include <qstring.h>
+
+class QWidget;
+class SMESHGUI_aParameter;
+
+typedef boost::shared_ptr<SMESHGUI_aParameter> SMESHGUI_aParameterPtr;
+
+//=================================================================================
+// class : SMESHGUI_aParameter
+// purpose :
+//=================================================================================
+class SMESHGUI_aParameter
+{
+public:
+ SMESHGUI_aParameter(const QString& label):_label(label) {}
+ virtual ~SMESHGUI_aParameter();
+
+ enum Type { INT, DOUBLE };
+ virtual Type GetType() const = 0;
+ virtual bool GetNewInt( int & Value ) const = 0;
+ virtual bool GetNewDouble( double & Value ) const = 0;
+ virtual void InitializeWidget( QWidget* ) const = 0;
+ virtual void TakeValue( QWidget* ) = 0;
+
+ QString & Label() { return _label; }
+
+ private:
+ QString _label;
+};
+
+//=================================================================================
+// class : SMESHGUI_intParameter
+// purpose :
+//=================================================================================
+class SMESHGUI_intParameter: public SMESHGUI_aParameter
+{
+public:
+ SMESHGUI_intParameter(const int initValue = 0,
+ const QString& label = QString::null,
+ const int bottom = 0,
+ const int top = 1000);
+ int & InitValue() { return _initValue; }
+ int & Top() { return _top; }
+ int & Bottom() { return _bottom; }
+ virtual Type GetType() const;
+ virtual bool GetNewInt( int & Value ) const;
+ virtual bool GetNewDouble( double & Value ) const;
+ virtual void InitializeWidget( QWidget* ) const;
+ virtual void TakeValue( QWidget* );
+
+ private:
+ int _top, _bottom;
+ int _initValue, _newValue;
+};
+
+//=================================================================================
+// class : SMESHGUI_doubleParameter
+// purpose :
+//=================================================================================
+class SMESHGUI_doubleParameter: public SMESHGUI_aParameter
+{
+public:
+ SMESHGUI_doubleParameter(const double initValue = 0.0,
+ const QString& label = QString::null,
+ const double bottom = -1E6,
+ const double top = +1E6,
+ const double step = 1.0,
+ const int decimals = 3);
+ double & InitValue() { return _initValue; }
+ double & Top() { return _top; }
+ double & Bottom() { return _bottom; }
+ double & Step() { return _step; }
+ int & Decimals() { return _decimals; }
+ virtual Type GetType() const;
+ virtual bool GetNewInt( int & Value ) const;
+ virtual bool GetNewDouble( double & Value ) const;
+ virtual void InitializeWidget( QWidget* ) const;
+ virtual void TakeValue( QWidget* );
+
+ private:
+ double _top, _bottom, _step;
+ double _initValue, _newValue;
+ int _decimals;
+};
+
+#endif // SMESHGUI_aParameter.h
// Module : SMESH
// $Header$
-using namespace std;
+#include "QAD_Tools.h"
+#include "QAD_Desktop.h"
+#include "QAD_Application.h"
+
#include "SMESHGUI_aParameterDlg.h"
+#include "SMESHGUI_aParameter.h"
#include "SMESHGUI.h"
-#include "QAD_SpinBoxDbl.h"
-#include "QAD_Tools.h"
+#include "SMESHGUI_SpinBox.h"
// QT Includes
#include <qgroupbox.h>
#include <qspinbox.h>
#include <qvalidator.h>
-//======================================================================================
-// function : SMESHGUI_aParameterDlg()
-// purpose : Constructs a SMESHGUI_aParametertDlg for double values
-//
-// parent : parent widget
-// title : is the title for the user in dialog box
-// label : text label for the value
-//
-// bottom : the minimal value to be entered
-// top : the maximum value to be entered
-// decimals : number of decimals to be entered
-//
-// The dialog will by default be modal, unless you set 'modal' to
-// false when constructing dialog
-//
-//======================================================================================
-SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg( QWidget* parent,
- QString title,
- QString label,
- const double bottom,
- const double top,
- const int decimals,
- bool modal )
-: QDialog( parent, "MyParameterDialog", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- myIntSpin( 0 ), myDblSpin( 0 )
-{
- /* creating widgets */
- init( true );
- /* title */
- setCaption( title );
- /* caption */
- myTextLabel->setText( label );
- /* range */
- myDblSpin->setRange( bottom, top );
- ((QDoubleValidator*)(myDblSpin->validator()))->setRange( bottom, top, decimals );
-
- /* Move widget on the botton right corner of main widget */
- QAD_Tools::centerWidget( this, parent );
-}
+using namespace std;
//======================================================================================
// function : SMESHGUI_aParameterDlg()
-// purpose : Constructs a SMESHGUI_aParametertDlg for int values
-//
-// parent : parent widget
-// title : is the title for the user in dialog box
-// label : text label for the value
-//
-// bottom : the minimal value to be entered
-// top : the maximum value to be entered
//
// The dialog will by default be modal, unless you set 'modal' to
// false when constructing dialog
//
//======================================================================================
-SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg( QWidget* parent,
- QString title,
- QString label,
- const int bottom,
- const int top,
- bool modal )
+SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
+ (std::list<SMESHGUI_aParameterPtr> params,
+ QWidget* parent,
+ QString title,
+ bool modal )
: QDialog( parent, "MyParameterDialog", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- myIntSpin( 0 ), myDblSpin( 0 )
+ myParamList( params )
{
/* creating widgets */
- init( false );
+ init();
/* title */
setCaption( title );
- /* caption */
- myTextLabel->setText( label );
- /* range */
- myIntSpin->setRange( bottom, top );
- ((QIntValidator*)(myIntSpin->validator()))->setRange( bottom, top );
/* Move widget on the botton right corner of main widget */
QAD_Tools::centerWidget( this, parent );
// function : SMESHGUI_aParameterDlg::init()
// purpose : creates dialog's layout
//======================================================================================
-void SMESHGUI_aParameterDlg::init( bool isDouble )
+void SMESHGUI_aParameterDlg::init()
{
setSizeGripEnabled( TRUE );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
- /* Label */
- /* aTitle1 : text prompt on left of edit line */
- myTextLabel = new QLabel( GroupC1, "TextLabel" );
- GroupC1Layout->addWidget( myTextLabel, 0, 0 );
- /* Spin box */
- if ( isDouble ) {
- myIntSpin = 0;
- myDblSpin = new QAD_SpinBoxDbl( GroupC1 );
- myDblSpin->setPrecision( 12 );
- myDblSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- myDblSpin->setMinimumSize( 150, 0 );
- GroupC1Layout->addWidget( myDblSpin, 0, 1 );
- }
- else {
- myDblSpin = 0;
- myIntSpin = new QSpinBox( GroupC1 );
- myIntSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- myIntSpin->setMinimumSize( 150, 0 );
- GroupC1Layout->addWidget( myIntSpin, 0, 1 );
+ /* Spin boxes with labels */
+ list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
+ for ( int row = 0; paramIt != myParamList.end(); paramIt++ , row++ )
+ {
+ SMESHGUI_aParameterPtr param = (*paramIt);
+ QLabel * label = new QLabel( GroupC1, "TextLabel" );
+ GroupC1Layout->addWidget( label, row, 0 );
+ label->setText( param->Label() );
+ QWidget* aSpinWidget;
+ switch ( param->GetType() ) {
+ case SMESHGUI_aParameter::DOUBLE: {
+ SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox( GroupC1 );
+ aSpinWidget = spin;
+ spin->setPrecision( 12 );
+ break;
+ }
+ case SMESHGUI_aParameter::INT: {
+ QSpinBox* spin = new QSpinBox( GroupC1 );
+ aSpinWidget = spin;
+ break;
+ }
+ default:;
+ }
+ GroupC1Layout->addWidget( aSpinWidget, row, 1 );
+ aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ aSpinWidget->setMinimumSize( 150, 0 );
+ param->InitializeWidget( aSpinWidget );
+ mySpinList.push_back( aSpinWidget );
}
/***************************************************************/
topLayout->addWidget( GroupButtons, 1, 0);
/* signals and slots connections */
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
/* Retrieve SMESHGUI */
{
}
-//======================================================================================
-// function : SMESHGUI_aParameterDlg::setValue
-// purpose : sets double value
-//======================================================================================
-void SMESHGUI_aParameterDlg::setValue( const double val )
-{
- if ( myDblSpin )
- myDblSpin->setValue( val );
-}
-//======================================================================================
-// function : SMESHGUI_aParameterDlg::setValue
-// purpose : sets int value
-//======================================================================================
-void SMESHGUI_aParameterDlg::setValue( const int val )
-{
- if ( myIntSpin )
- myIntSpin->setValue( val );
-}
-//======================================================================================
-// function : SMESHGUI_aParameterDlg::getDblValue
-// purpose : returns double value entered by user
-//======================================================================================
-double SMESHGUI_aParameterDlg::getDblValue()
-{
- if ( myDblSpin )
- return myDblSpin->value();
- return 0.0;
-}
+//=======================================================================
+//function : ClickOnOk
+//purpose :
+//=======================================================================
-//======================================================================================
-// function : SMESHGUI_aParameterDlg::getIntValu
-// purpose : returns int value entered by user
-//======================================================================================
-int SMESHGUI_aParameterDlg::getIntValue()
+void SMESHGUI_aParameterDlg::ClickOnOk()
{
- if ( myIntSpin )
- return myIntSpin->value();
- return 0;
+ if ( !mySMESHGUI->ActiveStudyLocked() ) {
+ list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
+ list<QWidget*>::iterator widgetIt = mySpinList.begin();
+ for ( ;
+ paramIt != myParamList.end() && widgetIt != mySpinList.end();
+ paramIt++ , widgetIt++ )
+ (*paramIt)->TakeValue( *widgetIt );
+
+ accept();
+ }
}
-
-
-
-
-
-
-
+//=======================================================================
+// function : Parameters()
+// purpose : return a list of parameters from a dialog box
+//=======================================================================
+bool SMESHGUI_aParameterDlg::Parameters( list<SMESHGUI_aParameterPtr> params, const char *aTitle)
+{
+ if ( !params.empty() ) {
+ SMESHGUI_aParameterDlg *Dialog =
+ new SMESHGUI_aParameterDlg(params,
+ QAD_Application::getDesktop(),
+ aTitle,
+ TRUE);
+ return (Dialog->exec() == QDialog::Accepted);
+ }
+ return false;
+}
// QT Includes
#include <qdialog.h>
+#include <list>
+#include "SMESHGUI_aParameter.h"
+
class QLabel;
class QPushButton;
-class QSpinBox;
class SMESHGUI;
-class QAD_SpinBoxDbl;
+class QWidget;
+
//=================================================================================
// class : SMESHGUI_aParameterDlg
Q_OBJECT
public:
- SMESHGUI_aParameterDlg( QWidget* parent = 0,
- QString title = QString::null,
- QString label = QString::null,
- const double bottom = -1E6,
- const double top = +1E6,
- const int decimals = 3,
- bool modal = TRUE );
- SMESHGUI_aParameterDlg( QWidget* parent = 0,
- QString title = QString::null,
- QString label = QString::null,
- const int bottom = 0,
- const int top = 1000,
- bool modal = TRUE );
+ SMESHGUI_aParameterDlg( std::list<SMESHGUI_aParameterPtr> params,
+ QWidget* parent = 0,
+ QString title = QString::null,
+ bool modal = TRUE );
~SMESHGUI_aParameterDlg();
- void setValue( const double val );
- void setValue( const int val );
- double getDblValue();
- int getIntValue();
+ /* Parameter function */
+ static bool Parameters( std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
protected:
- void init( bool isDouble );
+ void init();
+
+private slots:
+ void ClickOnOk();
private:
SMESHGUI* mySMESHGUI ;
QPushButton* myButtonOk;
QPushButton* myButtonCancel;
- QLabel* myTextLabel;
- QSpinBox* myIntSpin;
- QAD_SpinBoxDbl* myDblSpin;
+
+ std::list<QWidget*> mySpinList;
+ std::list<SMESHGUI_aParameterPtr> myParamList;
};
#endif // SMESHGUI_aParameterDlg.h
msgid "ICON_DLG_CONNECTIVITY"
msgstr "mesh_connectivity.png"
+#Smoothing
+msgid "ICON_DLG_SMOOTHING"
+msgstr "mesh_smoothing.png"
+
+#Renumbering nodes
+msgid "ICON_DLG_RENUMBERING_NODES"
+msgstr "mesh_renumbering_nodes.png"
+
+#Renumbering elements
+msgid "ICON_DLG_RENUMBERING_ELEMENTS"
+msgstr "mesh_renumbering_elements.png"
+
+#Rotation
+msgid "ICON_DLG_ROTATION"
+msgstr "mesh_rotation.png"
+
+#Translation by vector
+msgid "ICON_SMESH_TRANSLATION_VECTOR"
+msgstr "mesh_translation_vector.png"
+
+#Translation by two points
+msgid "ICON_SMESH_TRANSLATION_POINTS"
+msgstr "mesh_translation_points.png"
+
+#Symmetry by point
+msgid "ICON_SMESH_SYMMETRY_POINT"
+msgstr "mesh_symmetry_point.png"
+
+#Symmetry by axis
+msgid "ICON_SMESH_SYMMETRY_AXIS"
+msgstr "mesh_symmetry_axis.png"
+
+#Symmetry by plane
+msgid "ICON_SMESH_SYMMETRY_PLANE"
+msgstr "mesh_symmetry_plane.png"
+
+#Sew free borders
+msgid "ICON_SMESH_SEWING_FREEBORDERS"
+msgstr "mesh_sew_freeborders.png"
+
+#Sew conform free borders
+msgid "ICON_SMESH_SEWING_CONFORM_FREEBORDERS"
+msgstr "mesh_sew_conform_freeborders.png"
+
+#Sew border to side
+msgid "ICON_SMESH_SEWING_BORDERTOSIDE"
+msgstr "mesh_sew_bordertoside.png"
+
+#Sew side elements
+msgid "ICON_SMESH_SEWING_SIDEELEMENTS"
+msgstr "mesh_sew_sideelements.png"
+
+#Merge nodes
+msgid "ICON_SMESH_MERGE_NODES"
+msgstr "mesh_merge_nodes.png"
#-----------------------------------------------------------
# Hypothesis
msgstr "mesh_vertex.png"
#Line
-msgid "ICON_DLG_LINE"
+msgid "ICON_DLG_EDGE"
msgstr "mesh_line.png"
#triangle
msgid "ICON_CONSTRUCT_GROUP"
msgstr "mesh_make_group.png"
+
+#-----------------------------------------------------------
+# Mesh pattern
+#-----------------------------------------------------------
+
+msgid "ICON_PATTERN_2d"
+msgstr "mesh_algo_mefisto.png"
+
+msgid "ICON_PATTERN_3d"
+msgstr "mesh_algo_hexa.png"
+
+msgid "ICON_PATTERN_SAMPLE_2D"
+msgstr "pattern_sample_2d.png"
+
+msgid "ICON_PATTERN_SAMPLE_3D"
+msgstr "pattern_sample_3D.png"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-# This is a Qt message file in .po format. Each msgid starts with
+OA# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
+"PO-Revision-Date: 2004-04-23 13:04+0400\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
msgid "SMESH_BUT_CREATE"
msgstr "Create"
+#New
+msgid "SMESH_BUT_NEW"
+msgstr "New"
+
+#Delete
+msgid "SMESH_BUT_DELETE"
+msgstr "Delete"
+
+
#-------------------------------------------------------------------------
# WARNING
#-------------------------------------------------------------------------
msgid "SMESH_WRN_WARNING"
msgstr "Warning"
+msgid "SMESH_WARNING"
+msgstr "Warning"
+
+#Error
+msgid "SMESH_OPERATION_FAILED"
+msgstr "Operation failed"
+
#: SMESHGUI.cxx:465
msgid "SMESH_REALLY_DELETE"
msgstr "Do you really want to delete object(s) ?"
msgid "SMESH_WRN_MISSING_PARAMETERS"
msgstr "Missing parameters"
+#Compute failed
+msgid "SMESH_WRN_COMPUTE_FAILED"
+msgstr "Mesh computation failed"
+
#Study frame with VTK Viewer must be activated
msgid "SMESH_WRN_VIEWER_VTK"
msgstr "Study frame with VTK Viewer must be activated"
msgid "SMESH_Z"
msgstr "Z"
+#dX
+msgid "SMESH_DX"
+msgstr "dX"
+
+#dY
+msgid "SMESH_DY"
+msgstr "dY"
+
+#dZ
+msgid "SMESH_DZ"
+msgstr "dZ"
+
+msgid "SMESH_POINT"
+msgstr "Point"
+
+msgid "SMESH_POINT_1"
+msgstr "Point 1"
+
+msgid "SMESH_POINT_2"
+msgstr "Point 2"
+
+msgid "SMESH_VECTOR"
+msgstr "Vector"
+
+#Axis
+msgid "SMESH_AXIS"
+msgstr "Axis"
+
+#Plane
+msgid "SMESH_PLANE"
+msgstr "Plane"
+
+#Normal
+msgid "SMESH_NORMAL"
+msgstr "Normal"
+
+#Parameters
+msgid "SMESH_PARAMETERS"
+msgstr "Parameters"
+
+#Distance
+msgid "SMESH_DISTANCE"
+msgstr "Distance"
+
#-------------------------------------------------------------------------
# DLG
#Node Construction
msgid "MESH_NODE_TITLE"
-msgstr "Node Construction"
+msgstr "Add Node"
#Segments
msgid "SMESH_SEGMENTS"
msgstr "Add Hexahedron"
+#Angle
+msgid "SMESH_ANGLE"
+msgstr "Angle"
+
+#Tolerance
+msgid "SMESH_TOLERANCE"
+msgstr "Tolerance"
+
# -------------- Transparency --------------
#Opacity
msgstr "Transparent <---"
+# -------------- Clipping --------------
+
+#Transparency
+msgid "SMESH_CLIPPING_TITLE"
+msgstr "Change Clipping"
+
+#Front
+msgid "SMESH_CLIPPING_FROM"
+msgstr "From <---"
+
+#Back
+msgid "SMESH_CLIPPING_INTO"
+msgstr "---> Into"
+
+
# -------------- Preferences -----------
#Scalar Bar Preferences
msgid "SMESH_NUMBEROFLABELS"
msgstr "Nb of labels:"
+#Number Of Steps
+msgid "SMESH_NUMBEROFSTEPS"
+msgstr "Number of steps:"
+
#Orientation
msgid "SMESH_ORIENTATION"
msgstr "Orientation"
msgid "SMESH_DIAGONAL_INVERSION_TITLE"
msgstr "Diagonal Inversion"
+#Select whole mesh or submesh
+msgid "SMESH_SELECT_WHOLE_MESH"
+msgstr "Select whole mesh or submesh"
+
+#Smoothing
+msgid "SMESH_SMOOTHING"
+msgstr "Smoothing"
+
+#Renumberig
+msgid "SMESH_RENUMBERING"
+msgstr "Renumbering"
+
+#Renumberig nodes
+msgid "SMESH_RENUMBERING_NODES_TITLE"
+msgstr "Renumbering nodes"
+
+#Renumberig elements
+msgid "SMESH_RENUMBERING_ELEMENTS_TITLE"
+msgstr "Renumbering elements"
+
+#Rotation about an axis
+msgid "SMESH_ROTATION_TITLE"
+msgstr "Rotation about an axis"
+
+#Translation
+msgid "SMESH_TRANSLATION"
+msgstr "Translation"
+
+#Symmetry
+msgid "SMESH_SYMMETRY"
+msgstr "Symmetry"
+
+#Sewing
+msgid "SMESH_SEWING"
+msgstr "Sewing"
+
+#Merge nodes
+msgid "SMESH_MERGE_NODES"
+msgstr "Merge nodes"
+
+#Extrusion
+msgid "SMESH_EXTRUSION"
+msgstr "Extrusion"
+
+#Revolution
+msgid "SMESH_REVOLUTION"
+msgstr "Revolution"
+
+#Create a copy
+msgid "SMESH_CREATE_COPY"
+msgstr "Create a copy"
+
+#Rotation
+msgid "SMESH_ROTATION"
+msgstr "Rotation"
# -------------- Mesh Infos --------------
msgid "SMESH_CONTENT"
msgstr "Content"
-#Select rom
+#Select from
msgid "SMESH_SELECT_FROM"
msgstr "Select From"
msgid "SMESH_GROUP"
msgstr "Group"
+#Geometry group
+msgid "SMESH_GEOM_GROUP"
+msgstr "Geometry group"
+
#%1 SubMeshes
msgid "SMESH_SUBMESH_SELECTED"
msgstr "%1 SubMeshes"
msgid "SMESH_OUTLINE_COLOR"
msgstr "Mesh Object Color"
+# -------------- SMESHGUI_FilterTable --------------
-# -------------- SMESHGUI_FilterDlg --------------
-msgid "SMESHGUI_FilterDlg::FACES_TLT"
-msgstr "Filter for Faces"
-
-msgid "SMESHGUI_FilterDlg::EDGES_TLT"
-msgstr "Filter for Edges"
+msgid "SMESHGUI_FilterTable::FILTER"
+msgstr "Filter"
-msgid "SMESHGUI_FilterDlg::ADD"
+msgid "SMESHGUI_FilterTable::ADD"
msgstr "Add"
-msgid "SMESHGUI_FilterDlg::REMOVE"
+msgid "SMESHGUI_FilterTable::CLEAR"
+msgstr "Clear"
+
+msgid "SMESHGUI_FilterTable::REMOVE"
msgstr "Remove"
-msgid "SMESHGUI_FilterDlg::CRITERION"
+msgid "SMESHGUI_FilterTable::INSERT"
+msgstr "Insert"
+
+msgid "SMESHGUI_FilterTable::ADD_TO"
+msgstr "Add to..."
+
+msgid "SMESHGUI_FilterTable::COPY_FROM"
+msgstr "Copy from..."
+
+msgid "SMESHGUI_FilterTable::ADDITIONAL_PARAMETERS"
+msgstr "Additional parameters"
+
+msgid "SMESHGUI_FilterTable::CRITERION"
msgstr "Criterion"
-msgid "SMESHGUI_FilterDlg::COMPARE"
+msgid "SMESHGUI_FilterTable::COMPARE"
msgstr "Compare"
-msgid "SMESHGUI_FilterDlg::THRESHOLD_VALUE"
+msgid "SMESHGUI_FilterTable::THRESHOLD_VALUE"
msgstr "Threshold value"
-msgid "SMESHGUI_FilterDlg::UNARY"
+msgid "SMESHGUI_FilterTable::UNARY"
msgstr "Unary"
-msgid "SMESHGUI_FilterDlg::BINARY"
+msgid "SMESHGUI_FilterTable::BINARY"
msgstr "Binary"
-msgid "SMESHGUI_FilterDlg::FREE_BORDERS"
+msgid "SMESHGUI_FilterTable::FREE_EDGES"
+msgstr "Free edges"
+
+msgid "SMESHGUI_FilterTable::FREE_BORDERS"
msgstr "Free borders"
-msgid "SMESHGUI_FilterDlg::MULTI_BORDERS"
+msgid "SMESHGUI_FilterTable::MULTI_BORDERS"
msgstr "Borders at multi-connections"
-msgid "SMESHGUI_FilterDlg::LENGTH"
+msgid "SMESHGUI_FilterTable::LENGTH"
msgstr "Length"
-msgid "SMESHGUI_FilterDlg::ASPECT_RATIO"
+msgid "SMESHGUI_FilterTable::ASPECT_RATIO"
msgstr "Aspect ratio"
-msgid "SMESHGUI_FilterDlg::WARPING"
+msgid "SMESHGUI_FilterTable::WARPING"
msgstr "Warping"
-msgid "SMESHGUI_FilterDlg::MINIMUM_ANGLE"
+msgid "SMESHGUI_FilterTable::MINIMUM_ANGLE"
msgstr "Minimum angle"
-msgid "SMESHGUI_FilterDlg::TAPER"
+msgid "SMESHGUI_FilterTable::TAPER"
msgstr "Taper"
-msgid "SMESHGUI_FilterDlg::SKEW"
+msgid "SMESHGUI_FilterTable::SKEW"
msgstr "Skew"
-msgid "SMESHGUI_FilterDlg::AREA"
+msgid "SMESHGUI_FilterTable::AREA"
msgstr "Area"
-msgid "SMESHGUI_FilterDlg::LESS_THAN"
+msgid "SMESHGUI_FilterTable::LESS_THAN"
msgstr "Less than"
-msgid "SMESHGUI_FilterDlg::MORE_THAN"
+msgid "SMESHGUI_FilterTable::MORE_THAN"
msgstr "More than"
-msgid "SMESHGUI_FilterDlg::EQUAL_TO"
+msgid "SMESHGUI_FilterTable::EQUAL_TO"
msgstr "Equal to"
-msgid "SMESHGUI_FilterDlg::NOT"
+msgid "SMESHGUI_FilterTable::NOT"
msgstr "Not"
-msgid "SMESHGUI_FilterDlg::AND"
+msgid "SMESHGUI_FilterTable::AND"
msgstr "And"
-msgid "SMESHGUI_FilterDlg::OR"
+msgid "SMESHGUI_FilterTable::OR"
msgstr "Or"
-msgid "SMESHGUI_FilterDlg::ERROR"
+msgid "SMESHGUI_FilterTable::ERROR"
msgstr "Threshold value is not correctly specified\nPlease enter correct value and try again"
-msgid "SMESHGUI_FilterDlg::MULTIEDGES_ERROR"
+msgid "SMESHGUI_INVALID_PARAMETERS"
+msgstr "Parameters are not correctly specified\nPlease enter correct values and try again"
+
+msgid "SMESHGUI_FilterTable::MULTIEDGES_ERROR"
msgstr "Threshold value of borders at multi-connections can not be equal 1\nPlease enter correct value and try again"
+msgid "SMESHGUI_FilterTable::ENTITY_TYPE"
+msgstr "Entity type"
+
+msgid "SMESHGUI_FilterTable::FACES"
+msgstr "Faces"
+
+msgid "SMESHGUI_FilterTable::EDGES"
+msgstr "Edges"
+
+msgid "SMESHGUI_FilterTable::NODES"
+msgstr "Nodes"
+
+msgid "SMESHGUI_FilterTable::VOLUMES"
+msgstr "Volumes"
+
+msgid "SMESHGUI_FilterTable::ID"
+msgstr "ID"
+
+msgid "SMESHGUI_FilterTable::RANGE_OF_IDS"
+msgstr "Range of IDs"
+
+msgid "SMESHGUI_FilterTable::BELONG_TO_GEOM"
+msgstr "Belong to Geom"
+
+msgid "SMESHGUI_FilterTable::BELONG_TO_PLANE"
+msgstr "Belong to Plane"
+
+msgid "SMESHGUI_FilterTable::BELONG_TO_CYLINDER"
+msgstr "Belong to Cylinder"
+
+# -------------- SMESHGUI_FilterDlg --------------
+msgid "SMESHGUI_FilterDlg::TLT"
+msgstr "Selection filter"
+
+msgid "SMESHGUI_FilterDlg::FACES_TLT"
+msgstr "Filter for Faces"
+
+msgid "SMESHGUI_FilterDlg::EDGES_TLT"
+msgstr "Filter for Edges"
+
+msgid "SMESHGUI_FilterDlg::NODES_TLT"
+msgstr "Filter for Nodes"
+
+msgid "SMESHGUI_FilterDlg::VOLUMES_TLT"
+msgstr "Filter for Volumes"
+
msgid "SMESHGUI_FilterDlg::SOURCE"
msgstr "Source"
msgstr "Mesh"
msgid "SMESHGUI_FilterDlg::SELECTION"
-msgstr "Current Selection"
+msgstr "Initial Selection"
msgid "SMESHGUI_FilterDlg::CURRENT_GROUP"
msgstr "Current Group"
-msgid "SMESHGUI_FilterDlg::NONE"
-msgstr "None"
-
msgid "SMESHGUI_FilterDlg::SET_IN_VIEWER"
msgstr "Insert filter in viewer"
-msgid "SMESHGUI_FilterDlg::CLEAR"
-msgstr "Clear"
+msgid "SMESHGUI_FilterDlg::BAD_SHAPE_NAME"
+msgstr "There is no \"%1\" geometrical object in the current study\nPlease select valid object and try again"
+
+msgid "SMESHGUI_FilterDlg::SHAPE_IS_NOT_A_FACE"
+msgstr "\"%1\" is not a face\nPlease select a face and try again"
+
+msgid "SMESHGUI_FilterDlg::SHAPE_IS_NOT_A_PLANE"
+msgstr "\"%1\" is not a plane\nPlease select a plane and try again"
+
+msgid "SMESHGUI_FilterDlg::SHAPE_IS_NOT_A_CYLINDER"
+msgstr "\"%1\" is not a cylinderical face\nPlease select a cylindrical face and try again"
# -------------- SMESHGUI --------------
-msgid "SMESHGUI::MESH_IS_NOT_SELECTED"
+msgid "MESH_IS_NOT_SELECTED"
msgstr "There is no selected mesh\nPlease, select a mesh and try again"
msgid "SMESHGUI::NOT_A_VTK_VIEWER"
msgstr "This command is available in VTK viewer only\nPlease, create VTK viewer and try again"
-msgid "SMESHGUI::LENGTH_EDGES"
+msgid "LENGTH_EDGES"
msgstr "Length"
-msgid "SMESHGUI::FREE_BORDERS"
+msgid "FREE_BORDERS"
msgstr "Free borders"
-msgid "SMESHGUI::MULTI_BORDERS"
+msgid "MULTI_BORDERS"
msgstr "Borders at multi-connections"
-msgid "SMESHGUI::AREA_ELEMENTS"
+msgid "AREA_ELEMENTS"
msgstr "Area"
-msgid "SMESHGUI::TAPER_ELEMENTS"
+msgid "TAPER_ELEMENTS"
msgstr "Taper"
-msgid "SMESHGUI::ASPECTRATIO_ELEMENTS"
+msgid "ASPECTRATIO_ELEMENTS"
msgstr "Aspect Ratio"
-msgid "SMESHGUI::MINIMUMANGLE_ELEMENTS"
+msgid "MINIMUMANGLE_ELEMENTS"
msgstr "Minimum Angle"
-msgid "SMESHGUI::WARP_ELEMENTS"
-msgstr "Warp"
+msgid "WARP_ELEMENTS"
+msgstr "Warping"
-msgid "SMESHGUI::SKEW_ELEMENTS"
+msgid "SKEW_ELEMENTS"
msgstr "Skew"
msgid "SMESH_INSUFFICIENT_DATA"
msgstr "Insufficient input value"
+msgid "SMESH_CANT_ADD_HYP"
+msgstr "Can not assign \"%1\":\n"
+
+msgid "SMESH_ADD_HYP_WRN"
+msgstr "\"%1\" assigned but:\n"
+
+msgid "SMESH_CANT_RM_HYP"
+msgstr "Can not unassign \"%1\":\n"
+
+msgid "SMESH_RM_HYP_WRN"
+msgstr "\"%1\" unassigned but:\n"
+
msgid "SMESH_HYP_1"
msgstr "Algorithm misses a hypothesis"
msgid "SMESH_HYP_2"
-msgstr "Concurrent hypotheses on a shape"
+msgstr "There are concurrent hypotheses on a shape"
msgid "SMESH_HYP_3"
msgstr "Hypothesis has a bad parameter value"
msgid "SMESH_HYP_4"
-msgstr "Unknown fatal error while assigning hypothesis"
+msgstr "Unknown fatal error at hypothesis definition"
msgid "SMESH_HYP_5"
msgstr "Hypothesis is not suitable in the current context"
msgstr "Non-conform mesh is produced using applied hypotheses"
msgid "SMESH_HYP_7"
-msgstr "Such hypothesis is already assigned to the shape"
+msgstr "Such dimention hypothesis is already assigned to the shape"
msgid "SMESH_HYP_8"
msgstr "Hypothesis and submesh dimensions mismatch"
msgstr " The file is incorrect,\n"
"some information will be missed"
+msgid "SMESH_DRS_EMPTY"
+msgstr " The file is empty,\n"
+ "there is nothing to be published"
+
+msgid "SMESH_EXPORT_UNV"
+msgstr "During export mesh with name - \"%1\" to UNV\n"
+ " pyramid's elements will be missed"
+
msgid "INF_SELECT_OBJECT"
-msgstr "Select an object"
\ No newline at end of file
+msgstr "Select an object"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_FilterLibraryDlg::ADD_TO_TLT"
+msgstr "Add selection filter to library"
+
+msgid "SMESHGUI_FilterLibraryDlg::COPY_FROM_TLT"
+msgstr "Copy selection filter from library"
+
+msgid "SMESHGUI_FilterLibraryDlg::EDIT_LIB_TLT"
+msgstr "Selection filter library"
+
+msgid "SMESHGUI_FilterLibraryDlg::LIBRARY_FILE"
+msgstr "Library file name"
+
+msgid "SMESHGUI_FilterLibraryDlg::ADD"
+msgstr "Add"
+
+msgid "SMESHGUI_FilterLibraryDlg::DELETE"
+msgstr "Delete"
+
+msgid "SMESHGUI_FilterLibraryDlg::FILTER_NAME"
+msgstr "Filter name"
+
+msgid "SMESHGUI_FilterLibraryDlg::OPEN_LIBRARY"
+msgstr "Open library"
+
+msgid "SMESHGUI_FilterLibraryDlg::XML_FILT"
+msgstr "XML files(*.xml)"
+
+msgid "SMESHGUI_FilterLibraryDlg::ALL_FILES_FILTER"
+msgstr "All Files (*.*)"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_LOAD"
+msgstr "It is impossible to load library\nPlease check library file name and attributes"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_FILTER_NAME"
+msgstr "Name of the filter is not unique\nPlease enter other name"
+
+msgid "SMESHGUI_FilterLibraryDlg::EMPTY_FILTER_NAME"
+msgstr "Name of the filter is empty\nPlease enter a non-empty name"
+
+msgid "SMESHGUI_FilterLibraryDlg::FACE"
+msgstr "Face"
+
+msgid "SMESHGUI_FilterLibraryDlg::EDGE"
+msgstr "Edge"
+
+msgid "SMESHGUI_FilterLibraryDlg::NODE"
+msgstr "Node"
+
+msgid "SMESHGUI_FilterLibraryDlg::VOLUME"
+msgstr "Volume"
+
+msgid "SMESHGUI_FilterLibraryDlg::ELEMENT"
+msgstr "Element"
+
+msgid "SMESHGUI_FilterLibraryDlg::LIB_NAME"
+msgstr "FilterLib.xml"
+
+msgid "SMESHGUI_FilterLibraryDlg::SELECTION"
+msgstr "Selection"
+
+msgid "SMESHGUI_FilterLibraryDlg::FILTER"
+msgstr "Filter"
+
+msgid "SMESHGUI_FilterLibraryDlg::LIBRARY_IS_NOT_LOADED"
+msgstr "Library is not loaded. Please load library and try again"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_OF_ADDING"
+msgstr "Internal error occurs during adiing new filter in library.\nPlease verify validity of entered information"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_OF_DELETING"
+msgstr "Internal error occurs during deleting filter from library.\nPlease verify validity of entered information"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_OF_COPYING"
+msgstr "Internal error occurs during copying filter from library.\nPlease verify validity of entered information"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_OF_EDITING"
+msgstr "Internal error occurs during editing filter library.\nPlease verify validity of entered information"
+
+msgid "SMESHGUI_FilterLibraryDlg::ASSIGN_NEW_NAME"
+msgstr "Library already contains filter with name \"%1\"\nNew name \"%2\" is assigned to added filter"
+
+msgid "SMESHGUI_FilterLibraryDlg::FILTER_NAMES"
+msgstr "Names of filters"
+
+msgid "SMESHGUI_FilterLibraryDlg::NO_PERMISSION"
+msgstr "You do not have write permission to this file"
+
+msgid "SMESHGUI_FilterLibraryDlg::ERROR_OF_SAVING"
+msgstr "Internal error occurs during saving filter library\nPlease check input data and try again"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_SingleEditDlg::EDGE_BETWEEN"
+msgstr "Edge between neighboring triangles"
+
+msgid "SMESHGUI_TrianglesInversionDlg::CAPTION"
+msgstr "Diagonal inversion"
+
+msgid "SMESHGUI_UnionOfTwoTrianglesDlg::CAPTION"
+msgstr "Union of two triangles"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_MultiEditDlg::FILTER"
+msgstr "Filter"
+
+msgid "SMESHGUI_MultiEditDlg::ADD"
+msgstr "Add"
+
+msgid "SMESHGUI_MultiEditDlg::REMOVE"
+msgstr "Remove"
+
+msgid "SMESHGUI_MultiEditDlg::SORT_LIST"
+msgstr "Sort list"
+
+msgid "SMESHGUI_MultiEditDlg::TO_ALL"
+msgstr "Apply to all"
+
+msgid "SMESHGUI_MultiEditDlg::SELECT_FROM"
+msgstr "Select from"
+
+msgid "SMESHGUI_MultiEditDlg::GROUP"
+msgstr "Group"
+
+msgid "SMESHGUI_ChangeOrientationDlg::CAPTION"
+msgstr "Modification of orientation"
+
+msgid "SMESHGUI_UnionOfTrianglesDlg::CAPTION"
+msgstr "Union of triangles"
+
+msgid "SMESHGUI_CuttingOfQuadsDlg::CAPTION"
+msgstr "Cutting of quadrangles"
+
+msgid "SMESHGUI_CuttingOfQuadsDlg::USE_DIAGONAL_2_4"
+msgstr "Use diagonal 2-4"
+
+msgid "SMESHGUI_CuttingOfQuadsDlg::PREVIEW"
+msgstr "Preview"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_MoveNodesDlg::CAPTION"
+msgstr "Move node"
+
+msgid "SMESHGUI_MoveNodesDlg::NODE_ID"
+msgstr "Node ID"
+
+msgid "SMESHGUI_MoveNodesDlg::NODE_ID_IS_NOT_DEFINED"
+msgstr "Node ID is not defined"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_DeleteGroupDlg::CAPTION"
+msgstr "Delete groups with contents"
+
+msgid "SMESHGUI_DeleteGroupDlg::SELECTED_GROUPS"
+msgstr "Selected groups"
+
+msgid "SMESHGUI_DeleteGroupDlg::NO_SELECTED_GROUPS"
+msgstr "There are no selected groups\nPlease select a groups and try again"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_GroupOpDlg::NAME"
+msgstr "Name"
+
+msgid "SMESHGUI_GroupOpDlg::RESULT_NAME"
+msgstr "Result name"
+
+msgid "SMESHGUI_GroupOpDlg::ARGUMENTS"
+msgstr "Arguments"
+
+msgid "SMESHGUI_GroupOpDlg::OBJECT_1"
+msgstr "Object 1"
+
+msgid "SMESHGUI_GroupOpDlg::OBJECT_2"
+msgstr "Object 2"
+
+msgid "SMESHGUI_GroupOpDlg::MAIN_OBJECT"
+msgstr "Main object"
+
+msgid "SMESHGUI_GroupOpDlg::TOOL_OBJECT"
+msgstr "Tool object"
+
+msgid "SMESHGUI_GroupOpDlg::UNION_OF_TWO_GROUPS"
+msgstr "Union of two groups"
+
+msgid "SMESHGUI_GroupOpDlg::INTERSECTION_OF_TWO_GROUPS"
+msgstr "Intersection of two groups"
+
+msgid "SMESHGUI_GroupOpDlg::CUT_OF_TWO_GROUPS"
+msgstr "Cut of two groups"
+
+msgid "SMESHGUI_GroupOpDlg::INCORRECT_ARGUMENTS"
+msgstr "Arguments of operation are not specified\nPlease specify them and try again"
+
+msgid "SMESHGUI_GroupOpDlg::DIFF_MESHES"
+msgstr "Arguments of operation are not correctly specified\nGroups correspond to a different meshes\nPlease specify valid arguments and try again"
+
+msgid "SMESHGUI_GroupOpDlg::DIFF_TYPES"
+msgstr "Arguments of operation are not correctly specified\nGroups contain elements of different types\nPlease specify valid arguments and try again"
+
+msgid "SMESHGUI_GroupOpDlg::EMPTY_NAME"
+msgstr "Name of group to be created is not valid\nPlease specify non-empty name and try again"
+
+#----------------------------------------------------
+
+
+msgid "SMESHGUI_SmoothingDlg::FIXED_NODES_IDS"
+msgstr "Fixed nodes ids"
+
+msgid "SMESHGUI_SmoothingDlg::METHOD"
+msgstr "Method"
+
+msgid "SMESHGUI_SmoothingDlg::ITERATION_LIMIT"
+msgstr "Iteration limit"
+
+msgid "SMESHGUI_SmoothingDlg::MAX_ASPECT_RATIO"
+msgstr "Max. aspect ratio"
+
+msgid "SMESHGUI_SmoothingDlg::LAPLACIAN"
+msgstr "Laplacian"
+
+msgid "SMESHGUI_SmoothingDlg::CENTROIDAL"
+msgstr "Centroidal"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_ALONG_LINE"
+msgstr "Extrusion along a line"
+
+
+msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_1D"
+msgstr "Extrusion of 1D elements"
+
+msgid "SMESHGUI_ExtrusionDlg::EXTRUSION_2D"
+msgstr "Extrusion of 2D elements"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_RevolutionDlg::REVOLUTION_AROUND_AXIS"
+msgstr "Revolution around an axis"
+
+msgid "SMESHGUI_RevolutionDlg::REVOLUTION_1D"
+msgstr "Revolution of 1D elements"
+
+msgid "SMESHGUI_RevolutionDlg::REVOLUTION_2D"
+msgstr "Revolution of 2D elements"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_SewingDlg::MERGE_EQUAL_ELEMENTS"
+msgstr "Merge equal elements"
+
+msgid "SMESHGUI_SewingDlg::SEW_FREE_BORDERS"
+msgstr "Sew Free Borders"
+
+msgid "SMESHGUI_SewingDlg::BORDER"
+msgstr "Border"
+
+msgid "SMESHGUI_SewingDlg::BORDER_1"
+msgstr "Border 1"
+
+msgid "SMESHGUI_SewingDlg::BORDER_2"
+msgstr "Border 2"
+
+msgid "SMESHGUI_SewingDlg::SEW_CONFORM_FREE_BORDERS"
+msgstr "Sew Conform Free Borders"
+
+msgid "SMESHGUI_SewingDlg::SEW_BORDER_TO_SIDE"
+msgstr "Sew Border To Side"
+
+msgid "SMESHGUI_SewingDlg::SIDE"
+msgstr "Side"
+
+msgid "SMESHGUI_SewingDlg::SEW_SIDE_ELEMENTS"
+msgstr "Sew Side Elements"
+
+msgid "SMESHGUI_SewingDlg::SIDE_1"
+msgstr "Side 1"
+
+msgid "SMESHGUI_SewingDlg::SIDE_2"
+msgstr "Side 2"
+
+msgid "SMESHGUI_SewingDlg::NODE1_TO_MERGE"
+msgstr "Node 1 To Merge"
+
+msgid "SMESHGUI_SewingDlg::NODE2_TO_MERGE"
+msgstr "Node 2 To Merge"
+
+msgid "SMESHGUI_SewingDlg::FIRST_NODE_ID"
+msgstr "First Node ID"
+
+msgid "SMESHGUI_SewingDlg::SECOND_NODE_ID"
+msgstr "Second Node ID"
+
+msgid "SMESHGUI_SewingDlg::LAST_NODE_ID"
+msgstr "Last Node ID"
+
+#----------------------------------------------------
+
+#Coincident nodes
+msgid "SMESHGUI_MergeNodesDlg::COINCIDENT_NODES"
+msgstr "Coincident nodes"
+
+#Detect
+msgid "SMESHGUI_MergeNodesDlg::DETECT"
+msgstr "Detect"
+
+#Select all
+msgid "SMESHGUI_MergeNodesDlg::SELECT_ALL"
+msgstr "Select all"
+
+# Edit group of nodes
+msgid "SMESHGUI_MergeNodesDlg::EDIT_GROUP_OF_NODES"
+msgstr "Edit group of nodes"
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_MeshPatternDlg::CAPTION"
+msgstr "Pattern Mapping"
+
+msgid "SMESHGUI_MeshPatternDlg::PATTERN_TYPE"
+msgstr "Pattern type"
+
+msgid "SMESHGUI_MeshPatternDlg::PATTERN"
+msgstr "Pattern"
+
+msgid "SMESHGUI_MeshPatternDlg::NEW"
+msgstr "New..."
+
+msgid "SMESHGUI_MeshPatternDlg::FACE"
+msgstr "Face"
+
+msgid "SMESHGUI_MeshPatternDlg::VERTEX"
+msgstr "Vertex "
+
+msgid "SMESHGUI_MeshPatternDlg::VERTEX1"
+msgstr "Vertex 1"
+
+msgid "SMESHGUI_MeshPatternDlg::VERTEX2"
+msgstr "Vertex 2"
+
+msgid "SMESHGUI_MeshPatternDlg::REVERSE"
+msgstr "Reverse order of key-points"
+
+msgid "SMESHGUI_MeshPatternDlg::PREVIEW"
+msgstr "Preview"
+
+msgid "SMESHGUI_MeshPatternDlg::3D_BLOCK"
+msgstr "3D block"
+
+msgid "SMESHGUI_MeshPatternDlg::LOAD_PATTERN"
+msgstr "Load pattern"
+
+msgid "SMESHGUI_MeshPatternDlg::PATTERN_FILT"
+msgstr "Pattern files(*.smp)"
+
+msgid "SMESHGUI_MeshPatternDlg::ERROR_OF_LOADING"
+msgstr "Loading of pattern from file failed. Probably file\nis corrupted or contains pattern of the other type"
+
+msgid "SMESHGUI_MeshPatternDlg::ERROR_OF_OPENING"
+msgstr "It is impossible to open file. Please verify whether\nfile exists and your permission to this file"
+
+msgid "SMESHGUI_MeshPatternDlg::ERROR_OF_READING"
+msgstr "It is impossible to load pattern\nPlease verify file's contents"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_NB_POINTS"
+msgstr "It is impossible to load pattern\nIt is impossible to read number of points from file"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_POINT_COORDS"
+msgstr "It is impossible to load pattern\nIt is impossible to read point coordinates from file"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_TOO_FEW_POINTS"
+msgstr "It is impossible to load pattern. There are\n too few points in the file for pattern loading"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_3D_COORD"
+msgstr "It is impossible to load pattern\nCoordinates of 3D points out of [0,1] range"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_NO_KEYPOINT"
+msgstr "It is impossible to load pattern\nThere are no key-points in 2D one"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_BAD_INDEX"
+msgstr "It is impossible to load pattern\nInvalid index of point detected"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_ELEM_POINTS"
+msgstr "It is impossible to load pattern\ninvalid number of points in element"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_NO_ELEMS"
+msgstr "It is impossible to load pattern\nThere are no elements in it"
+
+msgid "SMESHGUI_MeshPatternDlg::ERR_READ_BAD_KEY_POINT"
+msgstr "It is impossible to load pattern\nKey-point not on a boundary"
+
+
+#----------------------------------------------------
+
+msgid "SMESHGUI_CreatePatternDlg::CAPTION"
+msgstr "Pattern Creation"
+
+msgid "SMESHGUI_CreatePatternDlg::MESH_OR_SUBMESH"
+msgstr "Mesh or SubMesh"
+
+msgid "SMESHGUI_CreatePatternDlg::PROJECT"
+msgstr "Project nodes on the face"
+
+msgid "SMESHGUI_CreatePatternDlg::PATTERN"
+msgstr "Pattern"
+
+msgid "SMESHGUI_CreatePatternDlg::PATTERN_NAME"
+msgstr "Pattern name"
+
+msgid "SMESHGUI_CreatePatternDlg::SAVE"
+msgstr "Save..."
+
+msgid "SMESHGUI_CreatePatternDlg::ERROR_OF_CREATION"
+msgstr "Internal error occurs during pattern creation\nPlease verify validity of entered information"
+
+msgid "SMESHGUI_CreatePatternDlg::DEFAULT_2D"
+msgstr "Pattern_2d"
+
+msgid "SMESHGUI_CreatePatternDlg::DEFAULT_3D"
+msgstr "Pattern_3d"
+
+msgid "SMESHGUI_CreatePatternDlg::SAVE_PATTERN"
+msgstr "Save Pattern"
+
+msgid "SMESHGUI_CreatePatternDlg::ERROR_OF_SAVING"
+msgstr "Internal error occurs during pattern saving. Please verify\n\free disk space and your write permission to this file"
+
+msgid "SMESHGUI_CreatePatternDlg::PATTERN_TYPE"
+msgstr "Pattern type"
+
+msgid "SMESHGUI_CreatePatternDlg::PATTERN_FILT"
+msgstr "Pattern files(*.smp)"
+
+msgid "SMESHGUI_CreatePatternDlg::ERR_LOAD_EMPTY_SUBMESH"
+msgstr "There are no elements to create pattern"
+
+msgid "SMESHGUI_CreatePatternDlg::ERR_LOADF_NARROW_FACE"
+msgstr "It is impossible to create pattern from narrow face"
+
+msgid "SMESHGUI_CreatePatternDlg::ERR_LOADF_CLOSED_FACE"
+msgstr "It is impossible to create pattern from face having seam edge"
+
+msgid "SMESHGUI_CreatePatternDlg::ERR_LOADV_BAD_SHAPE"
+msgstr "Pattern can be created from closed shell or solid with 6 faces only"
+
+msgid "SMESHGUI_CreatePatternDlg::ERR_LOADV_COMPUTE_PARAMS"
+msgstr "It is impossible to compute point parameters"
+
+#-------------------------------------------------------------------------
+
+msgid "SMESHGUI_PrecisionDlg::CAPTION"
+msgstr "Precision for mesh quality controls"
+
+msgid "SMESHGUI_PrecisionDlg::PRECISION"
+msgstr "Number of digits after point"
+
+msgid "SMESHGUI_PrecisionDlg::NOT_USE"
+msgstr "Do not use"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
SMESH_2D_Algo_i.hxx \
SMESH_3D_Algo_i.hxx \
SMESH_subMesh_i.hxx \
- SMESH_topo.hxx \
SMESH_Mesh_i.hxx \
SMESH_Hypothesis_i.hxx
SMESH_subMesh_i.cxx \
SMESH_MeshEditor_i.cxx \
SMESH_Hypothesis_i.cxx \
- SMESH_topo.cxx \
SMESH_Algo_i.cxx \
SMESH_1D_Algo_i.cxx \
SMESH_2D_Algo_i.cxx \
SMESH_3D_Algo_i.cxx \
SMESH_Filter_i.cxx \
- SMESH_Group_i.cxx
+ SMESH_Group_i.cxx \
+ SMESH_Pattern_i.cxx
LIB_SERVER_IDL = SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Mesh.idl \
SALOME_Component.idl SALOME_Exception.idl \
- SMESH_Filter.idl SMESH_Group.idl
+ SMESH_Filter.idl SMESH_Group.idl SMESH_Pattern.idl
-LIB_CLIENT_IDL = SALOMEDS.idl GEOM_Gen.idl GEOM_Shape.idl MED.idl SALOMEDS_Attributes.idl SALOME_GenericObj.idl
+LIB_CLIENT_IDL = SALOMEDS.idl GEOM_Gen.idl MED.idl SALOMEDS_Attributes.idl SALOME_GenericObj.idl
# Executables targets
-BIN =
+BIN = SMESHEngine
BIN_SRC =
# additionnal information to compil and link file
CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
-I${GEOM_ROOT_DIR}/include/salome
-#IDLCXXFLAGS+= -Wbtp
+LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lRegistry -lSalomeHDFPersist -lSalomeLifeCycleCORBA -lTOOLSDS -lSalomeGenericObj \
+ -L${GEOM_ROOT_DIR}/lib/salome -lGEOMClient -lSMESHimpl -lSMESHControls \
+ -L${CASROOT}/lin/lib -lTKCDF -lTKBO
-LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGEOMClient -lSMESHDS -lSMDS -lMeshDriverMED -lSalomeLifeCycleCORBA -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
+
+LDFLAGSFORBIN += -lSMDS -lSMESHDS -lMEDWrapper -lMeshDriver -lMeshDriverMED -lMeshDriverUNV -lMeshDriverDAT -lMeshDriverSTL \
+ -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lRegistry \
+ -lOpUtil -lSALOMELocalTrace -lSalomeNotification \
+ -lSalomeHDFPersist -lSalomeLifeCycleCORBA -lTOOLSDS -lSalomeGenericObj \
+ -L${GEOM_ROOT_DIR}/lib/salome -lGEOMClient -lSMESHimpl -lSMESHControls \
+ -L${CASROOT}/lin/lib -lTKCDF -lTKBO
@CONCLUDE@
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+int main(int argc, char** argv)
+{
+ return 1;
+}
int nbHyp = hypList.size();
listOfHypothesis->length( nbHyp );
for ( int i = 0; i < nbHyp; i++ ) {
- listOfHypothesis[ i ] = strdup( hypList[ i ].c_str() );
+ listOfHypothesis[ i ] = CORBA::string_dup( hypList[ i ].c_str() );
}
return listOfHypothesis._retn();
}
#include "SMESH_Filter_i.hxx"
-#include "SMDS_Iterator.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "SMDSAbs_ElementType.hxx"
#include "SMESH_Gen_i.hxx"
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_MeshElement.hxx"
+
#include "SMESHDS_Mesh.hxx"
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <gp_XYZ.hxx>
-#include <Precision.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
+#include <LDOM_Document.hxx>
+#include <LDOM_Element.hxx>
+#include <LDOM_Node.hxx>
+#include <LDOMString.hxx>
+#include <LDOMParser.hxx>
+#include <LDOM_XmlWriter.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListOfReal.hxx>
#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_SequenceOfHAsciiString.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <Precision.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <TopExp_Explorer.hxx>
+#include <OSD_Path.hxx>
+#include <OSD_File.hxx>
+
+using namespace SMESH;
+using namespace SMESH::Controls;
/*
- AUXILIARY METHODS
+ Class : BelongToGeom
+ Description : Predicate for verifying whether entiy belong to
+ specified geometrical support
*/
-static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
-{
- return gp_Vec( P1 - P2 ).Angle( gp_Vec( P3 - P2 ) );
-}
+Controls::BelongToGeom::BelongToGeom()
+: myMeshDS(NULL),
+ myType(SMDSAbs_All)
+{}
-static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+void Controls::BelongToGeom::SetMesh( SMDS_Mesh* theMesh )
{
- gp_Vec aVec1( P2 - P1 );
- gp_Vec aVec2( P3 - P1 );
- return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+ myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
}
-static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
{
- return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+ myShape = theShape;
}
-static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
+static bool IsContains( SMESHDS_Mesh* theMeshDS,
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE )
{
- double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
- return aDist;
+ TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
+
+ while( anExp.More() )
+ {
+ const TopoDS_Shape& aShape = anExp.Current();
+ if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
+ if( aSubMesh->Contains( theElem ) )
+ return true;
+ }
+ anExp.Next();
+ }
+ return false;
}
-static int getNbMultiConnection( SMESHDS_Mesh* theMesh, const int theId )
+bool Controls::BelongToGeom::IsSatisfy( long theId )
{
- if ( theMesh == 0 )
- return 0;
-
- const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
- if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
- return 0;
-
- TColStd_MapOfInteger aMap;
+ if ( myMeshDS == 0 || myShape.IsNull() )
+ return false;
- int aResult = 0;
- SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
- if ( anIter != 0 )
+ if( myType == SMDSAbs_Node )
+ {
+ if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
+ {
+ const SMDS_PositionPtr& aPosition = aNode->GetPosition();
+ SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
+ switch( aTypeOfPosition )
+ {
+ case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
+ case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
+ case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
+ case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
+ }
+ }
+ }
+ else
{
- while( anIter->more() )
+ if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
{
- const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode == 0 )
- return 0;
- SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
- while( anElemIter->more() )
+ if( myType == SMDSAbs_All )
{
- const SMDS_MeshElement* anElem = anElemIter->next();
- if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge )
+ return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
+ IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
+ IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+ IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID );
+ }
+ else if( myType == anElem->GetType() )
+ {
+ switch( myType )
{
- int anId = anElem->GetID();
-
- if ( anIter->more() ) // i.e. first node
- aMap.Add( anId );
- else if ( aMap.Contains( anId ) )
- aResult++;
+ case SMDSAbs_Edge : return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE );
+ case SMDSAbs_Face : return IsContains( myMeshDS,myShape,anElem,TopAbs_FACE );
+ case SMDSAbs_Volume: return IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+ IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID );
}
}
-// delete anElemIter;
}
-// delete anIter;
}
+
+ return false;
+}
- return aResult;
+void Controls::BelongToGeom::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
}
-using namespace std;
-using namespace SMESH;
+SMDSAbs_ElementType Controls::BelongToGeom::GetType() const
+{
+ return myType;
+}
+
+TopoDS_Shape Controls::BelongToGeom::GetShape()
+{
+ return myShape;
+}
+
+SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS()
+{
+ return myMeshDS;
+}
-/*
- FUNCTORS
-*/
/*
- Class : NumericalFunctor_i
- Description : Base class for numerical functors
+ AUXILIARY METHODS
*/
-NumericalFunctor_i::NumericalFunctor_i()
-: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
+static inline SMDS_Mesh* MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
{
- myMesh = 0;
- SMESH_Gen_i::GetPOA()->activate_object( this );
+ SMESH_Mesh_i* anImplPtr =
+ dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+ return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
}
-void NumericalFunctor_i::SetMesh( SMESH_Mesh_ptr theMesh )
+static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList )
{
- SMESH_Mesh_i* anImplPtr =
- dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
- myMesh = anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
+ SMESH::long_array_var anArray = new SMESH::long_array;
+ anArray->length( aList.Extent() );
+ TColStd_ListIteratorOfListOfInteger anIter( aList );
+ int i = 0;
+ for( ; anIter.More(); anIter.Next() )
+ anArray[ i++ ] = anIter.Value();
+
+ return anArray._retn();
}
-bool NumericalFunctor_i::getPoints( const int theId,
- TColgp_SequenceOfXYZ& theRes ) const
+static inline SMESH::double_array* toArray( const TColStd_ListOfReal& aList )
{
- theRes.Clear();
+ SMESH::double_array_var anArray = new SMESH::double_array;
+ anArray->length( aList.Extent() );
+ TColStd_ListIteratorOfListOfReal anIter( aList );
+ int i = 0;
+ for( ; anIter.More(); anIter.Next() )
+ anArray[ i++ ] = anIter.Value();
- if ( myMesh == 0 )
- return false;
+ return anArray._retn();
+}
- // Get nodes of the face
- const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
- if ( anElem == 0 || anElem->GetType() != GetType() )
- return false;
+static SMESH::Filter::Criterion createCriterion()
+{
+ SMESH::Filter::Criterion aCriterion;
+
+ aCriterion.Type = FT_Undefined;
+ aCriterion.Compare = FT_Undefined;
+ aCriterion.Threshold = 0;
+ aCriterion.UnaryOp = FT_Undefined;
+ aCriterion.BinaryOp = FT_Undefined;
+ aCriterion.ThresholdStr = "";
+ aCriterion.Tolerance = Precision::Confusion();
+ aCriterion.TypeOfElement = SMESH::ALL;
+ aCriterion.Precision = -1;
- int nbNodes = anElem->NbNodes();
+ return aCriterion;
+}
- SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
- if ( anIter != 0 )
+static TopoDS_Shape getShapeByName( const char* theName )
+{
+ if ( theName != 0 )
{
- while( anIter->more() )
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+ if ( aStudy != 0 )
{
- const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode != 0 )
- theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+ SALOMEDS::Study::ListOfSObject_var aList =
+ aStudy->FindObjectByName( theName, "GEOM" );
+ if ( aList->length() > 0 )
+ {
+ GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
+ if ( !aGeomObj->_is_nil() )
+ {
+ GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+ TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj );
+ return aLocShape;
+ }
+ }
}
-
-// delete anIter;
}
-
- return true;
+ return TopoDS_Shape();
}
+
/*
- Class : SMESH_MinimumAngleFunct
- Description : Functor for calculation of minimum angle
+ FUNCTORS
*/
-CORBA::Double MinimumAngle_i::GetValue( CORBA::Long theId )
+/*
+ Class : Functor_i
+ Description : An abstact class for all functors
+*/
+Functor_i::Functor_i():
+ SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 3 && P.Length() != 4 )
- return 0;
-
- double aMin;
-
- if ( P.Length() == 3 )
- {
- double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
- double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
- double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
+ SMESH_Gen_i::GetPOA()->activate_object( this );
+}
- aMin = Min( A0, Min( A1, A2 ) );
- }
- else
- {
- double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
- double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
- double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
- double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
-
- aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
- }
-
- return aMin * 180 / PI;
+void Functor_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+ myFunctorPtr->SetMesh( MeshPtr2SMDSMesh( theMesh ) );
+ INFOS("Functor_i::SetMesh~");
}
-int MinimumAngle_i::GetType() const
+ElementType Functor_i::GetElementType()
{
- return SMDSAbs_Face;
+ return ( ElementType )myFunctorPtr->GetType();
}
+
/*
- Class : AspectRatio_i
- Description : Functor for calculating aspect ratio
+ Class : NumericalFunctor_i
+ Description : Base class for numerical functors
*/
-
-CORBA::Double AspectRatio_i::GetValue( CORBA::Long theId )
+CORBA::Double NumericalFunctor_i::GetValue( CORBA::Long theId )
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 3 && P.Length() != 4 )
- return 0;
-
- int nbNodes = P.Length();
-
- // Compute lengths of the sides
-
- double aLen[ nbNodes ];
- for ( int i = 0; i < nbNodes - 1; i++ )
- aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
- aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) );
-
- // Compute aspect ratio
+ return myNumericalFunctorPtr->GetValue( theId );
+}
- if ( nbNodes == 3 )
- {
- double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
- double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
- static double aCoef = sqrt( 3. ) / 4;
+void NumericalFunctor_i::SetPrecision( CORBA::Long thePrecision )
+{
+ myNumericalFunctorPtr->SetPrecision( thePrecision );
+}
- return anArea != 0 ? aCoef * aMaxLen * aMaxLen / anArea : 0;
- }
- else
- {
- double aMaxLen = Max( Max( aLen[ 0 ], aLen[ 1 ] ), Max( aLen[ 2 ], aLen[ 3 ] ) );
- double aMinLen = Min( Min( aLen[ 0 ], aLen[ 1 ] ), Min( aLen[ 2 ], aLen[ 3 ] ) );
-
- return aMinLen != 0 ? aMaxLen / aMinLen : 0;
- }
+CORBA::Long NumericalFunctor_i::GetPrecision()
+{
+ return myNumericalFunctorPtr->GetPrecision();
}
-int AspectRatio_i::GetType() const
+Controls::NumericalFunctorPtr NumericalFunctor_i::GetNumericalFunctor()
{
- return SMDSAbs_Face;
+ return myNumericalFunctorPtr;
}
+
/*
- Class : Warping_i
- Description : Functor for calculating warping
+ Class : SMESH_MinimumAngle
+ Description : Functor for calculation of minimum angle
*/
-
-CORBA::Double Warping_i::GetValue( CORBA::Long theId )
+MinimumAngle_i::MinimumAngle_i()
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 4 )
- return 0;
+ myNumericalFunctorPtr.reset( new Controls::MinimumAngle() );
+ myFunctorPtr = myNumericalFunctorPtr;
+}
- gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
+FunctorType MinimumAngle_i::GetFunctorType()
+{
+ return SMESH::FT_MinimumAngle;
+}
- double A1 = ComputeA( P( 1 ), P( 2 ), P( 3 ), G );
- double A2 = ComputeA( P( 2 ), P( 3 ), P( 4 ), G );
- double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
- double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
- return Max( Max( A1, A2 ), Max( A3, A4 ) );
+/*
+ Class : AspectRatio
+ Description : Functor for calculating aspect ratio
+*/
+AspectRatio_i::AspectRatio_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::AspectRatio() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-double Warping_i::ComputeA( const gp_XYZ& thePnt1,
- const gp_XYZ& thePnt2,
- const gp_XYZ& thePnt3,
- const gp_XYZ& theG ) const
+FunctorType AspectRatio_i::GetFunctorType()
{
- double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
- double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
- double L = Min( aLen1, aLen2 ) * 0.5;
+ return SMESH::FT_AspectRatio;
+}
- gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
- gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
- gp_XYZ N = GI.Crossed( GJ );
- N.Normalize();
- double H = gp_Vec( thePnt2 - theG ).Dot( gp_Vec( N ) );
- return asin( fabs( H / L ) ) * 180 / PI;
+/*
+ Class : Warping_i
+ Description : Functor for calculating warping
+*/
+Warping_i::Warping_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::Warping() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int Warping_i::GetType() const
+FunctorType Warping_i::GetFunctorType()
{
- return SMDSAbs_Face;
+ return SMESH::FT_Warping;
}
+
/*
Class : Taper_i
Description : Functor for calculating taper
*/
-
-CORBA::Double Taper_i::GetValue( CORBA::Long theId )
+Taper_i::Taper_i()
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 4 )
- return 0;
-
- // Compute taper
- double J1 = getArea( P( 4 ), P( 1 ), P( 2 ) ) / 2;
- double J2 = getArea( P( 3 ), P( 1 ), P( 2 ) ) / 2;
- double J3 = getArea( P( 2 ), P( 3 ), P( 4 ) ) / 2;
- double J4 = getArea( P( 3 ), P( 4 ), P( 1 ) ) / 2;
-
- double JA = 0.25 * ( J1 + J2 + J3 + J4 );
-
- double T1 = fabs( ( J1 - JA ) / JA );
- double T2 = fabs( ( J2 - JA ) / JA );
- double T3 = fabs( ( J3 - JA ) / JA );
- double T4 = fabs( ( J4 - JA ) / JA );
-
- return Max( Max( T1, T2 ), Max( T3, T4 ) );
+ myNumericalFunctorPtr.reset( new Controls::Taper() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int Taper_i::GetType() const
+FunctorType Taper_i::GetFunctorType()
{
- return SMDSAbs_Face;
+ return SMESH::FT_Taper;
}
+
/*
Class : Skew_i
Description : Functor for calculating skew in degrees
*/
-
-static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ& p3 )
-{
- gp_XYZ p12 = ( p2 + p1 ) / 2;
- gp_XYZ p23 = ( p3 + p2 ) / 2;
- gp_XYZ p31 = ( p3 + p1 ) / 2;
-
- return gp_Vec( p31 - p2 ).Angle( p12 - p23 );
-}
-
-CORBA::Double Skew_i::GetValue( CORBA::Long theId )
+Skew_i::Skew_i()
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 3 && P.Length() != 4 )
- return 0;
-
- // Compute skew
- static double PI2 = PI / 2;
- if ( P.Length() == 3 )
- {
- double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
- double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
- double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
-
- return Max( A0, Max( A1, A2 ) ) * 180 / PI;
- }
- else
- {
- gp_XYZ p12 = ( P( 1 ) + P( 2 ) ) / 2;
- gp_XYZ p23 = ( P( 2 ) + P( 3 ) ) / 2;
- gp_XYZ p34 = ( P( 3 ) + P( 4 ) ) / 2;
- gp_XYZ p41 = ( P( 4 ) + P( 1 ) ) / 2;
-
- double A = fabs( PI2 - gp_Vec( p34 - p12 ).Angle( p23 - p41 ) );
-
- return A * 180 / PI;
- }
+ myNumericalFunctorPtr.reset( new Controls::Skew() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int Skew_i::GetType() const
+FunctorType Skew_i::GetFunctorType()
{
- return SMDSAbs_Face;
+ return SMESH::FT_Skew;
}
/*
Class : Area_i
Description : Functor for calculating area
*/
-
-CORBA::Double Area_i::GetValue( CORBA::Long theId )
+Area_i::Area_i()
{
- TColgp_SequenceOfXYZ P;
- if ( !getPoints( theId, P ) || P.Length() != 3 && P.Length() != 4 )
- return 0;
-
- if ( P.Length() == 3 )
- return getArea( P( 1 ), P( 2 ), P( 3 ) );
- else
- return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
+ myNumericalFunctorPtr.reset( new Controls::Area() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int Area_i::GetType() const
+FunctorType Area_i::GetFunctorType()
{
- return SMDSAbs_Face;
+ return SMESH::FT_Area;
}
/*
Class : Length_i
Description : Functor for calculating length off edge
*/
-
-CORBA::Double Length_i::GetValue( CORBA::Long theId )
+Length_i::Length_i()
{
- TColgp_SequenceOfXYZ P;
- return getPoints( theId, P ) && P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0;
+ myNumericalFunctorPtr.reset( new Controls::Length() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int Length_i::GetType() const
+FunctorType Length_i::GetFunctorType()
{
- return SMDSAbs_Edge;
+ return SMESH::FT_Length;
}
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
*/
-
-CORBA::Double MultiConnection_i::GetValue( CORBA::Long theId )
+MultiConnection_i::MultiConnection_i()
{
- return getNbMultiConnection( myMesh, theId );
+ myNumericalFunctorPtr.reset( new Controls::MultiConnection() );
+ myFunctorPtr = myNumericalFunctorPtr;
}
-int MultiConnection_i::GetType() const
+FunctorType MultiConnection_i::GetFunctorType()
{
- return SMDSAbs_Edge;
+ return SMESH::FT_MultiConnection;
}
+
/*
PREDICATES
*/
+
/*
Class : Predicate_i
Description : Base class for all predicates
*/
-Predicate_i::Predicate_i()
-: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
+CORBA::Boolean Predicate_i::IsSatisfy( CORBA::Long theId )
{
- SMESH_Gen_i::GetPOA()->activate_object( this );
+ return myPredicatePtr->IsSatisfy( theId );
+}
+
+Controls::PredicatePtr Predicate_i::GetPredicate()
+{
+ return myPredicatePtr;
}
/*
- Class : FreeBorders_i
- Description : Predicate for free borders
+ Class : BelongToGeom_i
+ Description : Predicate for selection on geometrical support
*/
+BelongToGeom_i::BelongToGeom_i()
+{
+ myBelongToGeomPtr.reset( new Controls::BelongToGeom() );
+ myFunctorPtr = myPredicatePtr = myBelongToGeomPtr;
+ myShapeName = 0;
+}
-FreeBorders_i::FreeBorders_i()
+BelongToGeom_i::~BelongToGeom_i()
{
- myMesh = 0;
+ delete myShapeName;
}
-void FreeBorders_i::SetMesh( SMESH_Mesh_ptr theMesh )
+void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
{
- SMESH_Mesh_i* anImplPtr =
- dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
- myMesh = anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
+ if ( theGeom->_is_nil() )
+ return;
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+ TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
+ myBelongToGeomPtr->SetGeom( aLocShape );
}
-CORBA::Boolean FreeBorders_i::IsSatisfy( CORBA::Long theId )
+void BelongToGeom_i::SetGeom( const TopoDS_Shape& theShape )
{
- return getNbMultiConnection( myMesh, theId ) == 1;
+ myBelongToGeomPtr->SetGeom( theShape );
+}
+
+void BelongToGeom_i::SetElementType(ElementType theType){
+ myBelongToGeomPtr->SetType(SMDSAbs_ElementType(theType));
}
-int FreeBorders_i::GetType() const
+FunctorType BelongToGeom_i::GetFunctorType()
{
- return SMDSAbs_Edge;
+ return SMESH::FT_BelongToGeom;
}
-/*
- Class : Comparator_i
- Description : Base class for comparators
-*/
+void BelongToGeom_i::SetShapeName( const char* theName )
+{
+ delete myShapeName;
+ myShapeName = strdup( theName );
+ myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
-Comparator_i::Comparator_i()
+char* BelongToGeom_i::GetShapeName()
{
- myMargin = 0;
- myFunctor = 0;
+ return CORBA::string_dup( myShapeName );
}
-Comparator_i::~Comparator_i()
+/*
+ Class : BelongToSurface_i
+ Description : Predicate for selection on geometrical support
+*/
+BelongToSurface_i::BelongToSurface_i( const Handle(Standard_Type)& theSurfaceType )
{
- if ( myFunctor != 0 )
- myFunctor->Destroy();
+ myElementsOnSurfacePtr.reset( new Controls::ElementsOnSurface() );
+ myFunctorPtr = myPredicatePtr = myElementsOnSurfacePtr;
+ myShapeName = 0;
+ mySurfaceType = theSurfaceType;
}
-void Comparator_i::SetMesh( SMESH_Mesh_ptr theMesh )
+BelongToSurface_i::~BelongToSurface_i()
{
- if ( myFunctor != 0 )
- myFunctor->SetMesh( theMesh );
+ delete myShapeName;
}
-void Comparator_i::SetMargin( CORBA::Double theValue )
+void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
{
- myMargin = theValue;
+ if ( theGeom->_is_nil() )
+ return;
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+ TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
+
+ if ( aLocShape.ShapeType() == TopAbs_FACE )
+ {
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface( TopoDS::Face( aLocShape ) );
+ if ( !aSurf.IsNull() && aSurf->DynamicType() == mySurfaceType )
+ {
+ myElementsOnSurfacePtr->SetSurface( aLocShape, (SMDSAbs_ElementType)theType );
+ return;
+ }
+ }
+
+ myElementsOnSurfacePtr->SetSurface( TopoDS_Shape(), (SMDSAbs_ElementType)theType );
}
-void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
+void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
{
- if ( myFunctor != 0 )
- myFunctor->Destroy();
+ delete myShapeName;
+ myShapeName = strdup( theName );
+ myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+}
- myFunctor = dynamic_cast<NumericalFunctor_i*>( SMESH_Gen_i::GetServant( theFunct ).in() );
+char* BelongToSurface_i::GetShapeName()
+{
+ return CORBA::string_dup( myShapeName );
+}
- if ( myFunctor != 0 )
- myFunctor->Register();
+void BelongToSurface_i::SetTolerance( CORBA::Double theToler )
+{
+ myElementsOnSurfacePtr->SetTolerance( theToler );
}
-int Comparator_i::GetType() const
+CORBA::Double BelongToSurface_i::GetTolerance()
{
- return myFunctor != 0 ? myFunctor->GetType() : SMDSAbs_All;
+ return myElementsOnSurfacePtr->GetTolerance();
}
/*
- Class : LessThan_i
- Description : Comparator "<"
+ Class : BelongToPlane_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
*/
-CORBA::Boolean LessThan_i::IsSatisfy( CORBA::Long theId )
+BelongToPlane_i::BelongToPlane_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_Plane ) )
{
- return myFunctor != 0 && myFunctor->GetValue( theId ) < myMargin;
}
-/*
- Class : MoreThan_i
- Description : Comparator ">"
-*/
+void BelongToPlane_i::SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
+{
+ BelongToSurface_i::SetSurface( theGeom, theType );
+}
-CORBA::Boolean MoreThan_i::IsSatisfy( CORBA::Long theId )
+FunctorType BelongToPlane_i::GetFunctorType()
{
- return myFunctor != 0 && myFunctor->GetValue( theId ) > myMargin;
+ return FT_BelongToPlane;
}
/*
- Class : EqualTo_i
- Description : Comparator "="
+ Class : BelongToCylinder_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
*/
-EqualTo_i::EqualTo_i()
+
+BelongToCylinder_i::BelongToCylinder_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_CylindricalSurface ) )
{
- myToler = Precision::Confusion();
}
-CORBA::Boolean EqualTo_i::IsSatisfy( CORBA::Long theId )
+void BelongToCylinder_i::SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
{
- return myFunctor != 0 && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
+ BelongToSurface_i::SetSurface( theGeom, theType );
}
-void EqualTo_i::SetTolerance( CORBA::Double theToler )
+FunctorType BelongToCylinder_i::GetFunctorType()
{
- myToler = theToler;
+ return FT_BelongToCylinder;
}
+
/*
- Class : LogicalNOT_i
- Description : Logical NOT predicate
+ Class : FreeBorders_i
+ Description : Predicate for free borders
*/
-
-LogicalNOT_i::LogicalNOT_i()
+FreeBorders_i::FreeBorders_i()
{
- myPredicate = 0;
+ myPredicatePtr.reset(new Controls::FreeBorders());
+ myFunctorPtr = myPredicatePtr;
}
-LogicalNOT_i::~LogicalNOT_i()
+FunctorType FreeBorders_i::GetFunctorType()
{
- if ( myPredicate )
- myPredicate->Destroy();
+ return SMESH::FT_FreeBorders;
}
-CORBA::Boolean LogicalNOT_i::IsSatisfy( CORBA::Long theId )
+/*
+ Class : FreeEdges_i
+ Description : Predicate for free borders
+*/
+FreeEdges_i::FreeEdges_i()
+: myFreeEdgesPtr( new Controls::FreeEdges() )
{
- return myPredicate !=0 && !myPredicate->IsSatisfy( theId );
+ myFunctorPtr = myPredicatePtr = myFreeEdgesPtr;
}
-void LogicalNOT_i::SetMesh( SMESH_Mesh_ptr theMesh )
+SMESH::FreeEdges::Borders* FreeEdges_i::GetBorders()
{
- if ( myPredicate != 0 )
- myPredicate->SetMesh( theMesh );
-}
+ INFOS("FreeEdges_i::GetBorders");
+ SMESH::Controls::FreeEdges::TBorders aBorders;
+ myFreeEdgesPtr->GetBoreders( aBorders );
+
+ long i = 0, iEnd = aBorders.size();
-void LogicalNOT_i::SetPredicate( Predicate_ptr thePred )
-{
- if ( myPredicate != 0 )
- myPredicate->Destroy();
+ SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders(iEnd);
- myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePred ).in() );
+ SMESH::Controls::FreeEdges::TBorders::const_iterator anIter;
+ for ( anIter = aBorders.begin() ; anIter != aBorders.end(); anIter++, i++ )
+ {
+ const SMESH::Controls::FreeEdges::Border& aBord = *anIter;
+ SMESH::FreeEdges::Border &aBorder = aResult[ i ];
+
+ aBorder.myElemId = aBord.myElemId;
+ aBorder.myPnt1 = aBord.myPntId[ 0 ];
+ aBorder.myPnt2 = aBord.myPntId[ 1 ];
+ }
- if ( myPredicate != 0 )
- myPredicate->Register();
+ INFOS("FreeEdges_i::GetBorders~");
+ return aResult._retn();
}
-int LogicalNOT_i::GetType() const
+FunctorType FreeEdges_i::GetFunctorType()
{
- return myPredicate != 0 ? myPredicate->GetType() : SMDSAbs_All;
+ return SMESH::FT_FreeEdges;
}
-
/*
- Class : LogicalBinary_i
- Description : Base class for binary logical predicate
+ Class : RangeOfIds_i
+ Description : Predicate for Range of Ids.
+ Range may be specified with two ways.
+ 1. Using AddToRange method
+ 2. With SetRangeStr method. Parameter of this method is a string
+ like as "1,2,3,50-60,63,67,70-"
*/
-LogicalBinary_i::LogicalBinary_i()
+RangeOfIds_i::RangeOfIds_i()
{
- myPredicate1 = 0;
- myPredicate2 = 0;
+ myRangeOfIdsPtr.reset( new Controls::RangeOfIds() );
+ myFunctorPtr = myPredicatePtr = myRangeOfIdsPtr;
}
-LogicalBinary_i::~LogicalBinary_i()
+
+void RangeOfIds_i::SetRange( const SMESH::long_array& theIds )
{
- if ( myPredicate1 != 0 )
- myPredicate1->Destroy();
+ CORBA::Long iEnd = theIds.length();
+ for ( CORBA::Long i = 0; i < iEnd; i++ )
+ myRangeOfIdsPtr->AddToRange( theIds[ i ] );
+}
- if ( myPredicate2 != 0 )
- myPredicate2->Destroy();
+CORBA::Boolean RangeOfIds_i::SetRangeStr( const char* theRange )
+{
+ return myRangeOfIdsPtr->SetRangeStr(
+ TCollection_AsciiString( (Standard_CString)theRange ) );
}
-void LogicalBinary_i::SetMesh( SMESH_Mesh_ptr theMesh )
+char* RangeOfIds_i::GetRangeStr()
{
- if ( myPredicate1 != 0 )
- myPredicate1->SetMesh( theMesh );
+ TCollection_AsciiString aStr;
+ myRangeOfIdsPtr->GetRangeStr( aStr );
+ return CORBA::string_dup( aStr.ToCString() );
+}
- if ( myPredicate2 != 0 )
- myPredicate2->SetMesh( theMesh );
+void RangeOfIds_i::SetElementType( ElementType theType )
+{
+ myRangeOfIdsPtr->SetType( SMDSAbs_ElementType( theType ) );
}
-void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
+FunctorType RangeOfIds_i::GetFunctorType()
{
- if ( myPredicate1 != 0 )
- myPredicate1->Destroy();
+ return SMESH::FT_RangeOfIds;
+}
- myPredicate1 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+/*
+ Class : Comparator_i
+ Description : Base class for comparators
+*/
+Comparator_i::Comparator_i():
+ myNumericalFunctor( NULL )
+{}
- if ( myPredicate1 != 0 )
- myPredicate1->Register();
+Comparator_i::~Comparator_i()
+{
+ if ( myNumericalFunctor )
+ myNumericalFunctor->Destroy();
}
-void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
+void Comparator_i::SetMargin( CORBA::Double theValue )
{
- if ( myPredicate2 != 0 )
- myPredicate2->Destroy();
-
- myPredicate2 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+ myComparatorPtr->SetMargin( theValue );
+}
- if ( myPredicate2 != 0 )
- myPredicate2->Register();
+CORBA::Double Comparator_i::GetMargin()
+{
+ return myComparatorPtr->GetMargin();
}
-int LogicalBinary_i::GetType() const
+void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
{
- if ( myPredicate1 == 0 || myPredicate2 == 0 )
- return SMDSAbs_All;
+ if ( myNumericalFunctor )
+ myNumericalFunctor->Destroy();
- int aType1 = myPredicate1->GetType();
- int aType2 = myPredicate2->GetType();
+ myNumericalFunctor = dynamic_cast<NumericalFunctor_i*>( SMESH_Gen_i::GetServant( theFunct ).in() );
- return aType1 == aType2 ? aType1 : SMDSAbs_All;
+ if ( myNumericalFunctor )
+ {
+ myComparatorPtr->SetNumFunctor( myNumericalFunctor->GetNumericalFunctor() );
+ myNumericalFunctor->Register();
+ }
+}
+
+Controls::ComparatorPtr Comparator_i::GetComparator()
+{
+ return myComparatorPtr;
+}
+
+NumericalFunctor_i* Comparator_i::GetNumFunctor_i()
+{
+ return myNumericalFunctor;
}
+
/*
- Class : LogicalAND_i
- Description : Logical AND
+ Class : LessThan_i
+ Description : Comparator "<"
*/
+LessThan_i::LessThan_i()
+{
+ myComparatorPtr.reset( new Controls::LessThan() );
+ myFunctorPtr = myPredicatePtr = myComparatorPtr;
+}
-CORBA::Boolean LogicalAND_i::IsSatisfy( CORBA::Long theId )
+FunctorType LessThan_i::GetFunctorType()
{
- return myPredicate1 != 0 &&
- myPredicate2 != 0 &&
- myPredicate1->IsSatisfy( theId ) && myPredicate2->IsSatisfy( theId );;
+ return SMESH::FT_LessThan;
}
+
/*
- Class : LogicalOR_i
- Description : Logical OR
+ Class : MoreThan_i
+ Description : Comparator ">"
*/
+MoreThan_i::MoreThan_i()
+{
+ myComparatorPtr.reset( new Controls::MoreThan() );
+ myFunctorPtr = myPredicatePtr = myComparatorPtr;
+}
-CORBA::Boolean LogicalOR_i::IsSatisfy( CORBA::Long theId )
+FunctorType MoreThan_i::GetFunctorType()
{
- return myPredicate1 != 0 &&
- myPredicate2 != 0 &&
- myPredicate1->IsSatisfy( theId ) || myPredicate2->IsSatisfy( theId );
+ return SMESH::FT_MoreThan;
}
/*
- FILTER
+ Class : EqualTo_i
+ Description : Comparator "="
*/
+EqualTo_i::EqualTo_i()
+: myEqualToPtr( new Controls::EqualTo() )
+{
+ myFunctorPtr = myPredicatePtr = myComparatorPtr = myEqualToPtr;
+}
-Filter_i::Filter_i()
+void EqualTo_i::SetTolerance( CORBA::Double theToler )
{
- myPredicate = 0;
+ myEqualToPtr->SetTolerance( theToler );
}
-Filter_i::~Filter_i()
+CORBA::Double EqualTo_i::GetTolerance()
{
- if ( myPredicate != 0 )
+ return myEqualToPtr->GetTolerance();
+}
+
+FunctorType EqualTo_i::GetFunctorType()
+{
+ return SMESH::FT_EqualTo;
+}
+
+/*
+ Class : LogicalNOT_i
+ Description : Logical NOT predicate
+*/
+LogicalNOT_i::LogicalNOT_i()
+: myPredicate( NULL ),
+ myLogicalNOTPtr( new Controls::LogicalNOT() )
+{
+ myFunctorPtr = myPredicatePtr = myLogicalNOTPtr;
+}
+
+LogicalNOT_i::~LogicalNOT_i()
+{
+ if ( myPredicate )
myPredicate->Destroy();
}
-void Filter_i::SetPredicate( Predicate_ptr thePredicate )
+void LogicalNOT_i::SetPredicate( Predicate_ptr thePred )
{
- if ( myPredicate != 0 )
+ if ( myPredicate )
myPredicate->Destroy();
- myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+ myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePred ).in() );
- if ( myPredicate != 0 )
+ if ( myPredicate ){
+ myLogicalNOTPtr->SetPredicate(myPredicate->GetPredicate());
myPredicate->Register();
+ }
}
-void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
+FunctorType LogicalNOT_i::GetFunctorType()
{
- if ( myPredicate != 0 )
- myPredicate->SetMesh( theMesh );
+ return SMESH::FT_LogicalNOT;
}
-SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh )
+Predicate_i* LogicalNOT_i::GetPredicate_i()
{
+ return myPredicate;
+}
- SetMesh( theMesh );
- SMESH_Mesh_i* anImplPtr =
- dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+/*
+ Class : LogicalBinary_i
+ Description : Base class for binary logical predicate
+*/
+LogicalBinary_i::LogicalBinary_i()
+: myPredicate1( NULL ),
+ myPredicate2( NULL )
+{}
- TColStd_ListOfInteger aList;
+LogicalBinary_i::~LogicalBinary_i()
+{
+ if ( myPredicate1 )
+ myPredicate1->Destroy();
- if ( anImplPtr != 0 )
- {
- SMESHDS_Mesh* aMesh = anImplPtr->GetImpl().GetMeshDS();
+ if ( myPredicate2 )
+ myPredicate2->Destroy();
+}
- if ( myPredicate != 0 )
- {
- int aType = myPredicate->GetType();
-
- if ( aType == SMDSAbs_Edge )
- {
- SMDS_EdgeIteratorPtr anIter = aMesh->edgesIterator();
- if ( anIter != 0 )
- {
- while( anIter->more() )
- {
- const SMDS_MeshElement* anElem = anIter->next();
- if ( myPredicate->IsSatisfy( anElem->GetID() ) )
- aList.Append( anElem->GetID() );
- }
- }
-// delete anIter;
- }
- else if ( aType == SMDSAbs_Face )
- {
- SMDS_FaceIteratorPtr anIter = aMesh->facesIterator();
- if ( anIter != 0 )
- {
- while( anIter->more() )
- {
- const SMDS_MeshElement* anElem = anIter->next();
- if ( myPredicate->IsSatisfy( anElem->GetID() ) )
- aList.Append( anElem->GetID() );
- }
- }
-// delete anIter;
- }
- }
+void LogicalBinary_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+ if ( myPredicate1 )
+ myPredicate1->SetMesh( theMesh );
+
+ if ( myPredicate2 )
+ myPredicate2->SetMesh( theMesh );
+}
+
+void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
+{
+ if ( myPredicate1 )
+ myPredicate1->Destroy();
+
+ myPredicate1 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+ if ( myPredicate1 ){
+ myLogicalBinaryPtr->SetPredicate1(myPredicate1->GetPredicate());
+ myPredicate1->Register();
}
-
- SMESH::long_array_var anArray = new SMESH::long_array;
-
- anArray->length( aList.Extent() );
- TColStd_ListIteratorOfListOfInteger anIter( aList );
- int i = 0;
- for( ; anIter.More(); anIter.Next() )
- anArray[ i++ ] = anIter.Value();
+}
- return anArray._retn();
+void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
+{
+ if ( myPredicate2 )
+ myPredicate2->Destroy();
+
+ myPredicate2 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+ if ( myPredicate2 ){
+ myLogicalBinaryPtr->SetPredicate2(myPredicate2->GetPredicate());
+ myPredicate2->Register();
+ }
+}
+
+Controls::LogicalBinaryPtr LogicalBinary_i::GetLogicalBinary()
+{
+ return myLogicalBinaryPtr;
+}
+
+Predicate_i* LogicalBinary_i::GetPredicate1_i()
+{
+ return myPredicate1;
+}
+Predicate_i* LogicalBinary_i::GetPredicate2_i()
+{
+ return myPredicate2;
+}
+
+
+/*
+ Class : LogicalAND_i
+ Description : Logical AND
+*/
+LogicalAND_i::LogicalAND_i()
+{
+ myLogicalBinaryPtr.reset( new Controls::LogicalAND() );
+ myFunctorPtr = myPredicatePtr = myLogicalBinaryPtr;
+}
+
+FunctorType LogicalAND_i::GetFunctorType()
+{
+ return SMESH::FT_LogicalAND;
+}
+
+
+/*
+ Class : LogicalOR_i
+ Description : Logical OR
+*/
+LogicalOR_i::LogicalOR_i()
+{
+ myLogicalBinaryPtr.reset( new Controls::LogicalOR() );
+ myFunctorPtr = myPredicatePtr = myLogicalBinaryPtr;
}
+FunctorType LogicalOR_i::GetFunctorType()
+{
+ return SMESH::FT_LogicalOR;
+}
+
+
/*
FILTER MANAGER
*/
}
+BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
+{
+ SMESH::BelongToGeom_i* aServant = new SMESH::BelongToGeom_i();
+ SMESH::BelongToGeom_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
+BelongToPlane_ptr FilterManager_i::CreateBelongToPlane()
+{
+ SMESH::BelongToPlane_i* aServant = new SMESH::BelongToPlane_i();
+ SMESH::BelongToPlane_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
+BelongToCylinder_ptr FilterManager_i::CreateBelongToCylinder()
+{
+ SMESH::BelongToCylinder_i* aServant = new SMESH::BelongToCylinder_i();
+ SMESH::BelongToCylinder_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
FreeBorders_ptr FilterManager_i::CreateFreeBorders()
{
SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
return anObj._retn();
}
+FreeEdges_ptr FilterManager_i::CreateFreeEdges()
+{
+ SMESH::FreeEdges_i* aServant = new SMESH::FreeEdges_i();
+ SMESH::FreeEdges_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
+RangeOfIds_ptr FilterManager_i::CreateRangeOfIds()
+{
+ SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i();
+ SMESH::RangeOfIds_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
LessThan_ptr FilterManager_i::CreateLessThan()
{
SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
SMESH::Filter_var anObj = aServant->_this();
return anObj._retn();
}
+
+FilterLibrary_ptr FilterManager_i::LoadLibrary( const char* aFileName )
+{
+ SMESH::FilterLibrary_i* aServant = new SMESH::FilterLibrary_i( aFileName );
+ SMESH::FilterLibrary_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
+FilterLibrary_ptr FilterManager_i::CreateLibrary()
+{
+ SMESH::FilterLibrary_i* aServant = new SMESH::FilterLibrary_i();
+ SMESH::FilterLibrary_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
+CORBA::Boolean FilterManager_i::DeleteLibrary( const char* aFileName )
+{
+ return remove( aFileName ) ? false : true;
+}
+
+//=============================================================================
+/*!
+ * SMESH_Gen_i::CreateFilterManager
+ *
+ * Create filter manager
+ */
+//=============================================================================
+
+SMESH::FilterManager_ptr SMESH_Gen_i::CreateFilterManager()
+{
+ SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
+ SMESH::FilterManager_var anObj = aFilter->_this();
+ return anObj._retn();
+}
+
+
+/*
+ FILTER
+*/
+
+//=======================================================================
+// name : Filter_i::Filter_i
+// Purpose : Constructor
+//=======================================================================
+Filter_i::Filter_i()
+: myPredicate( NULL )
+{}
+
+//=======================================================================
+// name : Filter_i::~Filter_i
+// Purpose : Destructor
+//=======================================================================
+Filter_i::~Filter_i()
+{
+ if ( myPredicate )
+ myPredicate->Destroy();
+}
+
+//=======================================================================
+// name : Filter_i::SetPredicate
+// Purpose : Set predicate
+//=======================================================================
+void Filter_i::SetPredicate( Predicate_ptr thePredicate )
+{
+ if ( myPredicate )
+ myPredicate->Destroy();
+
+ myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+ if ( myPredicate )
+ {
+ myFilter.SetPredicate( myPredicate->GetPredicate() );
+ myPredicate->Register();
+ }
+}
+
+//=======================================================================
+// name : Filter_i::GetElementType
+// Purpose : Get entity type
+//=======================================================================
+SMESH::ElementType Filter_i::GetElementType()
+{
+ return myPredicate != 0 ? myPredicate->GetElementType() : SMESH::ALL;
+}
+
+//=======================================================================
+// name : Filter_i::SetMesh
+// Purpose : Set mesh
+//=======================================================================
+void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+ if ( myPredicate )
+ myPredicate->SetMesh( theMesh );
+}
+
+//=======================================================================
+// name : Filter_i::GetElementsId
+// Purpose : Get ids of entities
+//=======================================================================
+SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh )
+{
+ SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh);
+ Controls::Filter::TIdSequence aSequence = myFilter.GetElementsId(aMesh);
+
+ SMESH::long_array_var anArray = new SMESH::long_array;
+ long i = 0, iEnd = aSequence.size();
+
+ anArray->length( iEnd );
+ for ( ; i < iEnd; i++ )
+ anArray[ i ] = aSequence[i];
+
+ return anArray._retn();
+}
+
+//=======================================================================
+// name : getCriteria
+// Purpose : Retrieve criterions from predicate
+//=======================================================================
+static inline bool getCriteria( Predicate_i* thePred,
+ SMESH::Filter::Criteria_out theCriteria )
+{
+ int aFType = thePred->GetFunctorType();
+
+ switch ( aFType )
+ {
+ case FT_FreeBorders:
+ case FT_FreeEdges:
+ {
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = aFType;
+ theCriteria[ i ].TypeOfElement = thePred->GetElementType();
+ return true;
+ }
+ case FT_BelongToGeom:
+ {
+ BelongToGeom_i* aPred = dynamic_cast<BelongToGeom_i*>( thePred );
+
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = FT_BelongToGeom;
+ theCriteria[ i ].ThresholdStr = aPred->GetShapeName();
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
+ return true;
+ }
+ case FT_BelongToPlane:
+ case FT_BelongToCylinder:
+ {
+ BelongToSurface_i* aPred = dynamic_cast<BelongToSurface_i*>( thePred );
+
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = aFType;
+ theCriteria[ i ].ThresholdStr = aPred->GetShapeName();
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+ theCriteria[ i ].Tolerance = aPred->GetTolerance();
+
+ return true;
+ }
+ case FT_RangeOfIds:
+ {
+ RangeOfIds_i* aPred = dynamic_cast<RangeOfIds_i*>( thePred );
+
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = FT_RangeOfIds;
+ theCriteria[ i ].ThresholdStr = aPred->GetRangeStr();
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
+ return true;
+ }
+ case FT_LessThan:
+ case FT_MoreThan:
+ case FT_EqualTo:
+ {
+ Comparator_i* aCompar = dynamic_cast<Comparator_i*>( thePred );
+
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = aCompar->GetNumFunctor_i()->GetFunctorType();
+ theCriteria[ i ].Compare = aFType;
+ theCriteria[ i ].Threshold = aCompar->GetMargin();
+ theCriteria[ i ].TypeOfElement = aCompar->GetElementType();
+
+ if ( aFType == FT_EqualTo )
+ {
+ EqualTo_i* aCompar = dynamic_cast<EqualTo_i*>( thePred );
+ theCriteria[ i ].Tolerance = aCompar->GetTolerance();
+ }
+ }
+ return true;
+
+ case FT_LogicalNOT:
+ {
+ Predicate_i* aPred = ( dynamic_cast<LogicalNOT_i*>( thePred ) )->GetPredicate_i();
+ getCriteria( aPred, theCriteria );
+ theCriteria[ theCriteria->length() - 1 ].UnaryOp = FT_LogicalNOT;
+ }
+ return true;
+
+ case FT_LogicalAND:
+ case FT_LogicalOR:
+ {
+ Predicate_i* aPred1 = ( dynamic_cast<LogicalBinary_i*>( thePred ) )->GetPredicate1_i();
+ Predicate_i* aPred2 = ( dynamic_cast<LogicalBinary_i*>( thePred ) )->GetPredicate2_i();
+ if ( !getCriteria( aPred1, theCriteria ) )
+ return false;
+ theCriteria[ theCriteria->length() - 1 ].BinaryOp = aFType;
+ return getCriteria( aPred2, theCriteria );
+ }
+
+ case FT_Undefined:
+ return false;
+ default:
+ return false;
+ }
+}
+
+//=======================================================================
+// name : Filter_i::GetCriteria
+// Purpose : Retrieve criterions from predicate
+//=======================================================================
+CORBA::Boolean Filter_i::GetCriteria( SMESH::Filter::Criteria_out theCriteria )
+{
+ theCriteria = new SMESH::Filter::Criteria;
+ return myPredicate != 0 ? getCriteria( myPredicate, theCriteria ) : true;
+}
+
+//=======================================================================
+// name : Filter_i::SetCriteria
+// Purpose : Create new predicate and set criterions in it
+//=======================================================================
+CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria )
+{
+ if ( myPredicate != 0 )
+ myPredicate->Destroy();
+
+ SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
+ FilterManager_ptr aFilterMgr = aFilter->_this();
+
+ // CREATE two lists ( PREDICATES and LOG OP )
+
+ // Criterion
+ std::list<SMESH::Predicate_ptr> aPredicates;
+ std::list<int> aBinaries;
+ for ( int i = 0, n = theCriteria.length(); i < n; i++ )
+ {
+ int aCriterion = theCriteria[ i ].Type;
+ int aCompare = theCriteria[ i ].Compare;
+ double aThreshold = theCriteria[ i ].Threshold;
+ int aUnary = theCriteria[ i ].UnaryOp;
+ int aBinary = theCriteria[ i ].BinaryOp;
+ double aTolerance = theCriteria[ i ].Tolerance;
+ const char* aThresholdStr = theCriteria[ i ].ThresholdStr;
+ ElementType aTypeOfElem = theCriteria[ i ].TypeOfElement;
+ long aPrecision = theCriteria[ i ].Precision;
+
+ SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
+ SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
+
+ switch ( aCriterion )
+ {
+ // Functors
+
+ case SMESH::FT_MultiConnection:
+ aFunctor = aFilterMgr->CreateMultiConnection();
+ break;
+ case SMESH::FT_Length:
+ aFunctor = aFilterMgr->CreateLength();
+ break;
+ case SMESH::FT_AspectRatio:
+ aFunctor = aFilterMgr->CreateAspectRatio();
+ break;
+ case SMESH::FT_Warping:
+ aFunctor = aFilterMgr->CreateWarping();
+ break;
+ case SMESH::FT_MinimumAngle:
+ aFunctor = aFilterMgr->CreateMinimumAngle();
+ break;
+ case SMESH::FT_Taper:
+ aFunctor = aFilterMgr->CreateTaper();
+ break;
+ case SMESH::FT_Skew:
+ aFunctor = aFilterMgr->CreateSkew();
+ break;
+ case SMESH::FT_Area:
+ aFunctor = aFilterMgr->CreateArea();
+ break;
+
+ // Predicates
+
+ case SMESH::FT_FreeBorders:
+ aPredicate = aFilterMgr->CreateFreeBorders();
+ break;
+ case SMESH::FT_FreeEdges:
+ aPredicate = aFilterMgr->CreateFreeEdges();
+ break;
+ case SMESH::FT_BelongToGeom:
+ {
+ SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom();
+ tmpPred->SetElementType( aTypeOfElem );
+ tmpPred->SetShapeName( aThresholdStr );
+ aPredicate = tmpPred;
+ }
+ break;
+ case SMESH::FT_BelongToPlane:
+ case SMESH::FT_BelongToCylinder:
+ {
+ SMESH::BelongToSurface_ptr tmpPred;
+ if ( aCriterion == SMESH::FT_BelongToPlane )
+ tmpPred = aFilterMgr->CreateBelongToPlane();
+ else
+ tmpPred = aFilterMgr->CreateBelongToCylinder();
+ tmpPred->SetShapeName( aThresholdStr, aTypeOfElem );
+ tmpPred->SetTolerance( aTolerance );
+ aPredicate = tmpPred;
+ }
+ break;
+ case SMESH::FT_RangeOfIds:
+ {
+ SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds();
+ tmpPred->SetRangeStr( aThresholdStr );
+ tmpPred->SetElementType( aTypeOfElem );
+ aPredicate = tmpPred;
+ }
+ break;
+
+ default:
+ continue;
+ }
+
+ // Comparator
+ if ( !aFunctor->_is_nil() && aPredicate->_is_nil() )
+ {
+ SMESH::Comparator_ptr aComparator = SMESH::Comparator::_nil();
+
+ if ( aCompare == SMESH::FT_LessThan )
+ aComparator = aFilterMgr->CreateLessThan();
+ else if ( aCompare == SMESH::FT_MoreThan )
+ aComparator = aFilterMgr->CreateMoreThan();
+ else if ( aCompare == SMESH::FT_EqualTo )
+ aComparator = aFilterMgr->CreateEqualTo();
+ else
+ continue;
+
+ aComparator->SetNumFunctor( aFunctor );
+ aComparator->SetMargin( aThreshold );
+
+ if ( aCompare == FT_EqualTo )
+ {
+ SMESH::EqualTo_var anEqualTo = SMESH::EqualTo::_narrow( aComparator );
+ anEqualTo->SetTolerance( aTolerance );
+ }
+
+ aPredicate = aComparator;
+
+ aFunctor->SetPrecision( aPrecision );
+ }
+
+ // Logical not
+ if ( aUnary == FT_LogicalNOT )
+ {
+ SMESH::LogicalNOT_ptr aNotPred = aFilterMgr->CreateLogicalNOT();
+ aNotPred->SetPredicate( aPredicate );
+ aPredicate = aNotPred;
+ }
+
+ // logical op
+ aPredicates.push_back( aPredicate );
+ aBinaries.push_back( aBinary );
+
+ } // end of for
+
+ // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
+
+ // combine all "AND" operations
+
+ std::list<SMESH::Predicate_ptr> aResList;
+
+ std::list<SMESH::Predicate_ptr>::iterator aPredIter;
+ std::list<int>::iterator aBinaryIter;
+
+ SMESH::Predicate_ptr aPrevPredicate = SMESH::Predicate::_nil();
+ int aPrevBinary = SMESH::FT_Undefined;
+
+ for ( aPredIter = aPredicates.begin(), aBinaryIter = aBinaries.begin();
+ aPredIter != aPredicates.end() && aBinaryIter != aBinaries.end();
+ ++aPredIter, ++aBinaryIter )
+ {
+ int aCurrBinary = *aBinaryIter;
+
+ SMESH::Predicate_ptr aCurrPred = SMESH::Predicate::_nil();
+
+ if ( aPrevBinary == SMESH::FT_LogicalAND )
+ {
+
+ SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalAND();
+ aBinaryPred->SetPredicate1( aPrevPredicate );
+ aBinaryPred->SetPredicate2( *aPredIter );
+ aCurrPred = aBinaryPred;
+ }
+ else
+ aCurrPred = *aPredIter;
+
+ if ( aCurrBinary != SMESH::FT_LogicalAND )
+ aResList.push_back( aCurrPred );
+
+ aPrevPredicate = aCurrPred;
+ aPrevBinary = aCurrBinary;
+ }
+
+ // combine all "OR" operations
+
+ SMESH::Predicate_ptr aResPredicate = SMESH::Predicate::_nil();
+
+ if ( aResList.size() == 1 )
+ aResPredicate = *aResList.begin();
+ else if ( aResList.size() > 1 )
+ {
+ std::list<SMESH::Predicate_ptr>::iterator anIter = aResList.begin();
+ aResPredicate = *anIter;
+ anIter++;
+ for ( ; anIter != aResList.end(); ++anIter )
+ {
+ SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalOR();
+ aBinaryPred->SetPredicate1( aResPredicate );
+ aBinaryPred->SetPredicate2( *anIter );
+ aResPredicate = aBinaryPred;
+ }
+ }
+
+ SetPredicate( aResPredicate );
+
+ return !aResPredicate->_is_nil();
+}
+
+//=======================================================================
+// name : Filter_i::GetPredicate_i
+// Purpose : Get implementation of predicate
+//=======================================================================
+Predicate_i* Filter_i::GetPredicate_i()
+{
+ return myPredicate;
+}
+
+//=======================================================================
+// name : Filter_i::GetPredicate
+// Purpose : Get predicate
+//=======================================================================
+Predicate_ptr Filter_i::GetPredicate()
+{
+ if ( myPredicate == 0 )
+ return SMESH::Predicate::_nil();
+ else
+ {
+ SMESH::Predicate_var anObj = myPredicate->_this();
+ return anObj._retn();
+ }
+}
+
+/*
+ FILTER LIBRARY
+*/
+
+#define ATTR_TYPE "type"
+#define ATTR_COMPARE "compare"
+#define ATTR_THRESHOLD "threshold"
+#define ATTR_UNARY "unary"
+#define ATTR_BINARY "binary"
+#define ATTR_THRESHOLD_STR "threshold_str"
+#define ATTR_TOLERANCE "tolerance"
+#define ATTR_ELEMENT_TYPE "ElementType"
+
+//=======================================================================
+// name : toString
+// Purpose : Convert bool to LDOMString
+//=======================================================================
+static inline LDOMString toString( const bool val )
+{
+ return val ? "logical not" : "";
+}
+
+//=======================================================================
+// name : toBool
+// Purpose : Convert LDOMString to bool
+//=======================================================================
+static inline bool toBool( const LDOMString& theStr )
+{
+ return theStr.equals( "logical not" );
+}
+
+//=======================================================================
+// name : toString
+// Purpose : Convert double to LDOMString
+//=======================================================================
+static inline LDOMString toString( const double val )
+{
+ char a[ 255 ];
+ sprintf( a, "%e", val );
+ return LDOMString( a );
+}
+
+//=======================================================================
+// name : toDouble
+// Purpose : Convert LDOMString to double
+//=======================================================================
+static inline double toDouble( const LDOMString& theStr )
+{
+ return atof( theStr.GetString() );
+}
+
+//=======================================================================
+// name : toString
+// Purpose : Convert functor type to LDOMString
+//=======================================================================
+static inline LDOMString toString( const long theType )
+{
+ switch ( theType )
+ {
+ case FT_AspectRatio : return "Aspect ratio";
+ case FT_Warping : return "Warping";
+ case FT_MinimumAngle : return "Minimum angle";
+ case FT_Taper : return "Taper";
+ case FT_Skew : return "Skew";
+ case FT_Area : return "Area";
+ case FT_BelongToGeom : return "Belong to Geom";
+ case FT_BelongToPlane : return "Belong to Plane";
+ case FT_BelongToCylinder: return "Belong to Cylinder";
+ case FT_RangeOfIds : return "Range of IDs";
+ case FT_FreeBorders : return "Free borders";
+ case FT_FreeEdges : return "Free edges";
+ case FT_MultiConnection : return "Borders at multi-connections";
+ case FT_Length : return "Length";
+ case FT_LessThan : return "Less than";
+ case FT_MoreThan : return "More than";
+ case FT_EqualTo : return "Equal to";
+ case FT_LogicalNOT : return "Not";
+ case FT_LogicalAND : return "And";
+ case FT_LogicalOR : return "Or";
+ case FT_Undefined : return "";
+ default : return "";
+ }
+}
+
+//=======================================================================
+// name : toFunctorType
+// Purpose : Convert LDOMString to functor type
+//=======================================================================
+static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
+{
+ if ( theStr.equals( "Aspect ratio" ) ) return FT_AspectRatio;
+ else if ( theStr.equals( "Warping" ) ) return FT_Warping;
+ else if ( theStr.equals( "Minimum angle" ) ) return FT_MinimumAngle;
+ else if ( theStr.equals( "Taper" ) ) return FT_Taper;
+ else if ( theStr.equals( "Skew" ) ) return FT_Skew;
+ else if ( theStr.equals( "Area" ) ) return FT_Area;
+ else if ( theStr.equals( "Belong to Geom" ) ) return FT_BelongToGeom;
+ else if ( theStr.equals( "Belong to Plane" ) ) return FT_BelongToPlane;
+ else if ( theStr.equals( "Belong to Cylinder" ) ) return FT_BelongToCylinder;
+ else if ( theStr.equals( "Free borders" ) ) return FT_FreeBorders;
+ else if ( theStr.equals( "Free edges" ) ) return FT_FreeEdges;
+ else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
+ else if ( theStr.equals( "Length" ) ) return FT_Length;
+ else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds;
+ else if ( theStr.equals( "Less than" ) ) return FT_LessThan;
+ else if ( theStr.equals( "More than" ) ) return FT_MoreThan;
+ else if ( theStr.equals( "Equal to" ) ) return FT_EqualTo;
+ else if ( theStr.equals( "Not" ) ) return FT_LogicalNOT;
+ else if ( theStr.equals( "And" ) ) return FT_LogicalAND;
+ else if ( theStr.equals( "Or" ) ) return FT_LogicalOR;
+ else if ( theStr.equals( "" ) ) return FT_Undefined;
+ else return FT_Undefined;
+}
+
+//=======================================================================
+// name : toFunctorType
+// Purpose : Convert LDOMString to value of ElementType enumeration
+//=======================================================================
+static inline SMESH::ElementType toElementType( const LDOMString& theStr )
+{
+ if ( theStr.equals( "NODE" ) ) return SMESH::NODE;
+ else if ( theStr.equals( "EDGE" ) ) return SMESH::EDGE;
+ else if ( theStr.equals( "FACE" ) ) return SMESH::FACE;
+ else if ( theStr.equals( "VOLUME" ) ) return SMESH::VOLUME;
+ else return SMESH::ALL;
+}
+
+//=======================================================================
+// name : toString
+// Purpose : Convert ElementType to string
+//=======================================================================
+static inline LDOMString toString( const SMESH::ElementType theType )
+{
+ switch ( theType )
+ {
+ case SMESH::NODE : return "NODE";
+ case SMESH::EDGE : return "EDGE";
+ case SMESH::FACE : return "FACE";
+ case SMESH::VOLUME : return "VOLUME";
+ case SMESH::ALL : return "ALL";
+ default : return "";
+ }
+}
+
+//=======================================================================
+// name : findFilter
+// Purpose : Find filter in document
+//=======================================================================
+static LDOM_Element findFilter( const char* theFilterName,
+ const LDOM_Document& theDoc,
+ LDOM_Node* theParent = 0 )
+{
+ LDOM_Element aRootElement = theDoc.getDocumentElement();
+ if ( aRootElement.isNull() || !aRootElement.hasChildNodes() )
+ return LDOM_Element();
+
+ for ( LDOM_Node aTypeNode = aRootElement.getFirstChild();
+ !aTypeNode.isNull(); aTypeNode = aTypeNode.getNextSibling() )
+ {
+ for ( LDOM_Node aFilter = aTypeNode.getFirstChild();
+ !aFilter.isNull(); aFilter = aFilter.getNextSibling() )
+ {
+ LDOM_Element* anElem = ( LDOM_Element* )&aFilter;
+ if ( anElem->getTagName().equals( LDOMString( "filter" ) ) &&
+ anElem->getAttribute( "name" ).equals( LDOMString( theFilterName ) ) )
+ {
+ if ( theParent != 0 )
+ *theParent = aTypeNode;
+ return (LDOM_Element&)aFilter;
+ }
+ }
+ }
+ return LDOM_Element();
+}
+
+//=======================================================================
+// name : getSectionName
+// Purpose : Get name of section of filters
+//=======================================================================
+static const char* getSectionName( const ElementType theType )
+{
+ switch ( theType )
+ {
+ case SMESH::NODE : return "Filters for nodes";
+ case SMESH::EDGE : return "Filters for edges";
+ case SMESH::FACE : return "Filters for faces";
+ case SMESH::VOLUME : return "Filters for volumes";
+ case SMESH::ALL : return "Filters for elements";
+ default : return "";
+ }
+}
+
+//=======================================================================
+// name : getSection
+// Purpose : Create section for filters corresponding to the entity type
+//=======================================================================
+static LDOM_Node getSection( const ElementType theType,
+ LDOM_Document& theDoc,
+ const bool toCreate = false )
+{
+ LDOM_Element aRootElement = theDoc.getDocumentElement();
+ if ( aRootElement.isNull() )
+ return LDOM_Node();
+
+ // Find section
+ bool anExist = false;
+ const char* aSectionName = getSectionName( theType );
+ if ( strcmp( aSectionName, "" ) == 0 )
+ return LDOM_Node();
+
+ LDOM_NodeList aSections = theDoc.getElementsByTagName( "section" );
+ LDOM_Node aNode;
+ for ( int i = 0, n = aSections.getLength(); i < n; i++ )
+ {
+ aNode = aSections.item( i );
+ LDOM_Element& anItem = ( LDOM_Element& )aNode;
+ if ( anItem.getAttribute( "name" ).equals( LDOMString( aSectionName ) ) )
+ {
+ anExist = true;
+ break;
+ }
+ }
+
+ // Create new section if necessary
+ if ( !anExist )
+ {
+ if ( toCreate )
+ {
+ LDOM_Element aNewItem = theDoc.createElement( "section" );
+ aNewItem.setAttribute( "name", aSectionName );
+ aRootElement.appendChild( aNewItem );
+ return aNewItem;
+ }
+ else
+ return LDOM_Node();
+ }
+ return
+ aNode;
+}
+
+//=======================================================================
+// name : createFilterItem
+// Purpose : Create filter item or LDOM document
+//=======================================================================
+static LDOM_Element createFilterItem( const char* theName,
+ SMESH::Filter_ptr theFilter,
+ LDOM_Document& theDoc )
+{
+ // create new filter in document
+ LDOM_Element aFilterItem = theDoc.createElement( "filter" );
+ aFilterItem.setAttribute( "name", theName );
+
+ // save filter criterions
+ SMESH::Filter::Criteria_var aCriteria = new SMESH::Filter::Criteria;
+
+ if ( !theFilter->GetCriteria( aCriteria ) )
+ return LDOM_Element();
+
+ for ( CORBA::ULong i = 0, n = aCriteria->length(); i < n; i++ )
+ {
+ LDOM_Element aCriterionItem = theDoc.createElement( "criterion" );
+
+ aCriterionItem.setAttribute( ATTR_TYPE , toString( aCriteria[ i ].Type ) );
+ aCriterionItem.setAttribute( ATTR_COMPARE , toString( aCriteria[ i ].Compare ) );
+ aCriterionItem.setAttribute( ATTR_THRESHOLD , toString( aCriteria[ i ].Threshold ) );
+ aCriterionItem.setAttribute( ATTR_UNARY , toString( aCriteria[ i ].UnaryOp ) );
+ aCriterionItem.setAttribute( ATTR_BINARY , toString( aCriteria[ i ].BinaryOp ) );
+
+ aCriterionItem.setAttribute( ATTR_THRESHOLD_STR, (const char*)aCriteria[ i ].ThresholdStr );
+ aCriterionItem.setAttribute( ATTR_TOLERANCE , toString( aCriteria[ i ].Tolerance ) );
+ aCriterionItem.setAttribute( ATTR_ELEMENT_TYPE ,
+ toString( (SMESH::ElementType)aCriteria[ i ].TypeOfElement ) );
+
+ aFilterItem.appendChild( aCriterionItem );
+ }
+
+ return aFilterItem;
+}
+
+//=======================================================================
+// name : FilterLibrary_i::FilterLibrary_i
+// Purpose : Constructor
+//=======================================================================
+FilterLibrary_i::FilterLibrary_i( const char* theFileName )
+{
+ myFileName = strdup( theFileName );
+ SMESH::FilterManager_i* aFilterMgr = new SMESH::FilterManager_i();
+ myFilterMgr = aFilterMgr->_this();
+
+ LDOMParser aParser;
+
+ // Try to use existing library file
+ bool anExists = false;
+ if ( !aParser.parse( myFileName ) )
+ {
+ myDoc = aParser.getDocument();
+ anExists = true;
+ }
+ // Create a new XML document if it doesn't exist
+ else
+ myDoc = LDOM_Document::createDocument( LDOMString() );
+
+ LDOM_Element aRootElement = myDoc.getDocumentElement();
+ if ( aRootElement.isNull() )
+ {
+ // If the existing document is empty --> try to create a new one
+ if ( anExists )
+ myDoc = LDOM_Document::createDocument( LDOMString() );
+ }
+}
+
+//=======================================================================
+// name : FilterLibrary_i::FilterLibrary_i
+// Purpose : Constructor
+//=======================================================================
+FilterLibrary_i::FilterLibrary_i()
+{
+ myFileName = 0;
+ SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
+ myFilterMgr = aFilter->_this();
+
+ myDoc = LDOM_Document::createDocument( LDOMString() );
+}
+
+FilterLibrary_i::~FilterLibrary_i()
+{
+ delete myFileName;
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Copy
+// Purpose : Create filter and initialize it with values from library
+//=======================================================================
+Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
+{
+ Filter_ptr aRes;
+ LDOM_Node aFilter = findFilter( theFilterName, myDoc );
+
+ if ( aFilter.isNull() )
+ return aRes;
+
+ std::list<SMESH::Filter::Criterion> aCriteria;
+
+ for ( LDOM_Node aCritNode = aFilter.getFirstChild();
+ !aCritNode.isNull() ; aCritNode = aCritNode.getNextSibling() )
+ {
+ LDOM_Element* aCrit = (LDOM_Element*)&aCritNode;
+
+ const char* aTypeStr = aCrit->getAttribute( ATTR_TYPE ).GetString();
+ const char* aCompareStr = aCrit->getAttribute( ATTR_COMPARE ).GetString();
+ const char* aUnaryStr = aCrit->getAttribute( ATTR_UNARY ).GetString();
+ const char* aBinaryStr = aCrit->getAttribute( ATTR_BINARY ).GetString();
+ const char* anElemTypeStr = aCrit->getAttribute( ATTR_ELEMENT_TYPE ).GetString();
+
+ SMESH::Filter::Criterion aCriterion = createCriterion();
+
+ aCriterion.Type = toFunctorType( aTypeStr );
+ aCriterion.Compare = toFunctorType( aCompareStr );
+ aCriterion.UnaryOp = toFunctorType( aUnaryStr );
+ aCriterion.BinaryOp = toFunctorType( aBinaryStr );
+
+ aCriterion.TypeOfElement = toElementType( anElemTypeStr );
+
+ LDOMString str = aCrit->getAttribute( ATTR_THRESHOLD );
+ int val = 0;
+ aCriterion.Threshold = str.Type() == LDOMBasicString::LDOM_Integer && str.GetInteger( val )
+ ? val : atof( str.GetString() );
+
+ str = aCrit->getAttribute( ATTR_TOLERANCE );
+ aCriterion.Tolerance = str.Type() == LDOMBasicString::LDOM_Integer && str.GetInteger( val )
+ ? val : atof( str.GetString() );
+
+ str = aCrit->getAttribute( ATTR_THRESHOLD_STR );
+ if ( str.Type() == LDOMBasicString::LDOM_Integer && str.GetInteger( val ) )
+ {
+ char a[ 255 ];
+ sprintf( a, "%d", val );
+ aCriterion.ThresholdStr = strdup( a );
+ }
+ else
+ aCriterion.ThresholdStr = str.GetString();
+
+ aCriteria.push_back( aCriterion );
+ }
+
+ SMESH::Filter::Criteria_var aCriteriaVar = new SMESH::Filter::Criteria;
+ aCriteriaVar->length( aCriteria.size() );
+
+ CORBA::ULong i = 0;
+ std::list<SMESH::Filter::Criterion>::iterator anIter = aCriteria.begin();
+
+ for( ; anIter != aCriteria.end(); ++anIter )
+ aCriteriaVar[ i++ ] = *anIter;
+
+ aRes = myFilterMgr->CreateFilter();
+ aRes->SetCriteria( aCriteriaVar.inout() );
+
+ return aRes;
+}
+
+//=======================================================================
+// name : FilterLibrary_i::SetFileName
+// Purpose : Set file name for library
+//=======================================================================
+void FilterLibrary_i::SetFileName( const char* theFileName )
+{
+ delete myFileName;
+ myFileName = strdup( theFileName );
+}
+
+//=======================================================================
+// name : FilterLibrary_i::GetFileName
+// Purpose : Get file name of library
+//=======================================================================
+char* FilterLibrary_i::GetFileName()
+{
+ return CORBA::string_dup( myFileName );
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Add
+// Purpose : Add new filter to library
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::Add( const char* theFilterName, Filter_ptr theFilter )
+{
+ // if filter already in library or entry filter is null do nothing
+ LDOM_Node aFilterNode = findFilter( theFilterName, myDoc );
+ if ( !aFilterNode.isNull() || theFilter->_is_nil() )
+ return false;
+
+ // get section corresponding to the filter type
+ ElementType anEntType = theFilter->GetElementType();
+
+ LDOM_Node aSection = getSection( anEntType, myDoc, true );
+ if ( aSection.isNull() )
+ return false;
+
+ // create filter item
+ LDOM_Element aFilterItem = createFilterItem( theFilterName, theFilter, myDoc );
+ if ( aFilterItem.isNull() )
+ return false;
+ else
+ {
+ aSection.appendChild( aFilterItem );
+ return true;
+ }
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Add
+// Purpose : Add new filter to library
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::AddEmpty( const char* theFilterName, ElementType theType )
+{
+ // if filter already in library or entry filter is null do nothing
+ LDOM_Node aFilterNode = findFilter( theFilterName, myDoc );
+ if ( !aFilterNode.isNull() )
+ return false;
+
+ LDOM_Node aSection = getSection( theType, myDoc, true );
+ if ( aSection.isNull() )
+ return false;
+
+ // create filter item
+ Filter_var aFilter = myFilterMgr->CreateFilter();
+
+ LDOM_Element aFilterItem = createFilterItem( theFilterName, aFilter, myDoc );
+ if ( aFilterItem.isNull() )
+ return false;
+ else
+ {
+ aSection.appendChild( aFilterItem );
+ return true;
+ }
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Delete
+// Purpose : Delete filter from library
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::Delete ( const char* theFilterName )
+{
+ LDOM_Node aParentNode;
+ LDOM_Node aFilterNode = findFilter( theFilterName, myDoc, &aParentNode );
+ if ( aFilterNode.isNull() || aParentNode.isNull() )
+ return false;
+
+ aParentNode.removeChild( aFilterNode );
+ return true;
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Replace
+// Purpose : Replace existing filter with entry filter.
+// IMPORTANT : If filter does not exist it is not created
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
+ const char* theNewName,
+ Filter_ptr theFilter )
+{
+ LDOM_Element aFilterItem = findFilter( theFilterName, myDoc );
+ if ( aFilterItem.isNull() || theFilter->_is_nil() )
+ return false;
+
+ LDOM_Element aNewItem = createFilterItem( theNewName, theFilter, myDoc );
+ if ( aNewItem.isNull() )
+ return false;
+ else
+ {
+ aFilterItem.ReplaceElement( aNewItem );
+ return true;
+ }
+}
+
+//=======================================================================
+// name : FilterLibrary_i::Save
+// Purpose : Save library on disk
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::Save()
+{
+ if ( myFileName == 0 || strlen( myFileName ) == 0 )
+ return false;
+
+ FILE* aOutFile = fopen( myFileName, "wt" );
+ if ( !aOutFile )
+ return false;
+
+ LDOM_XmlWriter aWriter( aOutFile );
+ aWriter.SetIndentation( 2 );
+ aWriter << myDoc;
+ fclose( aOutFile );
+
+ return true;
+}
+
+//=======================================================================
+// name : FilterLibrary_i::SaveAs
+// Purpose : Save library on disk
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::SaveAs( const char* aFileName )
+{
+ myFileName = strdup ( aFileName );
+ return Save();
+}
+
+//=======================================================================
+// name : FilterLibrary_i::IsPresent
+// Purpose : Verify whether filter is in library
+//=======================================================================
+CORBA::Boolean FilterLibrary_i::IsPresent( const char* theFilterName )
+{
+ return !findFilter( theFilterName, myDoc ).isNull();
+}
+
+//=======================================================================
+// name : FilterLibrary_i::NbFilters
+// Purpose : Return amount of filters in library
+//=======================================================================
+CORBA::Long FilterLibrary_i::NbFilters( ElementType theType )
+{
+ string_array_var aNames = GetNames( theType );
+ return aNames->length();
+}
+
+//=======================================================================
+// name : FilterLibrary_i::GetNames
+// Purpose : Get names of filters from library
+//=======================================================================
+string_array* FilterLibrary_i::GetNames( ElementType theType )
+{
+ string_array_var anArray = new string_array;
+ TColStd_SequenceOfHAsciiString aSeq;
+
+ LDOM_Node aSection = getSection( theType, myDoc, false );
+
+ if ( !aSection.isNull() )
+ {
+ for ( LDOM_Node aFilter = aSection.getFirstChild();
+ !aFilter.isNull(); aFilter = aFilter.getNextSibling() )
+ {
+ LDOM_Element& anElem = ( LDOM_Element& )aFilter;
+ aSeq.Append( new TCollection_HAsciiString(
+ (Standard_CString)anElem.getAttribute( "name" ).GetString() ) );
+ }
+ }
+
+ anArray->length( aSeq.Length() );
+ for ( int i = 1, n = aSeq.Length(); i <= n; i++ )
+ anArray[ i - 1 ] = CORBA::string_dup( aSeq( i )->ToCString() );
+
+ return anArray._retn();
+}
+
+//=======================================================================
+// name : FilterLibrary_i::GetAllNames
+// Purpose : Get names of filters from library
+//=======================================================================
+string_array* FilterLibrary_i::GetAllNames()
+{
+ string_array_var aResArray = new string_array;
+ for ( int type = SMESH::ALL; type <= SMESH::VOLUME; type++ )
+ {
+ SMESH::string_array_var aNames = GetNames( (SMESH::ElementType)type );
+
+ int aPrevLength = aResArray->length();
+ aResArray->length( aPrevLength + aNames->length() );
+ for ( int i = 0, n = aNames->length(); i < n; i++ )
+ aResArray[ aPrevLength + i ] = aNames[ i ];
+ }
+
+ return aResArray._retn();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-// File : SMESH_Filter_i.hxx\r
-// Author : Alexey Petrov, OCC\r
-// Module : SMESH\r
-\r
-#ifndef _SMESH_FILTER_I_HXX_\r
-#define _SMESH_FILTER_I_HXX_\r
-\r
-#include <SALOMEconfig.h>\r
-#include CORBA_SERVER_HEADER(SMESH_Filter)\r
-#include "SALOME_GenericObj_i.hh"\r
-\r
-class SMESHDS_Mesh;\r
-class gp_Pnt;\r
-class gp_XYZ;\r
-class TColgp_SequenceOfXYZ;\r
-\r
-namespace SMESH{\r
-\r
-/*\r
- FUNCTORS\r
-*/\r
-\r
-/*\r
- Class : NumericalFunctor_i\r
- Description : Base class for numerical functors \r
- \r
- PortableServer::POA_ptr thePOA\r
-\r
-*/\r
-\r
-class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,\r
- public virtual SALOME::GenericObj_i\r
-{\r
-public:\r
- NumericalFunctor_i();\r
- void SetMesh( SMESH_Mesh_ptr theMesh );\r
- virtual int GetType() const = 0;\r
-\r
-protected:\r
- bool getPoints( const int theId, \r
- TColgp_SequenceOfXYZ& theRes ) const;\r
-protected:\r
- SMESHDS_Mesh* myMesh;\r
-};\r
-\r
-/*\r
- Class : SMESH_MinimumAngleFunct\r
- Description : Functor for calculation of minimum angle\r
-*/\r
-\r
-class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : AspectRatio_i\r
- Description : Functor for calculating aspect ratio\r
-*/\r
-\r
-class AspectRatio_i: public virtual POA_SMESH::AspectRatio,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue(CORBA::Long theElementId);\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : Warping_i\r
- Description : Functor for calculating warping\r
-*/\r
-\r
-class Warping_i: public virtual POA_SMESH::Warping,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue(CORBA::Long theElementId);\r
- virtual int GetType() const;\r
-\r
-private:\r
- double ComputeA( const gp_XYZ&, const gp_XYZ&, \r
- const gp_XYZ&, const gp_XYZ& ) const;\r
-};\r
-\r
-/*\r
- Class : Taper_i\r
- Description : Functor for calculating taper\r
-*/\r
-\r
-class Taper_i: public virtual POA_SMESH::Taper,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : Skew_i\r
- Description : Functor for calculating skew in degrees\r
-*/\r
-\r
-class Skew_i: public virtual POA_SMESH::Skew,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : Area_i\r
- Description : Functor for calculating area\r
-*/\r
-\r
-class Area_i: public virtual POA_SMESH::Area,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : Length_i\r
- Description : Functor for calculating length of edge\r
-*/\r
-\r
-class Length_i: public virtual POA_SMESH::Length,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-/*\r
- Class : MultiConnection_i\r
- Description : Functor for calculating number of faces conneted to the edge\r
-*/\r
-\r
-class MultiConnection_i: public virtual POA_SMESH::MultiConnection,\r
- public virtual NumericalFunctor_i\r
-{\r
-public:\r
- CORBA::Double GetValue( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-};\r
-\r
-\r
-/*\r
- PREDICATES\r
-*/\r
-\r
-/*\r
- Class : Predicate_i\r
- Description : Base class for all predicates\r
-*/\r
-\r
-class Predicate_i: public virtual POA_SMESH::Predicate,\r
- public virtual SALOME::GenericObj_i\r
-{\r
-public:\r
- Predicate_i();\r
- virtual int GetType() const = 0;\r
-};\r
-\r
-\r
-/*\r
- Class : FreeBorders_i\r
- Description : Predicate for free borders\r
-*/\r
-\r
-class FreeBorders_i: public virtual POA_SMESH::FreeBorders,\r
- public virtual Predicate_i\r
-{\r
-public:\r
- FreeBorders_i();\r
- void SetMesh( SMESH_Mesh_ptr theMesh );\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
- virtual int GetType() const;\r
-\r
-protected:\r
- SMESHDS_Mesh* myMesh;\r
-};\r
-\r
-/*\r
- Class : Comparator_i\r
- Description : Base class for comparators\r
-*/\r
-\r
-class Comparator_i: public virtual POA_SMESH::Comparator,\r
- public virtual Predicate_i\r
-{\r
-public:\r
- Comparator_i();\r
- virtual ~Comparator_i();\r
-\r
- void SetMesh( SMESH_Mesh_ptr theMesh );\r
- void SetMargin( CORBA::Double );\r
- void SetNumFunctor( NumericalFunctor_ptr );\r
-\r
- virtual int GetType() const;\r
-\r
-protected:\r
- CORBA::Double myMargin;\r
- NumericalFunctor_i* myFunctor;\r
-};\r
-\r
-/*\r
- Class : LessThan_i\r
- Description : Comparator "<"\r
-*/\r
-\r
-class LessThan_i: public virtual POA_SMESH::LessThan,\r
- public virtual Comparator_i\r
-{\r
-public:\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
-};\r
-\r
-/*\r
- Class : MoreThan_i\r
- Description : Comparator ">"\r
-*/\r
-class MoreThan_i: public virtual POA_SMESH::MoreThan,\r
- public virtual Comparator_i\r
-{\r
-public:\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
-};\r
-\r
-/*\r
- Class : EqualTo_i\r
- Description : Comparator "="\r
-*/\r
-class EqualTo_i: public virtual POA_SMESH::EqualTo,\r
- public virtual Comparator_i\r
-{\r
-public:\r
- EqualTo_i();\r
-\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
-\r
- void SetTolerance( CORBA::Double );\r
-\r
-private:\r
- CORBA::Double myToler;\r
-};\r
-\r
-/*\r
- Class : Logical_i\r
- Description : Base class for logical predicate\r
-*/\r
-\r
-class Logical_i: public virtual POA_SMESH::Logical,\r
- public virtual Predicate_i\r
- \r
-{\r
-};\r
-\r
-/*\r
- Class : LogicalNOT_i\r
- Description : Logical NOT predicate\r
-*/\r
-\r
-class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,\r
- public virtual Logical_i\r
-{\r
-public:\r
- LogicalNOT_i();\r
- virtual ~LogicalNOT_i();\r
-\r
- CORBA::Boolean IsSatisfy( CORBA::Long );\r
-\r
- void SetMesh( SMESH_Mesh_ptr );\r
- void SetPredicate( Predicate_ptr );\r
-\r
- virtual int GetType() const;\r
-\r
-private:\r
- Predicate_i* myPredicate;\r
-};\r
-\r
-\r
-/*\r
- Class : LogicalBinary_i\r
- Description : Base class for binary logical predicate\r
-*/\r
-\r
-class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,\r
- public virtual Logical_i\r
-{\r
-public:\r
- LogicalBinary_i();\r
- virtual ~LogicalBinary_i();\r
-\r
- void SetMesh( SMESH_Mesh_ptr );\r
-\r
- void SetPredicate1( Predicate_ptr );\r
- void SetPredicate2( Predicate_ptr );\r
-\r
- virtual int GetType() const;\r
-\r
-protected:\r
- Predicate_i* myPredicate1;\r
- Predicate_i* myPredicate2;\r
-};\r
-\r
-/*\r
- Class : LogicalAND_i\r
- Description : Logical AND\r
-*/\r
-\r
-class LogicalAND_i: public virtual POA_SMESH::LogicalAND,\r
- public virtual LogicalBinary_i\r
-{\r
-public:\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
-};\r
-\r
-/*\r
- Class : LogicalOR_i\r
- Description : Logical OR\r
-*/\r
-\r
-class LogicalOR_i: public virtual POA_SMESH::LogicalOR,\r
- public virtual LogicalBinary_i\r
-{\r
-public:\r
- CORBA::Boolean IsSatisfy( CORBA::Long theElementId );\r
-};\r
-\r
-\r
-/*\r
- FILTER\r
-*/\r
-\r
-class Filter_i: public virtual POA_SMESH::Filter,\r
- public virtual SALOME::GenericObj_i\r
-{\r
-public:\r
- Filter_i();\r
- virtual ~Filter_i();\r
- void SetPredicate(Predicate_ptr );\r
- long_array* GetElementsId(SMESH_Mesh_ptr );\r
- void SetMesh( SMESH_Mesh_ptr );\r
-\r
-protected:\r
- Predicate_i* myPredicate;\r
-};\r
-\r
-\r
-/*\r
- FILTER MANAGER\r
-*/\r
-\r
-class FilterManager_i: public virtual POA_SMESH::FilterManager,\r
- public virtual SALOME::GenericObj_i\r
-{\r
-public:\r
- FilterManager_i();\r
- MinimumAngle_ptr CreateMinimumAngle();\r
- AspectRatio_ptr CreateAspectRatio();\r
- Warping_ptr CreateWarping();\r
- Taper_ptr CreateTaper();\r
- Skew_ptr CreateSkew();\r
- Area_ptr CreateArea();\r
- Length_ptr CreateLength();\r
- MultiConnection_ptr CreateMultiConnection();\r
- \r
- FreeBorders_ptr CreateFreeBorders();\r
-\r
- LessThan_ptr CreateLessThan();\r
- MoreThan_ptr CreateMoreThan();\r
- EqualTo_ptr CreateEqualTo();\r
- \r
- LogicalNOT_ptr CreateLogicalNOT();\r
- LogicalAND_ptr CreateLogicalAND();\r
- LogicalOR_ptr CreateLogicalOR();\r
-\r
- Filter_ptr CreateFilter();\r
-};\r
-\r
-\r
-\r
-};\r
-\r
-\r
-#endif\r
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_Filter_i.hxx
+// Author : Alexey Petrov, OCC
+// Module : SMESH
+
+#ifndef _SMESH_FILTER_I_HXX_
+#define _SMESH_FILTER_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+
+#include <LDOM_Document.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include "SALOME_GenericObj_i.hh"
+#include "SMESH_Controls.hxx"
+
+class SMESHDS_Mesh;
+
+namespace SMESH
+{
+
+namespace Controls
+{
+
+/*
+ Class : BelongToGeom
+ Description : Predicate for verifying whether entiy belong to
+ specified geometrical support
+*/
+class BelongToGeom: public virtual Predicate
+{
+public:
+ BelongToGeom();
+
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual void SetGeom( const TopoDS_Shape& theShape );
+
+ virtual bool IsSatisfy( long theElementId );
+
+ virtual void SetType( SMDSAbs_ElementType theType );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ TopoDS_Shape GetShape();
+ SMESHDS_Mesh* GetMeshDS();
+
+private:
+ TopoDS_Shape myShape;
+ SMESHDS_Mesh* myMeshDS;
+ SMDSAbs_ElementType myType;
+};
+typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
+}
+
+/*
+ FUNCTORS
+*/
+
+/*
+ Class : Functor_i
+ Description : An abstact class for all functors
+*/
+class Functor_i: public virtual POA_SMESH::Functor,
+ public virtual SALOME::GenericObj_i
+{
+public:
+ void SetMesh( SMESH_Mesh_ptr theMesh );
+ Controls::FunctorPtr GetFunctor(){ return myFunctorPtr;}
+ ElementType GetElementType();
+
+protected:
+ Functor_i();
+protected:
+ Controls::FunctorPtr myFunctorPtr;
+};
+
+
+/*
+ Class : NumericalFunctor_i
+ Description : Base class for numerical functors
+*/
+class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
+ public virtual Functor_i
+{
+public:
+ CORBA::Double GetValue( CORBA::Long theElementId );
+ void SetPrecision( CORBA::Long thePrecision );
+ CORBA::Long GetPrecision();
+ Controls::NumericalFunctorPtr GetNumericalFunctor();
+
+protected:
+ Controls::NumericalFunctorPtr myNumericalFunctorPtr;
+};
+
+
+/*
+ Class : SMESH_MinimumAngleFunct
+ Description : Functor for calculation of minimum angle
+*/
+class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
+ public virtual NumericalFunctor_i
+{
+public:
+ MinimumAngle_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : AspectRatio_i
+ Description : Functor for calculating aspect ratio
+*/
+class AspectRatio_i: public virtual POA_SMESH::AspectRatio,
+ public virtual NumericalFunctor_i
+{
+public:
+ AspectRatio_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : Warping_i
+ Description : Functor for calculating warping
+*/
+class Warping_i: public virtual POA_SMESH::Warping,
+ public virtual NumericalFunctor_i
+{
+public:
+ Warping_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : Taper_i
+ Description : Functor for calculating taper
+*/
+class Taper_i: public virtual POA_SMESH::Taper,
+ public virtual NumericalFunctor_i
+{
+public:
+ Taper_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : Skew_i
+ Description : Functor for calculating skew in degrees
+*/
+class Skew_i: public virtual POA_SMESH::Skew,
+ public virtual NumericalFunctor_i
+{
+public:
+ Skew_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : Area_i
+ Description : Functor for calculating area
+*/
+class Area_i: public virtual POA_SMESH::Area,
+ public virtual NumericalFunctor_i
+{
+public:
+ Area_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : Length_i
+ Description : Functor for calculating length of edge
+*/
+class Length_i: public virtual POA_SMESH::Length,
+ public virtual NumericalFunctor_i
+{
+public:
+ Length_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : MultiConnection_i
+ Description : Functor for calculating number of faces conneted to the edge
+*/
+class MultiConnection_i: public virtual POA_SMESH::MultiConnection,
+ public virtual NumericalFunctor_i
+{
+public:
+ MultiConnection_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ PREDICATES
+*/
+/*
+ Class : Predicate_i
+ Description : Base class for all predicates
+*/
+class Predicate_i: public virtual POA_SMESH::Predicate,
+ public virtual Functor_i
+{
+public:
+ CORBA::Boolean IsSatisfy( CORBA::Long theElementId );
+ Controls::PredicatePtr GetPredicate();
+
+protected:
+ Controls::PredicatePtr myPredicatePtr;
+};
+
+
+/*
+ Class : BelongToGeom_i
+ Description : Predicate for selection on geometrical support
+*/
+class BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
+ public virtual Predicate_i
+{
+public:
+ BelongToGeom_i();
+ virtual ~BelongToGeom_i();
+
+ void SetGeom( GEOM::GEOM_Object_ptr theGeom );
+ void SetElementType( ElementType theType );
+ FunctorType GetFunctorType();
+
+ void SetGeom( const TopoDS_Shape& theShape );
+
+ void SetShapeName( const char* theName );
+ char* GetShapeName();
+
+protected:
+ Controls::BelongToGeomPtr myBelongToGeomPtr;
+ char* myShapeName;
+};
+
+/*
+ Class : BelongToSurface_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+class BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
+ public virtual Predicate_i
+{
+public:
+ BelongToSurface_i( const Handle(Standard_Type)& );
+ virtual ~BelongToSurface_i();
+
+ void SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+
+ void SetShapeName( const char* theName, ElementType theType );
+ char* GetShapeName();
+
+ void SetTolerance( CORBA::Double );
+ CORBA::Double GetTolerance();
+
+protected:
+ Controls::ElementsOnSurfacePtr myElementsOnSurfacePtr;
+ char* myShapeName;
+ Handle(Standard_Type) mySurfaceType;
+};
+
+/*
+ Class : BelongToPlane_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+class BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
+ public virtual BelongToSurface_i
+{
+public:
+ BelongToPlane_i();
+ void SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+ FunctorType GetFunctorType();
+};
+
+/*
+ Class : BelongToCylinder_i
+ Description : Verify whether mesh element lie in pointed Geom cylindrical object
+*/
+class BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
+ public virtual BelongToSurface_i
+{
+public:
+ BelongToCylinder_i();
+ void SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : FreeBorders_i
+ Description : Predicate for free borders
+*/
+class FreeBorders_i: public virtual POA_SMESH::FreeBorders,
+ public virtual Predicate_i
+{
+public:
+ FreeBorders_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : FreeEdges_i
+ Description : Predicate for free edges
+*/
+class FreeEdges_i: public virtual POA_SMESH::FreeEdges,
+ public virtual Predicate_i
+{
+public:
+ FreeEdges_i();
+ SMESH::FreeEdges::Borders* GetBorders();
+ FunctorType GetFunctorType();
+
+protected:
+ Controls::FreeEdgesPtr myFreeEdgesPtr;
+};
+
+
+/*
+ Class : RangeOfIds_i
+ Description : Predicate for Range of Ids
+*/
+class RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
+ public virtual Predicate_i
+{
+public:
+ RangeOfIds_i();
+ void SetRange( const SMESH::long_array& theIds );
+ CORBA::Boolean SetRangeStr( const char* theRange );
+ char* GetRangeStr();
+
+ void SetElementType( ElementType theType );
+ FunctorType GetFunctorType();
+
+protected:
+ Controls::RangeOfIdsPtr myRangeOfIdsPtr;
+};
+
+/*
+ Class : Comparator_i
+ Description : Base class for comparators
+*/
+class Comparator_i: public virtual POA_SMESH::Comparator,
+ public virtual Predicate_i
+{
+public:
+ virtual ~Comparator_i();
+
+ virtual void SetMargin( CORBA::Double );
+ virtual void SetNumFunctor( NumericalFunctor_ptr );
+
+ Controls::ComparatorPtr GetComparator();
+ NumericalFunctor_i* GetNumFunctor_i();
+ CORBA::Double GetMargin();
+
+protected:
+ Comparator_i();
+protected:
+ Controls::ComparatorPtr myComparatorPtr;
+ NumericalFunctor_i* myNumericalFunctor;
+};
+
+
+/*
+ Class : LessThan_i
+ Description : Comparator "<"
+*/
+class LessThan_i: public virtual POA_SMESH::LessThan,
+ public virtual Comparator_i
+{
+public:
+ LessThan_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : MoreThan_i
+ Description : Comparator ">"
+*/
+class MoreThan_i: public virtual POA_SMESH::MoreThan,
+ public virtual Comparator_i
+{
+public:
+ MoreThan_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : EqualTo_i
+ Description : Comparator "="
+*/
+class EqualTo_i: public virtual POA_SMESH::EqualTo,
+ public virtual Comparator_i
+{
+public:
+ EqualTo_i();
+ virtual void SetTolerance( CORBA::Double );
+ CORBA::Double GetTolerance();
+ FunctorType GetFunctorType();
+
+protected:
+ Controls::EqualToPtr myEqualToPtr;
+};
+
+
+/*
+ Class : LogicalNOT_i
+ Description : Logical NOT predicate
+*/
+class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
+ public virtual Predicate_i
+{
+public:
+ LogicalNOT_i();
+ virtual ~LogicalNOT_i();
+
+ virtual void SetPredicate( Predicate_ptr );
+ Predicate_i* GetPredicate_i();
+ FunctorType GetFunctorType();
+
+protected:
+ Controls::LogicalNOTPtr myLogicalNOTPtr;
+ Predicate_i* myPredicate;
+};
+
+
+/*
+ Class : LogicalBinary_i
+ Description : Base class for binary logical predicate
+*/
+class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
+ public virtual Predicate_i
+{
+public:
+ virtual ~LogicalBinary_i();
+ virtual void SetMesh( SMESH_Mesh_ptr theMesh );
+ virtual void SetPredicate1( Predicate_ptr );
+ virtual void SetPredicate2( Predicate_ptr );
+
+ Controls::LogicalBinaryPtr GetLogicalBinary();
+ Predicate_i* GetPredicate1_i();
+ Predicate_i* GetPredicate2_i();
+
+protected:
+ LogicalBinary_i();
+protected:
+ Controls::LogicalBinaryPtr myLogicalBinaryPtr;
+ Predicate_i* myPredicate1;
+ Predicate_i* myPredicate2;
+};
+
+
+/*
+ Class : LogicalAND_i
+ Description : Logical AND
+*/
+class LogicalAND_i: public virtual POA_SMESH::LogicalAND,
+ public virtual LogicalBinary_i
+{
+public:
+ LogicalAND_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ Class : LogicalOR_i
+ Description : Logical OR
+*/
+class LogicalOR_i: public virtual POA_SMESH::LogicalOR,
+ public virtual LogicalBinary_i
+{
+public:
+ LogicalOR_i();
+ FunctorType GetFunctorType();
+};
+
+
+/*
+ FILTER
+*/
+class Filter_i: public virtual POA_SMESH::Filter,
+ public virtual SALOME::GenericObj_i
+{
+public:
+ Filter_i();
+ virtual ~Filter_i();
+
+ void SetPredicate( Predicate_ptr );
+ void SetMesh( SMESH_Mesh_ptr );
+
+ long_array* GetElementsId( SMESH_Mesh_ptr );
+ ElementType GetElementType();
+
+ CORBA::Boolean GetCriteria( SMESH::Filter::Criteria_out theCriteria );
+ CORBA::Boolean SetCriteria( const SMESH::Filter::Criteria& theCriteria );
+
+ Predicate_ptr GetPredicate();
+ Predicate_i* GetPredicate_i();
+
+private:
+ Controls::Filter myFilter;
+ Predicate_i* myPredicate;
+};
+
+
+/*
+ FILTER LIBRARY
+*/
+class FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
+ public virtual SALOME::GenericObj_i
+{
+public:
+ FilterLibrary_i( const char* theFileName );
+ FilterLibrary_i();
+ ~FilterLibrary_i();
+
+ Filter_ptr Copy( const char* theFilterName );
+
+ CORBA::Boolean Add ( const char* theFilterName, Filter_ptr theFilter );
+ CORBA::Boolean AddEmpty( const char* theFilterName, ElementType theType );
+ CORBA::Boolean Delete ( const char* theFilterName );
+ CORBA::Boolean Replace ( const char* theFilterName,
+ const char* theNewName,
+ Filter_ptr theFilter );
+
+ CORBA::Boolean Save();
+ CORBA::Boolean SaveAs( const char* aFileName );
+
+ CORBA::Boolean IsPresent( const char* aFilterName );
+ CORBA::Long NbFilters( ElementType );
+ string_array* GetNames( ElementType );
+ string_array* GetAllNames();
+ void SetFileName( const char* theFileName );
+ char* GetFileName();
+
+private:
+ char* myFileName;
+ LDOM_Document myDoc;
+ FilterManager_var myFilterMgr;
+};
+
+
+/*
+ FILTER MANAGER
+*/
+
+class FilterManager_i: public virtual POA_SMESH::FilterManager,
+ public virtual SALOME::GenericObj_i
+{
+public:
+ FilterManager_i();
+ MinimumAngle_ptr CreateMinimumAngle();
+ AspectRatio_ptr CreateAspectRatio();
+ Warping_ptr CreateWarping();
+ Taper_ptr CreateTaper();
+ Skew_ptr CreateSkew();
+ Area_ptr CreateArea();
+ Length_ptr CreateLength();
+ MultiConnection_ptr CreateMultiConnection();
+
+ BelongToGeom_ptr CreateBelongToGeom();
+ BelongToPlane_ptr CreateBelongToPlane();
+ BelongToCylinder_ptr CreateBelongToCylinder();
+
+ FreeBorders_ptr CreateFreeBorders();
+ FreeEdges_ptr CreateFreeEdges();
+
+ RangeOfIds_ptr CreateRangeOfIds();
+
+ LessThan_ptr CreateLessThan();
+ MoreThan_ptr CreateMoreThan();
+ EqualTo_ptr CreateEqualTo();
+
+ LogicalNOT_ptr CreateLogicalNOT();
+ LogicalAND_ptr CreateLogicalAND();
+ LogicalOR_ptr CreateLogicalOR();
+
+ Filter_ptr CreateFilter();
+
+ FilterLibrary_ptr LoadLibrary( const char* aFileName );
+ FilterLibrary_ptr CreateLibrary();
+ CORBA::Boolean DeleteLibrary( const char* aFileName );
+};
+
+
+
+};
+
+
+#endif
// Module : SMESH
// $Header$
-using namespace std;
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include "SMESHDS_Document.hxx"
#include "SMESHDS_Group.hxx"
-#include "SMESH_topo.hxx"
#include "SMESH_Group.hxx"
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
+
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Filter)
-#include "SMESH_Filter_i.hxx"
-#include "Document_Reader.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "DriverMED_R_SMESHDS_Document.h"
-#include "DriverUNV_R_SMESHDS_Document.h"
-#include "DriverDAT_R_SMESHDS_Document.h"
#include "SALOMEDS_Tool.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_ExceptHandlers.hxx"
#include <map>
+#include <boost/filesystem/path.hpp>
+
+using namespace std;
#define NUM_TMP_FILES 2
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
// Tags definition ===========================================================
// Top level
long Tag_HypothesisRoot = 1; // hypotheses root
// Mesh only
long Tag_SubMeshOnVertex = 4; // sub-meshes roots by type
long Tag_SubMeshOnEdge = 5; // ...
-long Tag_SubMeshOnFace = 6; // ...
-long Tag_SubMeshOnSolid = 7; // ...
-long Tag_SubMeshOnCompound = 8; // ...
-long Tag_NodeGroups = 9; // Group roots by type
-long Tag_EdgeGroups = 10; // ...
-long Tag_FaceGroups = 11; // ...
-long Tag_VolumeGroups = 12; // ...
+long Tag_SubMeshOnWire = 6; // ...
+long Tag_SubMeshOnFace = 7; // ...
+long Tag_SubMeshOnShell = 8; // ...
+long Tag_SubMeshOnSolid = 9; // ...
+long Tag_SubMeshOnCompound = 10; // ...
+long Tag_NodeGroups = 11; // Group roots by type
+long Tag_EdgeGroups = 12; // ...
+long Tag_FaceGroups = 13; // ...
+long Tag_VolumeGroups = 14; // ...
// ===========================================================================
// Static variables definition
PortableServer::POA_var SMESH_Gen_i::myPoa;
SALOME_NamingService* SMESH_Gen_i::myNS = NULL;
SALOME_LifeCycleCORBA* SMESH_Gen_i::myLCC = NULL;
+SMESH_Gen_i* SMESH_Gen_i::mySMESHGen = NULL;
//=============================================================================
/*!
return Tag_SubMeshOnCompound;
}
+long SMESH_Gen_i::GetSubMeshOnWireTag()
+{
+ return Tag_SubMeshOnWire;
+}
+
+long SMESH_Gen_i::GetSubMeshOnShellTag()
+{
+ return Tag_SubMeshOnShell;
+}
+
long SMESH_Gen_i::GetNodeGroupsTag()
{
return Tag_NodeGroups;
return aServant;
}
catch (...) {
- MESSAGE( "GetServant - Unknown exception was caught!!!" );
+ INFOS( "GetServant - Unknown exception was caught!!!" );
return NULL;
}
}
}
}
catch( ... ) {
- MESSAGE( "SObjectToObject - Unknown exception was caught!!!" );
+ INFOS( "SObjectToObject - Unknown exception was caught!!!" );
}
}
return anObj;
SMESH_Gen_i::SMESH_Gen_i()
{
- MESSAGE( "SMESH_Gen_i::SMESH_Gen_i : default constructor" );
+ INFOS( "SMESH_Gen_i::SMESH_Gen_i : default constructor" );
}
//=============================================================================
const char* interfaceName )
: Engines_Component_i( orb, poa, contId, instanceName, interfaceName )
{
- MESSAGE( "SMESH_Gen_i::SMESH_Gen_i : standard constructor" );
+ INFOS( "SMESH_Gen_i::SMESH_Gen_i : standard constructor" );
myOrb = CORBA::ORB::_duplicate(orb);
myPoa = PortableServer::POA::_duplicate(poa);
_id = myPoa->activate_object( _thisObj );
myShapeReader = NULL; // shape reader
+ mySMESHGen = this;
}
//=============================================================================
SMESH_Gen_i::~SMESH_Gen_i()
{
- MESSAGE( "SMESH_Gen_i::~SMESH_Gen_i" );
+ INFOS( "SMESH_Gen_i::~SMESH_Gen_i" );
// delete hypothesis creators
map<string, GenericHypothesisCreator_i*>::iterator itHyp;
delete myShapeReader;
}
-//=============================================================================
-/*!
- * SMESH_Gen_i::CreateFilterManager
- *
- * Create filter manager
- */
-//=============================================================================
-
-SMESH::FilterManager_ptr SMESH_Gen_i::CreateFilterManager()
-{
- SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
- SMESH::FilterManager_var anObj = aFilter->_this();
- return anObj._retn();
-}
-
//=============================================================================
/*!
* SMESH_Gen_i::createHypothesis
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "Create Hypothesis <" << theHypName << "> from " << theLibName);
+ if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << theLibName);
// get study context
StudyContext* myStudyContext = GetCurrentStudyContext();
if (myHypCreatorMap.find(string(theHypName)) == myHypCreatorMap.end())
{
// load plugin library
- MESSAGE("Loading server meshers plugin library ...");
+ if(MYDEBUG) MESSAGE("Loading server meshers plugin library ...");
void* libHandle = dlopen (theLibName, RTLD_LAZY);
if (!libHandle)
{
}
// get method, returning hypothesis creator
- MESSAGE("Find GetHypothesisCreator() method ...");
+ if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char* theHypName);
GetHypothesisCreator procHandle =
(GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
}
// get hypothesis creator
- MESSAGE("Get Hypothesis Creator for " << theHypName);
+ if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << theHypName);
GenericHypothesisCreator_i* aCreator = procHandle(theHypName);
if (!aCreator)
{
}
// create a new hypothesis object, store its ref. in studyContext
- MESSAGE("Create Hypothesis " << theHypName);
+ if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
myHypothesis_i =
myHypCreatorMap[string(theHypName)]->Create
(myPoa, myCurrentStudy->StudyId(), &myGen);
hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() );
string iorString = GetORB()->object_to_string( hypothesis_i );
int nextId = myStudyContext->addObject( iorString );
- MESSAGE( "Add hypo to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
+ if(MYDEBUG) MESSAGE( "Add hypo to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
return hypothesis_i._retn();
}
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::createMesh" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::createMesh" );
// get current study
StudyContext* myStudyContext = GetCurrentStudyContext();
SMESH::SMESH_Mesh_var mesh = meshServant->_this();
string iorString = GetORB()->object_to_string( mesh );
int nextId = myStudyContext->addObject( iorString );
- MESSAGE( "Add mesh to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
+ if(MYDEBUG) MESSAGE( "Add mesh to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
return mesh._retn();
}
catch (SALOME_Exception& S_ex) {
void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
{
- MESSAGE( "SMESH_Gen_i::SetCurrentStudy" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::SetCurrentStudy" );
myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
// create study context, if it doesn't exist and set current study
int studyId = myCurrentStudy->StudyId();
- MESSAGE( "SMESH_Gen_i::SetCurrentStudy: study Id = " << studyId );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::SetCurrentStudy: study Id = " << studyId );
if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) {
myStudyContextMap[ studyId ] = new StudyContext;
}
// set current study for geom engine
+ /*
if ( !CORBA::is_nil( GetGeomEngine() ) )
GetGeomEngine()->GetCurrentStudy( myCurrentStudy->StudyId() );
+ */
}
//=============================================================================
SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy()
{
- MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << myCurrentStudy->StudyId() );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << myCurrentStudy->StudyId() );
return SALOMEDS::Study::_duplicate( myCurrentStudy );
}
*/
//=============================================================================
-SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Shape_ptr theShape )
+SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::CreateMesh" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMesh" );
ASSERT( !CORBA::is_nil( myCurrentStudy ) );
// create mesh
SMESH::SMESH_Mesh_var mesh = this->createMesh();
// set shape
SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
ASSERT( meshServant );
- meshServant->SetShape( theShape );
+ meshServant->SetShape( theShapeObject );
return mesh._retn();
}
+//=============================================================================
+/*!
+ * SMESH_Gen_i::CreateMeshFromUNV
+ *
+ * Create mesh and import data from UNV file
+ */
+//=============================================================================
+
+SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName )
+ throw ( SALOME::SALOME_Exception )
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshesFromUNV" );
+ ASSERT( !CORBA::is_nil( myCurrentStudy ) );
+
+ SMESH::SMESH_Mesh_var aMesh = createMesh();
+ string aFileName; // = boost::filesystem::path(theFileName).leaf();
+ // publish mesh in the study
+ if ( CanPublishInStudy( aMesh ) ) {
+ PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+ }
+ SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
+ ASSERT( aServant );
+ aServant->ImportUNVFile( theFileName );
+ return aMesh._retn();
+}
+
//=============================================================================
/*!
* SMESH_Gen_i::CreateMeshFromMED
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
ASSERT( !CORBA::is_nil( myCurrentStudy ) );
// Retrieve mesh names from the file
DriverMED_R_SMESHDS_Mesh myReader;
myReader.SetFile( theFileName );
myReader.SetMeshId( -1 );
- list<string> aNames = myReader.GetMeshNames();
-
+ Driver_Mesh::Status aStatus;
+ list<string> aNames = myReader.GetMeshNames(aStatus);
SMESH::mesh_array_var aResult = new SMESH::mesh_array();
- aResult->length( aNames.size() );
- int i = 0;
-
- // Iterate through all meshes and create mesh objects
- theStatus = SMESH::DRS_OK;
- for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
- // create mesh
- SMESH::SMESH_Mesh_var mesh = createMesh();
+ theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
+ if(theStatus == SMESH::DRS_OK){
+ aResult->length( aNames.size() );
+ int i = 0;
- // publish mesh in the study
- if ( CanPublishInStudy( mesh ) ) {
- PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), mesh.in(), (*it).c_str() );
+ // Iterate through all meshes and create mesh objects
+ for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
+ // create mesh
+ SMESH::SMESH_Mesh_var mesh = createMesh();
+
+ // publish mesh in the study
+ if ( CanPublishInStudy( mesh ) ) {
+ PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), mesh.in(), (*it).c_str() );
+ }
+
+ // Read mesh data (groups are published automatically by ImportMEDFile())
+ SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
+ ASSERT( meshServant );
+ SMESH::DriverMED_ReadStatus status1 =
+ meshServant->ImportMEDFile( theFileName, (*it).c_str() );
+ if (status1 > theStatus)
+ theStatus = status1;
+
+ aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
}
+ }
+ return aResult._retn();
+}
- // Read mesh data (groups are published automatically by ImportMEDFile())
- SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( mesh ).in() );
- ASSERT( meshServant );
- SMESH::DriverMED_ReadStatus status1 =
- meshServant->ImportMEDFile( theFileName, (*it).c_str() );
- if (status1 > theStatus)
- theStatus = status1;
+//=============================================================================
+/*!
+ * SMESH_Gen_i::CreateMeshFromSTL
+ *
+ * Create mesh and import data from STL file
+ */
+//=============================================================================
- aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
- }
+SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName )
+ throw ( SALOME::SALOME_Exception )
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshesFromSTL" );
+ ASSERT( !CORBA::is_nil( myCurrentStudy ) );
- return aResult._retn();
+ SMESH::SMESH_Mesh_var aMesh = createMesh();
+ string aFileName; // = boost::filesystem::path(theFileName).leaf();
+ // publish mesh in the study
+ if ( CanPublishInStudy( aMesh ) ) {
+ PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+ }
+ SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
+ ASSERT( aServant );
+ aServant->ImportSTLFile( theFileName );
+ return aMesh._retn();
}
//=============================================================================
//=============================================================================
CORBA::Boolean SMESH_Gen_i::IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Shape_ptr theShape )
+ GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::IsReadyToCompute" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IsReadyToCompute" );
- if ( CORBA::is_nil( theShape ) )
- THROW_SALOME_CORBA_EXCEPTION( "bad shape reference",
+ if ( CORBA::is_nil( theShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) )
ASSERT( meshServant );
if ( meshServant ) {
// get local TopoDS_Shape
- TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), theShape );
+ TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), theShapeObject );
// call implementation
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
return myGen.CheckAlgoState( myLocMesh, myLocShape );
}
}
catch ( SALOME_Exception& S_ex ) {
- MESSAGE( "catch exception "<< S_ex.what() );
+ INFOS( "catch exception "<< S_ex.what() );
}
return false;
}
*/
//=============================================================================
-SMESH::long_array* SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Shape_ptr theMainShape,
- const SMESH::shape_array& theListOfSubShape )
+SMESH::long_array* SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
+ const SMESH::object_array& theListOfSubShapeObject )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::GetSubShapesId" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetSubShapesId" );
SMESH::long_array_var shapesId = new SMESH::long_array;
set<int> setId;
- if ( CORBA::is_nil( theMainShape ) )
- THROW_SALOME_CORBA_EXCEPTION( "bad shape reference",
+ if ( CORBA::is_nil( theMainShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM );
try
{
- if (! myShapeReader) myShapeReader = new GEOM_Client(GetContainerRef());
+ if ( !myShapeReader )
+ myShapeReader = new GEOM_Client( GetContainerRef() );
ASSERT(myShapeReader);
- TopoDS_Shape myMainShape = GetShapeReader()->GetShape(GetGeomEngine(),theMainShape);
+ TopoDS_Shape myMainShape = GetShapeReader()->GetShape(GetGeomEngine(),theMainShapeObject);
TopTools_IndexedMapOfShape myIndexToShape;
TopExp::MapShapes(myMainShape,myIndexToShape);
- for (int i=0; i<theListOfSubShape.length(); i++)
+ for ( int i = 0; i < theListOfSubShapeObject.length(); i++ )
{
- GEOM::GEOM_Shape_var aShape
- = GEOM::GEOM_Shape::_narrow(theListOfSubShape[i]);
- if (CORBA::is_nil(aShape))
- THROW_SALOME_CORBA_EXCEPTION("bad shape reference", \
- SALOME::BAD_PARAM);
- TopoDS_Shape locShape = GetShapeReader()->GetShape(GetGeomEngine(),aShape);
+ GEOM::GEOM_Object_var aShapeObject
+ = GEOM::GEOM_Object::_narrow(theListOfSubShapeObject[i]);
+ if ( CORBA::is_nil( aShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION ("bad shape object reference", \
+ SALOME::BAD_PARAM );
+
+ TopoDS_Shape locShape = GetShapeReader()->GetShape(GetGeomEngine(),aShapeObject);
for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next())
{
const TopoDS_Face& F = TopoDS::Face(exp.Current());
setId.insert(myIndexToShape.FindIndex(F));
- SCRUTE(myIndexToShape.FindIndex(F));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(F));
}
for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
setId.insert(myIndexToShape.FindIndex(E));
- SCRUTE(myIndexToShape.FindIndex(E));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(E));
}
for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next())
{
const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
setId.insert(myIndexToShape.FindIndex(V));
- SCRUTE(myIndexToShape.FindIndex(V));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(V));
}
}
shapesId->length(setId.size());
int i=0;
for (iind = setId.begin(); iind != setId.end(); iind++)
{
- SCRUTE((*iind));
+ if(MYDEBUG) SCRUTE((*iind));
shapesId[i] = (*iind);
- SCRUTE(shapesId[i]);
+ if(MYDEBUG) SCRUTE(shapesId[i]);
i++;
}
}
//=============================================================================
CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Shape_ptr theShape )
+ GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "SMESH_Gen_i::Compute" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
- if ( CORBA::is_nil( theShape ) )
- THROW_SALOME_CORBA_EXCEPTION( "bad shape reference",
+ if ( CORBA::is_nil( theShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) )
ASSERT( meshServant );
if ( meshServant ) {
// get local TopoDS_Shape
- TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), theShape );
+ TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), theShapeObject );
// call implementarion compute
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
return myGen.Compute( myLocMesh, myLocShape);
}
}
catch ( SALOME_Exception& S_ex ) {
- MESSAGE( "Compute(): catch exception "<< S_ex.what() );
+ INFOS( "Compute(): catch exception "<< S_ex.what() );
}
catch ( ... ) {
- MESSAGE( "Compute(): unknown exception " );
+ INFOS( "Compute(): unknown exception " );
}
return false;
}
{
INFOS( "SMESH_Gen_i::Save" );
- ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
+// ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
+ // san -- in case <myCurrentStudy> differs from theComponent's study,
+ // use that of the component
+ if ( myCurrentStudy->_is_nil() ||
+ theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
+ SetCurrentStudy( theComponent->GetStudy() );
+
StudyContext* myStudyContext = GetCurrentStudyContext();
// Declare a byte stream
// Obtain a temporary dir
TCollection_AsciiString tmpDir =
- ( isMultiFile ) ? TCollection_AsciiString( ( char* )theURL ) : SALOMEDS_Tool::GetTmpDir();
+ ( isMultiFile ) ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
// Create a sequence of files processed
SALOMEDS::ListOfFileNames_var aFileSeq = new SALOMEDS::ListOfFileNames;
TCollection_AsciiString aStudyName( "" );
if ( isMultiFile )
- aStudyName = ( SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ) );
+ aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files
TCollection_AsciiString filename =
strcpy( name_meshgroup, "SubMeshes On Vertex" );
else if ( i == GetSubMeshOnEdgeTag() )
strcpy( name_meshgroup, "SubMeshes On Edge" );
+ else if ( i == GetSubMeshOnWireTag() )
+ strcpy( name_meshgroup, "SubMeshes On Wire" );
else if ( i == GetSubMeshOnFaceTag() )
strcpy( name_meshgroup, "SubMeshes On Face" );
+ else if ( i == GetSubMeshOnShellTag() )
+ strcpy( name_meshgroup, "SubMeshes On Shell" );
else if ( i == GetSubMeshOnSolidTag() )
strcpy( name_meshgroup, "SubMeshes On Solid" );
else if ( i == GetSubMeshOnCompoundTag() )
// // Put submesh data to MED convertor
// if ( myImpl->_mapSubMesh.find( mySubMesh->GetId() ) != myImpl->_mapSubMesh.end() ) {
-// MESSAGE( "VSR - SMESH_Gen_i::Save(): saving submesh with ID = "
+// if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen_i::Save(): saving submesh with ID = "
// << mySubMesh->GetId() << " to MED file" );
// ::SMESH_subMesh* aLocalSubmesh = myImpl->_mapSubMesh[mySubMesh->GetId()];
// myWriter.AddSubMesh( aLocalSubmesh->GetSubMeshDS(), subid );
// Store the group contents into MED file
if ( myLocMesh.GetGroup( myGroupImpl->GetLocalID() ) ) {
- MESSAGE( "VSR - SMESH_Gen_i::Save(): saving group with StoreName = "
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen_i::Save(): saving group with StoreName = "
<< grpName << " to MED file" );
SMESHDS_Group* aGrpDS = myLocMesh.GetGroup( myGroupImpl->GetLocalID() )->GetGroupDS();
aGrpDS->SetStoreName( grpName );
}
}
- // Flush current mesh information into MED file
- if ( strcmp( strHasData.c_str(), "1" ) == 0 )
- myWriter.Add();
+ if ( strcmp( strHasData.c_str(), "1" ) == 0 )
+ {
+ // Flush current mesh information into MED file
+ myWriter.Perform();
+
+
+ // Store node positions on sub-shapes (SMDS_Position):
+
+ aGroup = new HDFgroup( "Node Positions", aTopGroup );
+ aGroup->CreateOnDisk();
+
+ // in aGroup, create 5 datasets to contain:
+ // "Nodes on Edges" - ID of node on edge
+ // "Edge positions" - U parameter on node on edge
+ // "Nodes on Faces" - ID of node on face
+ // "Face U positions" - U parameter of node on face
+ // "Face V positions" - V parameter of node on face
+
+ // Find out nb of nodes on edges and faces
+ // Collect corresponing sub-meshes
+ int nbEdgeNodes = 0, nbFaceNodes = 0;
+ list<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
+ // loop on SMESHDS_SubMesh'es
+ const map<int,SMESHDS_SubMesh*>& aSubMeshes = mySMESHDSMesh->SubMeshes();
+ map<int,SMESHDS_SubMesh*>::const_iterator itSubM ( aSubMeshes.begin() );
+ for ( ; itSubM != aSubMeshes.end() ; itSubM++ )
+ {
+ SMESHDS_SubMesh* aSubMesh = (*itSubM).second;
+ int nbNodes = aSubMesh->NbNodes();
+ if ( nbNodes == 0 ) continue;
+
+ int aShapeID = (*itSubM).first;
+ int aShapeType = mySMESHDSMesh->IndexToShape( aShapeID ).ShapeType();
+ // write only SMDS_FacePosition and SMDS_EdgePosition
+ switch ( aShapeType ) {
+ case TopAbs_FACE:
+ nbFaceNodes += nbNodes;
+ aFaceSM.push_back( aSubMesh );
+ break;
+ case TopAbs_EDGE:
+ nbEdgeNodes += nbNodes;
+ aEdgeSM.push_back( aSubMesh );
+ break;
+ default:
+ continue;
+ }
+ }
+ // Treat positions on edges or faces
+ for ( int onFace = 0; onFace < 2; onFace++ )
+ {
+ // Create arrays to store in datasets
+ int iNode = 0, nbNodes = ( onFace ? nbFaceNodes : nbEdgeNodes );
+ if (!nbNodes) continue;
+ int* aNodeIDs = new int [ nbNodes ];
+ double* aUPos = new double [ nbNodes ];
+ double* aVPos = ( onFace ? new double[ nbNodes ] : 0 );
+
+ // Fill arrays
+ // loop on sub-meshes
+ list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM );
+ list<SMESHDS_SubMesh*>::iterator itSM = pListSM->begin();
+ for ( ; itSM != pListSM->end(); itSM++ )
+ {
+ SMESHDS_SubMesh* aSubMesh = (*itSM);
+
+ SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes();
+ // loop on nodes in aSubMesh
+ while ( itNode->more() )
+ {
+ //node ID
+ const SMDS_MeshNode* node = itNode->next();
+ aNodeIDs [ iNode ] = node->GetID();
+
+ // Position
+ const SMDS_PositionPtr pos = node->GetPosition();
+ if ( onFace ) { // on FACE
+ const SMDS_FacePosition* fPos =
+ dynamic_cast<const SMDS_FacePosition*>( pos.get() );
+ if ( fPos ) {
+ aUPos[ iNode ] = fPos->GetUParameter();
+ aVPos[ iNode ] = fPos->GetVParameter();
+ iNode++;
+ }
+ else
+ nbNodes--;
+ }
+ else { // on EDGE
+ const SMDS_EdgePosition* ePos =
+ dynamic_cast<const SMDS_EdgePosition*>( pos.get() );
+ if ( ePos ) {
+ aUPos[ iNode ] = ePos->GetUParameter();
+ iNode++;
+ }
+ else
+ nbNodes--;
+ }
+ } // loop on nodes in aSubMesh
+ } // loop on sub-meshes
+
+ // Write datasets
+ if ( nbNodes )
+ {
+ aSize[ 0 ] = nbNodes;
+ // IDS
+ string aDSName( onFace ? "Nodes on Faces" : "Nodes on Edges");
+ aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aNodeIDs );
+ aDataset->CloseOnDisk();
+
+ // U Positions
+ aDSName = ( onFace ? "Face U positions" : "Edge positions");
+ aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aUPos );
+ aDataset->CloseOnDisk();
+ // V Positions
+ if ( onFace ) {
+ aDataset = new HDFdataset( "Face V positions", aGroup, HDF_FLOAT64, aSize, 1);
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( aVPos );
+ aDataset->CloseOnDisk();
+ }
+ }
+ delete [] aNodeIDs;
+ delete [] aUPos;
+ if ( aVPos ) delete [] aVPos;
+
+ } // treat positions on edges or faces
+
+ // close "Node Positions" group
+ aGroup->CloseOnDisk();
+
+ } // if ( hasData )
// close mesh HDF group
aTopGroup->CloseOnDisk();
SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile ) {
- MESSAGE( "SMESH_Gen_i::SaveASCII" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::SaveASCII" );
SALOMEDS::TMPFile_var aStreamFile = Save( theComponent, theURL, isMultiFile );
return aStreamFile._retn();
}
{
INFOS( "SMESH_Gen_i::Load" );
- ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
+ if ( myCurrentStudy->_is_nil() ||
+ theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
+ SetCurrentStudy( theComponent->GetStudy() );
+
StudyContext* myStudyContext = GetCurrentStudyContext();
// Get temporary files location
TCollection_AsciiString tmpDir =
- isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : SALOMEDS_Tool::GetTmpDir();
+ isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
// Convert the stream into sequence of files to process
SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
isMultiFile );
TCollection_AsciiString aStudyName( "" );
if ( isMultiFile )
- aStudyName = ( SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ) );
+ aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files
TCollection_AsciiString filename = tmpDir + aStudyName + TCollection_AsciiString( "_SMESH.hdf" );
aFile->OpenOnDisk( HDF_RDONLY );
}
catch ( HDFexception ) {
- MESSAGE( "Load(): " << filename << " not found!" );
+ INFOS( "Load(): " << filename << " not found!" );
return false;
}
size = aDataset->GetSize();
char* libname_str = new char[ size ];
aDataset->ReadFromDisk( libname_str );
- SCRUTE( libname_str );
+ if(MYDEBUG) SCRUTE( libname_str );
libname = string( libname_str );
delete libname_str;
aDataset->CloseOnDisk();
// --> restore hypothesis from data
if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
- MESSAGE("VSR - load hypothesis : id = " << id <<
+ if(MYDEBUG) MESSAGE("VSR - load hypothesis : id = " << id <<
", name = " << hypname.c_str() << ", persistent string = " << hypdata.c_str());
SMESH::SMESH_Hypothesis_var myHyp;
myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
}
catch (...) {
- MESSAGE( "Exception during hypothesis creation" );
+ INFOS( "Exception during hypothesis creation" );
}
SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
myStudyContext->mapOldToNew( id, newId );
}
else
- MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
}
}
}
size = aDataset->GetSize();
char* libname_str = new char[ size ];
aDataset->ReadFromDisk( libname_str );
- SCRUTE( libname_str );
+ if(MYDEBUG) SCRUTE( libname_str );
libname = string( libname_str );
delete libname_str;
aDataset->CloseOnDisk();
size = aDataset->GetSize();
char* hypdata_str = new char[ size ];
aDataset->ReadFromDisk( hypdata_str );
- SCRUTE( hypdata_str );
+ if(MYDEBUG) SCRUTE( hypdata_str );
hypdata = string( hypdata_str );
delete hypdata_str;
aDataset->CloseOnDisk();
// --> restore algorithm from data
if ( id > 0 && !hypname.empty()/* && !hypdata.empty()*/ ) { // VSR : persistent data can be empty
- MESSAGE("VSR - load algo : id = " << id <<
+ if(MYDEBUG) MESSAGE("VSR - load algo : id = " << id <<
", name = " << hypname.c_str() << ", persistent string = " << hypdata.c_str());
SMESH::SMESH_Hypothesis_var myHyp;
myHyp = this->createHypothesis( hypname.c_str(), libname.c_str() );
}
catch (...) {
- MESSAGE( "Exception during hypothesis creation" );
+ INFOS( "Exception during hypothesis creation" );
}
SMESH_Hypothesis_i* myImpl = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( myHyp ).in() );
myStudyContext->mapOldToNew( id, newId );
}
else
- MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
+ if(MYDEBUG) MESSAGE( "VSR - SMESH_Gen::Load - can't get servant" );
}
}
}
int aNbObjects = aTopGroup->nInternalObjects();
if ( aNbObjects > 0 ) {
// create mesh
- MESSAGE( "VSR - load mesh : id = " << id );
+ if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id );
SMESH::SMESH_Mesh_var myNewMesh = this->createMesh();
SMESH_Mesh_i* myNewMeshImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( myNewMesh ).in() );
- if ( !myNewMeshImpl )
+ if ( !myNewMeshImpl )
continue;
string iorString = GetORB()->object_to_string( myNewMesh );
int newId = myStudyContext->findId( iorString );
// read mesh data from MED file
myReader.SetMesh( mySMESHDSMesh );
myReader.SetMeshId( id );
- myReader.ReadMySelf();
+ myReader.Perform();
hasData = true;
}
}
// try to read and set reference to shape
- GEOM::GEOM_Shape_var aShape;
+ GEOM::GEOM_Object_var aShapeObject;
if ( aTopGroup->ExistInternalObject( "Ref on shape" ) ) {
// load mesh "Ref on shape" - it's an entry to SObject
aDataset = new HDFdataset( "Ref on shape", aTopGroup );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
if ( !CORBA::is_nil( shapeObject ) ) {
- aShape = GEOM::GEOM_Shape::_narrow( shapeObject );
- if ( !aShape->_is_nil() )
- myNewMeshImpl->setShape( aShape );
+ aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
+ if ( !aShapeObject->_is_nil() )
+ myNewMeshImpl->setShape( aShapeObject );
}
}
}
aGroup->OpenOnDisk();
// get number of applied hypotheses
int aNbSubObjects = aGroup->nInternalObjects();
- MESSAGE( "VSR - number of applied hypotheses = " << aNbSubObjects );
for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset );
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShape->_is_nil() )
- myNewMeshImpl->addHypothesis( aShape, anHyp );
+ if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
}
}
}
}
aGroup->CloseOnDisk();
}
-
+
// try to get applied algorithms
if ( aTopGroup->ExistInternalObject( "Applied Algorithms" ) ) {
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
aGroup->OpenOnDisk();
// get number of applied algorithms
int aNbSubObjects = aGroup->nInternalObjects();
- MESSAGE( "VSR - number of applied algos " << aNbSubObjects );
+ if(MYDEBUG) MESSAGE( "VSR - number of applied algos " << aNbSubObjects );
for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset );
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShape->_is_nil() )
- myNewMeshImpl->addHypothesis( aShape, anHyp );
+ if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
}
}
}
strcpy( name_meshgroup, "SubMeshes On Vertex" );
else if ( j == GetSubMeshOnEdgeTag() )
strcpy( name_meshgroup, "SubMeshes On Edge" );
+ else if ( j == GetSubMeshOnWireTag() )
+ strcpy( name_meshgroup, "SubMeshes On Wire" );
else if ( j == GetSubMeshOnFaceTag() )
strcpy( name_meshgroup, "SubMeshes On Face" );
+ else if ( j == GetSubMeshOnShellTag() )
+ strcpy( name_meshgroup, "SubMeshes On Shell" );
else if ( j == GetSubMeshOnSolidTag() )
strcpy( name_meshgroup, "SubMeshes On Solid" );
else if ( j == GetSubMeshOnCompoundTag() )
aSubGroup->OpenOnDisk();
// try to read and set reference to subshape
- GEOM::GEOM_Shape_var aSubShape;
+ GEOM::GEOM_Object_var aSubShapeObject;
SMESH::SMESH_subMesh_var aSubMesh;
-
+
if ( aSubGroup->ExistInternalObject( "Ref on shape" ) ) {
// load submesh "Ref on shape" - it's an entry to SObject
aDataset = new HDFdataset( "Ref on shape", aSubGroup );
SALOMEDS::SObject_var subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
CORBA::Object_var subShapeObject = SObjectToObject( subShapeSO );
if ( !CORBA::is_nil( subShapeObject ) ) {
- aSubShape = GEOM::GEOM_Shape::_narrow( subShapeObject );
- if ( !aSubShape->_is_nil() )
+ aSubShapeObject = GEOM::GEOM_Object::_narrow( subShapeObject );
+ if ( !aSubShapeObject->_is_nil() )
aSubMesh = SMESH::SMESH_subMesh::_duplicate
- ( myNewMeshImpl->createSubMesh( aSubShape ) );
+ ( myNewMeshImpl->createSubMesh( aSubShapeObject ) );
if ( aSubMesh->_is_nil() )
continue;
string iorSubString = GetORB()->object_to_string( aSubMesh );
// VSR: Get submesh data from MED convertor
// int anInternalSubmeshId = aSubMesh->GetId(); // this is not a persistent ID, it's an internal one computed from sub-shape
// if (myNewMeshImpl->_mapSubMesh.find(anInternalSubmeshId) != myNewMeshImpl->_mapSubMesh.end()) {
-// MESSAGE("VSR - SMESH_Gen_i::Load(): loading from MED file submesh with ID = " <<
+// if(MYDEBUG) MESSAGE("VSR - SMESH_Gen_i::Load(): loading from MED file submesh with ID = " <<
// subid << " for subshape # " << anInternalSubmeshId);
// SMESHDS_SubMesh* aSubMeshDS =
// myNewMeshImpl->_mapSubMesh[anInternalSubmeshId]->CreateSubMeshDS();
// if ( !aSubMeshDS ) {
-// MESSAGE("VSR - SMESH_Gen_i::Load(): FAILED to create a submesh for subshape # " <<
+// if(MYDEBUG) MESSAGE("VSR - SMESH_Gen_i::Load(): FAILED to create a submesh for subshape # " <<
// anInternalSubmeshId << " in current mesh!");
// }
// else
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShape->_is_nil() )
- myNewMeshImpl->addHypothesis( aSubShape, anHyp );
+ if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ myNewMeshImpl->addHypothesis( aSubShapeObject, anHyp );
}
}
}
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
if ( !CORBA::is_nil( hypObject ) ) {
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
- if ( !anHyp->_is_nil() && !aShape->_is_nil() )
- myNewMeshImpl->addHypothesis( aSubShape, anHyp );
+ if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
+ myNewMeshImpl->addHypothesis( aSubShapeObject, anHyp );
}
}
}
}
}
- if(hasData){
+ if(hasData) {
// Read sub-meshes from MED
- MESSAGE("JFA - Create all sub-meshes");
+ if(MYDEBUG) MESSAGE("JFA - Create all sub-meshes");
myReader.CreateAllSubMeshes();
- }
+
+
+ // Read node positions on sub-shapes (SMDS_Position)
+
+ if ( aTopGroup->ExistInternalObject( "Node Positions" ))
+ {
+ // There are 5 datasets to read:
+ // "Nodes on Edges" - ID of node on edge
+ // "Edge positions" - U parameter on node on edge
+ // "Nodes on Faces" - ID of node on face
+ // "Face U positions" - U parameter of node on face
+ // "Face V positions" - V parameter of node on face
+ char* aEid_DSName = "Nodes on Edges";
+ char* aEu_DSName = "Edge positions";
+ char* aFu_DSName = "Face U positions";
+ //char* aFid_DSName = "Nodes on Faces";
+ //char* aFv_DSName = "Face V positions";
+
+ // data to retrieve
+ int nbEids = 0, nbFids = 0;
+ int *aEids = 0, *aFids = 0;
+ double *aEpos = 0, *aFupos = 0, *aFvpos = 0;
+
+ // open a group
+ aGroup = new HDFgroup( "Node Positions", aTopGroup );
+ aGroup->OpenOnDisk();
+
+ // loop on 5 data sets
+ int aNbObjects = aGroup->nInternalObjects();
+ for ( int i = 0; i < aNbObjects; i++ )
+ {
+ // identify dataset
+ char aDSName[ HDF_NAME_MAX_LEN+1 ];
+ aGroup->InternalObjectIndentify( i, aDSName );
+ // read data
+ aDataset = new HDFdataset( aDSName, aGroup );
+ aDataset->OpenOnDisk();
+ if ( aDataset->GetType() == HDF_FLOAT64 ) // Positions
+ {
+ double* pos = new double [ aDataset->GetSize() ];
+ aDataset->ReadFromDisk( pos );
+ // which one?
+ if ( strncmp( aDSName, aEu_DSName, strlen( aEu_DSName )) == 0 )
+ aEpos = pos;
+ else if ( strncmp( aDSName, aFu_DSName, strlen( aFu_DSName )) == 0 )
+ aFupos = pos;
+ else
+ aFvpos = pos;
+ }
+ else // NODE IDS
+ {
+ int* ids = new int [ aDataset->GetSize() ];
+ aDataset->ReadFromDisk( ids );
+ // on face or nodes?
+ if ( strncmp( aDSName, aEid_DSName, strlen( aEid_DSName )) == 0 ) {
+ aEids = ids;
+ nbEids = aDataset->GetSize();
+ }
+ else {
+ aFids = ids;
+ nbFids = aDataset->GetSize();
+ }
+ }
+ } // loop on 5 datasets
+
+ // Set node positions on edges or faces
+ for ( int onFace = 0; onFace < 2; onFace++ )
+ {
+ int nbNodes = ( onFace ? nbFids : nbEids );
+ if ( nbNodes == 0 ) continue;
+ int* aNodeIDs = ( onFace ? aFids : aEids );
+ double* aUPos = ( onFace ? aFupos : aEpos );
+ double* aVPos = ( onFace ? aFvpos : 0 );
+ // loop on node IDs
+ for ( int iNode = 0; iNode < nbNodes; iNode++ )
+ {
+ const SMDS_MeshNode* node = mySMESHDSMesh->FindNode( aNodeIDs[ iNode ]);
+ ASSERT( node );
+ SMDS_PositionPtr aPos = node->GetPosition();
+ ASSERT( aPos )
+ if ( onFace ) {
+ ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_FACE );
+ SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*>
+ ( static_cast<const SMDS_FacePosition*>( aPos.get() ));
+ fPos->SetUParameter( aUPos[ iNode ]);
+ fPos->SetVParameter( aVPos[ iNode ]);
+ }
+ else {
+ ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );
+ SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*>
+ ( static_cast<const SMDS_EdgePosition*>( aPos.get() ));
+ fPos->SetUParameter( aUPos[ iNode ]);
+ }
+ }
+ }
+ if ( aEids ) delete [] aEids;
+ if ( aFids ) delete [] aFids;
+ if ( aEpos ) delete [] aEpos;
+ if ( aFupos ) delete [] aFupos;
+ if ( aFvpos ) delete [] aFvpos;
+
+ aGroup->CloseOnDisk();
+
+ } // if ( aTopGroup->ExistInternalObject( "Node Positions" ) )
+ } // if ( hasData )
// Recompute State (as computed sub-meshes are restored from MED)
- if ( !aShape->_is_nil() ) {
+ if ( !aShapeObject->_is_nil() ) {
MESSAGE("JFA - Compute State Engine ...");
-// map<int, ::SMESH_subMesh*>::iterator anAllSubMeshes = myNewMeshImpl->_mapSubMesh.begin();
-// for (; anAllSubMeshes != myNewMeshImpl->_mapSubMesh.end(); anAllSubMeshes++)
-// {
-// (*anAllSubMeshes).second->GetSubMeshDS(); // init SMESH_subMesh::_meshDS
-// (*anAllSubMeshes).second->ComputeStateEngine(SMESH_subMesh::SUBMESH_RESTORED);
-// }
- TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), aShape );
+ TopoDS_Shape myLocShape = GetShapeReader()->GetShape( GetGeomEngine(), aShapeObject );
myNewMeshImpl->GetImpl().GetSubMesh(myLocShape)->ComputeStateEngine(SMESH_subMesh::SUBMESH_RESTORED);
MESSAGE("JFA - Compute State Engine finished");
}
const SALOMEDS::TMPFile& theStream,
const char* theURL,
bool isMultiFile ) {
- MESSAGE( "SMESH_Gen_i::LoadASCII" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::LoadASCII" );
return Load( theComponent, theStream, theURL, isMultiFile );
}
void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
{
- MESSAGE( "SMESH_Gen_i::Close" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Close" );
// Clear study contexts data
int studyId = myCurrentStudy->StudyId();
char* SMESH_Gen_i::ComponentDataType()
{
- MESSAGE( "SMESH_Gen_i::ComponentDataType" );
- return strdup( "SMESH" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::ComponentDataType" );
+ return CORBA::string_dup( "SMESH" );
}
CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII )
{
- MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
StudyContext* myStudyContext = GetCurrentStudyContext();
if ( strcmp( IORString, "" ) != 0 ) {
int anId = myStudyContext->findId( IORString );
if ( anId ) {
- MESSAGE( "VSR " << anId )
+ if(MYDEBUG) MESSAGE( "VSR " << anId )
char strId[ 20 ];
sprintf( strId, "%d", anId );
return CORBA::string_dup( strId );
}
}
- return strdup( "" );
+ return CORBA::string_dup( "" );
}
//=============================================================================
CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII )
{
- MESSAGE( "SMESH_Gen_i::LocalPersistentIDToIOR(): id = " << aLocalPersistentID );
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::LocalPersistentIDToIOR(): id = " << aLocalPersistentID );
StudyContext* myStudyContext = GetCurrentStudyContext();
if ( strcmp( aLocalPersistentID, "" ) != 0 ) {
int anId = atoi( aLocalPersistentID );
return CORBA::string_dup( myStudyContext->getIORbyOldId( anId ).c_str() );
}
- return strdup( "" );
+ return CORBA::string_dup( "" );
}
//=============================================================================
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy()" );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy()" );
SALOMEDS::SObject_var aSO;
- // san - first try to find SObject corresponding to SMESH component in theStudy
- // It is dangerous to use FindComponent("MESH") for this, as some other component
- // of type "MESH" might be present in theStudy.
- // So component's user name obtained from ModuleCatalog is passed to FindObject()...
- SALOME_ModuleCatalog::ModuleCatalog_var aCat =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow( GetNS()->Resolve("/Kernel/ModulCatalog") );
- if ( CORBA::is_nil( aCat ) )
- return aSO._retn();
-
- SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( "SMESH" );
- if ( CORBA::is_nil( aComp ) )
- return aSO._retn();
-
SALOMEDS::SComponent_var father =
- SALOMEDS::SComponent::_narrow( theStudy->FindObject( strdup( aComp->componentusername() ) ) );
+ SALOMEDS::SComponent::_narrow( theStudy->FindComponent( ComponentDataType() ) );
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributePixMap_var aPixmap;
if ( father->_is_nil() ) {
- father = aStudyBuilder->NewComponent( "MESH" );
+ SALOME_ModuleCatalog::ModuleCatalog_var aCat =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow( GetNS()->Resolve("/Kernel/ModulCatalog") );
+ if ( CORBA::is_nil( aCat ) )
+ return aSO._retn();
+
+ SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( ComponentDataType() );
+ if ( CORBA::is_nil( aComp ) )
+ return aSO._retn();
+
+ father = aStudyBuilder->NewComponent( ComponentDataType() );
anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributeName" );
aName = SALOMEDS::AttributeName::_narrow( anAttr );
- aName ->SetValue( strdup( aComp->componentusername() ) );
+ aName ->SetValue( aComp->componentusername() );
anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" );
aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
aPixmap ->SetPixMap( "ICON_OBJBROWSER_SMESH" );
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( theIOR );
if( aSO->_is_nil() && !aSubMesh->_is_nil() ) {
// try to obtain a parent mesh's SObject
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing submesh..." );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing submesh..." );
SALOMEDS::SObject_var aParentSO;
SMESH::SMESH_Mesh_var aParentMesh;
SMESH_subMesh_i* aServant = dynamic_cast<SMESH_subMesh_i*>( GetServant( aSubMesh ).in() );
SMESH_Mesh_i* aMeshServant = aServant->_mesh_i;
if ( aMeshServant->_mapSubMesh.find( aServant->GetId() ) != aMeshServant->_mapSubMesh.end() ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): local submesh found" )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): local submesh found" )
SMESH_subMesh* aLocalSubMesh = aMeshServant->_mapSubMesh[aServant->GetId()];
switch ( aLocalSubMesh->GetSubShape().ShapeType() ) {
case TopAbs_VERTEX:
break;
case TopAbs_EDGE:
aRootTag = GetSubMeshOnEdgeTag();
- aRootName = "SubMeshes on Edge";
+ aRootName = "SubMeshes on Edge";
+ break;
+ case TopAbs_WIRE:
+ aRootTag = GetSubMeshOnWireTag();
+ aRootName = "SubMeshes on Wire";
break;
case TopAbs_FACE:
aRootTag = GetSubMeshOnFaceTag();
aRootName = "SubMeshes on Face";
break;
+ case TopAbs_SHELL:
+ aRootTag = GetSubMeshOnShellTag();
+ aRootName = "SubMeshes on Shell";
+ break;
case TopAbs_SOLID:
aRootTag = GetSubMeshOnSolidTag();
aRootName = "SubMeshes on Solid";
break;
}
}
+ else {
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): local submesh NOT found" );
+ }
// Find or create submesh root
SALOMEDS::SObject_var aRootSO;
if ( !aParentSO->FindSubObject ( aRootTag, aRootSO ) ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): creating submesh root..." )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): creating submesh root..." );
aRootSO = aStudyBuilder->NewObjectToTag( aParentSO, aRootTag );
anAttr = aStudyBuilder->FindOrCreateAttribute( aRootSO, "AttributeName" );
aName = SALOMEDS::AttributeName::_narrow( anAttr );
}
// Add new submesh to corresponding sub-tree
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): adding submesh to study..." )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): adding submesh to study..." );
SALOMEDS::SObject_var newMesh = aStudyBuilder->NewObject( aRootSO );
anAttr = aStudyBuilder->FindOrCreateAttribute( newMesh, "AttributePixMap" );
aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
aSO = SALOMEDS::SObject::_narrow( newMesh );
anObjName = TCollection_AsciiString( "SubMesh" );
}
+ else {
+ if(MYDEBUG) SCRUTE( aParentSO->_is_nil() );
+ }
}
// Publishing a hypothesis or algorithm
SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow(theIOR);
if( aSO->_is_nil() && !aGroup->_is_nil() ) {
// try to obtain a parent mesh's SObject
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group..." );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group..." );
SALOMEDS::SObject_var aParentSO;
SMESH::SMESH_Mesh_var aParentMesh;
SMESH_Group_i* aServant = dynamic_cast<SMESH_Group_i*>( GetServant( aGroup ).in() );
if ( aServant != NULL ) {
aParentMesh = SMESH::SMESH_Mesh::_narrow( GetPOA()->servant_to_reference( aServant->GetMeshServant() ) );
if ( !aParentMesh->_is_nil() ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: refernce to mesh is OK" );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: refernce to mesh is OK" );
string anIOR = GetORB()->object_to_string( aParentMesh );
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: mesh IOR = "<<anIOR.c_str() );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: mesh IOR = "<<anIOR.c_str() );
aParentSO = theStudy->FindObjectIOR( anIOR.c_str() );
}
}
// Find proper group sub-tree tag
if ( !aParentSO->_is_nil() ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: parent mesh found" );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: parent mesh found" );
int aType = (int)aGroup->GetType();
const char* aRootNames[] = { "Compound Groups", "Groups of Nodes", "Groups of Edges", "Groups of Faces", "Groups of Volumes" };
// Currently, groups with heterogenous content are not supported
if ( aType != SMESH::ALL ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: group type OK" );
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): publishing group: group type OK" );
long aRootTag = GetNodeGroupsTag() + aType - 1;
// Find or create groups root
SALOMEDS::SObject_var aRootSO;
if ( !aParentSO->FindSubObject ( aRootTag, aRootSO ) ) {
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): creating groups root..." )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): creating groups root..." )
aRootSO = aStudyBuilder->NewObjectToTag( aParentSO, aRootTag );
anAttr = aStudyBuilder->FindOrCreateAttribute( aRootSO, "AttributeName" );
aName = SALOMEDS::AttributeName::_narrow( anAttr );
}
// Add new group to corresponding sub-tree
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): adding group to study..." )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): adding group to study..." )
SALOMEDS::SObject_var aGroupSO = aStudyBuilder->NewObject( aRootSO );
anAttr = aStudyBuilder->FindOrCreateAttribute( aGroupSO, "AttributePixMap" );
aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
if ( strlen( theName ) == 0 )
anObjName += TCollection_AsciiString( "_" ) + TCollection_AsciiString( aSO->Tag() );
else
- anObjName = TCollection_AsciiString( strdup( theName ) );
+ anObjName = TCollection_AsciiString( (char*)theName );
anAttr = aStudyBuilder->FindOrCreateAttribute( aSO, "AttributeName" );
aName = SALOMEDS::AttributeName::_narrow( anAttr );
- aName ->SetValue( anObjName.ToCString() );
+ aName ->SetValue( anObjName.ToCString() );
+ if(MYDEBUG) MESSAGE ("********** SMESH_Gen_i: \"" << anObjName.ToCString() << "\" PUBLISHED");
}
- MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): COMPLETED" )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Gen_i::PublishInStudy(): COMPLETED" )
return aSO._retn();
}
const char* instanceName,
const char* interfaceName )
{
- MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" );
- SCRUTE(interfaceName);
- SMESH_Gen_i * mySMESH_Gen
- = new SMESH_Gen_i(orb, poa, contId, instanceName, interfaceName);
- return mySMESH_Gen->getId() ;
+ if(MYDEBUG) MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" );
+ if(MYDEBUG) SCRUTE(interfaceName);
+ SMESH_Gen_i* aSMESHGen = new SMESH_Gen_i(orb, poa, contId, instanceName, interfaceName);
+ return aSMESHGen->getId() ;
}
}
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include "SALOME_NamingService.hxx"
#include "SMESH_Gen.hxx"
-#include "SMESH_topo.hxx"
#include "GEOM_Client.hxx"
#include <map>
public virtual Engines_Component_i
{
public:
+ // Get last created instance of the class
+ static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
// Get ORB object
static CORBA::ORB_var GetORB() { return myOrb;}
// Get SMESH module's POA object
throw ( SALOME::SALOME_Exception );
// Create empty mesh on a shape
- SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Shape_ptr theShape )
+ SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
+ throw ( SALOME::SALOME_Exception );
+
+ // Create mesh(es) and import data from UNV file
+ SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
throw ( SALOME::SALOME_Exception );
// Create mesh(es) and import data from MED file
SMESH::DriverMED_ReadStatus& theStatus )
throw ( SALOME::SALOME_Exception );
+ // Create mesh(es) and import data from STL file
+ SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
+ throw ( SALOME::SALOME_Exception );
+
// Compute mesh on a shape
CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Shape_ptr theShape )
+ GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception );
// Returns true if mesh contains enough data to be computed
CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
- GEOM::GEOM_Shape_ptr theShape )
+ GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception );
// Get sub-shapes unique ID's list
- SMESH::long_array* GetSubShapesId( GEOM::GEOM_Shape_ptr theMainShape,
- const SMESH::shape_array& theListOfSubShape )
+ SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
+ const SMESH::object_array& theListOfSubShape )
throw ( SALOME::SALOME_Exception );
// Save SMESH data
SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
- bool isMultiFile );
+ const char* theURL,
+ bool isMultiFile );
// Load SMESH data
bool Load( SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
// Create filter manager
SMESH::FilterManager_ptr CreateFilterManager();
+ // Return a pattern mesher
+ SMESH::SMESH_Pattern_ptr GetPattern();
+
// Clears study-connected data when it is closed
void Close( SALOMEDS::SComponent_ptr theComponent );
static long GetSubMeshOnFaceTag();
static long GetSubMeshOnSolidTag();
static long GetSubMeshOnCompoundTag();
+ static long GetSubMeshOnWireTag();
+ static long GetSubMeshOnShellTag();
static long GetNodeGroupsTag();
static long GetEdgeGroupsTag();
static long GetFaceGroupsTag();
static PortableServer::POA_var myPoa; // POA reference
static SALOME_NamingService* myNS; // Naming Service
static SALOME_LifeCycleCORBA* myLCC; // Life Cycle CORBA
-
+ static SMESH_Gen_i* mySMESHGen; // Point to last created instance of the class
::SMESH_Gen myGen; // SMESH_Gen local implementation
// hypotheses managing
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
- if (_numberOfAttribute = 0)
+ if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
- if (_numberOfAttribute = 0)
+ if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
- if (_numberOfAttribute = 0)
+ if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
- if (_numberOfAttribute = 0)
+ if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
// File : SMESH_MEDMesh_i.cxx
// Module : SMESH
-using namespace std;
#include "SMESH_MEDMesh_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include <stdio.h>
}
+using namespace std;
+
//=============================================================================
/*!
* Default constructor
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESH_MeshEditor_i.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
+#include "SMESH_MeshEditor.hxx"
+
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Filter_i.hxx"
+
#include "utilities.h"
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Vec.hxx>
+
+using namespace std;
//=============================================================================
/*!
*/
//=============================================================================
-SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESHDS_Mesh* theMesh)
+SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh* theMesh)
{
- _myMeshDS = theMesh;
+ _myMesh = theMesh;
};
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::
long_array & IDsOfElements)
{
- for (int i = 0; i < IDsOfElements.length(); i++)
- {
- CORBA::Long index = IDsOfElements[i];
- const SMDS_MeshElement * elem = _myMeshDS->FindElement(index);
- // an element may be removed as a result of preceding
- // loop removal
- if ( elem )
- {
- _myMeshDS->RemoveElement( elem );
- MESSAGE("Element " << index << " was removed");
- }
- }
- return true;
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ list< int > IdList;
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ IdList.push_back( IDsOfElements[i] );
+
+ return anEditor.Remove( IdList, false );
};
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::
long_array & IDsOfNodes)
{
- // It's nodes' turn to die
- for (int i = 0; i < IDsOfNodes.length(); i++)
- {
- const SMDS_MeshNode * node=_myMeshDS->FindNode(IDsOfNodes[i]);
- if(node==NULL)
- {
- MESSAGE("SMESH_MeshEditor_i::RemoveNodes: Node "<<IDsOfNodes[i]
- <<" not found");
- continue;
- }
- _myMeshDS->RemoveNode(node);
- MESSAGE("Node " << IDsOfNodes[i] << " was removed")
- }
- return true;
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ list< int > IdList;
+ for (int i = 0; i < IDsOfNodes.length(); i++)
+ IdList.push_back( IDsOfNodes[i] );
+
+ return anEditor.Remove( IdList, true );
};
//=============================================================================
{
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
- _myMeshDS->AddEdge(_myMeshDS->FindNode(index1), _myMeshDS->FindNode(index2));
+ GetMeshDS()->AddEdge(GetMeshDS()->FindNode(index1), GetMeshDS()->FindNode(index2));
}
return true;
}
CORBA::Double y, CORBA::Double z)
{
MESSAGE(" AddNode " << x << " , " << y << " , " << z)
- int idNode = _myMeshDS->AddNode(x, y, z)->GetID();
+ int idNode = GetMeshDS()->AddNode(x, y, z)->GetID();
MESSAGE(" idNode " << idNode) return true;
}
{
int NbNodes = IDsOfNodes.length();
const SMDS_MeshNode* nodes[4];
- for(int i=0;i<NbNodes;i++) nodes[i]=_myMeshDS->FindNode(IDsOfNodes[i]);
+ for(int i=0;i<NbNodes;i++) nodes[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
if (NbNodes == 3)
{
- _myMeshDS->AddFace(nodes[0], nodes[1], nodes[2]);
+ GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
}
else if (NbNodes == 4)
{
- _myMeshDS->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
+ GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
}
return true;
};
{
int NbNodes = IDsOfNodes.length();
const SMDS_MeshNode* n[8];
- for(int i=0;i<NbNodes;i++) n[i]=_myMeshDS->FindNode(IDsOfNodes[i]);
+ for(int i=0;i<NbNodes;i++) n[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
switch(NbNodes)
{
- case 4:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3]); break;
- case 5:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
- case 6:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
- case 8:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
+ case 4:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
+ case 5:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
+ case 6:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
+ case 8:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
}
return true;
};
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+{
+ const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
+ if ( !node )
+ return false;
+
+ GetMeshDS()->MoveNode(node, x, y, z);
+
+ return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::InverseDiag(CORBA::Long NodeID1,
+ CORBA::Long NodeID2)
+{
+ const SMDS_MeshNode * n1 = GetMeshDS()->FindNode( NodeID1 );
+ const SMDS_MeshNode * n2 = GetMeshDS()->FindNode( NodeID2 );
+ if ( !n1 || !n2 )
+ return false;
+
+ ::SMESH_MeshEditor aMeshEditor( _myMesh );
+ return aMeshEditor.InverseDiag ( n1, n2 );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DeleteDiag(CORBA::Long NodeID1,
+ CORBA::Long NodeID2)
+{
+ const SMDS_MeshNode * n1 = GetMeshDS()->FindNode( NodeID1 );
+ const SMDS_MeshNode * n2 = GetMeshDS()->FindNode( NodeID2 );
+ if ( !n1 || !n2 )
+ return false;
+
+ ::SMESH_MeshEditor aMeshEditor( _myMesh );
+ return aMeshEditor.DeleteDiag ( n1, n2 );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfElements)
+{
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ {
+ CORBA::Long index = IDsOfElements[i];
+ const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
+ if ( elem )
+ anEditor.Reorient( elem );
+ }
+ return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean
+ SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfElements,
+ SMESH::NumericalFunctor_ptr Criterion,
+ CORBA::Double MaxAngle)
+{
+ set<const SMDS_MeshElement*> faces;
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ {
+ CORBA::Long index = IDsOfElements[i];
+ const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
+ if ( elem && elem->GetType() == SMDSAbs_Face)
+ faces.insert( elem );
+ }
+ SMESH::NumericalFunctor_i* aNumericalFunctor =
+ dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
+ SMESH::Controls::NumericalFunctorPtr aCrit;
+ if ( !aNumericalFunctor )
+ aCrit.reset( new SMESH::Controls::AspectRatio() );
+ else
+ aCrit = aNumericalFunctor->GetNumericalFunctor();
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.TriToQuad( faces, aCrit, MaxAngle );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean
+ SMESH_MeshEditor_i::QuadToTri(const SMESH::long_array & IDsOfElements,
+ SMESH::NumericalFunctor_ptr Criterion)
+{
+ set<const SMDS_MeshElement*> faces;
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ {
+ CORBA::Long index = IDsOfElements[i];
+ const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
+ if ( elem && elem->GetType() == SMDSAbs_Face)
+ faces.insert( elem );
+ }
+ SMESH::NumericalFunctor_i* aNumericalFunctor =
+ dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
+ SMESH::Controls::NumericalFunctorPtr aCrit;
+ if ( !aNumericalFunctor )
+ aCrit.reset( new SMESH::Controls::AspectRatio() );
+ else
+ aCrit = aNumericalFunctor->GetNumericalFunctor();
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.QuadToTri( faces, aCrit );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean
+ SMESH_MeshEditor_i::SplitQuad(const SMESH::long_array & IDsOfElements,
+ CORBA::Boolean Diag13)
+{
+ set<const SMDS_MeshElement*> faces;
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ {
+ CORBA::Long index = IDsOfElements[i];
+ const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
+ if ( elem && elem->GetType() == SMDSAbs_Face)
+ faces.insert( elem );
+ }
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.QuadToTri( faces, Diag13 );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Boolean
+ SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < IDsOfElements.length(); i++)
+ {
+ CORBA::Long index = IDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem && elem->GetType() == SMDSAbs_Face)
+ elements.insert( elem );
+ }
+
+ set<const SMDS_MeshNode*> fixedNodes;
+ for (int i = 0; i < IDsOfFixedNodes.length(); i++)
+ {
+ CORBA::Long index = IDsOfFixedNodes[i];
+ const SMDS_MeshNode * node = aMesh->FindNode(index);
+ if ( node )
+ fixedNodes.insert( node );
+ }
+ ::SMESH_MeshEditor::SmoothMethod method = ::SMESH_MeshEditor::LAPLACIAN;
+ if ( Method != SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH )
+ method = ::SMESH_MeshEditor::CENTROIDAL;
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.Smooth( elements, fixedNodes, method, MaxNbOfIterations, MaxAspectRatio );
+
+ return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void SMESH_MeshEditor_i::RenumberNodes()
+{
+ GetMeshDS()->Renumber( true );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void SMESH_MeshEditor_i::RenumberElements()
+{
+ GetMeshDS()->Renumber( false );
+}
+
+//=======================================================================
+//function : RotationSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < theIDsOfElements.length(); i++)
+ {
+ CORBA::Long index = theIDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem )
+ elements.insert( elem );
+ }
+ gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ),
+ gp_Vec( theAxis.vx, theAxis.vy, theAxis.vz ));
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.RotationSweep (elements, Ax1, theAngleInRadians,
+ theNbOfSteps, theTolerance);
+}
+
+//=======================================================================
+//function : ExtrusionSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < theIDsOfElements.length(); i++)
+ {
+ CORBA::Long index = theIDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem )
+ elements.insert( elem );
+ }
+ const SMESH::PointStruct * P = &theStepVector.PS;
+ gp_Vec stepVec( P->x, P->y, P->z );
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
+}
+
+//=======================================================================
+//function : Mirror
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < theIDsOfElements.length(); i++)
+ {
+ CORBA::Long index = theIDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem )
+ elements.insert( elem );
+ }
+ gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
+ gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
+
+ gp_Trsf aTrsf;
+ switch ( theMirrorType ) {
+ case SMESH::SMESH_MeshEditor::POINT:
+ aTrsf.SetMirror( P );
+ break;
+ case SMESH::SMESH_MeshEditor::AXIS:
+ aTrsf.SetMirror( gp_Ax1( P, V ));
+ break;
+ default:
+ aTrsf.SetMirror( gp_Ax2( P, V ));
+ }
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.Transform (elements, aTrsf, theCopy);
+}
+
+//=======================================================================
+//function : Translate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < theIDsOfElements.length(); i++)
+ {
+ CORBA::Long index = theIDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem )
+ elements.insert( elem );
+ }
+ gp_Trsf aTrsf;
+ const SMESH::PointStruct * P = &theVector.PS;
+ aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.Transform (elements, aTrsf, theCopy);
+}
+
+//=======================================================================
+//function : Rotate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ set<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < theIDsOfElements.length(); i++)
+ {
+ CORBA::Long index = theIDsOfElements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( elem )
+ elements.insert( elem );
+ }
+ gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
+ gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
+
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
+
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.Transform (elements, aTrsf, theCopy);
+}
+
+//=======================================================================
+//function : FindCoincidentNodes
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double Tolerance,
+ SMESH::array_of_long_array_out GroupsOfNodes)
+{
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.FindCoincidentNodes( Tolerance, aListOfListOfNodes );
+
+ GroupsOfNodes = new SMESH::array_of_long_array;
+ GroupsOfNodes->length( aListOfListOfNodes.size() );
+ ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
+ for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ )
+ {
+ list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
+ list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
+ SMESH::long_array& aGroup = GroupsOfNodes[ i ];
+ aGroup.length( aListOfNodes.size() );
+ for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
+ aGroup[ j ] = (*lIt)->GetID();
+ }
+}
+
+//=======================================================================
+//function : MergeNodes
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ list<const SMDS_MeshElement*> elements;
+ for (int i = 0; i < GroupsOfNodes.length(); i++)
+ {
+ const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
+ aListOfListOfNodes.push_back( list< const SMDS_MeshNode* >() );
+ list< const SMDS_MeshNode* >& aListOfNodes = aListOfListOfNodes.back();
+ for ( int j = 0; j < aNodeGroup.length(); j++ )
+ {
+ CORBA::Long index = aNodeGroup[ j ];
+ const SMDS_MeshNode * node = aMesh->FindNode(index);
+ if ( node )
+ aListOfNodes.push_back( node );
+ }
+ if ( aListOfNodes.size() < 2 )
+ aListOfListOfNodes.pop_back();
+ }
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.MergeNodes( aListOfListOfNodes );
+}
+
+//=======================================================================
+//function : MergeEqualElements
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MergeEqualElements()
+{
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ anEditor.MergeEqualElements();
+}
+
+//=======================================================================
+//function : SewFreeBorders
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2,
+ CORBA::Long LastNodeID2)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
+ const SMDS_MeshNode* aSide2ThirdNode = aMesh->FindNode( LastNodeID2 );
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode ||
+ !aSide2FirstNode ||
+ !aSide2SecondNode ||
+ !aSide2ThirdNode)
+ return false;
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ true);
+}
+
+//=======================================================================
+//function : SewConformFreeBorders
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::SewConformFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
+ const SMDS_MeshNode* aSide2ThirdNode = 0;
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode ||
+ !aSide2FirstNode ||
+ !aSide2SecondNode)
+ return false;
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ true);
+}
+
+//=======================================================================
+//function : SewBorderToSide
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
+ CORBA::Long SecondNodeIDOnFreeBorder,
+ CORBA::Long LastNodeIDOnFreeBorder,
+ CORBA::Long FirstNodeIDOnSide,
+ CORBA::Long LastNodeIDOnSide)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeIDOnSide );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( LastNodeIDOnSide );
+ const SMDS_MeshNode* aSide2ThirdNode = 0;
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode ||
+ !aSide2FirstNode ||
+ !aSide2SecondNode)
+ return false;
+
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ false);
+}
+
+//=======================================================================
+//function : SewSideElements
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
+ const SMESH::long_array& IDsOfSide2Elements,
+ CORBA::Long NodeID1OfSide1ToMerge,
+ CORBA::Long NodeID1OfSide2ToMerge,
+ CORBA::Long NodeID2OfSide1ToMerge,
+ CORBA::Long NodeID2OfSide2ToMerge)
+{
+ SMESHDS_Mesh* aMesh = GetMeshDS();
+
+ const SMDS_MeshNode* aFirstNode1ToMerge = aMesh->FindNode( NodeID1OfSide1ToMerge );
+ const SMDS_MeshNode* aFirstNode2ToMerge = aMesh->FindNode( NodeID1OfSide2ToMerge );
+ const SMDS_MeshNode* aSecondNode1ToMerge = aMesh->FindNode( NodeID2OfSide1ToMerge );
+ const SMDS_MeshNode* aSecondNode2ToMerge = aMesh->FindNode( NodeID2OfSide2ToMerge );
+
+ if (!aFirstNode1ToMerge ||
+ !aFirstNode2ToMerge ||
+ !aSecondNode1ToMerge||
+ !aSecondNode2ToMerge)
+ return false;
+
+ set<const SMDS_MeshElement*> aSide1Elems, aSide2Elems;
+ for (int i = 0; i < IDsOfSide1Elements.length(); i++)
+ {
+ CORBA::Long index = IDsOfSide1Elements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( !elem )
+ return false;
+ aSide1Elems.insert( elem );
+ }
+ for (int i = 0; i < IDsOfSide2Elements.length(); i++)
+ {
+ CORBA::Long index = IDsOfSide2Elements[i];
+ const SMDS_MeshElement * elem = aMesh->FindElement(index);
+ if ( !elem )
+ return false;
+ aSide2Elems.insert( elem );
+ }
+ ::SMESH_MeshEditor anEditor( _myMesh );
+ return anEditor.SewSideElements (aSide1Elems, aSide2Elems,
+ aFirstNode1ToMerge,
+ aFirstNode2ToMerge,
+ aSecondNode1ToMerge,
+ aSecondNode2ToMerge);
+}
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include "SMESHDS_Mesh.hxx"
+#include "SMESH_Mesh.hxx"
class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
{
- public:
- SMESH_MeshEditor_i(SMESHDS_Mesh * theMesh);
+ public:
+ SMESH_MeshEditor_i(SMESH_Mesh * theMesh);
- virtual ~ SMESH_MeshEditor_i()
- {
- };
+ virtual ~ SMESH_MeshEditor_i()
+ {
+ };
- // --- CORBA
- CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
- CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
+ // --- CORBA
+ CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
+ CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
- CORBA::Boolean AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
- CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
- CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
- CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
+ CORBA::Boolean AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
+ CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
+ CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
+ CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
+ CORBA::Boolean MoveNode(CORBA::Long NodeID,
+ CORBA::Double x, CORBA::Double y, CORBA::Double z);
- private:
- SMESH::SMESH_subMesh_var _myMesh;
- SMESHDS_Mesh *_myMeshDS;
+ CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
+ CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
+ CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
+
+ CORBA::Boolean TriToQuad(const SMESH::long_array & IDsOfElements,
+ SMESH::NumericalFunctor_ptr Criterion,
+ CORBA::Double MaxAngle);
+ CORBA::Boolean QuadToTri(const SMESH::long_array & IDsOfElements,
+ SMESH::NumericalFunctor_ptr Criterion);
+ CORBA::Boolean SplitQuad(const SMESH::long_array & IDsOfElements,
+ CORBA::Boolean Diag13);
+
+ CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
+ const SMESH::long_array & IDsOfFixedNodes,
+ CORBA::Long MaxNbOfIterations,
+ CORBA::Double MaxAspectRatio,
+ SMESH::SMESH_MeshEditor::Smooth_Method Method);
+
+ void RenumberNodes();
+ void RenumberElements();
+
+ void RotationSweep(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
+ void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
+ const SMESH::DirStruct & StepVector,
+ CORBA::Long NbOfSteps);
+
+ void Mirror(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+ CORBA::Boolean Copy);
+ void Translate(const SMESH::long_array & IDsOfElements,
+ const SMESH::DirStruct & Vector,
+ CORBA::Boolean Copy);
+ void Rotate(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double Angle,
+ CORBA::Boolean Copy);
+
+ void FindCoincidentNodes (CORBA::Double Tolerance,
+ SMESH::array_of_long_array_out GroupsOfNodes);
+ void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
+ void MergeEqualElements();
+
+ CORBA::Boolean SewFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2,
+ CORBA::Long LastNodeID2);
+ CORBA::Boolean SewConformFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2);
+ CORBA::Boolean SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
+ CORBA::Long SecondNodeIDOnFreeBorder,
+ CORBA::Long LastNodeIDOnFreeBorder,
+ CORBA::Long FirstNodeIDOnSide,
+ CORBA::Long LastNodeIDOnSide);
+ CORBA::Boolean SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
+ const SMESH::long_array& IDsOfSide2Elements,
+ CORBA::Long NodeID1OfSide1ToMerge,
+ CORBA::Long NodeID1OfSide2ToMerge,
+ CORBA::Long NodeID2OfSide1ToMerge,
+ CORBA::Long NodeID2OfSide2ToMerge);
+
+ private:
+ SMESHDS_Mesh * GetMeshDS() { return _myMesh->GetMeshDS(); }
+ SMESH_Mesh *_myMesh;
};
#endif
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH_MEDMesh_i.hxx"
#include "SMESH_Group_i.hxx"
+#include "SMESH_Filter_i.hxx"
#include "Utils_CorbaException.hxx"
#include "Utils_ExceptHandlers.hxx"
#include "OpUtil.hxx"
#include "TCollection_AsciiString.hxx"
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESH_MeshEditor_i.hxx"
// _CS_gbo_050504 Ajout explicite du sstream pour ostringstream
#include <sstream>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
-//**** SMESHDS en champ
+using namespace std;
int SMESH_Mesh_i::myIdGenerator = 0;
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-SMESH_Mesh_i::SMESH_Mesh_i()
- : SALOME::GenericObj_i( PortableServer::POA::_nil() )
-{
- MESSAGE("SMESH_Mesh_i: default constructor, not for use");
- ASSERT(0);
-}
-
//=============================================================================
/*!
* Constructor
CORBA::Long studyId )
: SALOME::GenericObj_i( thePOA )
{
- MESSAGE("SMESH_Mesh_i");
+ INFOS("SMESH_Mesh_i");
_gen_i = gen_i;
_id = myIdGenerator++;
_studyId = studyId;
thePOA->activate_object( this );
}
-/*
-SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i,
- CORBA::Long studyId,
- int localId)
-{
- MESSAGE("SMESH_Mesh_i");
- _gen_i = gen_i;
- _id = localId;
- _studyId = studyId;
-}
-*/
+
//=============================================================================
/*!
* Destructor
SMESH_Mesh_i::~SMESH_Mesh_i()
{
- MESSAGE("~SMESH_Mesh_i");
+ INFOS("~SMESH_Mesh_i");
map<int, SMESH::SMESH_Group_ptr>::iterator it;
for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
SMESH_Group_i* aGroup = dynamic_cast<SMESH_Group_i*>( SMESH_Gen_i::GetServant( it->second ).in() );
if ( aGroup ) {
- _impl->RemoveGroup( aGroup->GetLocalID() );
+
+ // this method is colled from destructor of group (PAL6331)
+ //_impl->RemoveGroup( aGroup->GetLocalID() );
+
aGroup->Destroy();
}
}
*/
//=============================================================================
-void SMESH_Mesh_i::SetShape( GEOM::GEOM_Shape_ptr theShape )
+void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject )
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
try {
- setShape( theShape );
+ setShape( theShapeObject );
}
catch(SALOME_Exception & S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
// Create a reference to <theShape>
SALOMEDS::SObject_var aMeshSO = SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( ( SMESH_Gen_i::GetORB()->object_to_string( _this() ) ) ) );
- SALOMEDS::SObject_var aShapeSO = aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( theShape ) );
+ SALOMEDS::SObject_var aShapeSO = aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( theShapeObject ) );
SALOMEDS::SObject_var anObj, aRef;
SALOMEDS::GenericAttribute_var anAttr;
*/
//=============================================================================
-bool SMESH_Mesh_i::setShape( GEOM::GEOM_Shape_ptr theShape )
+bool SMESH_Mesh_i::setShape( GEOM::GEOM_Object_ptr theShapeObject )
{
- TopoDS_Shape aLocShape = _gen_i->GetShapeReader()->GetShape( SMESH_Gen_i::GetGeomEngine(), theShape );
+ if ( theShapeObject->_is_nil() )
+ return false;
+
+ TopoDS_Shape aLocShape = _gen_i->GetShapeReader()->GetShape( SMESH_Gen_i::GetGeomEngine(), theShapeObject );
_impl->ShapeToMesh( aLocShape );
return true;
}
//=============================================================================
SMESH::DriverMED_ReadStatus
- SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName )
- throw ( SALOME::SALOME_Exception )
+SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName )
+ throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
int status;
return ConvertDriverMEDReadStatus(status);
}
+//=============================================================================
+/*!
+ * ImportUNVFile
+ *
+ * Imports mesh data from MED file
+ */
+//=============================================================================
+
+int SMESH_Mesh_i::ImportUNVFile( const char* theFileName )
+ throw ( SALOME::SALOME_Exception )
+{
+ // Read mesh with name = <theMeshName> into SMESH_Mesh
+ _impl->UNVToMesh( theFileName );
+
+ return 1;
+}
+
+//=============================================================================
+/*!
+ * ImportSTLFile
+ *
+ * Imports mesh data from STL file
+ */
+//=============================================================================
+int SMESH_Mesh_i::ImportSTLFile( const char* theFileName )
+ throw ( SALOME::SALOME_Exception )
+{
+ // Read mesh with name = <theMeshName> into SMESH_Mesh
+ _impl->STLToMesh( theFileName );
+
+ return 1;
+}
+
//=============================================================================
/*!
* importMEDFile
StudyContext* myStudyContext = _gen_i->GetCurrentStudyContext();
string iorString = SMESH_Gen_i::GetORB()->object_to_string( aGroup );
int nextId = myStudyContext->addObject( iorString );
- MESSAGE( "Add group to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
+ if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
}
return status;
*/
//=============================================================================
-SMESH::Hypothesis_Status SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+SMESH::Hypothesis_Status SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- SMESH_Hypothesis::Hypothesis_Status status = addHypothesis( aSubShape, anHyp );
+ SMESH_Hypothesis::Hypothesis_Status status = addHypothesis( aSubShapeObject, anHyp );
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
SALOMEDS::SObject_var aMeshSO = SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( ( SMESH_Gen_i::GetORB()->object_to_string( _this() ) ) ) );
+ if ( aMeshSO->_is_nil() ) {
+ SCRUTE( SMESH_Gen_i::GetORB()->object_to_string( _this() ));
+ removeHypothesis( aSubShapeObject, anHyp );
+ return SMESH::HYP_UNKNOWN_FATAL;
+ }
SALOMEDS::SObject_var aMorSM, aRef;
- CORBA::String_var aShapeIOR = CORBA::string_dup( SMESH_Gen_i::GetORB()->object_to_string( aSubShape ) );
+ CORBA::String_var aShapeIOR = CORBA::string_dup( SMESH_Gen_i::GetORB()->object_to_string( aSubShapeObject ) );
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator( aMeshSO );
for ( it->InitEx( true ); it->More(); it->Next() ) {
}
}
}
+ if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
return ConvertHypothesisStatus(status);
}
//=============================================================================
SMESH_Hypothesis::Hypothesis_Status
- SMESH_Mesh_i::addHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+ SMESH_Mesh_i::addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
{
- MESSAGE("addHypothesis");
+ if(MYDEBUG) MESSAGE("addHypothesis");
// **** proposer liste de subShape (selection multiple)
- GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
- if (CORBA::is_nil(mySubShape))
+ if (CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
try
{
TopoDS_Shape myLocSubShape =
- _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), mySubShape);
+ _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), aSubShapeObject);
int hypId = myHyp->GetId();
status = _impl->AddHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) )
*/
//=============================================================================
-SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- SMESH_Hypothesis::Hypothesis_Status status = removeHypothesis( aSubShape, anHyp );
+ SMESH_Hypothesis::Hypothesis_Status status = removeHypothesis( aSubShapeObject, anHyp );
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
SALOMEDS::SObject_var aMeshSO = SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( ( SMESH_Gen_i::GetORB()->object_to_string( _this() ) ) ) );
- if ( aMeshSO->_is_nil() )
+ if ( aMeshSO->_is_nil() ) {
+ SCRUTE( SMESH_Gen_i::GetORB()->object_to_string( _this() ));
+ addHypothesis( aSubShapeObject, anHyp );
return SMESH::HYP_UNKNOWN_FATAL;
-
+ }
SALOMEDS::SObject_var aMorSM, aRef;
- CORBA::String_var aShapeIOR = CORBA::string_dup( SMESH_Gen_i::GetORB()->object_to_string( aSubShape ) );
+ CORBA::String_var aShapeIOR = CORBA::string_dup( SMESH_Gen_i::GetORB()->object_to_string( aSubShapeObject ) );
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator( aMeshSO );
for ( it->InitEx( true ); it->More(); it->Next() ) {
*/
//=============================================================================
-SMESH_Hypothesis::Hypothesis_Status
- SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
{
- MESSAGE("removeHypothesis()");
+ if(MYDEBUG) MESSAGE("removeHypothesis()");
// **** proposer liste de subShape (selection multiple)
- GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
- if (CORBA::is_nil(mySubShape))
+ if (CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
try
{
TopoDS_Shape myLocSubShape =
- _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), mySubShape);
+ _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), aSubShapeObject);
int hypId = myHyp->GetId();
status = _impl->RemoveHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) )
//=============================================================================
SMESH::ListOfHypothesis *
- SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
+ SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
MESSAGE("GetHypothesisList");
- GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
- if (CORBA::is_nil(mySubShape))
+ if (CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
try {
TopoDS_Shape myLocSubShape
- = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), mySubShape);
+ = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), aSubShapeObject);
const list<const SMESHDS_Hypothesis*>& aLocalList = _impl->GetHypothesisList( myLocSubShape );
int i = 0, n = aLocalList.size();
*
*/
//=============================================================================
-SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Shape_ptr aSubShape,
+SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject,
const char* theName )
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE("SMESH_Mesh_i::GetElementsOnShape");
- GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
- if (CORBA::is_nil(mySubShape))
+ MESSAGE("SMESH_Mesh_i::GetSubMesh");
+ if (CORBA::is_nil(aSubShapeObject))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
int subMeshId = 0;
try {
TopoDS_Shape myLocSubShape
- = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), mySubShape);
+ = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), aSubShapeObject);
//Get or Create the SMESH_subMesh object implementation
// create a new subMesh object servant if there is none for the shape
if (_mapSubMesh.find(subMeshId) == _mapSubMesh.end()) {
- SMESH::SMESH_subMesh_var subMesh = createSubMesh( aSubShape );
+ SMESH::SMESH_subMesh_var subMesh = createSubMesh( aSubShapeObject );
if ( _gen_i->CanPublishInStudy( subMesh ) ) {
SALOMEDS::SObject_var aSubmeshSO = _gen_i->PublishInStudy( _gen_i->GetCurrentStudy(),
SALOMEDS::SObject::_nil(),
// Add reference to <aSubShape> to the study
SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
- SALOMEDS::SObject_var aShapeSO = aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( aSubShape ) );
+ SALOMEDS::SObject_var aShapeSO = aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( aSubShapeObject ) );
if ( !aSubmeshSO->_is_nil() && !aShapeSO->_is_nil() ) {
- MESSAGE( "********** SMESH_Mesh_i::GetSubMesh(): adding shape reference..." )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Mesh_i::GetSubMesh(): adding shape reference..." )
SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var SO = aBuilder->NewObjectToTag( aSubmeshSO, SMESH_Gen_i::GetRefOnShapeTag() );
aBuilder->Addreference( SO, aShapeSO );
- MESSAGE( "********** SMESH_Mesh_i::GetSubMesh(): shape reference added" )
+ if(MYDEBUG) MESSAGE( "********** SMESH_Mesh_i::GetSubMesh(): shape reference added" )
}
}
}
void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
throw (SALOME::SALOME_Exception)
{
- MESSAGE("SMESH_Mesh_i::RemoveSubMesh");
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::RemoveSubMesh");
if ( theSubMesh->_is_nil() )
return;
- GEOM::GEOM_Shape_var aSubShape;
+ GEOM::GEOM_Object_var aSubShapeObject;
SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
// Remove submesh's SObject
long aTag = SMESH_Gen_i::GetRefOnShapeTag();
SALOMEDS::SObject_var anObj, aRef;
if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) )
- aSubShape = GEOM::GEOM_Shape::_narrow( aRef->GetObject() );
+ aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
}
}
- removeSubMesh( theSubMesh, aSubShape.in() );
+ removeSubMesh( theSubMesh, aSubShapeObject.in() );
}
//=============================================================================
SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType,
- const char* theName )
+ const char* theName )
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroupFromGEOM( SMESH::ElementType theElemType,
+ const char* theName,
+ GEOM::GEOM_Object_ptr theGEOMGroup)
+ throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+
+ SMESH::SMESH_Group_var aNewGroup = createGroup( theElemType, theName );
+
+ if ( CORBA::is_nil(theGEOMGroup) || theGEOMGroup->GetType() != 37 || CORBA::is_nil(aNewGroup))
+ return aNewGroup._retn();
+
+ GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH_Gen_i::GetGeomEngine()->GetIGroupOperations(_studyId);
+ SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+
+ // Check if group constructed on the same shape as a mesh or on its child:
+ GEOM::GEOM_Object_var aGroupMainShape = aGroupOp->GetMainShape( theGEOMGroup );
+ SALOMEDS::SObject_var aGroupMainShapeSO =
+ SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string(aGroupMainShape) ) );
+ SALOMEDS::SObject_var aMeshSO =
+ SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( ( SMESH_Gen_i::GetORB()->object_to_string( _this() ) ) ) );
+
+ SALOMEDS::SObject_var anObj, aRef;
+ bool isRefOrSubShape = false;
+
+ if ( aMeshSO->FindSubObject( 1, anObj ) && anObj->ReferencedObject( aRef )) {
+ if ( strcmp( aRef->GetID(), aGroupMainShapeSO->GetID() ) == 0 )
+ isRefOrSubShape = true;
+ else
+ {
+ SALOMEDS::SObject_var aFather = aGroupMainShapeSO->GetFather();
+ SALOMEDS::SComponent_var aComponent = aGroupMainShapeSO->GetFatherComponent();
+ while ( !isRefOrSubShape && strcmp( aFather->GetID(), aComponent->GetID() ) != 0 )
+ {
+ if (strcmp( aRef->GetID(), aFather->GetID() ) == 0)
+ isRefOrSubShape = true;
+ else
+ aFather = aFather->GetFather();
+ }
+ }
+ if ( !isRefOrSubShape )
+ return aNewGroup._retn();
+ }
+
+ // Detect type of the geometry group
+ SMESH::ElementType aGEOMGroupType;
+
+ SMESH::ElementType aGroupType = SMESH::ALL;
+ switch(aGroupOp->GetType(theGEOMGroup))
+ {
+ case 7: aGEOMGroupType = SMESH::NODE; break;
+ case 6: aGEOMGroupType = SMESH::EDGE; break;
+ case 4: aGEOMGroupType = SMESH::FACE; break;
+ case 2: aGEOMGroupType = SMESH::VOLUME; break;
+ }
+
+ if ( aGEOMGroupType == theElemType )
+ {
+ if ( !aStudy->_is_nil() )
+ {
+ SALOMEDS::SObject_var aGEOMGroupSO =
+ SALOMEDS::SObject::_narrow( aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string(theGEOMGroup) ) );
+
+ if ( !aGEOMGroupSO->_is_nil() ) {
+ // Construct filter
+ SMESH::FilterManager_var aFilterMgr = _gen_i->CreateFilterManager();
+ SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
+ SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();
+ aBelongToGeom->SetGeom( theGEOMGroup );
+ aBelongToGeom->SetShapeName( aGEOMGroupSO->GetName() );
+ aBelongToGeom->SetElementType( theElemType );
+ aFilter->SetPredicate( aBelongToGeom );
+ SMESH::long_array_var anElements = aFilter->GetElementsId( _this() );
+ aNewGroup->Add( anElements );
+
+ // Groups should be put under separate roots according to their type (nodes, edges, faces, volumes)
+ if ( _gen_i->CanPublishInStudy( aNewGroup ) )
+ {
+ SALOMEDS::SObject_var aGroupSO = _gen_i->PublishInStudy( _gen_i->GetCurrentStudy(),
+ SALOMEDS::SObject::_nil(),
+ aNewGroup,
+ theName );
+ if ( !aGroupSO->_is_nil() )
+ {
+ //Add reference to geometry group
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::SObject_var aReference = aStudyBuilder->NewObject(aGroupSO);
+ aStudyBuilder->Addreference(aReference, aGEOMGroupSO);
+ }
+ }
+ }
+ }
+ }
+
+ return aNewGroup._retn();
+}
//=============================================================================
/*!
*
removeGroup( aGroup->GetLocalID() );
}
+//=============================================================================
+/*! RemoveGroupWithContents
+ * Remove group with its contents
+ */
+//=============================================================================
+void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_Group_ptr theGroup )
+ throw (SALOME::SALOME_Exception)
+{
+ if ( theGroup->_is_nil() )
+ return;
+
+ SMESH_Group_i* aGroup = dynamic_cast<SMESH_Group_i*>( SMESH_Gen_i::GetServant( theGroup ).in() );
+ if ( !aGroup )
+ return;
+
+ SMESH::long_array_var anIds = aGroup->GetListOfID();
+ SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
+
+ if ( aGroup->GetType() == SMESH::NODE )
+ aMeshEditor->RemoveNodes( anIds );
+ else
+ aMeshEditor->RemoveElements( anIds );
+
+ RemoveGroup( theGroup );
+}
+
+//=============================================================================
+/*! UnionGroups
+ * New group is created. All mesh elements that are
+ * present in initial groups are added to the new one
+ */
+//=============================================================================
+SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception)
+{
+ try
+ {
+ SMESH::SMESH_Group_var aResGrp;
+
+ if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
+ theGroup1->GetType() != theGroup2->GetType() )
+ return SMESH::SMESH_Group::_nil();
+
+ aResGrp = CreateGroup( theGroup1->GetType(), theName );
+ if ( aResGrp->_is_nil() )
+ return SMESH::SMESH_Group::_nil();
+
+ SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
+ SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
+
+ TColStd_MapOfInteger aResMap;
+
+ for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
+ aResMap.Add( anIds1[ i1 ] );
+
+ for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
+ aResMap.Add( anIds2[ i2 ] );
+
+ SMESH::long_array_var aResIds = new SMESH::long_array;
+ aResIds->length( aResMap.Extent() );
+
+ int resI = 0;
+ TColStd_MapIteratorOfMapOfInteger anIter( aResMap );
+ for( ; anIter.More(); anIter.Next() )
+ aResIds[ resI++ ] = anIter.Key();
+
+ aResGrp->Add( aResIds );
+
+ return aResGrp._retn();
+ }
+ catch( ... )
+ {
+ return SMESH::SMESH_Group::_nil();
+ }
+}
+
+//=============================================================================
+/*! IntersectGroups
+ * New group is created. All mesh elements that are
+ * present in both initial groups are added to the new one.
+ */
+//=============================================================================
+SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH::SMESH_Group_var aResGrp;
+
+ if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
+ theGroup1->GetType() != theGroup2->GetType() )
+ return aResGrp;
+
+ aResGrp = CreateGroup( theGroup1->GetType(), theName );
+ if ( aResGrp->_is_nil() )
+ return aResGrp;
+
+ SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
+ SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
+
+ TColStd_MapOfInteger aMap1;
+
+ for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
+ aMap1.Add( anIds1[ i1 ] );
+
+ TColStd_SequenceOfInteger aSeq;
+
+ for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
+ if ( aMap1.Contains( anIds2[ i2 ] ) )
+ aSeq.Append( anIds2[ i2 ] );
+
+ SMESH::long_array_var aResIds = new SMESH::long_array;
+ aResIds->length( aSeq.Length() );
+
+ for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
+ aResIds[ resI ] = aSeq( resI + 1 );
+
+ aResGrp->Add( aResIds );
+
+ return aResGrp._retn();
+}
+
+//=============================================================================
+/*! CutGroups
+ * New group is created. All mesh elements that are present in
+ * main group but do not present in tool group are added to the new one
+ */
+//=============================================================================
+SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH::SMESH_Group_var aResGrp;
+
+ if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
+ theGroup1->GetType() != theGroup2->GetType() )
+ return aResGrp;
+
+ aResGrp = CreateGroup( theGroup1->GetType(), theName );
+ if ( aResGrp->_is_nil() )
+ return aResGrp;
+
+ SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
+ SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
+
+ TColStd_MapOfInteger aMap2;
+
+ for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
+ aMap2.Add( anIds2[ i2 ] );
+
+
+ TColStd_SequenceOfInteger aSeq;
+ for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
+ if ( !aMap2.Contains( anIds1[ i1 ] ) )
+ aSeq.Append( anIds1[ i1 ] );
+
+ SMESH::long_array_var aResIds = new SMESH::long_array;
+ aResIds->length( aSeq.Length() );
+
+ for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
+ aResIds[ resI ] = aSeq( resI + 1 );
+
+ aResGrp->Add( aResIds );
+
+ return aResGrp._retn();
+}
//=============================================================================
/*!
*/
//=============================================================================
-SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Shape_ptr theSubShape ) {
-
- TopoDS_Shape myLocSubShape = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), theSubShape);
+SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject )
+{
+ TopoDS_Shape myLocSubShape = _gen_i->GetShapeReader()->GetShape(SMESH_Gen_i::GetGeomEngine(), theSubShapeObject);
::SMESH_subMesh * mySubMesh = _impl->GetSubMesh(myLocSubShape);
int subMeshId = mySubMesh->GetId();
StudyContext* myStudyContext = _gen_i->GetCurrentStudyContext();
string iorString = SMESH_Gen_i::GetORB()->object_to_string( subMesh );
int nextId = myStudyContext->addObject( iorString );
- MESSAGE( "Add submesh to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
+ if(MYDEBUG) MESSAGE( "Add submesh to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
return subMesh._retn();
}
*/
//=============================================================================
-void SMESH_Mesh_i::removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Shape_ptr theSubShape )
+void SMESH_Mesh_i::removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Object_ptr theSubShapeObject )
{
MESSAGE("SMESH_Mesh_i::removeSubMesh()");
- if ( theSubMesh->_is_nil() || theSubShape->_is_nil() )
+ if ( theSubMesh->_is_nil() || theSubShapeObject->_is_nil() )
return;
try {
- SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShape );
+ SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject );
for ( int i = 0, n = aHypList->length(); i < n; i++ ) {
- removeHypothesis( theSubShape, aHypList[i] );
+ removeHypothesis( theSubShapeObject, aHypList[i] );
}
}
catch( const SALOME::SALOME_Exception& ) {
- MESSAGE("SMESH_Mesh_i::removeSubMesh(): exception caught!");
+ INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
}
int subMeshId = theSubMesh->GetId();
_mapSubMesh.erase(subMeshId);
_mapSubMesh_i.erase(subMeshId);
_mapSubMeshIor.erase(subMeshId);
- MESSAGE("SMESH_Mesh_i::removeSubMesh() completed");
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeSubMesh() completed");
}
//=============================================================================
StudyContext* myStudyContext = _gen_i->GetCurrentStudyContext();
string iorString = SMESH_Gen_i::GetORB()->object_to_string( aGroup );
int nextId = myStudyContext->addObject( iorString );
- MESSAGE( "Add group to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
+ if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId << " and IOR = " << iorString.c_str() );
}
return aGroup._retn();
}
void SMESH_Mesh_i::removeGroup( const int theId )
{
- MESSAGE("SMESH_Mesh_i::removeGroup()" );
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeGroup()" );
if ( _mapGroups.find( theId ) != _mapGroups.end() ) {
_mapGroups.erase( theId );
_impl->RemoveGroup( theId );
SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
throw(SALOME::SALOME_Exception)
{
- MESSAGE("SMESH_Mesh_i::GetLog");
-
- SMESH::log_array_var aLog;
- try
- {
- list < SMESHDS_Command * >logDS = _impl->GetLog();
- aLog = new SMESH::log_array;
- int indexLog = 0;
- int lg = logDS.size();
- SCRUTE(lg);
- aLog->length(lg);
- list < SMESHDS_Command * >::iterator its = logDS.begin();
- while (its != logDS.end())
- {
- SMESHDS_Command *com = *its;
- int comType = com->GetType();
- //SCRUTE(comType);
- int lgcom = com->GetNumber();
- //SCRUTE(lgcom);
- const list < int >&intList = com->GetIndexes();
- int inum = intList.size();
- //SCRUTE(inum);
- list < int >::const_iterator ii = intList.begin();
- const list < double >&coordList = com->GetCoords();
- int rnum = coordList.size();
- //SCRUTE(rnum);
- list < double >::const_iterator ir = coordList.begin();
- aLog[indexLog].commandType = comType;
- aLog[indexLog].number = lgcom;
- aLog[indexLog].coords.length(rnum);
- aLog[indexLog].indexes.length(inum);
- for (int i = 0; i < rnum; i++)
- {
- aLog[indexLog].coords[i] = *ir;
- //MESSAGE(" "<<i<<" "<<ir.Value());
- ir++;
- }
- for (int i = 0; i < inum; i++)
- {
- aLog[indexLog].indexes[i] = *ii;
- //MESSAGE(" "<<i<<" "<<ii.Value());
- ii++;
- }
- indexLog++;
- its++;
- }
- if (clearAfterGet)
- _impl->ClearLog();
- }
- catch(SALOME_Exception & S_ex)
- {
- THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
- }
- return aLog._retn();
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::GetLog");
+
+ SMESH::log_array_var aLog;
+ try{
+ list < SMESHDS_Command * >logDS = _impl->GetLog();
+ aLog = new SMESH::log_array;
+ int indexLog = 0;
+ int lg = logDS.size();
+ SCRUTE(lg);
+ aLog->length(lg);
+ list < SMESHDS_Command * >::iterator its = logDS.begin();
+ while(its != logDS.end()){
+ SMESHDS_Command *com = *its;
+ int comType = com->GetType();
+ //SCRUTE(comType);
+ int lgcom = com->GetNumber();
+ //SCRUTE(lgcom);
+ const list < int >&intList = com->GetIndexes();
+ int inum = intList.size();
+ //SCRUTE(inum);
+ list < int >::const_iterator ii = intList.begin();
+ const list < double >&coordList = com->GetCoords();
+ int rnum = coordList.size();
+ //SCRUTE(rnum);
+ list < double >::const_iterator ir = coordList.begin();
+ aLog[indexLog].commandType = comType;
+ aLog[indexLog].number = lgcom;
+ aLog[indexLog].coords.length(rnum);
+ aLog[indexLog].indexes.length(inum);
+ for(int i = 0; i < rnum; i++){
+ aLog[indexLog].coords[i] = *ir;
+ //MESSAGE(" "<<i<<" "<<ir.Value());
+ ir++;
+ }
+ for(int i = 0; i < inum; i++){
+ aLog[indexLog].indexes[i] = *ii;
+ //MESSAGE(" "<<i<<" "<<ii.Value());
+ ii++;
+ }
+ indexLog++;
+ its++;
+ }
+ if(clearAfterGet)
+ _impl->ClearLog();
+ }
+ catch(SALOME_Exception & S_ex){
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
+ return aLog._retn();
}
-// SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
-// throw (SALOME::SALOME_Exception)
-// {
-// MESSAGE("SMESH_Mesh_i::GetLog");
-
-// SMESH::string_array_var aLog;
-// try
-// {
-// const SMESHDS_ListOfCommand& logDS =_impl->GetLog();
-// aLog = new SMESH::string_array;
-// int logSize = 0;
-// int indexLog = 0;
-// int lg = logDS.Extent();
-// SCRUTE(lg);
-// SMESHDS_ListIteratorOfListOfCommand its(logDS);
-// while(its.More())
-// {
-// Handle(SMESHDS_Command) com = its.Value();
-// int comType = com->GetType();
-// SCRUTE(comType);
-// int lgcom = com->GetNumber();
-// SCRUTE(lgcom);
-// logSize += lgcom;
-// aLog->length(logSize);
-// SCRUTE(logSize);
-// const TColStd_ListOfInteger& intList = com->GetIndexes();
-// TColStd_ListIteratorOfListOfInteger ii(intList);
-// const TColStd_ListOfReal& coordList = com->GetCoords();
-// TColStd_ListIteratorOfListOfReal ir(coordList);
-// for (int icom = 1; icom <= lgcom; icom++)
-// {
-// ostringstream S;
-// switch (comType)
-// {
-// case SMESHDS_AddNode:
-// S << "AddNode " << ii.Value(); ii.Next();
-// S << " " << ir.Value(); ir.Next();
-// S << " " << ir.Value(); ir.Next();
-// S << " " << ir.Value(); ir.Next();
-// break;
-// case SMESHDS_AddEdge:
-// S << "AddEdge " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddTriangle:
-// S << "AddFace " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddQuadrangle:
-// S << "AddFace " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddTetrahedron:
-// S << "AddVolume " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddPyramid:
-// S << "AddVolume " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddPrism:
-// S << "AddVolume " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_AddHexahedron:
-// S << "AddVolume " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// S << " " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_RemoveNode:
-// S << "RemoveNode " << ii.Value(); ii.Next();
-// break;
-// case SMESHDS_RemoveElement:
-// S << "RemoveElement " << ii.Value(); ii.Next();
-// break;
-// default:
-// ASSERT(0);
-// break;
-// }
-// string ch = S.str();
-// SCRUTE(ch);
-// aLog[indexLog++] = CORBA::string_dup(ch.c_str());
-// }
-// its.Next();
-// }
-// if (clearAfterGet) _impl->ClearLog();
-// }
-// catch (SALOME_Exception& S_ex)
-// {
-// THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
-// }
-// return aLog._retn();
-// }
//=============================================================================
/*!
void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
{
- MESSAGE("SMESH_Mesh_i::ClearLog");
- // ****
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog");
+ // ****
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception)
{
- MESSAGE("SMESH_Mesh_i::GetId");
- return _id;
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::GetId");
+ return _id;
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::GetStudyId()throw(SALOME::SALOME_Exception)
{
- return _studyId;
+ return _studyId;
}
//=============================================================================
void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl)
{
- MESSAGE("SMESH_Mesh_i::SetImpl");
- _impl = impl;
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::SetImpl");
+ _impl = impl;
}
//=============================================================================
::SMESH_Mesh & SMESH_Mesh_i::GetImpl()
{
- MESSAGE("SMESH_Mesh_i::GetImpl()");
- return *_impl;
+ if(MYDEBUG) MESSAGE("SMESH_Mesh_i::GetImpl()");
+ return *_impl;
}
SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
{
- SMESH_MeshEditor_i *aMeshEditor =
- new SMESH_MeshEditor_i(_impl->GetMeshDS());
+ SMESH_MeshEditor_i *aMeshEditor = new SMESH_MeshEditor_i( _impl );
SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
return aMesh._retn();
}
void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- _impl->ExportDAT(file);
+ _impl->ExportDAT(file);
}
void SMESH_Mesh_i::ExportUNV(const char *file) throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- _impl->ExportUNV(file);
+ _impl->ExportUNV(file);
+}
+
+void SMESH_Mesh_i::ExportSTL(const char *file, const bool isascii) throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ _impl->ExportSTL(file, isascii);
}
//=============================================================================
SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- SMESH_MEDMesh_i *aMedMesh = new SMESH_MEDMesh_i(this);
- SALOME_MED::MESH_var aMesh = aMedMesh->_this();
- return aMesh._retn();
+ SMESH_MEDMesh_i *aMedMesh = new SMESH_MEDMesh_i(this);
+ SALOME_MED::MESH_var aMesh = aMedMesh->_this();
+ return aMesh._retn();
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbNodes()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbNodes();
+ return _impl->NbNodes();
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbEdges()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbEdges();
+ return _impl->NbEdges();
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbFaces()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbFaces();
+ return _impl->NbFaces();
}
CORBA::Long SMESH_Mesh_i::NbTriangles()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbTriangles();
+ return _impl->NbTriangles();
}
CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbQuadrangles();
+ return _impl->NbQuadrangles();
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbVolumes()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbVolumes();
+ return _impl->NbVolumes();
}
CORBA::Long SMESH_Mesh_i::NbTetras()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbTetras();
+ return _impl->NbTetras();
}
CORBA::Long SMESH_Mesh_i::NbHexas()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbHexas();
+ return _impl->NbHexas();
}
CORBA::Long SMESH_Mesh_i::NbPyramids()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbPyramids();
+ return _impl->NbPyramids();
}
CORBA::Long SMESH_Mesh_i::NbPrisms()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbPrisms();
+ return _impl->NbPrisms();
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbSubMesh()throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- return _impl->NbSubMesh();
+ return _impl->NbSubMesh();
}
//=============================================================================
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(MED)
-class SMESH_Gen_i;
-class SMESH_Group_i;
-
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH_subMesh.hxx"
-#include "SMESH_topo.hxx"
-
-#include <map>
#include "SALOME_GenericObj_i.hh"
+class SMESH_Gen_i;
+class SMESH_Group_i;
+
+#include <map>
+
class SMESH_Mesh_i:
public virtual POA_SMESH::SMESH_Mesh,
public virtual SALOME::GenericObj_i
{
-public:
SMESH_Mesh_i();
+ SMESH_Mesh_i(const SMESH_Mesh_i&);
+public:
SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
SMESH_Gen_i* myGen_i,
CORBA::Long studyId );
virtual ~SMESH_Mesh_i();
// --- CORBA
- void SetShape( GEOM::GEOM_Shape_ptr theShape )
+ void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
throw (SALOME::SALOME_Exception);
- SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+ SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception);
- SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+ SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception);
- SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
+ SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
throw (SALOME::SALOME_Exception);
- SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Shape_ptr aSubShape, const char* theName)
+ SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
throw (SALOME::SALOME_Exception);
void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
throw (SALOME::SALOME_Exception);
+ SMESH::SMESH_Group_ptr CreateGroupFromGEOM( SMESH::ElementType theElemType, const char* theName,
+ GEOM::GEOM_Object_ptr theGEOMGroup )
+ throw (SALOME::SALOME_Exception);
+
void RemoveGroup( SMESH::SMESH_Group_ptr theGroup )
throw (SALOME::SALOME_Exception);
+
+ void RemoveGroupWithContents( SMESH::SMESH_Group_ptr theGroup )
+ throw (SALOME::SALOME_Exception);
+
+ SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception);
+
+ SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception);
+
+ SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_Group_ptr theGroup1,
+ SMESH::SMESH_Group_ptr theGroup2,
+ const char* theName )
+ throw (SALOME::SALOME_Exception);
// SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
// throw (SALOME::SALOME_Exception);
SMESH_Gen_i* GetGen() { return _gen_i; }
+ int ImportUNVFile( const char* theFileName )
+ throw (SALOME::SALOME_Exception);
+
+ int ImportSTLFile( const char* theFileName )
+ throw (SALOME::SALOME_Exception);
+
/*!
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
*/
throw (SALOME::SALOME_Exception);
void ExportUNV( const char* file )
throw (SALOME::SALOME_Exception);
+ void ExportSTL( const char* file, const bool isascii )
+ throw (SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr GetMEDMesh()
throw (SALOME::SALOME_Exception);
// Internal methods not available through CORBA
// They are called by corresponding interface methods
- SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+ SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp);
- SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
+ SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp);
- bool setShape( GEOM::GEOM_Shape_ptr theShape );
+ bool setShape( GEOM::GEOM_Object_ptr theShapeObject );
int importMEDFile( const char* theFileName, const char* theMeshName );
- SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Shape_ptr theSubShape );
+ SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
- void removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Shape_ptr theSubShape );
+ void removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Object_ptr theSubShapeObject );
SMESH::SMESH_Group_ptr createGroup( SMESH::ElementType theElemType, const char* theName );
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_Pattern_i.cxx
+// Created : Fri Aug 20 16:15:49 2004
+// Author : Edward AGAPOV (eap)
+// $Header:
+
+#include "SMESH_Pattern_i.hxx"
+
+#include "GEOM_Client.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Mesh.hxx"
+#include "SMESH_Mesh_i.hxx"
+
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+
+#include <sstream>
+
+//=============================================================================
+/*!
+ * SMESH_Gen_i::GetPattern
+ *
+ * Create pattern mapper
+ */
+//=============================================================================
+
+SMESH::SMESH_Pattern_ptr SMESH_Gen_i::GetPattern()
+{
+ SMESH_Pattern_i* i = new SMESH_Pattern_i( this );
+ SMESH::SMESH_Pattern_var anObj = i->_this();
+ return anObj._retn();
+}
+
+//=======================================================================
+//function : SMESH_Pattern_i
+//purpose :
+//=======================================================================
+
+SMESH_Pattern_i::SMESH_Pattern_i( SMESH_Gen_i* theGen_i ):
+ myGen( theGen_i )
+{
+}
+
+//=======================================================================
+//function : getShape
+//purpose :
+//=======================================================================
+
+TopoDS_Shape SMESH_Pattern_i::getShape( GEOM::GEOM_Object_ptr & theGeomObject )
+{
+ return myGen->GetShapeReader()->GetShape( SMESH_Gen_i::GetGeomEngine(), theGeomObject );
+}
+
+//=======================================================================
+//function : getMesh
+//purpose :
+//=======================================================================
+
+::SMESH_Mesh* SMESH_Pattern_i::getMesh( SMESH::SMESH_Mesh_ptr & theMesh )
+{
+ SMESH_Mesh_i* anImplPtr =
+ dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+ if ( anImplPtr )
+ return & anImplPtr->GetImpl();
+
+ return 0;
+}
+
+//=======================================================================
+//function : LoadFromFile
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_Pattern_i::LoadFromFile(const char* theFileContents)
+{
+ return myPattern.Load( theFileContents );
+}
+
+//=======================================================================
+//function : LoadFromFace
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theFace,
+ CORBA::Boolean theProject)
+{
+ if ( theMesh->_is_nil() || theFace->_is_nil() )
+ return false;
+
+ ::SMESH_Mesh* aMesh = getMesh( theMesh );
+ if ( !aMesh )
+ return false;
+
+ TopoDS_Face aFace = TopoDS::Face( getShape( theFace ));
+ if ( aFace.IsNull() )
+ return false;
+
+ return myPattern.Load( aMesh, aFace, theProject );
+}
+
+//=======================================================================
+//function : LoadFrom3DBlock
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theBlock)
+{
+ if ( theMesh->_is_nil() || theBlock->_is_nil() )
+ return false;
+
+ ::SMESH_Mesh* aMesh = getMesh( theMesh );
+ if ( !aMesh )
+ return false;
+
+ TopoDS_Shape aShape = getShape( theBlock );
+ if ( aShape.IsNull())
+ return false;
+
+ TopExp_Explorer exp ( aShape, TopAbs_SHELL );
+ if ( !exp.More() )
+ return false;
+
+ return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() ));
+}
+
+//=======================================================================
+//function : ApplyToFace
+//purpose :
+//=======================================================================
+
+SMESH::point_array* SMESH_Pattern_i::ApplyToFace(GEOM::GEOM_Object_ptr theFace,
+ GEOM::GEOM_Object_ptr theVertexOnKeyPoint1,
+ CORBA::Boolean theReverse)
+{
+ SMESH::point_array_var points = new SMESH::point_array;
+ list<const gp_XYZ *> xyzList;
+
+ TopoDS_Shape F = getShape( theFace );
+ TopoDS_Shape V = getShape( theVertexOnKeyPoint1 );
+
+ if (!F.IsNull() && F.ShapeType() == TopAbs_FACE &&
+ !V.IsNull() && V.ShapeType() == TopAbs_VERTEX
+ &&
+ myPattern.Apply( TopoDS::Face( F ), TopoDS::Vertex( V ), theReverse ) &&
+ myPattern.GetMappedPoints( xyzList ))
+ {
+ points->length( xyzList.size() );
+ list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
+ for ( int i = 0; xyzIt != xyzList.end(); xyzIt++ ) {
+ SMESH::PointStruct & p = points[ i++ ];
+ (*xyzIt)->Coord( p.x, p.y, p.z );
+ }
+ }
+
+ return points._retn();
+}
+
+//=======================================================================
+//function : ApplyTo3DBlock
+//purpose :
+//=======================================================================
+
+SMESH::point_array* SMESH_Pattern_i::ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlock,
+ GEOM::GEOM_Object_ptr theVertex000,
+ GEOM::GEOM_Object_ptr theVertex001)
+{
+ SMESH::point_array_var points = new SMESH::point_array;
+ list<const gp_XYZ *> xyzList;
+
+ TopExp_Explorer exp( getShape( theBlock ), TopAbs_SHELL );
+ TopoDS_Shape V000 = getShape( theVertex000 );
+ TopoDS_Shape V001 = getShape( theVertex001 );
+
+ if (exp.More() &&
+ !V000.IsNull() && V000.ShapeType() == TopAbs_VERTEX &&
+ !V001.IsNull() && V001.ShapeType() == TopAbs_VERTEX
+ &&
+ myPattern.Apply(TopoDS::Shell( exp.Current() ),
+ TopoDS::Vertex( V000 ),
+ TopoDS::Vertex( V001 )) &&
+ myPattern.GetMappedPoints( xyzList ))
+ {
+ points->length( xyzList.size() );
+ list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
+ for ( int i = 0; xyzIt != xyzList.end(); xyzIt++ ) {
+ SMESH::PointStruct & p = points[ i++ ];
+ (*xyzIt)->Coord( p.x, p.y, p.z );
+ }
+ }
+
+ return points._retn();
+}
+
+//=======================================================================
+//function : MakeMesh
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_Pattern_i::MakeMesh(SMESH::SMESH_Mesh_ptr theMesh)
+{
+ ::SMESH_Mesh* aMesh = getMesh( theMesh );
+ if ( !aMesh )
+ return false;
+
+ return myPattern.MakeMesh( aMesh );
+}
+
+//=======================================================================
+//function : GetString
+//purpose :
+//=======================================================================
+
+char* SMESH_Pattern_i::GetString()
+{
+ ostringstream os;
+ myPattern.Save( os );
+
+ return CORBA::string_dup( os.str().c_str() );
+}
+
+//=======================================================================
+//function : Is2D
+//purpose :
+//=======================================================================
+
+CORBA::Boolean SMESH_Pattern_i::Is2D()
+{
+ return myPattern.Is2D();
+}
+
+//=======================================================================
+//function : GetPoints
+//purpose :
+//=======================================================================
+
+SMESH::point_array* SMESH_Pattern_i::GetPoints()
+{
+ SMESH::point_array_var points = new SMESH::point_array;
+ list<const gp_XYZ *> xyzList;
+
+ if (myPattern.GetPoints( xyzList ))
+ {
+ points->length( xyzList.size() );
+ list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
+ for ( int i = 0; xyzIt != xyzList.end(); xyzIt++ ) {
+ SMESH::PointStruct & p = points[ i++ ];
+ (*xyzIt)->Coord( p.x, p.y, p.z );
+ }
+ }
+
+ return points._retn();
+}
+
+//=======================================================================
+//function : GetKeyPoints
+//purpose :
+//=======================================================================
+
+SMESH::long_array* SMESH_Pattern_i::GetKeyPoints()
+{
+ SMESH::long_array_var ids = new SMESH::long_array;
+ if ( myPattern.IsLoaded() ) {
+ const list< int > & idList = myPattern.GetKeyPointIDs();
+ ids->length( idList.size() );
+ list< int >::const_iterator iIt = idList.begin();
+ for ( int i = 0; iIt != idList.end(); iIt++, i++ )
+ ids[ i ] = *iIt;
+ }
+ return ids._retn();
+}
+
+//=======================================================================
+//function : GetElementPoints
+//purpose :
+//=======================================================================
+
+SMESH::array_of_long_array* SMESH_Pattern_i::GetElementPoints()
+{
+ SMESH::array_of_long_array_var arrayOfArray = new SMESH::array_of_long_array;
+
+ const list< list< int > >& listOfIdList = myPattern.GetElementPointIDs();
+ arrayOfArray->length( listOfIdList.size() );
+ list< list< int > >::const_iterator llIt = listOfIdList.begin();
+ for ( int i = 0 ; llIt != listOfIdList.end(); llIt++, i++ )
+ {
+ const list< int > & idList = (*llIt);
+ SMESH::long_array& ids = arrayOfArray[ i ];
+ ids.length( idList.size() );
+ list< int >::const_iterator iIt = idList.begin();
+ for ( int j = 0; iIt != idList.end(); iIt++, j++ )
+ ids[ j ] = *iIt;
+ }
+ return arrayOfArray._retn();
+}
+
+//=======================================================================
+//function : GetErrorCode
+//purpose :
+//=======================================================================
+
+#define RETCASE(enm) case ::SMESH_Pattern::enm: return SMESH::SMESH_Pattern::enm;
+
+SMESH::SMESH_Pattern::ErrorCode SMESH_Pattern_i::GetErrorCode()
+{
+ switch ( myPattern.GetErrorCode() ) {
+ RETCASE( ERR_OK );
+ RETCASE( ERR_READ_NB_POINTS );
+ RETCASE( ERR_READ_POINT_COORDS );
+ RETCASE( ERR_READ_TOO_FEW_POINTS );
+ RETCASE( ERR_READ_3D_COORD );
+ RETCASE( ERR_READ_NO_KEYPOINT );
+ RETCASE( ERR_READ_BAD_INDEX );
+ RETCASE( ERR_READ_ELEM_POINTS );
+ RETCASE( ERR_READ_NO_ELEMS );
+ RETCASE( ERR_READ_BAD_KEY_POINT );
+ RETCASE( ERR_SAVE_NOT_LOADED );
+ RETCASE( ERR_LOAD_EMPTY_SUBMESH );
+ RETCASE( ERR_LOADF_NARROW_FACE );
+ RETCASE( ERR_LOADF_CLOSED_FACE );
+ RETCASE( ERR_LOADV_BAD_SHAPE );
+ RETCASE( ERR_LOADV_COMPUTE_PARAMS );
+ RETCASE( ERR_APPL_NOT_LOADED );
+ RETCASE( ERR_APPL_BAD_DIMENTION );
+ RETCASE( ERR_APPL_BAD_NB_VERTICES );
+ RETCASE( ERR_APPLF_BAD_TOPOLOGY );
+ RETCASE( ERR_APPLF_BAD_VERTEX );
+ RETCASE( ERR_APPLF_INTERNAL_EEROR );
+ RETCASE( ERR_APPLV_BAD_SHAPE );
+ RETCASE( ERR_MAKEM_NOT_COMPUTED );
+ default:;
+ };
+ return SMESH::SMESH_Pattern::ERR_OK;
+}
+
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SMESH_Pattern_i.hxx
+// Created : Fri Aug 20 16:03:15 2004
+// Author : Edward AGAPOV (eap)
+
+// $Header:
+
+#ifndef SMESH_Pattern_I_HeaderFile
+#define SMESH_Pattern_I_HeaderFile
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Pattern)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+
+#include <TopoDS_Shape.hxx>
+#include "SMESH_Pattern.hxx"
+
+class SMESH_Gen_i;
+class SMESH_Mesh;
+
+class SMESH_Pattern_i:
+ public virtual POA_SMESH::SMESH_Pattern
+{
+ public:
+
+ SMESH_Pattern_i (SMESH_Gen_i* theGen_i);
+
+ CORBA::Boolean LoadFromFile(const char* theFileContents);
+
+ CORBA::Boolean LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theFace,
+ CORBA::Boolean theProject);
+
+ CORBA::Boolean LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theBlock);
+
+ SMESH::point_array* ApplyToFace(GEOM::GEOM_Object_ptr theFace,
+ GEOM::GEOM_Object_ptr theVertexOnKeyPoint1,
+ CORBA::Boolean theReverse);
+
+ SMESH::point_array* ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlock,
+ GEOM::GEOM_Object_ptr theVertex000,
+ GEOM::GEOM_Object_ptr theVertex001);
+
+ CORBA::Boolean MakeMesh(SMESH::SMESH_Mesh_ptr theMesh);
+
+ SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
+
+ char* GetString();
+
+ CORBA::Boolean Is2D();
+
+ SMESH::point_array* GetPoints();
+
+ SMESH::long_array* GetKeyPoints();
+
+ SMESH::array_of_long_array* GetElementPoints();
+
+
+ private:
+
+ TopoDS_Shape getShape( GEOM::GEOM_Object_ptr & theGeomObject );
+
+ ::SMESH_Mesh* getMesh( SMESH::SMESH_Mesh_ptr & theMesh );
+
+ ::SMESH_Pattern myPattern;
+
+ SMESH_Gen_i* myGen;
+};
+#endif
// Module : SMESH
// $Header$
-using namespace std;
using namespace std;
#include "SMESH_subMesh_i.hxx"
#include "SMESH_Gen_i.hxx"
*/
//=============================================================================
-CORBA::Long SMESH_subMesh_i::GetNumberOfNodes()
+CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
if ( aSubMeshDS == NULL )
return 0;
+ if ( all ) { // all nodes of submesh elements
+ set<int> nodeIds;
+ SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ return nodeIds.size();
+ }
+
return aSubMeshDS->NbNodes();
}
if ( aSubMeshDS == NULL )
return aResult._retn();
- int i = 0;
+ // No sense in returning ids of elements along with ids of nodes:
+ // when theElemType == SMESH::ALL, return node ids only if
+ // there are no elements
+ bool retNodes = (theElemType == SMESH::NODE ||
+ (theElemType == SMESH::ALL && aSubMeshDS->NbElements() == 0));
+
+ // PAL5440, return all nodes belonging to elements of submesh
+ set<int> nodeIds;
+ if ( retNodes ) {
+ SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ }
+
if ( theElemType == SMESH::ALL )
- aResult->length( aSubMeshDS->NbElements() + aSubMeshDS->NbNodes() );
+ aResult->length( aSubMeshDS->NbElements() + nodeIds.size());
else if ( theElemType == SMESH::NODE )
- aResult->length( aSubMeshDS->NbNodes() );
+ aResult->length( nodeIds.size() );
else
aResult->length( aSubMeshDS->NbElements() );
- int n = aResult->length();
+ int i = 0, n = aResult->length();
- if ( theElemType == SMESH::ALL || theElemType == SMESH::NODE ) {
- SMDS_NodeIteratorPtr anIt = aSubMeshDS->GetNodes();
- while ( i < n && anIt->more() )
- aResult[i++] = anIt->next()->GetID();
+ if ( retNodes && !nodeIds.empty() ) {
+ set<int>::iterator idIt = nodeIds.begin();
+ for ( ; i < n && idIt != nodeIds.end() ; i++, idIt++ )
+ aResult[i] = *idIt;
}
if ( theElemType == SMESH::ALL || theElemType != SMESH::NODE ) {
if ( families[i]->getIdentifier() == ( _localId ) )
return families[i];
}
+
+ return SALOME_MED::FAMILY::_nil();
}
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(MED)
#include "SALOME_GenericObj_i.hh"
CORBA::Long GetNumberOfElements()
throw (SALOME::SALOME_Exception);
- CORBA::Long GetNumberOfNodes()
+ CORBA::Long GetNumberOfNodes( CORBA::Boolean all )
throw (SALOME::SALOME_Exception);
SMESH::long_array* GetElementsId()
# SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : SMESH_test.py
# Module : SMESH
-import SMESH
-import StdMeshers
-
-import smeshpy
import salome
-from salome import sg
-import math
-#import SMESH_BasicHypothesis_idl
-
import geompy
+import smeshpy
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
-from geompy import gg
-
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
+import SMESH
+import StdMeshers
# ---- define a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idb = geompy.addToStudy(box,"box")
+idb = geompy.addToStudy(box, "box")
# ---- add first face of box in study
-subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
-face=subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
-print name
-idf=geompy.addToStudyInFather(box,face,name)
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+idf = geompy.addToStudyInFather(box, face, name)
# ---- add shell from box in study
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
shell = subShellList[0]
-name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
-print name
-ids=geompy.addToStudyInFather(box,shell,name)
+name = geompy.SubShapeName(shell, box)
+ids = geompy.addToStudyInFather(box, shell, name)
# ---- add first edge of face in study
-edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
-edge=edgeList[0];
-name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
-print name
-ide=geompy.addToStudyInFather(face,edge,name)
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0];
+name = geompy.SubShapeName(edge, face)
+ide = geompy.addToStudyInFather(face, edge, name)
# ---- launch SMESH, init a Mesh with the box
-gen=smeshpy.smeshpy()
-mesh=gen.CreateMesh(idb)
-# ---- create Hypothesis
+gen = smeshpy.smeshpy()
+mesh = gen.CreateMesh(idb)
print "-------------------------- create Hypothesis"
+
print "-------------------------- LocalLength"
-hyp1=gen.CreateHypothesis("LocalLength","libStdMeshersEngine.so")
-print hyp1.GetName()
-print hyp1.GetId()
-hypo1 = hyp1._narrow(StdMeshers.StdMeshers_LocalLength)
+
+hypo1 = gen.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
+print hypo1.GetName()
+print hypo1.GetId()
print hypo1.GetLength()
hypo1.SetLength(100)
print hypo1.GetLength()
print "-------------------------- bidon"
-hyp3=gen.CreateHypothesis("bidon","")
+
+hyp3 = gen.CreateHypothesis("bidon", "")
print "-------------------------- NumberOfSegments"
-hyp3=gen.CreateHypothesis("NumberOfSegments","libStdMeshersEngine.so")
-hypo3=hyp3._narrow(StdMeshers.StdMeshers_NumberOfSegments)
+
+hypo3 = gen.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypo3.SetNumberOfSegments(7)
print hypo3.GetName()
print hypo3.GetNumberOfSegments()
print hypo3.GetId()
print "-------------------------- MaxElementArea"
-hyp4=gen.CreateHypothesis("MaxElementArea","libStdMeshersEngine.so")
-hypo4=hyp4._narrow(StdMeshers.StdMeshers_MaxElementArea)
+
+hypo4 = gen.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypo4.SetMaxElementArea(5000)
print hypo4.GetName()
print hypo4.GetMaxElementArea()
print hypo4.GetId()
print "-------------------------- Regular_1D"
-alg1=gen.CreateHypothesis("Regular_1D","libStdMeshersEngine.so")
-print alg1.GetName()
-print alg1.GetId()
-algo1=alg1._narrow(SMESH.SMESH_Algo)
-listHyp=algo1.GetCompatibleHypothesis()
+
+algo_1 = gen.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+print algo_1.GetName()
+print algo_1.GetId()
+listHyp = algo_1.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
-
-algo_1=alg1._narrow(StdMeshers.StdMeshers_Regular_1D)
print algo_1.GetId()
print "-------------------------- MEFISTO_2D"
-alg2=gen.CreateHypothesis("MEFISTO_2D","libStdMeshersEngine.so")
-print alg2.GetName()
-print alg2.GetId()
-algo2=alg2._narrow(SMESH.SMESH_Algo)
-listHyp=algo2.GetCompatibleHypothesis()
+
+algo_2 = gen.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+print algo_2.GetName()
+print algo_2.GetId()
+listHyp = algo_2.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
-algo_2=alg2._narrow(StdMeshers.StdMeshers_MEFISTO_2D)
print algo_2.GetId()
-# ---- add hypothesis to edge
-
print "-------------------------- add hypothesis to edge"
-edge=salome.IDToObject(ide)
-submesh=mesh.GetElementsOnShape(edge)
-ret=mesh.AddHypothesis(edge,algo_1)
+
+edge = salome.IDToObject(ide)
+submesh = mesh.GetSubMesh(edge, "SubMeshEdge")
+ret = mesh.AddHypothesis(edge,algo_1)
print ret
-ret=mesh.AddHypothesis(edge,hypo1)
+ret = mesh.AddHypothesis(edge,hypo1)
print ret
-# ---- compute edge
-
##print "-------------------------- compute edge"
##ret=gen.Compute(mesh,ide)
##print ret
##for a in log:
## print a
-# ---- add hypothesis to box
-
print "-------------------------- add hypothesis to box"
-box=salome.IDToObject(idb)
-submesh=mesh.GetElementsOnShape(box)
-ret=mesh.AddHypothesis(box,algo_1)
+
+box = salome.IDToObject(idb)
+submesh = mesh.GetSubMesh(box, "SubMeshBox")
+ret = mesh.AddHypothesis(box,algo_1)
print ret
-ret=mesh.AddHypothesis(box,hypo1)
+ret = mesh.AddHypothesis(box,hypo1)
print ret
-ret=mesh.AddHypothesis(box,algo_2)
+ret = mesh.AddHypothesis(box,algo_2)
print ret
-ret=mesh.AddHypothesis(box,hypo4)
+ret = mesh.AddHypothesis(box,hypo4)
print ret
-# ---- compute face
+print "-------------------------- compute"
-print "-------------------------- compute face"
-ret=gen.Compute(mesh,idf)
+ret = gen.Compute(mesh,idf)
print ret
-log=mesh.GetLog(1);
+log = mesh.GetLog(1);
for a in log:
print "-------"
ii = 0
ii = ii+1
print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
-# ---- compute box
-
##print "-------------------------- compute box"
##ret=gen.Compute(mesh,idb)
##print ret
##print ret
##ret=gen.Compute(mesh,ids)
##print ret
-
+++ /dev/null
-// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESH_topo.cxx
-// Author : Paul RASCLE, EDF
-// Module : SMESH
-// $Header$
-
-using namespace std;
-using namespace std;
-#include "SMESH_topo.hxx"
-#include "utilities.h"
-
-SMESH_topo::SMESH_topo()
-{
- MESSAGE("SMESH_topo()");
-}
-
-SMESH_topo::~SMESH_topo()
-{
- MESSAGE("~SMESH_topo()");
-}
-
-//=============================================================================
-/*!
- * Static method, gives a unique local id for a given CORBA reference of
- * a shape, within the SALOME session (multi studies).
- * Internal geom id or stringified CORBA reference could be used here.
- * GEOM Id is more efficient (shorter string).
- */
-//=============================================================================
-
-string SMESH_topo::GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape)
-{
- string str = aShape->ShapeId(); //geomId
- MESSAGE(str);
- return str;
-}
-
+++ /dev/null
-// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESH_topo.hxx
-// Author : Paul RASCLE, EDF
-// Module : SMESH
-// $Header$
-
-#ifndef _SMESH_TOPO_HXX_
-#define _SMESH_TOPO_HXX_
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(GEOM_Shape)
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_CompSolid.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-
-#include <string>
-#include <map>
-
-static const char* const SMESH_shapeTypeNames[9] = { "0=TopAbs_COMPOUND",
- "1=TopAbs_COMPSOLID",
- "2=TopAbs_SOLID",
- "3=TopAbs_SHELL",
- "4=TopAbs_FACE",
- "5=TopAbs_WIRE",
- "6=TopAbs_EDGE",
- "7=TopAbs_VERTEX",
- "8=TopAbs_SHAPE" };
-
-class SMESH_topo
-{
-public:
-
- static string GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape);
-
- SMESH_topo();
- virtual ~SMESH_topo();
-
- map <string, int> _mapIndShapes[9];
- TopTools_IndexedMapOfShape _myShapes[9];
-
-protected:
-
-
-};
-
-#endif
SWIG_DEF = libSMESH_Swig.i
EXPORT_PYSCRIPTS = libSMESH_Swig.py \
+ batchmode_smesh.py \
+ batchmode_mefisto.py \
SMESH_test0.py\
SMESH_test1.py \
SMESH_test2.py \
SMESH_fixation.py \
SMESH_fixation_hexa.py \
SMESH_fixation_tetra.py \
- batchmode_smesh.py \
SMESH_box_tetra.py \
SMESH_box2_tetra.py \
SMESH_box3_tetra.py \
SMESH_flight_skin.py \
SMESH_Partition1_tetra.py\
- batchmode_mefisto.py \
SMESH_controls.py \
- SMESH_freebord.py
+ SMESH_freebord.py \
+ SMESH_blocks.py \
+ SMESH_GroupFromGeom.py
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOME_Exception.idl \
GEOM_Gen.idl \
- GEOM_Shape.idl \
SMESH_Gen.idl \
SMESH_Mesh.idl \
SMESH_Hypothesis.idl \
EXPORT_SHAREDPYSCRIPTS=SMESH_shared_modules.py
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -DHAVE_CONFIG_H
LIBS+= $(PYTHON_LIBS)
LDFLAGS+= -lSMESHGUI -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj
--- /dev/null
+import SMESH
+from SMESH_test1 import *
+
+def CheckBelongToGeomFilter(theMeshGen, theMesh, theShape, theSubShape, theElemType):
+ import geompy
+ if theShape != theSubShape:
+ aName = str(theSubShape)
+ geompy.addToStudyInFather(theShape,theSubShape,aName)
+
+ theMeshGen.Compute(theMesh,theShape)
+
+ aFilterMgr = theMeshGen.CreateFilterManager()
+ aFilter = aFilterMgr.CreateFilter()
+
+ aBelongToGeom = aFilterMgr.CreateBelongToGeom()
+ aBelongToGeom.SetGeom(theSubShape)
+ aBelongToGeom.SetElementType(theElemType)
+
+ aFilter.SetPredicate(aBelongToGeom)
+ return aFilter.GetElementsId(theMesh)
+
+anElemType = SMESH.ALL;
+print "anElemType =", anElemType
+#anIds = CheckBelongToGeomFilter(smesh,mesh,box,subShapeList[1],SMESH.FACE)
+anIds = CheckBelongToGeomFilter(smesh,mesh,box,box,SMESH.FACE)
+print "anIds = ", anIds
+
+salome.sg.updateObjBrowser(1);
--- /dev/null
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : SMESH_GroupFromGeom.py
+# Module : SMESH
+
+from SMESH_test1 import *
+import SMESH
+
+# Compute the mesh created in SMESH_test1
+
+smesh.Compute(mesh, box)
+
+# Create geometry groups on plane:
+aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"])
+geompy.AddObject(aGeomGroup1, 1)
+
+aGeomGroup2 = geompy.CreateGroup(face , geompy.ShapeType["EDGE"])
+
+geompy.AddObject(aGeomGroup2, 3)
+geompy.AddObject(aGeomGroup2, 6)
+geompy.AddObject(aGeomGroup2, 8)
+geompy.AddObject(aGeomGroup2, 10)
+
+geompy.addToStudy(aGeomGroup1, "Group on Faces")
+geompy.addToStudy(aGeomGroup2, "Group on Edges")
+
+aSmeshGroup1 = mesh.CreateGroupFromGEOM(SMESH.FACE, "SMESHGroup1", aGeomGroup1)
+aSmeshGroup2 = mesh.CreateGroupFromGEOM(SMESH.EDGE, "SMESHGroup2", aGeomGroup2)
+
+salome.sg.updateObjBrowser(1);
import salome
import geompy
+from math import sqrt
import StdMeshers
import NETGENPlugin
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-
-geom.GetCurrentStudy(salome.myStudy._get_StudyId())
smesh.SetCurrentStudy(salome.myStudy)
smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
+smeshgui.Init(salome.myStudyId)
#---------------------------------------------------------------
# --
cc_radius = colis_radius + cc_width
-from math import sqrt
colis_center = sqrt(2.0)*colis_step/2
# --
# --
-barier = geompy.MakeCylinder(
- geom.MakePointStruct(0.,0.,0.),
- geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
- barier_radius,
- barier_height)
+p0 = geompy.MakeVertex(0.,0.,0.)
+vz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
# --
-colis = geompy.MakeCylinder(
- geom.MakePointStruct(0.,0.,0.),
- geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
- colis_radius,
- barier_height)
+barier = geompy.MakeCylinder(p0, vz, barier_radius, barier_height)
-cc = geompy.MakeCylinder(
- geom.MakePointStruct(0.,0.,0.),
- geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
- cc_radius,
- barier_height)
+# --
-colis_cc = geompy.MakeCompound(
- [colis._get_Name(), cc._get_Name()])
+colis = geompy.MakeCylinder(p0, vz, colis_radius, barier_height)
+cc = geompy.MakeCylinder(p0, vz, cc_radius, barier_height)
-colis_cc = geompy.MakeTranslation(
- colis_cc, colis_center, 0.0, 0.0)
+colis_cc = geompy.MakeCompound([colis, cc])
+colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
-colis_cc_multi = geompy.MakeMultiRotation1D(
- colis_cc,
- geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
- geom.MakePointStruct(0.,0.,0.),
- 4)
+colis_cc_multi = geompy.MakeMultiRotation1D(colis_cc, vz, 4)
# --
-alveole = geompy.Partition(
- [colis_cc_multi._get_Name(), barier._get_Name()])
-
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
+alveole = geompy.MakePartition([colis_cc_multi, barier])
print "Analysis of the geometry to mesh (right after the Partition) :"
-subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
-print "number of Shells in alveole : ",len(subShellList)
-print "number of Faces in alveole : ",len(subFaceList)
-print "number of Edges in alveole : ",len(subEdgeList)
+print "number of Shells in alveole : ", len(subShellList)
+print "number of Faces in alveole : ", len(subFaceList)
+print "number of Edges in alveole : ", len(subEdgeList)
-subshapes = geompy.SubShapeAll( alveole, geompy.ShapeType["SHAPE"] )
+subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
## there are 9 subshapes
-comp1 = geompy.MakeCompound( [ subshapes[0]._get_Name(), subshapes[1]._get_Name() ] );
-comp2 = geompy.MakeCompound( [ subshapes[2]._get_Name(), subshapes[3]._get_Name() ] );
-comp3 = geompy.MakeCompound( [ subshapes[4]._get_Name(), subshapes[5]._get_Name() ] );
-comp4 = geompy.MakeCompound( [ subshapes[6]._get_Name(), subshapes[7]._get_Name() ] );
+comp1 = geompy.MakeCompound( [ subshapes[0], subshapes[1] ] )
+comp2 = geompy.MakeCompound( [ subshapes[2], subshapes[3] ] )
+comp3 = geompy.MakeCompound( [ subshapes[4], subshapes[5] ] )
+comp4 = geompy.MakeCompound( [ subshapes[6], subshapes[7] ] )
-compIORs = []
-compIORs.append( comp1._get_Name() );
-compIORs.append( comp2._get_Name() );
-compIORs.append( comp3._get_Name() );
-compIORs.append( comp4._get_Name() );
-comp = geompy.MakeCompound( compIORs );
+compGOs = []
+compGOs.append( comp1 )
+compGOs.append( comp2 )
+compGOs.append( comp3 )
+compGOs.append( comp4 )
+comp = geompy.MakeCompound( compGOs )
-alveole = geompy.MakeCompound( [ comp._get_Name(), subshapes[8]._get_Name() ]);
+alveole = geompy.MakeCompound( [ comp, subshapes[8] ])
-idalveole= geompy.addToStudy(alveole, "alveole")
+idalveole = geompy.addToStudy(alveole, "alveole")
print "Analysis of the geometry to mesh (right after the MakeCompound) :"
-subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
-print "number of Shells in alveole : ",len(subShellList)
-print "number of Faces in alveole : ",len(subFaceList)
-print "number of Edges in alveole : ",len(subEdgeList)
+print "number of Shells in alveole : ", len(subShellList)
+print "number of Faces in alveole : ", len(subFaceList)
+print "number of Edges in alveole : ", len(subEdgeList)
-status=geompy.CheckShape(alveole)
+status = geompy.CheckShape(alveole)
print " check status ", status
# ---- launch SMESH
-# ---- create Hypothesis
-
print "-------------------------- create Hypothesis (In this case global hypothesis are used)"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
print hypNbSeg.GetId()
maxElementArea = 0.1
-hypArea=smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
maxElementVolume = 0.5
-hypVolume=smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
+hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_0.5")
-# ---- create Algorithms
-
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
-netgen3D=smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
+netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
# ---- init a Mesh with the alveole
shape_mesh = salome.IDToObject( idalveole )
-mesh=smesh.CreateMesh(shape_mesh)
+mesh = smesh.CreateMesh(shape_mesh)
smeshgui.SetName(salome.ObjectToID(mesh), "MeshAlveole")
# ---- add hypothesis to alveole
mesh.AddHypothesis(shape_mesh,hypVolume)
print "-------------------------- compute the mesh of alveole "
-ret=smesh.Compute(mesh,shape_mesh)
+ret = smesh.Compute(mesh,shape_mesh)
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the Mesh_mechanic:"
- print "Number of nodes : ", mesh.NbNodes()
- print "Number of edges : ", mesh.NbEdges()
- print "Number of faces : ", mesh.NbFaces()
- print "Number of triangles : ", mesh.NbTriangles()
- print "Number of volumes: ", mesh.NbVolumes()
+ print "Number of nodes : ", mesh.NbNodes()
+ print "Number of edges : ", mesh.NbEdges()
+ print "Number of faces : ", mesh.NbFaces()
+ print "Number of triangles : ", mesh.NbTriangles()
+ print "Number of volumes : ", mesh.NbVolumes()
print "Number of tetrahedrons: ", mesh.NbTetras()
else:
print "problem when computing the mesh"
--- /dev/null
+# SMESH SMESH_SWIG : binding of C++ implementaion with Python
+#
+# Copyright (C) 2003 CEA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : SMESH_blocks.py
+# Author : Julia DOROVSKIKH
+# Module : SMESH
+# $Header$
+
+import salome
+import geompy
+import math
+
+import GEOM_Spanner
+
+isBlocksTest = 0 # False
+isMeshTest = 1 # True
+hasGUI = 1 # True
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smesh.SetCurrentStudy(salome.myStudy)
+
+GEOM_Spanner.MakeSpanner(salome, geompy, math, isBlocksTest, isMeshTest, smesh, hasGUI)
+
+salome.sg.updateObjBrowser(1);
import StdMeshers
import NETGENPlugin
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId);
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
# ---- define 2 boxes box1 and box2
box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox1 = geompy.addToStudy(box1,"box1")
+idbox1 = geompy.addToStudy(box1, "box1")
print "Analysis of the geometry box1 :"
-subShellList=geompy.SubShapeAll(box1,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box1,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box1,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
-print "number of Shells in box1 : ",len(subShellList)
-print "number of Faces in box1 : ",len(subFaceList)
-print "number of Edges in box1 : ",len(subEdgeList)
+print "number of Shells in box1 : ", len(subShellList)
+print "number of Faces in box1 : ", len(subFaceList)
+print "number of Edges in box1 : ", len(subEdgeList)
box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
-idbox2 = geompy.addToStudy(box2,"box2")
+idbox2 = geompy.addToStudy(box2, "box2")
print "Analysis of the geometry box2 :"
-subShellList=geompy.SubShapeAll(box2,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box2,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box2,ShapeTypeEdge)
-
-print "number of Shells in box2 : ",len(subShellList)
-print "number of Faces in box2 : ",len(subFaceList)
-print "number of Edges in box2 : ",len(subEdgeList)
+subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-blocs = []
-blocs.append(box1._get_Name())
-blocs.append(box2._get_Name())
+print "number of Shells in box2 : ", len(subShellList)
+print "number of Faces in box2 : ", len(subFaceList)
+print "number of Edges in box2 : ", len(subEdgeList)
# append the tow boxes to make ine shel, referrencing only once
# the internal interface
-shell = geompy.Partition(blocs)
-idshell = geompy.addToStudy(shell,"shell")
+shell = geompy.MakePartition([box1, box2])
+idshell = geompy.addToStudy(shell, "shell")
print "Analysis of the geometry shell (union of box1 and box2) :"
-subShellList=geompy.SubShapeAll(shell,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(shell,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(shell,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
-print "number of Shells in shell : ",len(subShellList)
-print "number of Faces in shell : ",len(subFaceList)
-print "number of Edges in shell : ",len(subEdgeList)
+print "number of Shells in shell : ", len(subShellList)
+print "number of Faces in shell : ", len(subFaceList)
+print "number of Edges in shell : ", len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
numberOfSegments = 10
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
maxElementArea = 500
-hypArea=smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
maxElementVolume = 500
-hypVolume=smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
+hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
-netgen3D=smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
+netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
# ---- init a Mesh with the shell
salome.sg.updateObjBrowser(1)
print "-------------------------- compute shell"
-ret= smesh.Compute(mesh,shell)
+ret = smesh.Compute(mesh,shell)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the MeshBox2:"
import StdMeshers
import NETGENPlugin
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId);
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
# ---- define 3 boxes box1, box2 and box3
box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox1 = geompy.addToStudy(box1,"box1")
+idbox1 = geompy.addToStudy(box1, "box1")
print "Analysis of the geometry box1 :"
-subShellList=geompy.SubShapeAll(box1,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box1,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box1,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
-print "number of Shells in box1 : ",len(subShellList)
-print "number of Faces in box1 : ",len(subFaceList)
-print "number of Edges in box1 : ",len(subEdgeList)
+print "number of Shells in box1 : ", len(subShellList)
+print "number of Faces in box1 : ", len(subFaceList)
+print "number of Edges in box1 : ", len(subEdgeList)
box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
-idbox2 = geompy.addToStudy(box2,"box2")
+idbox2 = geompy.addToStudy(box2, "box2")
print "Analysis of the geometry box2 :"
-subShellList=geompy.SubShapeAll(box2,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box2,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box2,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-print "number of Shells in box2 : ",len(subShellList)
-print "number of Faces in box2 : ",len(subFaceList)
-print "number of Edges in box2 : ",len(subEdgeList)
+print "number of Shells in box2 : ", len(subShellList)
+print "number of Faces in box2 : ", len(subFaceList)
+print "number of Edges in box2 : ", len(subEdgeList)
box3 = geompy.MakeBox(0., 0., 300., 200., 200., 500.)
-idbox3 = geompy.addToStudy(box3,"box3")
+idbox3 = geompy.addToStudy(box3, "box3")
print "Analysis of the geometry box3 :"
-subShellList=geompy.SubShapeAll(box3,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box3,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box3,ShapeTypeEdge)
-
-print "number of Shells in box3 : ",len(subShellList)
-print "number of Faces in box3 : ",len(subFaceList)
-print "number of Edges in box3 : ",len(subEdgeList)
+subShellList = geompy.SubShapeAll(box3, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box3, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box3, geompy.ShapeType["EDGE"])
-blocs = []
-blocs.append(box1._get_Name())
-blocs.append(box2._get_Name())
-blocs.append(box3._get_Name())
+print "number of Shells in box3 : ", len(subShellList)
+print "number of Faces in box3 : ", len(subFaceList)
+print "number of Edges in box3 : ", len(subEdgeList)
-shell = geompy.Partition(blocs)
+shell = geompy.MakePartition([box1, box2, box3])
idshell = geompy.addToStudy(shell,"shell")
print "Analysis of the geometry shell (union of box1, box2 and box3) :"
-subShellList=geompy.SubShapeAll(shell,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(shell,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(shell,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
-print "number of Shells in shell : ",len(subShellList)
-print "number of Faces in shell : ",len(subFaceList)
-print "number of Edges in shell : ",len(subEdgeList)
+print "number of Shells in shell : ", len(subShellList)
+print "number of Faces in shell : ", len(subFaceList)
+print "number of Edges in shell : ", len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
numberOfSegments = 10
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
maxElementArea = 500
-hypArea=smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
maxElementVolume = 500
-hypVolume=smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
+hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
-netgen3D=smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
+netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
# ---- init a Mesh with the shell
salome.sg.updateObjBrowser(1)
print "-------------------------- compute shell"
-ret= smesh.Compute(mesh,shell)
+ret = smesh.Compute(mesh,shell)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the MeshBox3:"
import StdMeshers
import NETGENPlugin
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId);
-# -----------------------------------------------------------------------------
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
# ---- define a boxe
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
+idbox = geompy.addToStudy(box, "box")
print "Analysis of the geometry box :"
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(box,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(box,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
-print "number of Shells in box : ",len(subShellList)
-print "number of Faces in box : ",len(subFaceList)
-print "number of Edges in box : ",len(subEdgeList)
+print "number of Shells in box : ", len(subShellList)
+print "number of Faces in box : ", len(subFaceList)
+print "number of Edges in box : ", len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
numberOfSegments = 10
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
maxElementArea = 500
-hypArea=smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
maxElementVolume = 500
-hypVolume=smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
+hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
-netgen3D=smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
+netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
# ---- init a Mesh with the boxe
salome.sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the boxe"
-ret=smesh.Compute(mesh,box)
+ret = smesh.Compute(mesh,box)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the MeshBox:"
# create group
aGroup = mesh.CreateGroup( SMESH.FACE, "Aspect Ratio > 1.3" )
-aGroup.Add( anIds )
+aGroup.Add( anIds )
# Criterion : MINIMUM ANGLE < 30
salome.sg.updateObjBrowser(1)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
import geompy
import math
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
# -----------------------------------------------------------------------------
def MakeFace(lstEdges) :
"""
- Creates a face from 4 edges
+ Creates a planar face from 4 edges
"""
- lstWire = []
- for edge in lstEdges :
- lstWire.append(edge._get_Name())
- wire = geom.MakeWire(lstWire)
- face = geom.MakeFace(wire, 1)
+ wire = geompy.MakeWire(lstEdges)
+ face = geompy.MakeFace(wire, 1)
return face
-def MakeShell(lstFaces) :
- """
- Creates a shell from 6 faces
- """
- lstShell = []
- for face in lstFaces :
- lstShell.append(face._get_Name())
- shell = geom.MakeSewing(lstShell, 0.00001)
- return shell
-
-def MakeCompound(lstShells) :
- """
- Creates a compound from several shells
- """
- lstCompound = []
- for shell in lstShells :
- lstCompound.append(shell._get_Name())
- compound = geom.MakeCompound(lstCompound)
- return compound
-
# -----------------------------------------------------------------------------
# ---- dimensions
epaisseurFond = 162
rayonTrou = 75
-posAxeTrou = hauteurFlanc -(180 + rayonTrou)
+posAxeTrou = hauteurFlanc - (180 + rayonTrou)
marge = 10
tol3d = 1.e-3
# ---- points, directions de base
-p0 = geom.MakePointStruct(0., 0., 0.)
-px = geom.MakePointStruct(100., 0., 0.)
-vx = geom.MakeDirection(px)
-py = geom.MakePointStruct(0., 100., 0.)
-vy = geom.MakeDirection(py)
-pz = geom.MakePointStruct(0., 0., 100.)
-vz = geom.MakeDirection(pz)
+p0 = geompy.MakeVertex(0., 0., 0.)
+
+vx = geompy.MakeVectorDXDYDZ(100., 0., 0.)
+vy = geompy.MakeVectorDXDYDZ(0., 100., 0.)
+vz = geompy.MakeVectorDXDYDZ(0., 0., 100.)
# ---- ellipse du flanc
-he = hauteurFlanc -2*rayonConge
+he = hauteurFlanc - 2*rayonConge
re = 0.5*(largeurPlq - epaisseurFond) - rayonConge
sine = re/he
-cose = math.sqrt(1.-sine*sine)
-pe = geom.MakePointStruct(sine, 0., cose)
-ve = geom.MakeDirection(pe)
-cyl0 = geom.MakeCylinder(p0, ve, re, 2*he)
-axecy = geom.MakeAxisStruct(0., 0., 0.,sine, 0., cose)
-cyl1 = geom.MakeRotation(cyl0, axecy, 0.5)
-cyle = geom.MakeTranslation(cyl1,
- -marge*sine, 0., -marge*cose)
-boxe = geom.MakeBox(0., 0., 0., 3*he, -2*re, 3*he)
-#idcyle = geompy.addToStudy(cyle, "cyle")
-#idboxe = geompy.addToStudy(boxe, "boxe")
-cylcoup = geom.MakeBoolean(cyle, boxe, 2)
-#idcylcoup = geompy.addToStudy(cylcoup, "cylcoup")
+cose = math.sqrt(1. - sine*sine)
+
+ve = geompy.MakeVectorDXDYDZ(sine, 0., cose)
+cyl0 = geompy.MakeCylinder(p0, ve, re, 2*he)
+cyl1 = geompy.MakeRotation(cyl0, ve, 0.5)
+cyle = geompy.MakeTranslation(cyl1, -marge*sine, 0., -marge*cose)
+
+pbe = geompy.MakeVertex(3*he, -2*re, 3*he)
+boxe = geompy.MakeBoxTwoPnt(p0, pbe)
+
+cylcoup = geompy.MakeBoolean(cyle, boxe, 2)
+
aretes = []
-aretes = geom.SubShapeAllSorted(cylcoup, ShapeTypeEdge)
+aretes = geompy.SubShapeAllSorted(cylcoup, geompy.ShapeType["EDGE"])
-##eid=0
-##for edge in aretes:
-## edname="arete%d"%eid
-## idedge=geompy.addToStudy(edge,edname)
-## eid=eid+1
-
-shape = geom.MakeCopy(aretes[0])
-#idarete = geompy.addToStudy(shape, "arete")
-aShape = geom.MakeTranslation(shape,
- 0., rayonConge +re, epaisseurPlq +2*rayonConge)
+shape = geompy.MakeCopy(aretes[0])
+aShape = geompy.MakeTranslation(shape, 0., rayonConge + re, epaisseurPlq + 2*rayonConge)
# -----------------------------------------------------------------------------
# ---- cotes x
-x0 = 0.
+x0 = 0.
x0h = rayonConge
-x1 = rayonConge + epaisseurFlanc
-xc = longueurPlq/2
-x2 = longueurPlq - rayonConge - epaisseurFlanc
+x1 = rayonConge + epaisseurFlanc
+xc = longueurPlq/2
+x2 = longueurPlq - rayonConge - epaisseurFlanc
x3h = longueurPlq - rayonConge
-x3 = longueurPlq
+x3 = longueurPlq
# ---- cotes y
-y0 = 0.
+y0 = 0.
y0h = rayonConge
-y1 = largeurPlq - epaisseurFond
-y1m = y1 -marge
-y2 = largeurPlq
+y1 = largeurPlq - epaisseurFond
+y1m = y1 - marge
+y2 = largeurPlq
y2p = largeurPlq + marge
# ---- cotes z
-z0 = 0.
-z1m = epaisseurPlq -marge
-z1 = epaisseurPlq
-z2 = epaisseurPlq + rayonConge
-z3 = epaisseurPlq + 2*rayonConge
-z4 = epaisseurPlq + hauteurFlanc
+z0 = 0.
+z1m = epaisseurPlq - marge
+z1 = epaisseurPlq
+z2 = epaisseurPlq + rayonConge
+z3 = epaisseurPlq + 2*rayonConge
+z4 = epaisseurPlq + hauteurFlanc
z4p = epaisseurPlq + hauteurFlanc + marge
-zc = epaisseurPlq + posAxeTrou
-zc2 = epaisseurPlq + (posAxeTrou -rayonTrou)/3
-zc3 = epaisseurPlq + 2*(posAxeTrou -rayonTrou)/3
+zc = epaisseurPlq + posAxeTrou
+zc2 = epaisseurPlq + (posAxeTrou - rayonTrou)/3
+zc3 = epaisseurPlq + 2*(posAxeTrou - rayonTrou)/3
# ---- decoupe du fond
-p11 = geom.MakePointStruct(x1, y1m, z1)
-p12 = geom.MakePointStruct(x1, y1m, z2)
-p13 = geom.MakePointStruct(x1, y1m, z3)
-p14 = geom.MakePointStruct(x1, y1m, z4)
-pc1 = geom.MakePointStruct(xc, y1m, z1)
-pc2 = geom.MakePointStruct(xc, y1m, zc2)
-pc3 = geom.MakePointStruct(xc, y1m, zc3)
-pcc = geom.MakePointStruct(xc, y1m, zc)
-pc4 = geom.MakePointStruct(xc, y1m, z4)
-p21 = geom.MakePointStruct(x2, y1m, z1)
-p22 = geom.MakePointStruct(x2, y1m, z2)
-p23 = geom.MakePointStruct(x2, y1m, z3)
-p24 = geom.MakePointStruct(x2, y1m, z4)
-pcf = geom.MakePointStruct(xc, y2p, zc)
-
-arc2 = geom.MakeArc(p12,pc2,p22)
-arc3 = geom.MakeArc(p13,pc3,p23)
-
-segz1 = geom.MakeVector(p11,p21)
-#segz4 = geom.MakeVector(p14,p24)
-segz41 = geom.MakeVector(p14,pc4)
-segz42 = geom.MakeVector(pc4,p24)
-segx11 = geom.MakeVector(p11,p12)
-segx12 = geom.MakeVector(p12,p13)
-segx13 = geom.MakeVector(p13,p14)
-segxc2 = geom.MakeVector(pc1,pc2)
-segxc3 = geom.MakeVector(pc2,pc3)
-segxc4 = geom.MakeVector(pcc,pc4)
-segx21 = geom.MakeVector(p21,p22)
-segx22 = geom.MakeVector(p22,p23)
-segx23 = geom.MakeVector(p23,p24)
-segx1c1 = geom.MakeVector(p13,pcc)
-segx1c2 = geom.MakeVector(p14,pcc)
-segx2c1 = geom.MakeVector(p23,pcc)
-segx2c2 = geom.MakeVector(p24,pcc)
+p11 = geompy.MakeVertex(x1, y1m, z1)
+p12 = geompy.MakeVertex(x1, y1m, z2)
+p13 = geompy.MakeVertex(x1, y1m, z3)
+p14 = geompy.MakeVertex(x1, y1m, z4)
+pc1 = geompy.MakeVertex(xc, y1m, z1)
+pc2 = geompy.MakeVertex(xc, y1m, zc2)
+pc3 = geompy.MakeVertex(xc, y1m, zc3)
+pcc = geompy.MakeVertex(xc, y1m, zc)
+pc4 = geompy.MakeVertex(xc, y1m, z4)
+p21 = geompy.MakeVertex(x2, y1m, z1)
+p22 = geompy.MakeVertex(x2, y1m, z2)
+p23 = geompy.MakeVertex(x2, y1m, z3)
+p24 = geompy.MakeVertex(x2, y1m, z4)
+pcf = geompy.MakeVertex(xc, y2p, zc)
+
+arc2 = geompy.MakeArc(p12,pc2,p22)
+arc3 = geompy.MakeArc(p13,pc3,p23)
+
+segz1 = geompy.MakeVector(p11,p21)
+segz41 = geompy.MakeVector(p14,pc4)
+segz42 = geompy.MakeVector(pc4,p24)
+segx11 = geompy.MakeVector(p11,p12)
+segx12 = geompy.MakeVector(p12,p13)
+segx13 = geompy.MakeVector(p13,p14)
+segxc2 = geompy.MakeVector(pc1,pc2)
+segxc3 = geompy.MakeVector(pc2,pc3)
+segxc4 = geompy.MakeVector(pcc,pc4)
+segx21 = geompy.MakeVector(p21,p22)
+segx22 = geompy.MakeVector(p22,p23)
+segx23 = geompy.MakeVector(p23,p24)
+segx1c1 = geompy.MakeVector(p13,pcc)
+segx1c2 = geompy.MakeVector(p14,pcc)
+segx2c1 = geompy.MakeVector(p23,pcc)
+segx2c2 = geompy.MakeVector(p24,pcc)
facef = []
facef.append(MakeFace([segx13,segx1c2,segx1c1]))
facef.append(MakeFace([segx12,arc2,segx22,arc3]))
facef.append(MakeFace([segx11,segz1,segx21,arc2]))
-decf =[]
+vcccf = geompy.MakeVector(pcc, pcf)
+hcccf = y2p - y1m
+decf = []
for face in facef:
- decf.append(geom.MakePrism(face,pcc,pcf))
-
-axeCyl = geom.MakeAxisStruct( 0.5*longueurPlq,
- 0.,
- epaisseurPlq + posAxeTrou,
- 0.,
- largeurPlq,
- 0.)
-pAxe1 = geom.MakePointStruct(xc, 0., zc)
-cylFond = geom.MakeCylinder(pAxe1, vy, rayonTrou, 1.1*largeurPlq)
-cylFond2 = geom.MakeRotation(geom.MakeCopy(cylFond),axeCyl,math.pi)
-#idcylfond2 = geompy.addToStudy(cylFond2,"cylFond2")
-
-fondec =[]
+ decf.append(geompy.MakePrism(face,vcccf,hcccf))
+
+pc = geompy.MakeVertex(xc, 0., zc)
+py2 = geompy.MakeVertex(xc, y2, zc)
+axeCyl = geompy.MakeVector(pc, py2)
+
+cylFond = geompy.MakeCylinder(pc, vy, rayonTrou, 1.1*largeurPlq)
+cylFond2 = geompy.MakeRotation(cylFond, axeCyl, math.pi)
+
+fondec = []
for id in (0,1,2,3):
- fondec.append(geom.MakeBoolean(decf[id],cylFond2,2))
-fondec.append(geom.MakeBoolean(decf[4],cylFond,2))
+ fondec.append(geompy.MakeBoolean(decf[id], cylFond2, 2))
+fondec.append(geompy.MakeBoolean(decf[4], cylFond, 2))
for id in (5,6):
fondec.append(decf[id])
-bcut1=geom.MakeBox(x0,y0,z0, xc,y2p,z4p)
-bcut2=geom.MakeBox(xc,y0,z0, x3,y2p,z4p)
+p_xcy2pz4p = geompy.MakeVertex(xc,y2p,z4p)
+p_x3y2pz4p = geompy.MakeVertex(x3,y2p,z4p)
+pxc = geompy.MakeVertex(xc,y0,z0)
+bcut1 = geompy.MakeBoxTwoPnt(p0, p_xcy2pz4p)
+bcut2 = geompy.MakeBoxTwoPnt(pxc, p_x3y2pz4p)
+
fondec2 = []
for id in (0,1,2,3):
fondec2.append(fondec[id])
for id in (4,5,6):
- fondec2.append(geom.MakeBoolean(fondec[id],bcut1,1))
- fondec2.append(geom.MakeBoolean(fondec[id],bcut2,1))
-
-##iff=0
-##for ff in fondec2:
-## idfo = geompy.addToStudy(ff, "ff%d"%(iff))
-## iff = iff +1
+ fondec2.append(geompy.MakeBoolean(fondec[id], bcut1, 1))
+ fondec2.append(geompy.MakeBoolean(fondec[id], bcut2, 1))
# ----- autres blocs de decoupe
-bcong1=geom.MakeBox(x0,y0,z1, x1,y1,z2)
-bcong2=geom.MakeBox(x0,y1,z1, x1,y2,z2)
-bcong3=geom.MakeBox(x2,y0,z1, x3,y1,z2)
-bcong4=geom.MakeBox(x2,y1,z1, x3,y2,z2)
-
-pcylx0 = geom.MakePointStruct(0., -marge, z2)
-cylcongx0 = geom.MakeCylinder(pcylx0, vy, rayonConge, largeurPlq +2*marge)
-#idcylcongx0 = geompy.addToStudy(cylcongx0,"cylcongx0")
-pcylx3 = geom.MakePointStruct(longueurPlq, -marge, z2)
-cylcongx3 = geom.MakeCylinder(pcylx3, vy, rayonConge, largeurPlq +2*marge)
-#idcylcongx3 = geompy.addToStudy(cylcongx3,"cylcongx3")
-pcyly0 = geom.MakePointStruct(-marge, 0., z2)
-cylcongy0 = geom.MakeCylinder(pcyly0, vx, rayonConge, longueurPlq +2*marge)
-#idcylcongy0 = geompy.addToStudy(cylcongy0,"cylcongy0")
-
-bcong1=geom.MakeBoolean(bcong1,cylcongx0,2)
-bcong2=geom.MakeBoolean(bcong2,cylcongx0,2)
-bcong1=geom.MakeBoolean(bcong1,cylcongy0,2)
+bcong1 = geompy.MakeBox(x0,y0,z1, x1,y1,z2)
+bcong2 = geompy.MakeBox(x0,y1,z1, x1,y2,z2)
+bcong3 = geompy.MakeBox(x2,y0,z1, x3,y1,z2)
+bcong4 = geompy.MakeBox(x2,y1,z1, x3,y2,z2)
+
+pcylx0 = geompy.MakeVertex(0., -marge, z2)
+pcylx3 = geompy.MakeVertex(longueurPlq, -marge, z2)
+pcyly0 = geompy.MakeVertex(-marge, 0., z2)
+
+cylcongx0 = geompy.MakeCylinder(pcylx0, vy, rayonConge, largeurPlq + 2*marge)
+cylcongx3 = geompy.MakeCylinder(pcylx3, vy, rayonConge, largeurPlq + 2*marge)
+cylcongy0 = geompy.MakeCylinder(pcyly0, vx, rayonConge, longueurPlq + 2*marge)
+
+bcong1 = geompy.MakeBoolean(bcong1,cylcongx0,2)
+bcong2 = geompy.MakeBoolean(bcong2,cylcongx0,2)
+bcong1 = geompy.MakeBoolean(bcong1,cylcongy0,2)
#NRI : inverse order of BOP
-bcong3=geom.MakeBoolean(bcong3,cylcongy0,2)
-bcong3=geom.MakeBoolean(bcong3,cylcongx3,2)
-bcong4=geom.MakeBoolean(bcong4,cylcongx3,2)
-
-pf1 = geom.MakePointStruct(0., y0h, z3)
-pf2 = geom.MakePointStruct(0., y1, z3)
-pf3 = geom.MakePointStruct(0., y1, z4)
-pf4 = geom.MakePointStruct(0.,0.5*(largeurPlq - epaisseurFond) , z4)
-vf1 = geom.MakeEdge(pf1,pf2)
-vf2 = geom.MakeEdge(pf2,pf3)
-vf3 = geom.MakeEdge(pf3,pf4)
+bcong3 = geompy.MakeBoolean(bcong3,cylcongy0,2)
+bcong3 = geompy.MakeBoolean(bcong3,cylcongx3,2)
+bcong4 = geompy.MakeBoolean(bcong4,cylcongx3,2)
+
+pf1 = geompy.MakeVertex(0., y0h, z3)
+pf2 = geompy.MakeVertex(0., y1, z3)
+pf3 = geompy.MakeVertex(0., y1, z4)
+pf4 = geompy.MakeVertex(0., 0.5*(largeurPlq - epaisseurFond) , z4)
+
+vf1 = geompy.MakeEdge(pf1, pf2)
+vf2 = geompy.MakeEdge(pf2, pf3)
+vf3 = geompy.MakeEdge(pf3, pf4)
+
faceFlanc = MakeFace([vf1,vf2,vf3,aShape])
-#idfaceFlanc = geompy.addToStudy(faceFlanc,"faceFlanc")
-pfe = geom.MakePointStruct(epaisseurFlanc, 0., 0.)
-flanc1 = geom.MakePrism(faceFlanc, p0, pfe)
-flanc2 = geom.MakeCopy(flanc1)
-flanc1 = geom.MakeTranslation(flanc1,
- rayonConge,0.,0.)
-flanc2 = geom.MakeTranslation(flanc2,
- longueurPlq-rayonConge-epaisseurFlanc,0.,0.)
+
+flanc1 = geompy.MakePrism(faceFlanc, vx, epaisseurFlanc)
+flanc2 = geompy.MakeCopy(flanc1)
+flanc1 = geompy.MakeTranslation(flanc1, rayonConge, 0., 0.)
+flanc2 = geompy.MakeTranslation(flanc2, longueurPlq - rayonConge - epaisseurFlanc, 0., 0.)
# ---- constitution et decoupe des blocs
-boxfond2 = geom.MakeBox(x0, y1, z0, x3, y2, z4p)
-#idboxfond2 = geompy.addToStudy(boxfond2,"boxfond2")
+boxfond2 = geompy.MakeBox(x0, y1, z0, x3, y2, z4p)
blocs = []
for dec in fondec2:
- blocs.append(geom.MakeBoolean(boxfond2, dec, 1))
-blocs.append(geom.MakeBox(x0,y1,z0, x1,y2,z1))
-blocs.append(geom.MakeBox(x1,y1,z0, xc,y2,z1))
-blocs.append(geom.MakeBox(xc,y1,z0, x2,y2,z1))
-blocs.append(geom.MakeBox(x2,y1,z0, x3,y2,z1))
-blocs.append(geom.MakeBox(x0,y0,z0, x1,y1,z1))
-blocs.append(geom.MakeBox(x1,y0,z0, xc,y1,z1))
-blocs.append(geom.MakeBox(xc,y0,z0, x2,y1,z1))
-blocs.append(geom.MakeBox(x2,y0,z0, x3,y1,z1))
+ blocs.append(geompy.MakeBoolean(boxfond2, dec, 1))
+
+blocs.append(geompy.MakeBox(x0,y1,z0, x1,y2,z1))
+blocs.append(geompy.MakeBox(x1,y1,z0, xc,y2,z1))
+blocs.append(geompy.MakeBox(xc,y1,z0, x2,y2,z1))
+blocs.append(geompy.MakeBox(x2,y1,z0, x3,y2,z1))
+blocs.append(geompy.MakeBox(x0,y0,z0, x1,y1,z1))
+blocs.append(geompy.MakeBox(x1,y0,z0, xc,y1,z1))
+blocs.append(geompy.MakeBox(xc,y0,z0, x2,y1,z1))
+blocs.append(geompy.MakeBox(x2,y0,z0, x3,y1,z1))
blocs.append(bcong2)
blocs.append(bcong4)
blocs.append(bcong1)
blocs.append(bcong3)
-blocs.append(geom.MakeBox(x0h,y1, z2, x1, y2, z3))
-blocs.append(geom.MakeBox(x2, y1, z2, x3h,y2, z3))
-blocs.append(geom.MakeBox(x0h,y0h,z2, x1, y1, z3))
-blocs.append(geom.MakeBox(x2, y0h,z2, x3h,y1, z3))
-blocs.append(geom.MakeBox(x0h,y1, z3, x1, y2, z4))
-blocs.append(geom.MakeBox(x2, y1, z3, x3h,y2, z4))
+blocs.append(geompy.MakeBox(x0h,y1, z2, x1, y2, z3))
+blocs.append(geompy.MakeBox(x2, y1, z2, x3h,y2, z3))
+blocs.append(geompy.MakeBox(x0h,y0h,z2, x1, y1, z3))
+blocs.append(geompy.MakeBox(x2, y0h,z2, x3h,y1, z3))
+blocs.append(geompy.MakeBox(x0h,y1, z3, x1, y2, z4))
+blocs.append(geompy.MakeBox(x2, y1, z3, x3h,y2, z4))
blocs.append(flanc1)
blocs.append(flanc2)
-compbloc = MakeCompound(blocs)
-idcomp = geompy.addToStudy(compbloc,"compbloc")
+compbloc = geompy.MakeCompound(blocs)
+idcomp = geompy.addToStudy(compbloc, "compbloc")
# ---- eliminer les faces en double, solid-->shell
-compshell = geom.MakeGlueFaces(compbloc,tol3d)
-idcomp = geompy.addToStudy(compshell,"compshell")
-
+compshell = geompy.MakeGlueFaces(compbloc,tol3d)
+idcomp = geompy.addToStudy(compshell, "compshell")
geompy = SMESH_fixation.geompy
salome = SMESH_fixation.salome
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
print "Analysis of the geometry to be meshed :"
-subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
-print "number of Shells in compshell : ",len(subShellList)
-print "number of Faces in compshell : ",len(subFaceList)
-print "number of Edges in compshell : ",len(subEdgeList)
+print "number of Shells in compshell : ", len(subShellList)
+print "number of Faces in compshell : ", len(subFaceList)
+print "number of Edges in compshell : ", len(subEdgeList)
-status=geompy.CheckShape(compshell)
+status = geompy.CheckShape(compshell)
print " check status ", status
### ---------------------------- SMESH --------------------------------------
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
-### ---- create Hypothesis
-
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 5
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5")
-# ---- create Algorithms
-
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- Quadrangle_2D"
-quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
+quad2D = smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D")
print "-------------------------- Hexa_3D"
-hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
+hexa3D = smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D")
# ---- init a Mesh with the compshell
shape_mesh = salome.IDToObject( idcomp )
-mesh=smesh.CreateMesh(shape_mesh)
+mesh = smesh.CreateMesh(shape_mesh)
smeshgui.SetName(salome.ObjectToID(mesh), "MeshCompShell")
-# ---- add hypothesis to compshell
-
print "-------------------------- add hypothesis to compshell"
mesh.AddHypothesis(shape_mesh,regular1D)
salome.sg.updateObjBrowser(1)
print "-------------------------- compute compshell"
-ret=smesh.Compute(mesh, shape_mesh)
+ret = smesh.Compute(mesh, shape_mesh)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the MeshcompShel:"
geompy = SMESH_fixation.geompy
salome = SMESH_fixation.salome
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
print "Analysis of the geometry to be meshed :"
-subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
-print "number of Shells in compshell : ",len(subShellList)
-print "number of Faces in compshell : ",len(subFaceList)
-print "number of Edges in compshell : ",len(subEdgeList)
+print "number of Shells in compshell : ", len(subShellList)
+print "number of Faces in compshell : ", len(subFaceList)
+print "number of Edges in compshell : ", len(subEdgeList)
-status=geompy.CheckShape(compshell)
+status = geompy.CheckShape(compshell)
print " check status ", status
### ---------------------------- SMESH --------------------------------------
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
-### ---- create Hypothesis
-
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 5
-hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg.SetNumberOfSegments(numberOfSegments)
print hypNbSeg.GetName()
## print hypArea.GetId()
## print hypArea.GetMaxElementArea()
## smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_160")
-hypLengthFromEdges=smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
+
+hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(hypLengthFromEdges), "LengthFromEdges")
maxElementVolume = 1000
-hypVolume=smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
+hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_1000")
-# ---- create Algorithms
-
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
-netgen3D=smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
+netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
# ---- init a Mesh with the compshell
-mesh=smesh.CreateMesh(compshell)
+mesh = smesh.CreateMesh(compshell)
smeshgui.SetName(salome.ObjectToID(mesh), "MeshcompShel")
-# ---- add hypothesis to compshell
-
print "-------------------------- add hypothesis to compshell"
mesh.AddHypothesis(compshell,regular1D)
salome.sg.updateObjBrowser(1)
print "-------------------------- compute compshell"
-ret=smesh.Compute(mesh,compshell)
+ret = smesh.Compute(mesh,compshell)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the MeshcompShel:"
import os
import salome
import geompy
-
import StdMeshers
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
+smeshgui.Init(salome.myStudyId)
# ---------------------------- GEOM --------------------------------------
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
# import a BRep
#before running this script, please be sure about
#the path the file fileName
-filePath=os.environ["SMESH_ROOT_DIR"]
-filePath=filePath+"/share/salome/resources/"
+filePath = os.environ["SMESH_ROOT_DIR"]
+filePath = filePath + "/share/salome/resources/"
filename = "flight_solid.brep"
filename = filePath + filename
-shape = geompy.ImportBREP(filename)
-idShape = geompy.addToStudy(shape,"flight")
+shape = geompy.Import(filename, "BREP")
+idShape = geompy.addToStudy(shape, "flight")
print "Analysis of the geometry flight :"
-subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
-print "number of Shells in flight : ",len(subShellList)
-print "number of Faces in flight : ",len(subFaceList)
-print "number of Edges in flight : ",len(subEdgeList)
+print "number of Shells in flight : ", len(subShellList)
+print "number of Faces in flight : ", len(subFaceList)
+print "number of Edges in flight : ", len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
-# ---- create Hypothesis
-
print "-------------------------- create Hypothesis"
print "-------------------------- LocalLength"
lengthOfSegments = 0.3
-hypLength=smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
+hypLength = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
hypLength.SetLength(lengthOfSegments)
print hypLength.GetName()
-print hypLength.GetId()
+print hypLength.GetId()
print hypLength.GetLength()
smeshgui.SetName(salome.ObjectToID(hypLength), "LocalLength_0.3")
print "-------------------------- LengthFromEdges"
-hypLengthFromEdge=smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
+hypLengthFromEdge = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
print hypLengthFromEdge.GetName()
print hypLengthFromEdge.GetId()
smeshgui.SetName(salome.ObjectToID(hypLengthFromEdge), "LengthFromEdge")
-# ---- create Algorithms
-
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
-regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
-mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
# ---- init a Mesh with the shell
shape_mesh = salome.IDToObject( idShape )
-mesh=smesh.CreateMesh(shape_mesh)
+mesh = smesh.CreateMesh(shape_mesh)
smeshgui.SetName(salome.ObjectToID(mesh), "MeshFlight")
# ---- add hypothesis to flight
print "-------------------------- compute the skin flight"
-ret=smesh.Compute(mesh,shape_mesh)
+ret = smesh.Compute(mesh,shape_mesh)
print ret
if ret != 0:
- log=mesh.GetLog(0) # no erase trace
+ log = mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
print "Information about the Mesh_mechanic_tetra:"
import salome\r
-from geompy import gg\r
import geompy\r
import SMESH\r
-\r
import StdMeshers\r
\r
-ShapeTypeCompSolid = 1\r
-ShapeTypeSolid = 2\r
-ShapeTypeShell = 3\r
-ShapeTypeFace = 4\r
-ShapeTypeWire = 5\r
-ShapeTypeEdge = 6\r
-ShapeTypeVertex = 7\r
-\r
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")\r
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")\r
-\r
-geom.GetCurrentStudy(salome.myStudy._get_StudyId())\r
smesh.SetCurrentStudy(salome.myStudy)\r
\r
# Create box without one plane\r
\r
box = geompy.MakeBox(0., 0., 0., 10., 20., 30.)\r
-subShapeList = geompy.SubShapeAll(box,ShapeTypeFace)\r
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])\r
\r
FaceList = []\r
for i in range( 5 ):\r
- FaceList.append( subShapeList[ i ]._get_Name() )\r
+ FaceList.append( subShapeList[ i ] )\r
\r
-aBox = geompy.MakeSewing( FaceList, 1. )\r
+aComp = geompy.MakeCompound( FaceList )\r
+aBox = geompy.Sew( aComp, 1. )\r
idbox = geompy.addToStudy( aBox, "box" )\r
\r
aBox = salome.IDToObject( idbox )\r
# Module : SMESH
# $Header$
+#-------------------------------------------------------------------------
+
import salome
import geompy
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-
-geom.GetCurrentStudy(salome.myStudy._get_StudyId())
-smesh.SetCurrentStudy(salome.myStudy)
-
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
-
import StdMeshers
# ---------------------------- GEOM --------------------------------------
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
# ---- define contigous arcs and segment to define a closed wire
-p1 = geom.MakePointStruct( 100.0, 0.0, 0.0 )
-p2 = geom.MakePointStruct( 50.0, 50.0, 0.0 )
-p3 = geom.MakePointStruct( 100.0, 100.0, 0.0 )
-arc1 = geom.MakeArc( p1, p2, p3 )
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
-p4 = geom.MakePointStruct( 170.0, 100.0, 0.0 )
-seg1 = geom.MakeVector( p3, p4 )
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
-p5 = geom.MakePointStruct( 200.0, 70.0, 0.0 )
-p6 = geom.MakePointStruct( 170.0, 40.0, 0.0 )
-arc2 = geom.MakeArc( p4, p5, p6 )
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
-p7 = geom.MakePointStruct( 120.0, 30.0, 0.0 )
-arc3 = geom.MakeArc( p6, p7, p1 )
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
# ---- define a closed wire with arcs and segment
List1 = []
List1.append( arc2 )
List1.append( arc3 )
-ListIOR1 = []
-for S in List1 :
- ListIOR1.append( S._get_Name() )
-wire1 = geom.MakeWire( ListIOR1 )
-
-Id_wire1 = geompy.addToStudy( wire1, "wire1")
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
# ---- define a planar face with wire
WantPlanarFace = 1 #True
-face1 = geom.MakeFace( wire1, WantPlanarFace )
-Id_face1 = geompy.addToStudy( face1, "face1")
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
# ---- create a shape by extrusion
-pO = geom.MakePointStruct( 0.0, 0.0, 0.0 )
-pz = geom.MakePointStruct( 0.0, 0.0, 100.0 )
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
-prism1 = geom.MakePrism( face1, pO, pz )
-Id_prism1 = geompy.addToStudy( prism1, "prism1")
+prism1 = geompy.MakePrism( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1" )
# ---- create two cylinders
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
-pc1 = geom.MakePointStruct( 90.0, 50.0, -40.0 )
-pc2 = geom.MakePointStruct( 170.0, 70.0, -40.0 )
-vz = geom.MakeDirection( pz )
radius = 20.0
height = 180.0
-cyl1 = geom.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geom.MakeCylinder( pc2, vz, radius, height )
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
# ---- cut with cyl1
-shape = geom.MakeBoolean( prism1, cyl1, 2 )
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
-# ---- fuse with cyl2
-shape1 = geom.MakeBoolean( shape, cyl2, 3 )
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
-Id_shape1 = geompy.addToStudy( shape1, "shape1")
+# ---- explode on faces
+SubFaceL = geompy.SubShapeAllSorted(mechanic, geompy.ShapeType["FACE"])
-#faces = geompy.SubShapeAllSorted( shape1, ShapeTypeFace)
-#i = 0
-#for face in faces:
-# geompy.addToStudy(face,"face_" + str(i))
-# i = i+1
-
# ---- add a face sub shape in study to be meshed different
-IdSubFaceList = []
-IdSubFaceList.append(1)
-sub_face = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceList )
-name = geompy.SubShapeName( sub_face._get_Name(), shape1._get_Name() )
+sub_face1 = SubFaceL[0]
+name = geompy.SubShapeName( sub_face1, mechanic )
-Id_SubFace = geompy.addToStudyInFather( shape1, sub_face, name )
+Id_SubFace1 = geompy.addToStudyInFather( mechanic, sub_face1, name )
# ---- add a face sub shape in study to be meshed different
-IdSubFaceL = []
-IdSubFaceL.append(2)
-sub_face2 = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceL )
-name = geompy.SubShapeName( sub_face2._get_Name(), shape1._get_Name() )
+sub_face2 = SubFaceL[4]
+name = geompy.SubShapeName( sub_face2, mechanic )
-Id_SubFace2 = geompy.addToStudyInFather( shape1, sub_face2, name )
+Id_SubFace2 = geompy.addToStudyInFather( mechanic, sub_face2, name )
# ---- add a face sub shape in study to be meshed different
-IdSubFaceL = []
-IdSubFaceL.append(3)
-sub_face3 = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceL )
-name = geompy.SubShapeName( sub_face3._get_Name(), shape1._get_Name() )
+sub_face3 = SubFaceL[5]
+name = geompy.SubShapeName( sub_face3, mechanic )
-Id_SubFace3 = geompy.addToStudyInFather( shape1, sub_face3, name )
+Id_SubFace3 = geompy.addToStudyInFather( mechanic, sub_face3, name )
# ---- add a face sub shape in study to be meshed different
-IdSubFaceL = []
-IdSubFaceL.append(6)
-sub_face4 = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceL )
-name = geompy.SubShapeName( sub_face4._get_Name(), shape1._get_Name() )
-
-Id_SubFace4 = geompy.addToStudyInFather( shape1, sub_face4, name )
+sub_face4 = SubFaceL[10]
+name = geompy.SubShapeName( sub_face4, mechanic )
+Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
# ---------------------------- SMESH --------------------------------------
-# ------------------------------ Length Hypothesis
+# ---- launch SMESH, init a Mesh with shape 'mechanic'
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-print "-------------------------- create Hypothesis"
-print "-------------------------- LocalLength"
-hyp1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
-hyp1.SetLength( 100.0 )
-print hyp1.GetName()
-print hyp1.GetId()
-print hyp1.GetLength()
+# -- Init --
+shape_mesh = salome.IDToObject( Id_mechanic )
+smesh.SetCurrentStudy(salome.myStudy)
-idlength = salome.ObjectToID(hyp1)
-smeshgui.SetName(idlength, "Local_Length_100");
+mesh = smesh.CreateMesh(shape_mesh)
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+idmesh = salome.ObjectToID(mesh)
+smeshgui.SetName( idmesh, "Mesh_mechanic" )
print "-------------------------- NumberOfSegments"
-hyp2 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
-hyp2.SetNumberOfSegments( 10 )
-print hyp2.GetName()
-print hyp2.GetId()
-print hyp2.GetNumberOfSegments()
+numberOfSegment = 10
+
+hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
+hypNbSeg.SetNumberOfSegments( numberOfSegment )
+print hypNbSeg.GetName()
+print hypNbSeg.GetId()
+print hypNbSeg.GetNumberOfSegments()
-idseg = salome.ObjectToID(hyp2)
-smeshgui.SetName(idseg, "NumberOfSegments_12");
+smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10")
print "-------------------------- MaxElementArea"
-hyp3 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hyp3.SetMaxElementArea( 25 )
-print hyp3.GetName()
-print hyp3.GetId()
-print hyp3.GetMaxElementArea()
+maxElementArea = 25
+
+hypArea25 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
+hypArea25.SetMaxElementArea( maxElementArea )
+print hypArea25.GetName()
+print hypArea25.GetId()
+print hypArea25.GetMaxElementArea()
-idarea1 = salome.ObjectToID(hyp3)
-smeshgui.SetName(idarea1, "MaxElementArea_20");
+smeshgui.SetName(salome.ObjectToID(hypArea25), "MaxElementArea_25")
print "-------------------------- MaxElementArea"
-hyp4 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
-hyp4.SetMaxElementArea( 35 )
-print hyp4.GetName()
-print hyp4.GetId()
-print hyp4.GetMaxElementArea()
+maxElementArea = 35
-idarea2 = salome.ObjectToID(hyp4)
-smeshgui.SetName(idarea2, "MaxElementArea_30");
+hypArea35 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
+hypArea35.SetMaxElementArea( maxElementArea )
+print hypArea35.GetName()
+print hypArea35.GetId()
+print hypArea35.GetMaxElementArea()
+smeshgui.SetName(salome.ObjectToID(hypArea35), "MaxElementArea_35")
print "-------------------------- Regular_1D"
-alg1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-listHyp =alg1.GetCompatibleHypothesis()
+algoReg1D = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" )
+listHyp = algoReg1D.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
-print alg1.GetName()
-print alg1.GetId()
+print algoReg1D.GetName()
+print algoReg1D.GetId()
-idreg1d = salome.ObjectToID(alg1)
-smeshgui.SetName( idreg1d, "Regular_1D" );
+smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D")
print "-------------------------- MEFISTO_2D"
-alg2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
-listHyp = alg2.GetCompatibleHypothesis()
+algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" )
+listHyp = algoMef.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
-print alg2.GetName()
-print alg2.GetId()
+print algoMef.GetName()
+print algoMef.GetId()
-idmef = salome.ObjectToID(alg2)
-smeshgui.SetName( idmef, "MEFISTO_2D" );
+smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D")
print "-------------------------- SMESH_Quadrangle_2D"
-alg3 = smesh.CreateHypothesis( "Quadrangle_2D", "libStdMeshersEngine.so" )
-listHyp = alg3.GetCompatibleHypothesis()
+algoQuad = smesh.CreateHypothesis( "Quadrangle_2D", "libStdMeshersEngine.so" )
+listHyp = algoQuad.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
-print alg3.GetName()
-print alg3.GetId()
+print algoQuad.GetName()
+print algoQuad.GetId()
-idqad2 = salome.ObjectToID(alg3)
-smeshgui.SetName( idqad2, "SMESH_Quadrangle_2D" );
+smeshgui.SetName(salome.ObjectToID(algoQuad), "SMESH_Quadrangle_2D")
+print "-------------------------- add hypothesis to main shape"
-print "-------------------------- add hypothesis to main shape1"
+mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments
+mesh.AddHypothesis( shape_mesh, hypArea25 ) # max area
-shape_mesh = salome.IDToObject( Id_shape1 )
+mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation
+mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D
-mesh = smesh.CreateMesh(shape_mesh)
-
-idmesh = salome.ObjectToID(mesh)
-smeshgui.SetName( idmesh, "Mesh_mechanic" );
+print "-------------------------- add hypothesis and algorithm to sub face 1"
-mesh.AddHypothesis( shape_mesh, alg1 ) # Regular 1D/wire discretisation
-mesh.AddHypothesis( shape_mesh, alg2 ) # MEFISTO 2D
+submesh = mesh.GetSubMesh(sub_face1, "SubMeshFace1")
-ret = mesh.AddHypothesis( shape_mesh, hyp2 ) # nb segments
-ret = mesh.AddHypothesis( shape_mesh, hyp3 ) # max area
+mesh.AddHypothesis( sub_face1, algoQuad ) # Quadrangle 2D
+mesh.AddHypothesis( sub_face1, hypArea35 ) # max area
-print "--------Add hypothesis and algorith to sub face"
+print "-------------------------- add hypothesis and algorithm to sub face 2"
-#sub_face = salome.IDToObject( Id_SubFace )
-submesh = mesh.GetSubMesh(sub_face, "SubMeshFace")
+submesh = mesh.GetSubMesh(sub_face2, "SubMeshFace2")
-mesh.AddHypothesis( sub_face, alg3 ) # Quadrangle 2D
-mesh.AddHypothesis( sub_face, hyp4 ) # max area
+mesh.AddHypothesis( sub_face2, algoQuad ) # Quadrangle 2D
+mesh.AddHypothesis( sub_face2, hypArea35 ) # max area
-print "--------Add hypothesis and algorith to sub face 2"
+print "-------------------------- add hypothesis and algorith to sub face 3"
-#sub_face2 = salome.IDToObject( Id_SubFace2 )
-submesh = mesh.GetSubMesh(sub_face2, "SubMeshFace2")
+submesh = mesh.GetSubMesh(sub_face3, "SubMeshFace3")
-mesh.AddHypothesis( sub_face2, alg3 ) # Quadrangle 2D
-ret = mesh.AddHypothesis( sub_face2, hyp4 ) # max area
+mesh.AddHypothesis( sub_face3, algoQuad ) # Quadrangle 2D
+mesh.AddHypothesis( sub_face3, hypArea35 ) # max area
-print "--------Add hypothesis and algorith to sub face 3"
+print "-------------------------- add hypothesis and algorith to sub face 4"
-#sub_face3 = salome.IDToObject( Id_SubFace3 )
-submesh = mesh.GetSubMesh(sub_face3, "SubMeshFace3")
+submesh = mesh.GetSubMesh(sub_face4, "SubMeshFace4")
-mesh.AddHypothesis( sub_face3, alg3 ) # Quadrangle 2D
-ret = mesh.AddHypothesis( sub_face3, hyp4 ) # max area
+mesh.AddHypothesis( sub_face4, algoQuad ) # Quadrangle 2D
+mesh.AddHypothesis( sub_face4, hypArea35 ) # max area
-print "--------Add hypothesis and algorith to sub face 4"
+print "-------------------------- compute the mesh of the mechanic piece"
-#sub_face4 = salome.IDToObject( Id_SubFace4 )
-submesh = mesh.GetSubMesh(sub_face4, "SubMeshFace4")
-
-mesh.AddHypothesis( sub_face4, alg3 ) # Quadrangle 2D
-ret = mesh.AddHypothesis( sub_face4, hyp4 ) # max area
-
-smesh.Compute(mesh,shape_mesh)
+smesh.Compute(mesh, shape_mesh)
print "Information about the Mesh_mechanic:"
-print "Number of nodes : ", mesh.NbNodes()
-print "Number of edges : ", mesh.NbEdges()
-print "Number of faces : ", mesh.NbFaces()
-print "Number of triangles : ", mesh.NbTriangles()
-print "Number of quadrangles: ", mesh.NbQuadrangles()
-
-salome.sg.updateObjBrowser(1);
+print "Number of nodes : ", mesh.NbNodes()
+print "Number of edges : ", mesh.NbEdges()
+print "Number of faces : ", mesh.NbFaces()
+print "Number of triangles : ", mesh.NbTriangles()
+print "Number of quadrangles : ", mesh.NbQuadrangles()
+print "Number of volumes : ", mesh.NbVolumes()
+print "Number of tetrahedrons: ", mesh.NbTetras()
+
+salome.sg.updateObjBrowser(1)
import salome
import geompy
-import StdMeshers
-import NETGENPlugin
-
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
+geom = geompy.geom
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smesh.SetCurrentStudy(salome.myStudy)
smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
+smeshgui.Init(salome.myStudyId)
+
+import StdMeshers
+import NETGENPlugin
# ---------------------------- GEOM --------------------------------------
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
# ---- define contigous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
-p1 = geom.MakePointStruct( 100.0, 0.0, 0.0 )
-p2 = geom.MakePointStruct( 50.0, 50.0, 0.0 )
-p3 = geom.MakePointStruct( 100.0, 100.0, 0.0 )
-arc1 = geom.MakeArc( p1, p2, p3 )
-
-p4 = geom.MakePointStruct( 170.0, 100.0, 0.0 )
-seg1 = geom.MakeVector( p3, p4 )
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
-p5 = geom.MakePointStruct( 200.0, 70.0, 0.0 )
-p6 = geom.MakePointStruct( 170.0, 40.0, 0.0 )
-arc2 = geom.MakeArc( p4, p5, p6 )
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
-p7 = geom.MakePointStruct( 120.0, 30.0, 0.0 )
-arc3 = geom.MakeArc( p6, p7, p1 )
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
# ---- define a closed wire with arcs and segment
-
List1 = []
List1.append( arc1 )
List1.append( seg1 )
List1.append( arc2 )
List1.append( arc3 )
-ListIOR1 = []
-for S in List1 :
- ListIOR1.append( S._get_Name() )
-wire1 = geom.MakeWire( ListIOR1 )
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
# ---- define a planar face with wire
-
WantPlanarFace = 1 #True
-face1 = geom.MakeFace( wire1, WantPlanarFace )
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
-pO = geom.MakePointStruct( 0.0, 0.0, 0.0 )
-pz = geom.MakePointStruct( 0.0, 0.0, 100.0 )
-
-prism1 = geom.MakePrism( face1, pO, pz )
+prism1 = geompy.MakePrism( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1")
# ---- create two cylinders
-pc1 = geom.MakePointStruct( 90.0, 50.0, -40.0 )
-pc2 = geom.MakePointStruct( 170.0, 70.0, -40.0 )
-vz = geom.MakeDirection( pz )
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
radius = 20.0
height = 180.0
-cyl1 = geom.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geom.MakeCylinder( pc2, vz, radius, height )
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
-# ---- cut with cyl1
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
-shape = geom.MakeBoolean( prism1, cyl1, 2 )
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
# ---- fuse with cyl2 to obtain the final mechanic piece :)
-
-mechanic = geom.MakeBoolean( shape, cyl2, 3 )
-
-idMechanic = geompy.addToStudy( mechanic, "mechanic")
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
# ---- Analysis of the geometry
print "Analysis of the geometry mechanic :"
-subShellList=geompy.SubShapeAll(mechanic,ShapeTypeShell)
-subFaceList=geompy.SubShapeAll(mechanic,ShapeTypeFace)
-subEdgeList=geompy.SubShapeAll(mechanic,ShapeTypeEdge)
+subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
print "number of Shells in mechanic : ",len(subShellList)
print "number of Faces in mechanic : ",len(subFaceList)
numberOfSegment = 10
hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
-hypNbSeg.SetNumberOfSegments(numberOfSegment)
+hypNbSeg.SetNumberOfSegments( numberOfSegment )
print hypNbSeg.GetName()
print hypNbSeg.GetId()
print hypNbSeg.GetNumberOfSegments()
maxElementArea = 20
hypArea = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hypArea.SetMaxElementArea(maxElementArea)
+hypArea.SetMaxElementArea( maxElementArea )
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
maxElementVolume = 20
hypVolume = smesh.CreateHypothesis( "MaxElementVolume", "libStdMeshersEngine.so" )
-hypVolume.SetMaxElementVolume(maxElementVolume)
+hypVolume.SetMaxElementVolume( maxElementVolume )
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
print algoReg1D.GetName()
print algoReg1D.GetId()
-smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D" )
+smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D")
print "-------------------------- MEFISTO_2D"
print algoMef.GetName()
print algoMef.GetId()
-smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D" )
+smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
print algoNg.GetName()
print algoNg.GetId()
-smeshgui.SetName(salome.ObjectToID(algoNg), "NETGEN_3D" )
+smeshgui.SetName(salome.ObjectToID(algoNg), "NETGEN_3D")
print "-------------------------- add hypothesis to main mechanic"
-shape_mesh = salome.IDToObject( idMechanic )
+shape_mesh = salome.IDToObject( Id_mechanic )
mesh = smesh.CreateMesh(shape_mesh)
-smeshgui.SetName(salome.ObjectToID(mesh), "Mesh_mechanic_tetra" );
-mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation
-mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D
-mesh.AddHypothesis( shape_mesh, algoNg ) # NETGEN 3D
+idmesh = salome.ObjectToID(mesh)
+smeshgui.SetName( idmesh, "Mesh_mechanic_tetra" )
mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments
mesh.AddHypothesis( shape_mesh, hypArea ) # max area
-mesh.AddHypothesis( shape_mesh, hypVolume ) # max volume
+mesh.AddHypothesis( shape_mesh, hypVolume ) # max volume
+
+mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation
+mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D
+mesh.AddHypothesis( shape_mesh, algoNg ) # NETGEN 3D
print "-------------------------- compute the mesh of the mechanic piece"
smesh.Compute(mesh,shape_mesh)
print "Information about the Mesh_mechanic_tetra:"
-print "Number of nodes : ", mesh.NbNodes()
-print "Number of edges : ", mesh.NbEdges()
-print "Number of faces : ", mesh.NbFaces()
-print "Number of triangles : ", mesh.NbTriangles()
-print "Number of volumes: ", mesh.NbVolumes()
+print "Number of nodes : ", mesh.NbNodes()
+print "Number of edges : ", mesh.NbEdges()
+print "Number of faces : ", mesh.NbFaces()
+print "Number of triangles : ", mesh.NbTriangles()
+print "Number of quadrangles: ", mesh.NbQuadrangles()
+print "Number of volumes : ", mesh.NbVolumes()
print "Number of tetrahedrons: ", mesh.NbTetras()
-salome.sg.updateObjBrowser(1);
-
+salome.sg.updateObjBrowser(1)
# File : SMESH_test0.py
# Module : SMESH
-import SMESH
-import smeshpy
import salome
-from salome import sg
-import math
-#import SMESH_BasicHypothesis_idl
-
import geompy
-
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
+from geompy import geom
from geompy import gg
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
+import SMESH
+
+myBuilder = salome.myStudy.NewBuilder()
# ---- define a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
+idbox = geompy.addToStudy(box, "box")
# ---- add first face of box in study
-subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
-face=subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
print name
-idface=geompy.addToStudyInFather(box,face,name)
+idface = geompy.addToStudyInFather(box, face, name)
# ---- add shell from box in study
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
shell = subShellList[0]
-name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(shell, box)
print name
-idshell=geompy.addToStudyInFather(box,shell,name)
+idshell = geompy.addToStudyInFather(box, shell, name)
# ---- add first edge of face in study
-edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
-edge=edgeList[0];
-name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0]
+name = geompy.SubShapeName(edge, face)
print name
-idedge=geompy.addToStudyInFather(face,edge,name)
+idedge = geompy.addToStudyInFather(face, edge, name)
-sg.updateObjBrowser(1);
+salome.sg.updateObjBrowser(1)
import StdMeshers
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-
-geom.GetCurrentStudy(salome.myStudy._get_StudyId())
smesh.SetCurrentStudy(salome.myStudy)
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
# ---- define a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
+idbox = geompy.addToStudy(box, "box")
# ---- add first face of box in study
-subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
-face=subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
print name
-idface=geompy.addToStudyInFather(box,face,name)
+idface = geompy.addToStudyInFather(box, face, name)
# ---- add shell from box in study
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
shell = subShellList[0]
-name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
+name = geompy.SubShapeName(shell, box)
print name
-idshell=geompy.addToStudyInFather(box,shell,name)
+idshell = geompy.addToStudyInFather(box, shell, name)
# ---- add first edge of face in study
-edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
-edge=edgeList[0];
-name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0]
+name = geompy.SubShapeName(edge, face)
print name
-idedge=geompy.addToStudyInFather(face,edge,name)
+idedge = geompy.addToStudyInFather(face, edge, name)
# ---- launch SMESH
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
-# ---- create Hypothesis
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
print "-------------------------- create Hypothesis"
-print "-------------------------- LocalLength"
+print "-------------------------- LocalLength"
hypLen1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
hypLen1.SetLength(100)
print hypLen1.GetName()
print "-------------------------- Regular_1D"
algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-listHyp=algoReg.GetCompatibleHypothesis()
+listHyp = algoReg.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
print algoReg.GetName()
print "-------------------------- MEFISTO_2D"
algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
-listHyp=algoMef.GetCompatibleHypothesis()
+listHyp = algoMef.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
print algoMef.GetName()
# ---- Init a Mesh with the box
-box=salome.IDToObject(idbox)
-mesh=smesh.CreateMesh(box)
-
+box = salome.IDToObject(idbox)
+mesh = smesh.CreateMesh(box)
idmesh = salome.ObjectToID(mesh)
smeshgui.SetName(idmesh, "Meshbox");
-# ---- add hypothesis to box
print "-------------------------- add hypothesis to box"
mesh.AddHypothesis(box,algoReg)
mesh.AddHypothesis(box,hypNbSeg1)
# ---- add hypothesis to edge
print "-------------------------- add hypothesis to edge"
-edge=salome.IDToObject(idedge)
+edge = salome.IDToObject(idedge)
submesh = mesh.GetSubMesh(edge, "SubMeshEdge")
-mesh.AddHypothesis(edge , algoReg)
+mesh.AddHypothesis(edge, algoReg)
mesh.AddHypothesis(edge, hypLen1)
print "-------------------------- add hypothesis to face"
face = salome.IDToObject(idface)
-submesh =mesh.GetSubMesh(face, "SubMeshFace")
-mesh.AddHypothesis(face,hypArea2)
+submesh = mesh.GetSubMesh(face, "SubMeshFace")
+mesh.AddHypothesis(face, hypArea2)
salome.sg.updateObjBrowser(1);
# ---- compute box
print "-------------------------- compute box"
-ret=smesh.Compute(mesh,box)
+ret = smesh.Compute(mesh,box)
print ret
-log=mesh.GetLog(0); # no erase trace
+log = mesh.GetLog(0); # no erase trace
for linelog in log:
print linelog
-
salome.sg.updateObjBrowser(1);
# ---- compute edge
# File : SMESH_test3.py
# Module : SMESH
-import smeshpy
-import salome
-from salome import sg
+#import salome
import math
-#import SMESH_BasicHypothesis_idl
-
import geompy
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
-from geompy import gg
+pi = math.pi
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
+# ---------------------------------------------
+xa = math.sin(pi/12)
+ya = 0
+za = math.cos(pi/12)
-pi=math.pi
+xb = 0
+yb = math.sin(pi/18)
+zb = math.cos(pi/18)
-# ---------------------------------------------
-xa=math.sin(pi/12)
-ya=0
-za=math.cos(pi/12)
-
-xb=0
-yb=math.sin(pi/18)
-zb=math.cos(pi/18)
-
-xc=math.cos(-pi/18)
-yc=0
-zc=math.sin(-pi/18)
-
-rc1=150
-hc1=300
-rc2=150
-rc3=150
-rc4=300
-# ---------------------------------------------
-point_0 = geom.MakePointStruct(0, 0, 0)
-point_z = geom.MakePointStruct(0, 0, 1)
+xc = math.cos(-pi/18)
+yc = 0
+zc = math.sin(-pi/18)
+
+rc1 = 150
+rc2 = 150
+rc3 = 150
+rc4 = 300
-point_a = geom.MakePointStruct(xa, ya, za)
-point_b = geom.MakePointStruct(xb, yb, zb)
-point_c = geom.MakePointStruct(xc, yc, zc)
+hc1 = 300
+hc2 = 2*hc1
+hc3 = 2*hc1
+hc4 = 2*hc1
-dir_z = geom.MakeDirection(point_z)
-axe_z = geom.MakeAxisStruct(0, 0, 0, 0, 0, 1)
+# ---------------------------------------------
+point_0 = geompy.MakeVertex(0, 0, 0)
+point_z = geompy.MakeVertex(0, 0, 1)
-dir_a = geom.MakeDirection(point_a)
-axe_a = geom.MakeAxisStruct(0, 0, 0, xa, ya, za)
+point_a = geompy.MakeVertex(xa, ya, za)
+point_b = geompy.MakeVertex(xb, yb, zb)
+point_c = geompy.MakeVertex(xc, yc, zc)
-dir_b = geom.MakeDirection(point_b)
-axe_b = geom.MakeAxisStruct(0, 0, 0, xb, yb, zb)
+dir_z = geompy.MakeVector(point_0, point_z)
+dir_a = geompy.MakeVector(point_0, point_a)
+dir_b = geompy.MakeVector(point_0, point_b)
+dir_c = geompy.MakeVector(point_0, point_c)
-dir_c = geom.MakeDirection(point_c)
-axe_c = geom.MakeAxisStruct(0, 0, 0, xc, yc, zc)
+axe_z = dir_z
+axe_a = dir_a
+axe_b = dir_b
+axe_c = dir_c
cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1)
-hc2=2*hc1
cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2)
cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1)
-hc3=2*hc1
cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3)
cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1)
-hc4=2*hc1
cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4)
cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2)
cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0)
import salome
-from geompy import gg
import geompy
import SMESH
-
import StdMeshers
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-
-geom.GetCurrentStudy(salome.myStudy._get_StudyId())
smesh.SetCurrentStudy(salome.myStudy)
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
+idbox = geompy.addToStudy(box, "box")
-subShapeList = geompy.SubShapeAll(box,ShapeTypeFace)
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
face = subShapeList[0]
-name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
-idface = geompy.addToStudyInFather(box,face,name)
+name = geompy.SubShapeName(face, box)
+idface = geompy.addToStudyInFather(box, face, name)
box = salome.IDToObject(idbox)
face = salome.IDToObject(idface)
--- /dev/null
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : SMESH_test1.py
+# Module : SMESH
+
+import salome
+import SMESH
+import SALOMEDS
+import CORBA
+import os
+import os.path
+
+def SetSObjName(theSObj,theName) :
+ ok, anAttr = theSObj.FindAttribute("AttributeName")
+ if ok:
+ aName = anAttr._narrow(SALOMEDS.AttributeName)
+ #print aName.__dict__
+ aName.SetValue(theName)
+
+def ConvertMED2UNV(thePath,theFile) :
+ anInitFileName = thePath + theFile
+ aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
+ print aResult, aMeshes
+
+ for iMesh in range(len(aMeshes)) :
+ aMesh = aMeshes[iMesh]
+ anSObj = salome.ObjectToSObject(aMesh)
+ print anSObj.GetName(),
+ aFileName = anInitFileName
+ aFileName = os.path.basename(aFileName)
+ SetSObjName(anSObj,aFileName)
+ print anSObj.GetName()
+
+ aFileName = thePath + theFile + "." + str(iMesh) + ".unv"
+ aMesh.ExportUNV(aFileName)
+ aMesh = smesh.CreateMeshesFromUNV(aFileName)
+ anSObj = salome.ObjectToSObject(aMesh)
+ print anSObj.GetName(),
+ os.remove(aFileName)
+ aFileName = os.path.basename(aFileName)
+ SetSObjName(anSObj,aFileName)
+ print anSObj.GetName()
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smesh.SetCurrentStudy(salome.myStudy)
+
+aPath = os.getenv('KERNEL_ROOT_DIR') + '/examples/'
+aListDir = os.listdir(aPath)
+print aListDir
+
+for iFile in range(len(aListDir)) :
+ aFileName = aListDir[iFile]
+ aName,anExt = os.path.splitext(aFileName)
+ if anExt == ".med" :
+ aFileName = os.path.basename(aFileName)
+ print aFileName
+ ConvertMED2UNV(aPath,aFileName)
+ #break
+
+salome.sg.updateObjBrowser(1)
import batchmode_salome
import batchmode_geompy
import batchmode_smesh
+import StdMeshers
-geom = batchmode_geompy.geom
smesh = batchmode_smesh.smesh
-
-geom.GetCurrentStudy(batchmode_salome.myStudyId)
smesh.SetCurrentStudy(batchmode_salome.myStudy)
-ShapeType = batchmode_smesh.ShapeType
-
-import StdMeshers
-
def CreateMesh (theFileName, area, len = None, nbseg = None):
if not(os.path.isfile(theFileName)) or re.search("\.brep$", theFileName) is None :
# ---- Import shape from BREP file and add it to the study
- shape_mesh = geom.ImportBREP(theFileName)
- Id_shape = batchmode_geompy.addToStudy( shape_mesh, "shape_mesh")
-
+ shape_mesh = batchmode_geompy.Import(theFileName, "BREP")
+ Id_shape = batchmode_geompy.addToStudy(shape_mesh, "shape_mesh")
# ---- SMESH
- # ---- create Hypothesis
-
print "-------------------------- create Hypothesis"
if (len is not None):
print "-------------------------- LocalLength"
hypLength1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
hypLength1.SetLength(len)
- print "Hypothesis type: ", hypLength1.GetName()
- print "Hypothesis ID: ", hypLength1.GetId()
+ print "Hypothesis type : ", hypLength1.GetName()
+ print "Hypothesis ID : ", hypLength1.GetId()
print "Hypothesis Value: ", hypLength1.GetLength()
if (nbseg is not None):
print "-------------------------- NumberOfSegments"
hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
hypNbSeg1.SetNumberOfSegments(nbseg)
- print "Hypothesis type: ", hypNbSeg1.GetName()
- print "Hypothesis ID: ", hypNbSeg1.GetId()
+ print "Hypothesis type : ", hypNbSeg1.GetName()
+ print "Hypothesis ID : ", hypNbSeg1.GetId()
print "Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments()
-
if (area == "LengthFromEdges"):
print "-------------------------- LengthFromEdges"
hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
hypLengthFromEdges.SetMode(1)
- print "Hypothesis type: ", hypLengthFromEdges.GetName()
- print "Hypothesis ID: ", hypLengthFromEdges.GetId()
+ print "Hypothesis type : ", hypLengthFromEdges.GetName()
+ print "Hypothesis ID : ", hypLengthFromEdges.GetId()
print "LengthFromEdges Mode: ", hypLengthFromEdges.GetMode()
else:
print "-------------------------- MaxElementArea"
hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
hypArea1.SetMaxElementArea(area)
- print "Hypothesis type: ", hypArea1.GetName()
- print "Hypothesis ID: ", hypArea1.GetId()
+ print "Hypothesis type : ", hypArea1.GetName()
+ print "Hypothesis ID : ", hypArea1.GetId()
print "Hypothesis Value: ", hypArea1.GetMaxElementArea()
-
print "-------------------------- Regular_1D"
print hyp
print "Algo name: ", algoReg.GetName()
- print "Algo ID: ", algoReg.GetId()
+ print "Algo ID : ", algoReg.GetId()
print "-------------------------- MEFISTO_2D"
algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
- listHyp=algoMef.GetCompatibleHypothesis()
+ listHyp = algoMef.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
print "Algo name: ", algoMef.GetName()
- print "Algo ID: ", algoMef.GetId()
-
+ print "Algo ID : ", algoMef.GetId()
# ---- add hypothesis to shape
print ret
if (nbseg is not None):
- ret=mesh.AddHypothesis(shape_mesh, hypNbSeg1)
+ ret = mesh.AddHypothesis(shape_mesh, hypNbSeg1)
print "Add Number Of Segements algo .... ",
print ret
if (len is not None):
- ret=mesh.AddHypothesis(shape_mesh,hypLength1)
+ ret = mesh.AddHypothesis(shape_mesh,hypLength1)
print "Add Local Length algo .... ",
print ret
- ret=mesh.AddHypothesis(shape_mesh, algoMef)
+ ret = mesh.AddHypothesis(shape_mesh, algoMef)
print "Add MEFISTO_2D algo....",
print ret
print "Add Length From Edges algo .... ",
print ret
else:
- ret=mesh.AddHypothesis(shape_mesh, hypArea1)
+ ret = mesh.AddHypothesis(shape_mesh, hypArea1)
print "Add Max Triangle Area algo .... ",
print ret
- # ---- compute mesh
-
print "-------------------------- compute mesh"
- ret=smesh.Compute(mesh,shape_mesh)
+ ret = smesh.Compute(mesh,shape_mesh)
print "Compute Mesh .... ",
print ret
- log=mesh.GetLog(0); # no erase trace
+ log = mesh.GetLog(0); # no erase trace
#for linelog in log:
# print linelog
print "------------ INFORMATION ABOUT MESH ------------"
- print "Number of nodes: ", mesh.NbNodes()
- print "Number of edges: ", mesh.NbEdges()
- print "Number of faces: ", mesh.NbFaces()
+ print "Number of nodes : ", mesh.NbNodes()
+ print "Number of edges : ", mesh.NbEdges()
+ print "Number of faces : ", mesh.NbFaces()
print "Number of triangles: ", mesh.NbTriangles()
return mesh
# $Header$
from batchmode_salome import *
+from batchmode_geompy import ShapeType
import SMESH
#--------------------------------------------------------------------------
if myStudyBuilder is None:
raise RuntimeError, " Null myStudyBuilder"
-father = myStudy.FindComponent("MESH")
+father = myStudy.FindComponent("SMESH")
if father is None:
- father = myStudyBuilder.NewComponent("MESH")
- FName = myStudyBuilder.FindOrCreateAttribute(father, "AttributeName");
- Comp = modulecatalog.GetComponent( "SMESH" )
- FName.SetValue( Comp._get_componentusername() )
- aPixmap = myStudyBuilder.FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap.SetPixMap( "ICON_OBJBROWSER_Mesh" );
+ father = myStudyBuilder.NewComponent("SMESH")
+ FName = myStudyBuilder.FindOrCreateAttribute(father, "AttributeName")
+ Comp = modulecatalog.GetComponent("SMESH")
+ FName.SetValue(Comp._get_componentusername())
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(father, "AttributePixMap")
+ aPixmap.SetPixMap("ICON_OBJBROWSER_Mesh")
myStudyBuilder.DefineComponentInstance(father,smesh)
mySComponentMesh = father._narrow(SALOMEDS.SComponent)
-Tag_HypothesisRoot = 1;
-Tag_AlgorithmsRoot = 2;
+Tag_HypothesisRoot = 1
+Tag_AlgorithmsRoot = 2
-Tag_RefOnShape = 1;
-Tag_RefOnAppliedHypothesis = 2;
-Tag_RefOnAppliedAlgorithms = 3;
+Tag_RefOnShape = 1
+Tag_RefOnAppliedHypothesis = 2
+Tag_RefOnAppliedAlgorithms = 3
-Tag_SubMeshOnVertex = 4;
-Tag_SubMeshOnEdge = 5;
-Tag_SubMeshOnFace = 6;
-Tag_SubMeshOnSolid = 7;
-Tag_SubMeshOnCompound = 8;
+Tag_SubMeshOnVertex = 4
+Tag_SubMeshOnEdge = 5
+Tag_SubMeshOnFace = 6
+Tag_SubMeshOnSolid = 7
+Tag_SubMeshOnCompound = 8
Tag = {"HypothesisRoot":1,"AlgorithmsRoot":2,"RefOnShape":1,"RefOnAppliedHypothesis":2,"RefOnAppliedAlgorithms":3,"SubMeshOnVertex":4,"SubMeshOnEdge":5,"SubMeshOnFace":6,"SubMeshOnSolid":7,"SubMeshOnCompound":8}
-# -- enumeration --
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
-# -- enumeration ShapeType as a dictionary --
-ShapeType = {"CompSolid":1, "Solid":2, "Shell":3, "Face":4, "Wire":5, "Edge":6, "Vertex":7}
-
#------------------------------------------------------------
def Init():
pass
aPixmap = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap")
aPixmap.SetPixMap( "mesh_tree_hypo.png" )
aSelAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable")
- aSelAttr.SetSelectable(0);
+ aSelAttr.SetSelectable(0)
res, AlgorithmsRoot = mySComponentMesh.FindSubObject (Tag_AlgorithmsRoot)
if AlgorithmsRoot is None or res == 0:
AlgorithmsRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot)
aName = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName")
- aName.SetValue("Algorithms");
- aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap");
- aPixmap.SetPixMap( "mesh_tree_algo.png" );
- aSelAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable");
- aSelAttr.SetSelectable(0);
+ aName.SetValue("Algorithms")
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_algo.png" )
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
HypothesisRoot = HypothesisRoot._narrow(SALOMEDS.SObject)
newMesh = myStudyBuilder.NewObject(mySComponentMesh)
res, HypothesisRoot = mySComponentMesh.FindSubObject (Tag_HypothesisRoot)
if HypothesisRoot is None or res == 0:
HypothesisRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot)
- aName = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName");
- aName.SetValue("Hypotheses");
- aSelAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable");
- aSelAttr.SetSelectable(0);
- aPixmap = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap");
- aPixmap.SetPixMap( "mesh_tree_hypo.png" );
+ aName = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName")
+ aName.SetValue("Hypotheses")
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_hypo.png" )
# Add New Hypothesis
newHypo = myStudyBuilder.NewObject(HypothesisRoot)
aPixmap = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap")
H = orb.string_to_object(IOR)
- aType = H.GetName();
- aPixmap.SetPixMap( "mesh_tree_hypo.png_" + aType );
- anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR");
- anIOR.SetValue(IOR);
- return newHypo.GetID();
+ aType = H.GetName()
+ aPixmap.SetPixMap( "mesh_tree_hypo.png_" + aType )
+ anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR")
+ anIOR.SetValue(IOR)
+ return newHypo.GetID()
#------------------------------------------------------------
def AddNewAlgorithms(IOR):
if AlgorithmsRoot is None or res == 0:
AlgorithmsRoot = myStudyBuilde.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot)
aName = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName")
- aName.SetValue("Algorithms");
+ aName.SetValue("Algorithms")
aSelAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable")
- aSelAttr.SetSelectable(0);
- aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap");
- aPixmap.SetPixMap( "mesh_tree_algo.png" );
+ aSelAttr.SetSelectable(0)
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_algo.png" )
# Add New Algorithms
newHypo = myStudyBuilder.NewObject(AlgorithmsRoot)
- aPixmap = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap");
- aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap);
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap")
+ aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap)
H = orb.string_to_object(IOR)
aType = H.GetName(); #QString in fact
- aPixmap.SetPixMap( "mesh_tree_algo.png_" + aType );
- anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR");
- anIOR.SetValue(IOR);
- return newHypo.GetID();
+ aPixmap.SetPixMap( "mesh_tree_algo.png_" + aType )
+ anIOR = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR")
+ anIOR.SetValue(IOR)
+ return newHypo.GetID()
#------------------------------------------------------------
def SetShape(ShapeEntry, MeshEntry):
SO_MorSM = myStudy.FindObjectID( MeshEntry )
- SO_GeomShape = myStudy.FindObjectID( ShapeEntry );
+ SO_GeomShape = myStudy.FindObjectID( ShapeEntry )
if SO_MorSM is not None and SO_GeomShape is not None :
# VSR: added temporarily - shape reference is published automatically by the engine
- res, Ref = SO_MorSM.FindSubObject( Tag_RefOnShape );
+ res, Ref = SO_MorSM.FindSubObject( Tag_RefOnShape )
if res == 1 :
- return;
+ return
# VSR ######################################################################
- SO = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnShape);
- myStudyBuilder.Addreference (SO,SO_GeomShape);
-
+ SO = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnShape)
+ myStudyBuilder.Addreference (SO,SO_GeomShape)
+
#------------------------------------------------------------
def SetHypothesis(Mesh_Or_SubMesh_Entry, Hypothesis_Entry):
- SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry );
- SO_Hypothesis = myStudy.FindObjectID( Hypothesis_Entry );
+ SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry )
+ SO_Hypothesis = myStudy.FindObjectID( Hypothesis_Entry )
if SO_MorSM is not None and SO_Hypothesis is not None :
#Find or Create Applied Hypothesis root
res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedHypothesis)
if AHR is None or res == 0:
- AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis);
- aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName");
+ AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis)
+ aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName")
# The same name as in SMESH_Mesh_i::AddHypothesis() ##################
- aName.SetValue("Applied hypotheses");
+ aName.SetValue("Applied hypotheses")
- aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable");
- aSelAttr.SetSelectable(0);
- aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap");
- aPixmap.SetPixMap( "mesh_tree_hypo.png" );
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_hypo.png" )
# VSR: added temporarily - reference to applied hypothesis is published automatically by the engine
else :
- it = myStudy.NewChildIterator(AHR);
+ it = myStudy.NewChildIterator(AHR)
while it.More() :
- res, Ref = it.Value().ReferencedObject();
+ res, Ref = it.Value().ReferencedObject()
if res and Ref is not None and Ref.GetID() == Hypothesis_Entry :
- return;
- it.Next();
+ return
+ it.Next()
# VSR ######################################################################
- SO = myStudyBuilder.NewObject(AHR);
- myStudyBuilder.Addreference (SO,SO_Hypothesis);
+ SO = myStudyBuilder.NewObject(AHR)
+ myStudyBuilder.Addreference (SO,SO_Hypothesis)
#------------------------------------------------------------
def SetAlgorithms(Mesh_Or_SubMesh_Entry, Algorithms_Entry):
SO_Algorithms = myStudy.FindObjectID( Algorithms_Entry )
if SO_MorSM != None and SO_Algorithms != None :
#Find or Create Applied Algorithms root
- res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedAlgorithms);
+ res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedAlgorithms)
if AHR is None or res == 0:
- AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms);
- aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName");
+ AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms)
+ aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName")
# The same name as in SMESH_Mesh_i::AddHypothesis() ##################
- aName.SetValue("Applied algorithms");
+ aName.SetValue("Applied algorithms")
- aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable");
- aSelAttr.SetSelectable(0);
- aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap");
- aPixmap.SetPixMap( "mesh_tree_algo.png" );
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_algo.png" )
# VSR: added temporarily - reference to applied hypothesis is published automatically by the engine
else :
- it = myStudy.NewChildIterator(AHR);
+ it = myStudy.NewChildIterator(AHR)
while it.More() :
- res, Ref = it.Value().ReferencedObject();
+ res, Ref = it.Value().ReferencedObject()
if res and Ref is not None and Ref.GetID() == Algorithms_Entry :
- return;
- it.Next();
+ return
+ it.Next()
# VSR ######################################################################
- SO = myStudyBuilder.NewObject(AHR);
- myStudyBuilder.Addreference (SO,SO_Algorithms);
+ SO = myStudyBuilder.NewObject(AHR)
+ myStudyBuilder.Addreference (SO,SO_Algorithms)
#------------------------------------------------------------
def UnSetHypothesis( Applied_Hypothesis_Entry ):
- SO_Applied_Hypothesis = myStudy.FindObjectID( Applied_Hypothesis_Entry );
+ SO_Applied_Hypothesis = myStudy.FindObjectID( Applied_Hypothesis_Entry )
if SO_Applied_Hypothesis :
- myStudyBuilder.RemoveObject(SO_Applied_Hypothesis);
+ myStudyBuilder.RemoveObject(SO_Applied_Hypothesis)
#------------------------------------------------------------
SO_Mesh = myStudy.FindObjectID( SO_Mesh_Entry )
if ( SO_Mesh ) :
- if ST == ShapeTypeCompSolid :
- Tag_Shape = Tag_SubMeshOnSolid;
- Name = "SubMeshes on Solid";
- elif ST == ShapeTypeFace :
- Tag_Shape = Tag_SubMeshOnFace;
- Name = "SubMeshes on Face";
- elif ST == ShapeTypeEdge :
- Tag_Shape = Tag_SubMeshOnEdge;
- Name = "SubMeshes on Edge";
- elif ST == ShapeTypeVertex :
- Tag_Shape = Tag_SubMeshOnVertex;
- Name = "SubMeshes on Vertex";
+ if ST == ShapeType["COMPSOLID"] :
+ Tag_Shape = Tag_SubMeshOnSolid
+ Name = "SubMeshes on Solid"
+ elif ST == ShapeType["FACE"] :
+ Tag_Shape = Tag_SubMeshOnFace
+ Name = "SubMeshes on Face"
+ elif ST == ShapeType["EDGE"] :
+ Tag_Shape = Tag_SubMeshOnEdge
+ Name = "SubMeshes on Edge"
+ elif ST == ShapeType["VERTEX"] :
+ Tag_Shape = Tag_SubMeshOnVertex
+ Name = "SubMeshes on Vertex"
else :
- Tag_Shape = Tag_SubMeshOnCompound;
- Name = "SubMeshes on Compound";
+ Tag_Shape = Tag_SubMeshOnCompound
+ Name = "SubMeshes on Compound"
res, SubmeshesRoot = SO_Mesh.FindSubObject (Tag_Shape)
if SubmeshesRoot is None or res == 0:
- SubmeshesRoot = myStudyBuilder.NewObjectToTag (SO_Mesh, Tag_Shape);
- aName = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeName");
- aName.SetValue(Name);
- aSelAttr = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable");
- aSelAttr.SetSelectable(0);
+ SubmeshesRoot = myStudyBuilder.NewObjectToTag (SO_Mesh, Tag_Shape)
+ aName = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeName")
+ aName.SetValue(Name)
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
- SO = myStudyBuilder.NewObject (SubmeshesRoot);
- anIOR = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeIOR");
- anIOR.SetValue(SM_IOR);
- return SO.GetID();
-
- return None;
+ SO = myStudyBuilder.NewObject (SubmeshesRoot)
+ anIOR = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeIOR")
+ anIOR.SetValue(SM_IOR)
+ return SO.GetID()
+
+ return None
#------------------------------------------------------------
def AddSubMeshOnShape (Mesh_Entry, GeomShape_Entry, SM_IOR, ST) :
if aSO is not None:
return aSO.GetID()
# VSR ######################################################################
- SO_GeomShape = myStudy.FindObjectID( GeomShape_Entry );
+ SO_GeomShape = myStudy.FindObjectID( GeomShape_Entry )
if SO_GeomShape != None :
- SM_Entry = AddSubMesh (Mesh_Entry,SM_IOR,ST);
- SO_SM = myStudy.FindObjectID( SM_Entry );
+ SM_Entry = AddSubMesh (Mesh_Entry,SM_IOR,ST)
+ SO_SM = myStudy.FindObjectID( SM_Entry )
if SO_SM != None :
- SetShape (GeomShape_Entry, SM_Entry);
- return SM_Entry;
-
- return None;
+ SetShape (GeomShape_Entry, SM_Entry)
+ return SM_Entry
+
+ return None
#------------------------------------------------------------
def SetName(Entry, Name):
- SO = myStudy.FindObjectID( Entry );
+ SO = myStudy.FindObjectID( Entry )
if SO != None :
- aName = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeName");
- aName.SetValue(Name);
-
-
+ aName = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeName")
+ aName.SetValue(Name)
# header files
EXPORT_HEADERS = \
- StdMeshers_LengthFromEdges.hxx \
StdMeshers_LocalLength.hxx \
+ StdMeshers_StartEndLength.hxx \
+ StdMeshers_Arithmetic1D.hxx \
StdMeshers_NumberOfSegments.hxx \
+ StdMeshers_Deflection1D.hxx \
+ StdMeshers_Propagation.hxx \
+ StdMeshers_LengthFromEdges.hxx \
StdMeshers_MaxElementArea.hxx \
StdMeshers_MaxElementVolume.hxx \
StdMeshers_NotConformAllowed.hxx \
LIB = libStdMeshers.la
LIB_SRC = \
- StdMeshers_LengthFromEdges.cxx \
StdMeshers_LocalLength.cxx \
+ StdMeshers_StartEndLength.cxx \
+ StdMeshers_Arithmetic1D.cxx \
+ StdMeshers_NumberOfSegments.cxx \
+ StdMeshers_Deflection1D.cxx \
+ StdMeshers_Propagation.cxx \
+ StdMeshers_LengthFromEdges.cxx \
StdMeshers_MaxElementArea.cxx \
StdMeshers_MaxElementVolume.cxx \
- StdMeshers_NumberOfSegments.cxx \
StdMeshers_NotConformAllowed.cxx \
StdMeshers_Regular_1D.cxx \
StdMeshers_Quadrangle_2D.cxx \
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Arithmetic1D.cxx
+// Author : Damien COQUERET, OCC
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_Arithmetic1D.hxx"
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_Arithmetic1D::StdMeshers_Arithmetic1D(int hypId, int studyId,
+ SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
+{
+ _begLength = 1.;
+ _endLength = 1.;
+ _name = "Arithmetic1D";
+ _param_algo_dim = 1;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_Arithmetic1D::~StdMeshers_Arithmetic1D()
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_Arithmetic1D::SetLength(double length, bool isStartLength)
+ throw(SALOME_Exception)
+{
+ if ( (isStartLength ? _begLength : _endLength) != length ) {
+ if (length <= 0)
+ throw SALOME_Exception(LOCALIZED("length must be positive"));
+ if ( isStartLength )
+ _begLength = length;
+ else
+ _endLength = length;
+
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+double StdMeshers_Arithmetic1D::GetLength(bool isStartLength) const
+{
+ return isStartLength ? _begLength : _endLength;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save)
+{
+ save << _begLength << _endLength;
+ return save;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & StdMeshers_Arithmetic1D::LoadFrom(istream & load)
+{
+ bool isOK = true;
+ isOK = (load >> _begLength);
+ if (!isOK)
+ load.clear(ios::badbit | load.rdstate());
+ isOK = (load >> _endLength);
+ if (!isOK)
+ load.clear(ios::badbit | load.rdstate());
+ return load;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_Arithmetic1D & hyp)
+{
+ return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_Arithmetic1D & hyp)
+{
+ return hyp.LoadFrom( load );
+}
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Arithmetic1D.hxx
+// Author : Damien COQUERET, OCC
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_ARITHMETIC1D_HXX_
+#define _SMESH_ARITHMETIC1D_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_Arithmetic1D:
+ public SMESH_Hypothesis
+{
+public:
+ StdMeshers_Arithmetic1D(int hypId, int studyId, SMESH_Gen* gen);
+ virtual ~StdMeshers_Arithmetic1D();
+
+ void SetLength(double length, bool isStartLength) throw(SALOME_Exception);
+
+ double GetLength(bool isStartLength) const;
+
+ virtual ostream & SaveTo(ostream & save);
+ virtual istream & LoadFrom(istream & load);
+ friend ostream& operator << (ostream & save, StdMeshers_Arithmetic1D & hyp);
+ friend istream& operator >> (istream & load, StdMeshers_Arithmetic1D & hyp);
+
+protected:
+ double _begLength, _endLength;
+};
+
+#endif
--- /dev/null
+// SMESH StdMeshers_Deflection1D : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Deflection1D.cxx
+// Module : SMESH
+// $Header$
+
+using namespace std;
+
+#include "StdMeshers_Deflection1D.hxx"
+#include "utilities.h"
+
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_Deflection1D::StdMeshers_Deflection1D(int hypId,
+ int studyId,
+ SMESH_Gen * gen)
+ :SMESH_Hypothesis(hypId, studyId, gen)
+{
+ _value = 1.;
+ _name = "Deflection1D";
+ _param_algo_dim = 1; // is used by SMESH_Regular_1D
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_Deflection1D::~StdMeshers_Deflection1D()
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_Deflection1D::SetDeflection(double value)
+ throw(SALOME_Exception)
+{
+ if (_value != value) {
+ if (value <= 0.)
+ throw SALOME_Exception(LOCALIZED("Value must be positive"));
+
+ NotifySubMeshesHypothesisModification();
+
+ _value = value;
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+double StdMeshers_Deflection1D::GetDeflection() const
+{
+ return _value;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & StdMeshers_Deflection1D::SaveTo(ostream & save)
+{
+ save << _value;
+ return save;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & StdMeshers_Deflection1D::LoadFrom(istream & load)
+{
+ bool isOK = (load >> _value);
+ if (!isOK)
+ load.clear(ios::badbit | load.rdstate());
+ return load;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_Deflection1D & hyp)
+{
+ return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_Deflection1D & hyp)
+{
+ return hyp.LoadFrom( load );
+}
--- /dev/null
+// SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Deflection1D.hxx
+// Module : SMESH
+// $Header$
+
+#ifndef _StdMeshers_Deflection1D_HXX_
+#define _StdMeshers_Deflection1D_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_Deflection1D:public SMESH_Hypothesis
+{
+ public:
+ StdMeshers_Deflection1D(int hypId, int studyId, SMESH_Gen * gen);
+ virtual ~ StdMeshers_Deflection1D();
+
+ void SetDeflection(double value) throw(SALOME_Exception);
+
+ double GetDeflection() const;
+
+ virtual ostream & SaveTo(ostream & save);
+ virtual istream & LoadFrom(istream & load);
+ friend ostream & operator <<(ostream & save, StdMeshers_Deflection1D & hyp);
+ friend istream & operator >>(istream & load, StdMeshers_Deflection1D & hyp);
+
+ protected:
+ double _value;
+};
+
+#endif
#include <Geom2d_Curve.hxx>
#include <Handle_Geom2d_Curve.hxx>
#include <Handle_Geom_Curve.hxx>
+#include <gp_Pnt2d.hxx>
#include "utilities.h"
#include "Utils_ExceptHandlers.hxx"
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
- MESSAGE("StdMeshers_Hexa_3D::CheckHypothesis");
+ //MESSAGE("StdMeshers_Hexa_3D::CheckHypothesis");
bool isOk = true;
aStatus = SMESH_Hypothesis::HYP_OK;
return isOk;
}
+//=======================================================================
+//function : findIJ
+//purpose : return i,j of the node
+//=======================================================================
+
+static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int& I, int& J)
+{
+ I = J = 0;
+ const SMDS_FacePosition* fpos =
+ static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+ if ( ! fpos ) return false;
+ gp_Pnt2d uv( fpos->GetUParameter(), fpos->GetVParameter() );
+
+ double minDist = DBL_MAX;
+ int nbhoriz = Min(quad->nbPts[0], quad->nbPts[2]);
+ int nbvertic = Min(quad->nbPts[1], quad->nbPts[3]);
+ for (int i = 1; i < nbhoriz - 1; i++) {
+ for (int j = 1; j < nbvertic - 1; j++) {
+ int ij = j * nbhoriz + i;
+ gp_Pnt2d uv2( quad->uv_grid[ij].u, quad->uv_grid[ij].v );
+ double dist = uv.SquareDistance( uv2 );
+ if ( dist < minDist ) {
+ minDist = dist;
+ I = i;
+ J = j;
+ }
+ }
+ }
+ return true;
+}
+
//=============================================================================
/*!
* Hexahedron mesh on hexaedron like form
// 0. - shape and face mesh verification
// 0.1 - shape must be a solid (or a shell) with 6 faces
- MESSAGE("---");
+ //MESSAGE("---");
vector < SMESH_subMesh * >meshFaces;
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next())
if (meshFaces.size() != 6)
{
SCRUTE(meshFaces.size());
- ASSERT(0);
+// ASSERT(0);
return false;
}
// 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges)
- MESSAGE("---");
+ //MESSAGE("---");
for (int i = 0; i < 6; i++)
{
{
// *** delete _quads
SCRUTE(algoName);
- ASSERT(0);
+// ASSERT(0);
return false;
}
StdMeshers_Quadrangle_2D *quadAlgo =
{
// *** delete _quads
// *** throw exception
- ASSERT(0);
+// ASSERT(0);
+ return false;
}
+
+ // 0.2.1 - number of points on the opposite edges must be the same
+ if (_quads[i]->nbPts[0] != _quads[i]->nbPts[2] ||
+ _quads[i]->nbPts[1] != _quads[i]->nbPts[3])
+ {
+ MESSAGE("different number of points on the opposite edges of face " << i);
+// ASSERT(0);
+ return false;
+ }
}
// 1. - identify faces and vertices of the "cube"
// 1.1 - ancestor maps vertex->edges in the cube
- MESSAGE("---");
+ //MESSAGE("---");
TopTools_IndexedDataMapOfShapeListOfShape MS;
TopExp::MapShapesAndAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, MS);
// 1.2 - first face is choosen as face Y=0 of the unit cube
- MESSAGE("---");
+ //MESSAGE("---");
const TopoDS_Shape & aFace = meshFaces[0]->GetSubShape();
const TopoDS_Face & F = TopoDS::Face(aFace);
// 1.3 - identify the 4 vertices of the face Y=0: V000, V100, V101, V001
- MESSAGE("---");
+ //MESSAGE("---");
int i = 0;
TopoDS_Edge E = _quads[0]->edge[i]; //edge will be Y=0,Z=0 on unit cube
// - find edge X=1, Z=0 (ancestor of V100 not in face Y=0)
// - find edge X=1, Z=1 (ancestor of V101 not in face Y=0)
// - find edge X=0, Z=1 (ancestor of V001 not in face Y=0)
- MESSAGE("---");
+ //MESSAGE("---");
TopoDS_Edge E_0Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V000, MS);
ASSERT(!E_0Y0.IsNull());
ASSERT(!E_0Y1.IsNull());
// 1.5 - identify the 4 vertices in face Y=1: V010, V110, V111, V011
- MESSAGE("---");
+ //MESSAGE("---");
TopExp::Vertices(E_0Y0, VFirst, VLast);
if (VFirst.IsSame(_cube.V000))
_cube.V011 = VFirst;
// 1.6 - find remaining faces given 4 vertices
- MESSAGE("---");
+ //MESSAGE("---");
_indY0 = 0;
_cube.quad_Y0 = _quads[_indY0];
_cube.V100, _cube.V101, _cube.V110, _cube.V111);
_cube.quad_X1 = _quads[_indX1];
- MESSAGE("---");
+ //MESSAGE("---");
// 1.7 - get convertion coefs from face 2D normalized to 3D normalized
// 1.8 - create a 3D structure for normalized values
- MESSAGE("---");
- int nbx = _cube.quad_Y0->nbPts[0];
- int nby = _cube.quad_Y0->nbPts[1];
- int nbz;
- if (cx0.a1 != 0)
- nbz = _cube.quad_X0->nbPts[1];
- else
- nbz = _cube.quad_X0->nbPts[0];
+ //MESSAGE("---");
+ int nbx = _cube.quad_Z0->nbPts[0];
+ if (cz0.a1 == 0.) nbx = _cube.quad_Z0->nbPts[1];
+
+ int nby = _cube.quad_X0->nbPts[0];
+ if (cx0.a1 == 0.) nby = _cube.quad_X0->nbPts[1];
+
+ int nbz = _cube.quad_Y0->nbPts[0];
+ if (cy0.a1 != 0.) nbz = _cube.quad_Y0->nbPts[1];
+// int nbx = _cube.quad_Y0->nbPts[0];
+// int nby = _cube.quad_Y0->nbPts[1];
+// int nbz;
+// if (cx0.a1 != 0)
+// nbz = _cube.quad_X0->nbPts[1];
+// else
+// nbz = _cube.quad_X0->nbPts[0];
//SCRUTE(nbx);
//SCRUTE(nby);
//SCRUTE(nbz);
- int nbxyz = nbx * nby * nbz;
+ int i1, j1, nbxyz = nbx * nby * nbz;
Point3DStruct *np = new Point3DStruct[nbxyz];
// 1.9 - store node indexes of faces
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition* fpos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition* fpos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition * fpos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition* fpos =
- static_cast<const SMDS_FacePosition *>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition * fpos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
while(itf->more())
{
const SMDS_MeshNode * node = itf->next();
- const SMDS_FacePosition* fpos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
- double ri = fpos->GetUParameter();
- double rj = fpos->GetVParameter();
- int i1 = int (ri);
- int j1 = int (rj);
+ findIJ( node, quad, i1, j1 );
int ij1 = j1 * nbdown + i1;
quad->uv_grid[ij1].node = node;
}
}
- MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
+ //MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
return true;
}
const TopoDS_Vertex & V1,
const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
{
- MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
+ //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
int faceIndex = -1;
for (int i = 1; i < 6; i++)
{
}
}
ASSERT(faceIndex > 0);
- SCRUTE(faceIndex);
+ //SCRUTE(faceIndex);
return faceIndex;
}
const TopoDS_Vertex & aVertex,
const TopTools_IndexedDataMapOfShapeListOfShape & MS)
{
- MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
+ //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
TopTools_IndexedDataMapOfShapeListOfShape MF;
TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
- SCRUTE(ancestorsInSolid.Extent());
- SCRUTE(ancestorsInFace.Extent());
+// SCRUTE(ancestorsInSolid.Extent());
+// SCRUTE(ancestorsInFace.Extent());
ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees)
ASSERT(ancestorsInFace.Extent() == 2);
const TopoDS_Vertex & V1,
const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
{
- MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
+// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
const TopoDS_Face & F = TopoDS::Face(aShape);
TopoDS_Edge E = quad.edge[0];
double f, l;
b2 = -1;
c2 = 1; // 1-y
}
- MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
- MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
+// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
+// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
conv.a1 = a1;
conv.b1 = b1;
conv.c1 = c1;
conv.jb = int (b2);
conv.jc =
int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
- MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
- MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
+// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
+// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
}
//=============================================================================
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
#include <string>
-#include <algorithm>
+//#include <algorithm>
//=============================================================================
/*!
isOk = false;
if (_maxElementArea > 0)
{
- _edgeLength = 2 * sqrt(_maxElementArea); // triangles : minorant
+// _edgeLength = 2 * sqrt(_maxElementArea); // triangles : minorant
+ _edgeLength = 2 * sqrt(_maxElementArea/sqrt(3.0));
isOk = true;
}
else
Z nutysu = 1; // 1: il existe un fonction areteideale_()
// Z nutysu=0; // 0: on utilise aretmx
R aretmx = _edgeLength; // longueur max aretes future triangulation
- //SCRUTE(aretmx);
nblf = NumberOfWires(F);
- //SCRUTE(nblf);
nudslf = new Z[1 + nblf];
nudslf[0] = 0;
int iw = 1;
int nbpnt = 0;
- const TopoDS_Wire OW1 = BRepTools::OuterWire(F);
- nbpnt += NumberOfPoints(aMesh, OW1);
+ myOuterWire = BRepTools::OuterWire(F);
+ nbpnt += NumberOfPoints(aMesh, myOuterWire);
+ if ( nbpnt < 3 ) // ex: a circle with 2 segments
+ return false;
nudslf[iw++] = nbpnt;
- //SCRUTE(nbpnt);
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
- if (!OW1.IsSame(W))
+ if (!myOuterWire.IsSame(W))
{
nbpnt += NumberOfPoints(aMesh, W);
nudslf[iw++] = nbpnt;
- //SCRUTE(nbpnt);
}
}
+ // avoid passing same uv points for a vertex common to 2 wires
+ TopTools_IndexedDataMapOfShapeListOfShape VWMap;
+ if ( iw - 1 > 1 ) // nbofWires > 1
+ TopExp::MapShapesAndAncestors( F , TopAbs_VERTEX, TopAbs_WIRE, VWMap );
+
uvslf = new R2[nudslf[nblf]];
- //SCRUTE(nudslf[nblf]);
int m = 0;
- map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
- TopoDS_Wire OW = BRepTools::OuterWire(F);
- LoadPoints(aMesh, F, OW, uvslf, m, mefistoToDS);
- //SCRUTE(m);
+ double scalex, scaley;
+ ComputeScaleOnFace(aMesh, F, scalex, scaley);
+
+ map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
+ if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
+ mefistoToDS, scalex, scaley, VWMap))
+ return false;
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
- if (!OW.IsSame(W))
+ if (!myOuterWire.IsSame(W))
{
- LoadPoints(aMesh, F, W, uvslf, m, mefistoToDS);
- //SCRUTE(m);
+ if (! LoadPoints(aMesh, F, W, uvslf, m,
+ mefistoToDS, scalex, scaley, VWMap ))
+ return false;
}
}
-// SCRUTE(nudslf[nblf]);
-// for (int i=0; i<=nblf; i++)
-// {
-// MESSAGE(" -+- " <<i<< " "<< nudslf[i]);
-// }
-// for (int i=0; i<nudslf[nblf]; i++)
-// {
-// MESSAGE(" -+- " <<i<< " "<< uvslf[i]);
-// }
-// SCRUTE(nutysu);
-// SCRUTE(aretmx);
-// SCRUTE(nblf);
-
- MESSAGE("MEFISTO triangulation ...");
+
uvst = NULL;
nust = NULL;
aptrte(nutysu, aretmx,
{
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
MESSAGE(" Node Number " << nbst);
- //SCRUTE(nbst);
- //SCRUTE(nbt);
StoreResult(aMesh, nbst, uvst, nbt, nust, F,
- faceIsForward, mefistoToDS);
+ faceIsForward, mefistoToDS, scalex, scaley);
isOk = true;
}
else
return isOk;
}
+//=======================================================================
+//function : fixOverlappedLinkUV
+//purpose : prevent failure due to overlapped adjacent links
+//=======================================================================
+
+static bool fixOverlappedLinkUV( R2& uv0, const R2& uv1, const R2& uv2 )
+{
+ gp_XY v1( uv0.x - uv1.x, uv0.y - uv1.y );
+ gp_XY v2( uv2.x - uv1.x, uv2.y - uv1.y );
+
+ double tol2 = DBL_MIN * DBL_MIN;
+ double sqMod1 = v1.SquareModulus();
+ if ( sqMod1 <= tol2 ) return false;
+ double sqMod2 = v2.SquareModulus();
+ if ( sqMod2 <= tol2 ) return false;
+
+ double dot = v1*v2;
+
+ // check sinus >= 1.e-3
+ const double minSin = 1.e-3;
+ if ( dot > 0 && 1 - dot * dot / ( sqMod1 * sqMod2 ) < minSin * minSin ) {
+ MESSAGE(" ___ FIX UV ____" << uv0.x << " " << uv0.y);
+ v1.SetCoord( -v1.Y(), v1.X() );
+ double delta = sqrt( sqMod1 ) * minSin;
+ if ( v1.X() < 0 )
+ uv0.x -= delta;
+ else
+ uv0.x += delta;
+ if ( v1.Y() < 0 )
+ uv0.y -= delta;
+ else
+ uv0.y += delta;
+// MESSAGE(" -> " << uv0.x << " " << uv0.y << " ");
+// MESSAGE("v1( " << v1.X() << " " << v1.Y() << " ) " <<
+// "v2( " << v2.X() << " " << v2.Y() << " ) ");
+// MESSAGE("SIN: " << sqrt(1 - dot * dot / (sqMod1 * sqMod2)));
+// v1.SetCoord( uv0.x - uv1.x, uv0.y - uv1.y );
+// v2.SetCoord( uv2.x - uv1.x, uv2.y - uv1.y );
+// gp_XY v3( uv2.x - uv0.x, uv2.y - uv0.y );
+// sqMod1 = v1.SquareModulus();
+// sqMod2 = v2.SquareModulus();
+// dot = v1*v2;
+// double sin = sqrt(1 - dot * dot / (sqMod1 * sqMod2));
+// MESSAGE("NEW SIN: " << sin);
+ return true;
+ }
+ return false;
+}
+
+//=======================================================================
+//function : fixCommonVertexUV
+//purpose :
+//=======================================================================
+
+static bool fixCommonVertexUV (gp_Pnt2d & theUV,
+ const TopoDS_Vertex& theV,
+ const TopoDS_Wire& theW,
+ const TopoDS_Wire& theOW,
+ const TopoDS_Face& theF,
+ const TopTools_IndexedDataMapOfShapeListOfShape & theVWMap,
+ SMESH_Mesh & theMesh)
+{
+ if( theW.IsSame( theOW ) ||
+ !theVWMap.Contains( theV )) return false;
+
+ // check if there is another wire sharing theV
+ const TopTools_ListOfShape& WList = theVWMap.FindFromKey( theV );
+ TopTools_ListIteratorOfListOfShape aWIt;
+ for ( aWIt.Initialize( WList ); aWIt.More(); aWIt.Next() )
+ if ( !theW.IsSame( aWIt.Value() ))
+ break;
+ if ( !aWIt.More() ) return false;
+
+ TopTools_ListOfShape EList;
+ list< double > UList;
+
+ // find edges of theW sharing theV
+ // and find 2d normal to them at theV
+ gp_Vec2d N(0.,0.);
+ TopoDS_Iterator itE( theW );
+ for ( ; itE.More(); itE.Next() )
+ {
+ const TopoDS_Edge& E = TopoDS::Edge( itE.Value() );
+ TopoDS_Iterator itV( E );
+ for ( ; itV.More(); itV.Next() )
+ {
+ const TopoDS_Vertex & V = TopoDS::Vertex( itV.Value() );
+ if ( !V.IsSame( theV ))
+ continue;
+ EList.Append( E );
+ Standard_Real u = BRep_Tool::Parameter( V, E );
+ UList.push_back( u );
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, theF, f, l);
+ gp_Vec2d d1;
+ gp_Pnt2d p;
+ C2d->D1( u, p, d1 );
+ gp_Vec2d n( d1.Y(), -d1.X() );
+ if ( E.Orientation() == TopAbs_REVERSED )
+ n.Reverse();
+ N += n.Normalized();
+ }
+ }
+
+ // define step size by which to move theUV
+
+ gp_Pnt2d nextUV; // uv of next node on edge, most distant of the four
+ double maxDist = -DBL_MAX;
+ TopTools_ListIteratorOfListOfShape aEIt (EList);
+ list< double >::iterator aUIt = UList.begin();
+ for ( ; aEIt.More(); aEIt.Next(), aUIt++ )
+ {
+ const TopoDS_Edge& E = TopoDS::Edge( aEIt.Value() );
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, theF, f, l);
+
+ double umin = DBL_MAX, umax = -DBL_MAX;
+ SMDS_NodeIteratorPtr nIt = theMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+ if ( !nIt->more() ) // no nodes on edge, only on vertices
+ {
+ umin = l;
+ umax = f;
+ }
+ else
+ {
+ while ( nIt->more() ) {
+ const SMDS_MeshNode* node = nIt->next();
+ const SMDS_EdgePosition* epos =
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ double u = epos->GetUParameter();
+ if ( u < umin )
+ umin = u;
+ if ( u > umax )
+ umax = u;
+ }
+ }
+ bool isFirstCommon = ( *aUIt == f );
+ gp_Pnt2d uv = C2d->Value( isFirstCommon ? umin : umax );
+ double dist = theUV.SquareDistance( uv );
+ if ( dist > maxDist ) {
+ maxDist = dist;
+ nextUV = uv;
+ }
+ }
+ R2 uv0, uv1, uv2;
+ uv0.x = theUV.X(); uv0.y = theUV.Y();
+ uv1.x = nextUV.X(); uv1.y = nextUV.Y();
+ uv2.x = uv0.x; uv2.y = uv0.y;
+ if ( fixOverlappedLinkUV( uv0, uv1, uv2 ))
+ {
+ double step = theUV.Distance( gp_Pnt2d( uv0.x, uv0.y ));
+
+ // move theUV along the normal by the step
+
+ N *= step;
+
+ MESSAGE("--fixCommonVertexUV move(" << theUV.X() << " " << theUV.Y()
+ << ") by (" << N.X() << " " << N.Y() << ")"
+ << endl << "--- MAX DIST " << maxDist);
+
+ theUV.SetXY( theUV.XY() + N.XY() );
+
+ return true;
+ }
+ return false;
+}
+
//=============================================================================
/*!
*
*/
//=============================================================================
-void StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
- const TopoDS_Face & FF,
- const TopoDS_Wire & WW, R2 * uvslf, int &m,
- map<int, const SMDS_MeshNode*>&mefistoToDS)
+bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
+ const TopoDS_Face & FF,
+ const TopoDS_Wire & WW,
+ R2 * uvslf,
+ int & m,
+ map<int, const SMDS_MeshNode*>&mefistoToDS,
+ double scalex,
+ double scaley,
+ const TopTools_IndexedDataMapOfShapeListOfShape& VWMap)
{
- MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
-
- SMDS_Mesh * meshDS = aMesh.GetMeshDS();
-
- double scalex;
- double scaley;
- TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
- ComputeScaleOnFace(aMesh, F, scalex, scaley);
-
- TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
- BRepTools_WireExplorer wexp(W, F);
- for (wexp.Init(W, F); wexp.More(); wexp.Next())
- {
- const TopoDS_Edge & E = wexp.Current();
-
- // --- IDNodes of first and last Vertex
-
- TopoDS_Vertex VFirst, VLast;
- TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
-
- ASSERT(!VFirst.IsNull());
- SMDS_NodeIteratorPtr lid=
- aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode* idFirst = lid->next();
-
- ASSERT(!VLast.IsNull());
- lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode* idLast = lid->next();
-
- // --- edge internal IDNodes (relies on good order storage, not checked)
-
- int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
- //SCRUTE(nbPoints);
-
- double f, l;
- Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
-
- SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
-
- bool isForward = (E.Orientation() == TopAbs_FORWARD);
- map<double, const SMDS_MeshNode*> params;
-
- while(ite->more())
- {
- const SMDS_MeshNode * node = ite->next();
- const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
- double param = epos->GetUParameter();
- params[param] = node;
- }
- // --- load 2D values into MEFISTO structure,
- // add IDNodes in mefistoToDS map
-
- if (E.Orientation() == TopAbs_FORWARD)
- {
- gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
- uvslf[m].x = scalex * p.X();
- uvslf[m].y = scaley * p.Y();
- mefistoToDS[m + 1] = idFirst;
- //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
- //MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
- for (int i = 1; i <= nbPoints; i++) // nbPoints internal
- {
- double param = (*itp).first;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[m].x = scalex * p.X();
- uvslf[m].y = scaley * p.Y();
- mefistoToDS[m + 1] = (*itp).second;
-// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
-// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- itp++;
- }
- }
- else
- {
- gp_Pnt2d p = C2d->Value(l); // last point = Vertex Reversed
- uvslf[m].x = scalex * p.X();
- uvslf[m].y = scaley * p.Y();
- mefistoToDS[m + 1] = idLast;
-// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
-// MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- map<double, const SMDS_MeshNode*>::reverse_iterator itp = params.rbegin();
- for (int i = nbPoints; i >= 1; i--)
- {
- double param = (*itp).first;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[m].x = scalex * p.X();
- uvslf[m].y = scaley * p.Y();
- mefistoToDS[m + 1] = (*itp).second;
-// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
-// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
- m++;
- itp++;
- }
- }
- }
+// MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
+
+ SMDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+ TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+
+ int mInit = m, mFirst, iEdge;
+ gp_XY scale( scalex, scaley );
+
+ TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
+ BRepTools_WireExplorer wexp(W, F);
+ for (wexp.Init(W, F), iEdge = 0; wexp.More(); wexp.Next(), iEdge++)
+ {
+ const TopoDS_Edge & E = wexp.Current();
+
+ // --- IDNodes of first and last Vertex
+
+ TopoDS_Vertex VFirst, VLast;
+ TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
+
+ ASSERT(!VFirst.IsNull());
+ SMDS_NodeIteratorPtr lid=
+ aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+ if ( !lid->more() ) {
+ MESSAGE (" NO NODE BUILT ON VERTEX ");
+ return false;
+ }
+ const SMDS_MeshNode* idFirst = lid->next();
+
+ ASSERT(!VLast.IsNull());
+ lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+ if ( !lid->more() ) {
+ MESSAGE (" NO NODE BUILT ON VERTEX ");
+ return false;
+ }
+ const SMDS_MeshNode* idLast = lid->next();
+
+ // --- edge internal IDNodes (relies on good order storage, not checked)
+
+ int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+
+ SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+
+ bool isForward = (E.Orientation() == TopAbs_FORWARD);
+ map<double, const SMDS_MeshNode*> params;
+
+ while(ite->more())
+ {
+ const SMDS_MeshNode * node = ite->next();
+ const SMDS_EdgePosition* epos =
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ double param = epos->GetUParameter();
+ params[param] = node;
+ }
+ if ( nbPoints != params.size())
+ {
+ MESSAGE( "BAD NODE ON EDGE POSITIONS" );
+ return false;
+ }
+
+ mFirst = m;
+
+ // --- load 2D values into MEFISTO structure,
+ // add IDNodes in mefistoToDS map
+ if (E.Orientation() == TopAbs_FORWARD)
+ {
+ gp_Pnt2d p = C2d->Value(f).XY().Multiplied( scale ); // first point = Vertex Forward
+ if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh ))
+ myNodesOnCommonV.push_back( idFirst );
+ uvslf[m].x = p.X();
+ uvslf[m].y = p.Y();
+ mefistoToDS[m + 1] = idFirst;
+ //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+ //MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
+ for (int i = 1; i <= nbPoints; i++) // nbPoints internal
+ {
+ double param = (*itp).first;
+ gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
+ uvslf[m].x = p.X();
+ uvslf[m].y = p.Y();
+ mefistoToDS[m + 1] = (*itp).second;
+ //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+ //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ itp++;
+ }
+ }
+ else
+ {
+ gp_Pnt2d p = C2d->Value(l).XY().Multiplied( scale ); // last point = Vertex Reversed
+ if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh ))
+ myNodesOnCommonV.push_back( idLast );
+ uvslf[m].x = p.X();
+ uvslf[m].y = p.Y();
+ mefistoToDS[m + 1] = idLast;
+ //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+ //MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ map<double, const SMDS_MeshNode*>::reverse_iterator itp = params.rbegin();
+ for (int i = nbPoints; i >= 1; i--)
+ {
+ double param = (*itp).first;
+ gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
+ uvslf[m].x = p.X();
+ uvslf[m].y = p.Y();
+ mefistoToDS[m + 1] = (*itp).second;
+ //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+ //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+ m++;
+ itp++;
+ }
+ }
+ // prevent failure on overlapped adjacent links
+ if ( iEdge > 0 )
+ fixOverlappedLinkUV (uvslf[ mFirst - 1],
+ uvslf[ mFirst ],
+ uvslf[ mFirst + 1 ]);
+
+ } // for wexp
+
+ fixOverlappedLinkUV (uvslf[ m - 1],
+ uvslf[ mInit ],
+ uvslf[ mInit + 1 ]);
+
+ return true;
}
//=============================================================================
*/
//=============================================================================
-// **** a mettre dans SMESH_Algo ou SMESH_2D_Algo
-
void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
const TopoDS_Face & aFace, double &scalex, double &scaley)
{
- //MESSAGE("StdMeshers_MEFISTO_2D::ComputeScaleOnFace");
- TopoDS_Face F = TopoDS::Face(aFace.Oriented(TopAbs_FORWARD));
- TopoDS_Wire W = BRepTools::OuterWire(F);
-
- BRepTools_WireExplorer wexp(W, F);
-
- double xmin = 1.e300; // min & max of face 2D parametric coord.
- double xmax = -1.e300;
- double ymin = 1.e300;
- double ymax = -1.e300;
- int nbp = 50;
- scalex = 1;
- scaley = 1;
- for (wexp.Init(W, F); wexp.More(); wexp.Next())
- {
- const TopoDS_Edge & E = wexp.Current();
- double f, l;
- Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
- for (int i = 0; i <= nbp; i++)
- {
- double param = f + (double (i) / double (nbp))*(l - f);
- gp_Pnt2d p = C2d->Value(param);
- if (p.X() < xmin)
- xmin = p.X();
- if (p.X() > xmax)
- xmax = p.X();
- if (p.Y() < ymin)
- ymin = p.Y();
- if (p.Y() > ymax)
- ymax = p.Y();
-// MESSAGE(" "<< f<<" "<<l<<" "<<param<<" "<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax);
- }
- }
-// SCRUTE(xmin);
-// SCRUTE(xmax);
-// SCRUTE(ymin);
-// SCRUTE(ymax);
- double xmoy = (xmax + xmin) / 2.;
- double ymoy = (ymax + ymin) / 2.;
-
- Handle(Geom_Surface) S = BRep_Tool::Surface(F); // 3D surface
-
- double length_x = 0;
- double length_y = 0;
- gp_Pnt PX0 = S->Value(xmin, ymoy);
- gp_Pnt PY0 = S->Value(xmoy, ymin);
- for (int i = 1; i <= nbp; i++)
- {
- double x = xmin + (double (i) / double (nbp))*(xmax - xmin);
- gp_Pnt PX = S->Value(x, ymoy);
- double y = ymin + (double (i) / double (nbp))*(ymax - ymin);
- gp_Pnt PY = S->Value(xmoy, y);
- length_x += PX.Distance(PX0);
- length_y += PY.Distance(PY0);
- PX0.SetCoord(PX.X(), PX.Y(), PX.Z());
- PY0.SetCoord(PY.X(), PY.Y(), PY.Z());
- }
-// SCRUTE(length_x);
-// SCRUTE(length_y);
- scalex = length_x / (xmax - xmin);
- scaley = length_y / (ymax - ymin);
-// SCRUTE(scalex);
-// SCRUTE(scaley);
- ASSERT(scalex);
- ASSERT(scaley);
+ //MESSAGE("StdMeshers_MEFISTO_2D::ComputeScaleOnFace");
+ TopoDS_Face F = TopoDS::Face(aFace.Oriented(TopAbs_FORWARD));
+ TopoDS_Wire W = BRepTools::OuterWire(F);
+
+ double xmin = 1.e300; // min & max of face 2D parametric coord.
+ double xmax = -1.e300;
+ double ymin = 1.e300;
+ double ymax = -1.e300;
+ int nbp = 23;
+ scalex = 1;
+ scaley = 1;
+
+ TopExp_Explorer wexp(W, TopAbs_EDGE);
+ for ( ; wexp.More(); wexp.Next())
+ {
+ const TopoDS_Edge & E = TopoDS::Edge( wexp.Current() );
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+ if ( C2d.IsNull() ) continue;
+ double du = (l - f) / double (nbp);
+ for (int i = 0; i <= nbp; i++)
+ {
+ double param = f + double (i) * du;
+ gp_Pnt2d p = C2d->Value(param);
+ if (p.X() < xmin)
+ xmin = p.X();
+ if (p.X() > xmax)
+ xmax = p.X();
+ if (p.Y() < ymin)
+ ymin = p.Y();
+ if (p.Y() > ymax)
+ ymax = p.Y();
+ // MESSAGE(" "<< f<<" "<<l<<" "<<param<<" "<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax);
+ }
+ }
+ // SCRUTE(xmin);
+ // SCRUTE(xmax);
+ // SCRUTE(ymin);
+ // SCRUTE(ymax);
+ double xmoy = (xmax + xmin) / 2.;
+ double ymoy = (ymax + ymin) / 2.;
+ double xsize = xmax - xmin;
+ double ysize = ymax - ymin;
+
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F); // 3D surface
+
+ double length_x = 0;
+ double length_y = 0;
+ gp_Pnt PX0 = S->Value(xmin, ymoy);
+ gp_Pnt PY0 = S->Value(xmoy, ymin);
+ double dx = xsize / double (nbp);
+ double dy = ysize / double (nbp);
+ for (int i = 1; i <= nbp; i++)
+ {
+ double x = xmin + double (i) * dx;
+ gp_Pnt PX = S->Value(x, ymoy);
+ double y = ymin + double (i) * dy;
+ gp_Pnt PY = S->Value(xmoy, y);
+ length_x += PX.Distance(PX0);
+ length_y += PY.Distance(PY0);
+ PX0 = PX;
+ PY0 = PY;
+ }
+ scalex = length_x / xsize;
+ scaley = length_y / ysize;
+// SCRUTE(xsize);
+// SCRUTE(ysize);
+ double xyratio = xsize*scalex/(ysize*scaley);
+ const double maxratio = 1.e2;
+ //SCRUTE(xyratio);
+ if (xyratio > maxratio) {
+ SCRUTE( scaley );
+ scaley *= xyratio / maxratio;
+ SCRUTE( scaley );
+ }
+ else if (xyratio < 1./maxratio) {
+ SCRUTE( scalex );
+ scalex *= 1 / xyratio / maxratio;
+ SCRUTE( scalex );
+ }
+ ASSERT(scalex);
+ ASSERT(scaley);
}
//=============================================================================
//=============================================================================
void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
- Z nbst, R2 * uvst, Z nbt, Z * nust,
- const TopoDS_Face & F, bool faceIsForward,
- map<int, const SMDS_MeshNode*>&mefistoToDS)
+ Z nbst, R2 * uvst, Z nbt, Z * nust,
+ const TopoDS_Face & F, bool faceIsForward,
+ map<int, const SMDS_MeshNode*>&mefistoToDS,
+ double scalex, double scaley)
{
- double scalex;
- double scaley;
- ComputeScaleOnFace(aMesh, F, scalex, scaley);
-
- SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
-
- Z n, m;
- Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+ Z n, m;
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+
+ for (n = 0; n < nbst; n++)
+ {
+ if (mefistoToDS.find(n + 1) == mefistoToDS.end())
+ {
+ double u = uvst[n][0] / scalex;
+ double v = uvst[n][1] / scaley;
+ gp_Pnt P = S->Value(u, v);
+
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnFace(node, F);
+
+ //MESSAGE(P.X()<<" "<<P.Y()<<" "<<P.Z());
+ mefistoToDS[n + 1] = node;
+ //MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]);
+ SMDS_FacePosition* fpos =
+ static_cast<SMDS_FacePosition*>(node->GetPosition().get());
+ fpos->SetUParameter(u);
+ fpos->SetVParameter(v);
+ }
+ }
+
+ m = 0;
+ int mt = 0;
+
+ //SCRUTE(faceIsForward);
+ for (n = 1; n <= nbt; n++)
+ {
+ int inode1 = nust[m++];
+ int inode2 = nust[m++];
+ int inode3 = nust[m++];
+
+ const SMDS_MeshNode *n1, *n2, *n3;
+ n1 = mefistoToDS[inode1];
+ n2 = mefistoToDS[inode2];
+ n3 = mefistoToDS[inode3];
+ //MESSAGE("-- "<<inode1<<" "<<inode2<<" "<<inode3);
+
+ // triangle points must be in trigonometric order if face is Forward
+ // else they must be put clockwise
+
+ bool triangleIsWellOriented = faceIsForward;
+
+ SMDS_MeshElement * elt;
+ if (triangleIsWellOriented)
+ elt = meshDS->AddFace(n1, n2, n3);
+ else
+ elt = meshDS->AddFace(n1, n3, n2);
+
+ meshDS->SetMeshElementOnShape(elt, F);
+ m++;
+ }
+
+ // remove bad elements build on vertices shared by wires
+
+ list<const SMDS_MeshNode*>::iterator itN = myNodesOnCommonV.begin();
+ for ( ; itN != myNodesOnCommonV.end(); itN++ )
+ {
+ const SMDS_MeshNode* node = *itN;
+ SMDS_ElemIteratorPtr invElemIt = node->GetInverseElementIterator();
+ while ( invElemIt->more() )
+ {
+ const SMDS_MeshElement* elem = invElemIt->next();
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ int nbSame = 0;
+ while ( itN->more() )
+ if ( itN->next() == node)
+ nbSame++;
+ if (nbSame > 1) {
+ MESSAGE( "RM bad element " << elem->GetID());
+ meshDS->RemoveElement( elem );
+ }
+ }
+ }
- for (n = 0; n < nbst; n++)
- {
- double u = uvst[n][0] / scalex;
- double v = uvst[n][1] / scaley;
- gp_Pnt P = S->Value(u, v);
-
- if (mefistoToDS.find(n + 1) == mefistoToDS.end())
- {
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnFace(node, F);
-
- //MESSAGE(nodeId<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z());
- mefistoToDS[n + 1] = node;
- //MESSAGE(" "<<n<<" "<<mefistoToDS[n+1]);
- SMDS_FacePosition* fpos =
- static_cast<SMDS_FacePosition*>(node->GetPosition().get());
- fpos->SetUParameter(u);
- fpos->SetVParameter(v);
- }
- }
-
- m = 0;
- int mt = 0;
-
- //SCRUTE(faceIsForward);
- for (n = 1; n <= nbt; n++)
- {
- int inode1 = nust[m++];
- int inode2 = nust[m++];
- int inode3 = nust[m++];
-
- const SMDS_MeshNode *n1, *n2, *n3;
- n1 = mefistoToDS[inode1];
- n2 = mefistoToDS[inode2];
- n3 = mefistoToDS[inode3];
- //MESSAGE("-- "<<inode1<<" "<<inode2<<" "<<inode3<<" ++ "<<nodeId1<<" "<<nodeId2<<" "<<nodeId3);
-
- // triangle points must be in trigonometric order if face is Forward
- // else they must be put clockwise
-
- bool triangleIsWellOriented = faceIsForward;
-
- SMDS_MeshElement * elt;
- if (triangleIsWellOriented)
- elt = meshDS->AddFace(n1, n2, n3);
- else
- elt = meshDS->AddFace(n1, n3, n2);
-
- meshDS->SetMeshElementOnShape(elt, F);
- m++;
- }
}
//=============================================================================
double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape)
{
- MESSAGE("StdMeshers_MEFISTO_2D::ComputeEdgeElementLength");
+ //MESSAGE("StdMeshers_MEFISTO_2D::ComputeEdgeElementLength");
// **** a mettre dans SMESH_2D_Algo ?
const TopoDS_Face & FF = TopoDS::Face(aShape);
#define _StdMeshers_MEFISTO_2D_HXX_
#include "SMESH_2D_Algo.hxx"
-#include "StdMeshers_MaxElementArea.hxx"
-#include "StdMeshers_LengthFromEdges.hxx"
-#include "Rn.h"
+#include <TopoDS_Wire.hxx>
class SMDS_MeshNode;
-#include <TopoDS_Face.hxx>
+class TopTools_IndexedDataMapOfShapeListOfShape;
+class TopoDS_Face;
+class TopoDS_WIre;
+class StdMeshers_MaxElementArea;
+class StdMeshers_LengthFromEdges;
+class SMDS_MeshNode;
+
+#include <list>
#include <map>
+#include "Rn.h"
class StdMeshers_MEFISTO_2D:
public SMESH_2D_Algo
double ComputeEdgeElementLength(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
- void LoadPoints(SMESH_Mesh& aMesh,
+ bool LoadPoints(SMESH_Mesh& aMesh,
const TopoDS_Face& F,
const TopoDS_Wire& W,
R2* uvslf,
int& m,
- map<int,const SMDS_MeshNode*>& mefistoToDS);
+ map<int,const SMDS_MeshNode*>& mefistoToDS,
+ double scalex, double scaley,
+ const TopTools_IndexedDataMapOfShapeListOfShape& VWMap);
void ComputeScaleOnFace(SMESH_Mesh& aMesh,
const TopoDS_Face& aFace,
void StoreResult (SMESH_Mesh& aMesh,
Z nbst, R2* uvst, Z nbt, Z* nust,
const TopoDS_Face& F, bool faceIsForward,
- map<int,const SMDS_MeshNode*>& mefistoToDS);
+ map<int,const SMDS_MeshNode*>& mefistoToDS,
+ double scalex, double scaley);
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);
friend istream & operator >> (istream & load, StdMeshers_MEFISTO_2D & hyp);
protected:
- double _edgeLength;
- double _maxElementArea;
- const StdMeshers_MaxElementArea* _hypMaxElementArea;
+ double _edgeLength;
+ double _maxElementArea;
+ const StdMeshers_MaxElementArea* _hypMaxElementArea;
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
+
+ TopoDS_Wire myOuterWire;
+ std::list<const SMDS_MeshNode*> myNodesOnCommonV;
};
#endif
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Propagation.cxx
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_Propagation.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+StdMeshers_Propagation::StdMeshers_Propagation (int hypId, int studyId,
+ SMESH_Gen * gen)
+ : SMESH_Hypothesis(hypId, studyId, gen)
+{
+ _name = GetName();
+ _param_algo_dim = -2;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+StdMeshers_Propagation::~StdMeshers_Propagation()
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & StdMeshers_Propagation::SaveTo (ostream & save)
+{
+ return save;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+istream & StdMeshers_Propagation::LoadFrom (istream & load)
+{
+ return load;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+ostream & operator << (ostream & save, StdMeshers_Propagation & hyp)
+{
+ return hyp.SaveTo(save);
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+istream & operator >> (istream & load, StdMeshers_Propagation & hyp)
+{
+ return hyp.LoadFrom(load);
+}
+
+//=============================================================================
+/*!
+ * GetName
+ */
+//=============================================================================
+std::string StdMeshers_Propagation::GetName ()
+{
+ return "Propagation";
+}
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Propagation.hxx
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_PROPAGATION_HXX_
+#define _SMESH_PROPAGATION_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_Propagation:public SMESH_Hypothesis
+{
+ public:
+ StdMeshers_Propagation(int hypId, int studyId, SMESH_Gen * gen);
+ virtual ~ StdMeshers_Propagation();
+
+ virtual ostream & SaveTo(ostream & save);
+ virtual istream & LoadFrom(istream & load);
+ friend ostream & operator <<(ostream & save, StdMeshers_Propagation & hyp);
+ friend istream & operator >>(istream & load, StdMeshers_Propagation & hyp);
+
+ static std::string GetName ();
+};
+
+#endif
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
+
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
-#include <Handle_Geom2d_Curve.hxx>
-#include <Handle_Geom_Curve.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+
+#include <Precision.hxx>
#include <gp_Pnt2d.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
*/
//=============================================================================
-StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D(int hypId,
- int studyId, SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
+StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMESH_Gen* gen)
+ : SMESH_2D_Algo(hypId, studyId, gen)
{
- MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
- _name = "Quadrangle_2D";
- // _shapeType = TopAbs_FACE;
- _shapeType = (1 << TopAbs_FACE);
+ MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
+ _name = "Quadrangle_2D";
+ // _shapeType = TopAbs_FACE;
+ _shapeType = (1 << TopAbs_FACE);
}
//=============================================================================
StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D()
{
- MESSAGE("StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D");
+ MESSAGE("StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D");
}
//=============================================================================
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
- //MESSAGE("StdMeshers_Quadrangle_2D::CheckHypothesis");
+ //MESSAGE("StdMeshers_Quadrangle_2D::CheckHypothesis");
- bool isOk = true;
- aStatus = SMESH_Hypothesis::HYP_OK;
+ bool isOk = true;
+ aStatus = SMESH_Hypothesis::HYP_OK;
- // nothing to check
+ // nothing to check
- return isOk;
+ return isOk;
}
//=============================================================================
*/
//=============================================================================
-bool StdMeshers_Quadrangle_2D::Compute(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape)throw(SALOME_Exception)
+bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape) throw (SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- //MESSAGE("StdMeshers_Quadrangle_2D::Compute");
- SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
-
- FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
- if (!quad)
- return false;
-
- // --- compute 3D values on points, store points & quadrangles
-
- int nbdown = quad->nbPts[0];
- int nbright = quad->nbPts[1];
- int nbVertices = nbdown * nbright;
- int nbQuad = (nbdown - 1) * (nbright - 1);
- //SCRUTE(nbVertices);
- //SCRUTE(nbQuad);
-
- // const TopoDS_Face& FF = TopoDS::Face(aShape);
- // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
- // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
- const TopoDS_Face & F = TopoDS::Face(aShape);
- bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
- Handle(Geom_Surface) S = BRep_Tool::Surface(F);
-
- for (int i = 1; i < nbdown - 1; i++)
- for (int j = 1; j < nbright - 1; j++) // internal points
- {
- int ij = j * nbdown + i;
- double u = quad->uv_grid[ij].u;
- double v = quad->uv_grid[ij].v;
- gp_Pnt P = S->Value(u, v);
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnFace(node, F);
- quad->uv_grid[ij].node = node;
-// Handle (SMDS_FacePosition) fpos
-// = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v
-// node->SetPosition(fpos);
- SMDS_FacePosition* fpos =
- dynamic_cast<SMDS_FacePosition*>(node->GetPosition().get());
- fpos->SetUParameter(i);
- fpos->SetVParameter(j);
- }
-
- // bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]);
- for (int i = 0; i < nbdown - 1; i++)
- for (int j = 0; j < nbright - 1; j++) // faces
- {
- const SMDS_MeshNode *a, *b, *c, *d;
- a = quad->uv_grid[j * nbdown + i].node;
- b = quad->uv_grid[j * nbdown + i + 1].node;
- c = quad->uv_grid[(j + 1) * nbdown + i + 1].node;
- d = quad->uv_grid[(j + 1) * nbdown + i].node;
- // if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d);
- // else faceId = meshDS->AddFace(a,d,c,b);
- SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
- meshDS->SetMeshElementOnShape(face, F);
- }
-
- QuadDelete(quad);
- bool isOk = true;
- return isOk;
+ //MESSAGE("StdMeshers_Quadrangle_2D::Compute");
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+ SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+ FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
+ if (!quad)
+ return false;
+
+ // --- compute 3D values on points, store points & quadrangles
+
+ int nbdown = quad->nbPts[0];
+ int nbup = quad->nbPts[2];
+// bool isDownOut = (nbdown > nbup);
+// bool isUpOut = (nbdown < nbup);
+
+ int nbright = quad->nbPts[1];
+ int nbleft = quad->nbPts[3];
+// bool isRightOut = (nbright > nbleft);
+// bool isLeftOut = (nbright < nbleft);
+
+ int nbhoriz = Min(nbdown, nbup);
+ int nbvertic = Min(nbright, nbleft);
+
+ int nbVertices = nbhoriz * nbvertic;
+ int nbQuad = (nbhoriz - 1) * (nbvertic - 1);
+ //SCRUTE(nbVertices);
+ //SCRUTE(nbQuad);
+
+ // const TopoDS_Face& FF = TopoDS::Face(aShape);
+ // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+ // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+ const TopoDS_Face& F = TopoDS::Face(aShape);
+ bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+
+ // internal mesh nodes
+ int i, j;
+ for (i = 1; i < nbhoriz - 1; i++) {
+ for (j = 1; j < nbvertic - 1; j++) {
+ int ij = j * nbhoriz + i;
+ double u = quad->uv_grid[ij].u;
+ double v = quad->uv_grid[ij].v;
+ gp_Pnt P = S->Value(u, v);
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnFace(node, F);
+ quad->uv_grid[ij].node = node;
+ SMDS_FacePosition* fpos =
+ dynamic_cast<SMDS_FacePosition*>(node->GetPosition().get());
+ fpos->SetUParameter(u);
+ fpos->SetVParameter(v);
+ }
+ }
+
+ // mesh faces
+
+ // [2]
+ // --.--.--.--.--.-- nbvertic
+ // | | ^
+ // | | ^
+ // [3] | | ^ j [1]
+ // | | ^
+ // | | ^
+ // ---.----.----.--- 0
+ // 0 > > > > > > > > nbhoriz
+ // i
+ // [0]
+
+ i = 0;
+ int ilow = 0;
+ int iup = nbhoriz - 1;
+ if (quad->isEdgeOut[3]) { ilow++; } else { if (quad->isEdgeOut[1]) iup--; }
+
+ int jlow = 0;
+ int jup = nbvertic - 1;
+ if (quad->isEdgeOut[0]) { jlow++; } else { if (quad->isEdgeOut[2]) jup--; }
+
+ // regular quadrangles
+ // bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]);
+ for (i = ilow; i < iup; i++) {
+ for (j = jlow; j < jup; j++) {
+ const SMDS_MeshNode *a, *b, *c, *d;
+ a = quad->uv_grid[j * nbhoriz + i].node;
+ b = quad->uv_grid[j * nbhoriz + i + 1].node;
+ c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
+ d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
+ // if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d);
+ // else faceId = meshDS->AddFace(a,d,c,b);
+ SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+ }
+ }
+
+ UVPtStruct *uv_e0 = quad->uv_edges[0];
+ UVPtStruct *uv_e1 = quad->uv_edges[1];
+ UVPtStruct *uv_e2 = quad->uv_edges[2];
+ UVPtStruct *uv_e3 = quad->uv_edges[3];
+
+ double eps = Precision::Confusion();
+
+ // Boundary quadrangles
+
+ if (quad->isEdgeOut[0]) {
+ // Down edge is out
+ //
+ // |___|___|___|___|___|___|
+ // | | | | | | |
+ // |___|___|___|___|___|___|
+ // | | | | | | |
+ // |___|___|___|___|___|___| __ first row of the regular grid
+ // . . . . . . . . . __ down edge nodes
+ //
+ // >->->->->->->->->->->->-> -- direction of processing
+
+ int g = 0; // number of last processed node in the regular grid
+
+ // number of last node of the down edge to be processed
+ int stop = nbdown - 1;
+ // if right edge is out, we will stop at a node, previous to the last one
+ if (quad->isEdgeOut[1]) stop--;
+
+ // for each node of the down edge find nearest node
+ // in the first row of the regular grid and link them
+ for (i = 0; i < stop; i++) {
+ const SMDS_MeshNode *a, *b, *c, *d;
+ a = uv_e0[i].node;
+ b = uv_e0[i + 1].node;
+ gp_Pnt pb (b->X(), b->Y(), b->Z());
+
+ // find node c in the regular grid, which will be linked with node b
+ int near = g;
+ if (i == stop - 1) {
+ // right bound reached, link with the rightmost node
+ near = iup;
+ c = quad->uv_grid[nbhoriz + iup].node;
+ } else {
+ // find in the grid node c, nearest to the b
+ double mind = RealLast();
+ for (int k = g; k <= iup; k++) {
+
+ const SMDS_MeshNode *nk;
+ if (k < ilow) // this can be, if left edge is out
+ nk = uv_e3[1].node; // get node from the left edge
+ else
+ nk = quad->uv_grid[nbhoriz + k].node; // get one of middle nodes
+
+ gp_Pnt pnk (nk->X(), nk->Y(), nk->Z());
+ double dist = pb.Distance(pnk);
+ if (dist < mind - eps) {
+ c = nk;
+ near = k;
+ mind = dist;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (near == g) { // make triangle
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+ meshDS->SetMeshElementOnShape(face, F);
+ } else { // make quadrangle
+ if (near - 1 < ilow)
+ d = uv_e3[1].node;
+ else
+ d = quad->uv_grid[nbhoriz + near - 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+
+ // if node d is not at position g - make additional triangles
+ if (near - 1 > g) {
+ for (int k = near - 1; k > g; k--) {
+ c = quad->uv_grid[nbhoriz + k].node;
+ if (k - 1 < ilow)
+ d = uv_e3[1].node;
+ else
+ d = quad->uv_grid[nbhoriz + k - 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+ }
+ }
+ g = near;
+ }
+ }
+ } else {
+ if (quad->isEdgeOut[2]) {
+ // Up edge is out
+ //
+ // <-<-<-<-<-<-<-<-<-<-<-<-< -- direction of processing
+ //
+ // . . . . . . . . . __ up edge nodes
+ // ___ ___ ___ ___ ___ ___ __ first row of the regular grid
+ // | | | | | | |
+ // |___|___|___|___|___|___|
+ // | | | | | | |
+ // |___|___|___|___|___|___|
+ // | | | | | | |
+
+ int g = nbhoriz - 1; // last processed node in the regular grid
+
+ int stop = 0;
+ // if left edge is out, we will stop at a second node
+ if (quad->isEdgeOut[3]) stop++;
+
+ // for each node of the up edge find nearest node
+ // in the first row of the regular grid and link them
+ for (i = nbup - 1; i > stop; i--) {
+ const SMDS_MeshNode *a, *b, *c, *d;
+ a = uv_e2[i].node;
+ b = uv_e2[i - 1].node;
+ gp_Pnt pb (b->X(), b->Y(), b->Z());
+
+ // find node c in the grid, which will be linked with node b
+ int near = g;
+ if (i == stop + 1) { // left bound reached, link with the leftmost node
+ c = quad->uv_grid[nbhoriz*(nbvertic - 2) + ilow].node;
+ near = ilow;
+ } else {
+ // find node c in the grid, nearest to the b
+ double mind = RealLast();
+ for (int k = g; k >= ilow; k--) {
+ const SMDS_MeshNode *nk;
+ if (k > iup)
+ nk = uv_e1[nbright - 2].node;
+ else
+ nk = quad->uv_grid[nbhoriz*(nbvertic - 2) + k].node;
+ gp_Pnt pnk (nk->X(), nk->Y(), nk->Z());
+ double dist = pb.Distance(pnk);
+ if (dist < mind - eps) {
+ c = nk;
+ near = k;
+ mind = dist;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (near == g) { // make triangle
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+ meshDS->SetMeshElementOnShape(face, F);
+ } else { // make quadrangle
+ if (near + 1 > iup)
+ d = uv_e1[nbright - 2].node;
+ else
+ d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+
+ if (near + 1 < g) { // if d not is at g - make additional triangles
+ for (int k = near + 1; k < g; k++) {
+ c = quad->uv_grid[nbhoriz*(nbvertic - 2) + k].node;
+ if (k + 1 > iup)
+ d = uv_e1[nbright - 2].node;
+ else
+ d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+ }
+ }
+ g = near;
+ }
+ }
+ }
+ }
+
+ // right or left boundary quadrangles
+ if (quad->isEdgeOut[1]) {
+// MESSAGE("right edge is out");
+ int g = 0; // last processed node in the grid
+ int stop = nbright - 1;
+ if (quad->isEdgeOut[2]) stop--;
+ for (i = 0; i < stop; i++) {
+ const SMDS_MeshNode *a, *b, *c, *d;
+ a = uv_e1[i].node;
+ b = uv_e1[i + 1].node;
+ gp_Pnt pb (b->X(), b->Y(), b->Z());
+
+ // find node c in the grid, nearest to the b
+ int near = g;
+ if (i == stop - 1) { // up bondary reached
+ c = quad->uv_grid[nbhoriz*(jup + 1) - 2].node;
+ near = jup;
+ } else {
+ double mind = RealLast();
+ for (int k = g; k <= jup; k++) {
+ const SMDS_MeshNode *nk;
+ if (k < jlow)
+ nk = uv_e0[nbdown - 2].node;
+ else
+ nk = quad->uv_grid[nbhoriz*(k + 1) - 2].node;
+ gp_Pnt pnk (nk->X(), nk->Y(), nk->Z());
+ double dist = pb.Distance(pnk);
+ if (dist < mind - eps) {
+ c = nk;
+ near = k;
+ mind = dist;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (near == g) { // make triangle
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+ meshDS->SetMeshElementOnShape(face, F);
+ } else { // make quadrangle
+ if (near - 1 < jlow)
+ d = uv_e0[nbdown - 2].node;
+ else
+ d = quad->uv_grid[nbhoriz*near - 2].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+
+ if (near - 1 > g) { // if d not is at g - make additional triangles
+ for (int k = near - 1; k > g; k--) {
+ c = quad->uv_grid[nbhoriz*(k + 1) - 2].node;
+ if (k - 1 < jlow)
+ d = uv_e0[nbdown - 2].node;
+ else
+ d = quad->uv_grid[nbhoriz*k - 2].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+ }
+ }
+ g = near;
+ }
+ }
+ } else {
+ if (quad->isEdgeOut[3]) {
+// MESSAGE("left edge is out");
+ int g = nbvertic - 1; // last processed node in the grid
+ int stop = 0;
+ if (quad->isEdgeOut[0]) stop++;
+ for (i = nbleft - 1; i > stop; i--) {
+ const SMDS_MeshNode *a, *b, *c, *d;
+ a = uv_e3[i].node;
+ b = uv_e3[i - 1].node;
+ gp_Pnt pb (b->X(), b->Y(), b->Z());
+
+ // find node c in the grid, nearest to the b
+ int near = g;
+ if (i == stop + 1) { // down bondary reached
+ c = quad->uv_grid[nbhoriz*jlow + 1].node;
+ near = jlow;
+ } else {
+ double mind = RealLast();
+ for (int k = g; k >= jlow; k--) {
+ const SMDS_MeshNode *nk;
+ if (k > jup)
+ nk = uv_e2[1].node;
+ else
+ nk = quad->uv_grid[nbhoriz*k + 1].node;
+ gp_Pnt pnk (nk->X(), nk->Y(), nk->Z());
+ double dist = pb.Distance(pnk);
+ if (dist < mind - eps) {
+ c = nk;
+ near = k;
+ mind = dist;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (near == g) { // make triangle
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+ meshDS->SetMeshElementOnShape(face, F);
+ } else { // make quadrangle
+ if (near + 1 > jup)
+ d = uv_e2[1].node;
+ else
+ d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+
+ if (near + 1 < g) { // if d not is at g - make additional triangles
+ for (int k = near + 1; k < g; k++) {
+ c = quad->uv_grid[nbhoriz*k + 1].node;
+ if (k + 1 > jup)
+ d = uv_e2[1].node;
+ else
+ d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
+ SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+ meshDS->SetMeshElementOnShape(face, F);
+ }
+ }
+ g = near;
+ }
+ }
+ }
+ }
+
+ QuadDelete(quad);
+ bool isOk = true;
+ return isOk;
}
//=============================================================================
*/
//=============================================================================
-FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape)throw(SALOME_Exception)
+FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
+ (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- //MESSAGE("StdMeshers_Quadrangle_2D::ComputeWithoutStore");
-
- SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
-
- // const TopoDS_Face& FF = TopoDS::Face(aShape);
- // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
- // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
- const TopoDS_Face & F = TopoDS::Face(aShape);
- bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
-
- // verify 1 wire only, with 4 edges, same number of points on opposite edges
-
- if (NumberOfWires(F) != 1)
- {
- MESSAGE("only 1 wire by face (quadrangles)");
- return 0;
- //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)"));
- }
- // const TopoDS_Wire WW = BRepTools::OuterWire(F);
- // TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
- const TopoDS_Wire & W = BRepTools::OuterWire(F);
- BRepTools_WireExplorer wexp(W, F);
-
- FaceQuadStruct *quad = new FaceQuadStruct;
- for (int i = 0; i < 4; i++)
- quad->uv_edges[i] = 0;
- quad->uv_grid = 0;
-
- int nbEdges = 0;
- for (wexp.Init(W, F); wexp.More(); wexp.Next())
- {
- // const TopoDS_Edge& EE = wexp.Current();
- // TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
- const TopoDS_Edge & E = wexp.Current();
- int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
- if (nbEdges < 4)
- {
- quad->edge[nbEdges] = E;
- quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
- }
- nbEdges++;
- }
-
- if (nbEdges != 4)
- {
- MESSAGE("face must have 4 edges /quadrangles");
- QuadDelete(quad);
- return 0;
- //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles"));
- }
-
- if (quad->nbPts[0] != quad->nbPts[2])
- {
- MESSAGE("different point number-opposed edge");
- QuadDelete(quad);
- return 0;
- //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
- }
-
- if (quad->nbPts[1] != quad->nbPts[3])
- {
- MESSAGE("different point number-opposed edge");
- QuadDelete(quad);
- return 0;
- //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
- }
-
- // set normalized grid on unit square in parametric domain
-
- SetNormalizedGrid(aMesh, F, quad);
-
- return quad;
+// MESSAGE("StdMeshers_Quadrangle_2D::CheckAnd2Dcompute");
+
+ SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+ // const TopoDS_Face& FF = TopoDS::Face(aShape);
+ // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+ // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+ const TopoDS_Face & F = TopoDS::Face(aShape);
+ bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
+
+ // verify 1 wire only, with 4 edges
+
+ if (NumberOfWires(F) != 1)
+ {
+ MESSAGE("only 1 wire by face (quadrangles)");
+ return 0;
+ //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)"));
+ }
+ // const TopoDS_Wire WW = BRepTools::OuterWire(F);
+ // TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
+ const TopoDS_Wire& W = BRepTools::OuterWire(F);
+ BRepTools_WireExplorer wexp (W, F);
+
+ FaceQuadStruct *quad = new FaceQuadStruct;
+ for (int i = 0; i < 4; i++)
+ quad->uv_edges[i] = 0;
+ quad->uv_grid = 0;
+
+ int nbEdges = 0;
+ for (wexp.Init(W, F); wexp.More(); wexp.Next())
+ {
+ // const TopoDS_Edge& EE = wexp.Current();
+ // TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
+ const TopoDS_Edge& E = wexp.Current();
+ int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+ if (nbEdges < 4)
+ {
+ quad->edge[nbEdges] = E;
+ quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
+ }
+ nbEdges++;
+ }
+
+ if (nbEdges != 4)
+ {
+ MESSAGE("face must have 4 edges /quadrangles");
+ QuadDelete(quad);
+ return 0;
+ //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles"));
+ }
+
+// if (quad->nbPts[0] != quad->nbPts[2]) {
+// MESSAGE("different point number-opposed edge");
+// QuadDelete(quad);
+// return 0;
+// //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+// }
+//
+// if (quad->nbPts[1] != quad->nbPts[3]) {
+// MESSAGE("different point number-opposed edge");
+// QuadDelete(quad);
+// return 0;
+// //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+// }
+
+ // set normalized grid on unit square in parametric domain
+
+ SetNormalizedGrid(aMesh, F, quad);
+
+ return quad;
}
//=============================================================================
*/
//=============================================================================
-void StdMeshers_Quadrangle_2D::QuadDelete(FaceQuadStruct * quad)
+void StdMeshers_Quadrangle_2D::QuadDelete (FaceQuadStruct * quad)
{
- //MESSAGE("StdMeshers_Quadrangle_2D::QuadDelete");
- if (quad)
- {
- for (int i = 0; i < 4; i++)
- {
- if (quad->uv_edges[i])
- delete[]quad->uv_edges[i];
- quad->edge[i].Nullify();
- }
- if (quad->uv_grid)
- delete[]quad->uv_grid;
- delete quad;
- }
+ //MESSAGE("StdMeshers_Quadrangle_2D::QuadDelete");
+ if (quad)
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ if (quad->uv_edges[i])
+ delete [] quad->uv_edges[i];
+ quad->edge[i].Nullify();
+ }
+ if (quad->uv_grid)
+ delete [] quad->uv_grid;
+ delete quad;
+ }
}
//=============================================================================
*/
//=============================================================================
-void StdMeshers_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape, FaceQuadStruct * quad) throw(SALOME_Exception)
+void StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
+ const TopoDS_Shape& aShape,
+ FaceQuadStruct* quad) throw (SALOME_Exception)
{
Unexpect aCatch(SalomeException);
- // Algorithme décrit dans "Génération automatique de maillages"
- // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
- // traitement dans le domaine paramétrique 2d u,v
- // transport - projection sur le carré unité
-
- const TopoDS_Face & F = TopoDS::Face(aShape);
-
- // 1 --- find orientation of the 4 edges, by test on extrema
-
- // max min 0 x1 1
- // |<----north-2-------^ a3 -------------> a2
- // | | ^1 1^
- // west-3 east-1 =right | |
- // | | ==> | |
- // y0 | | y1 | |
- // | | |0 0|
- // v----south-0--------> a0 -------------> a1
- // min max 0 x0 1
- // =down
- //
-
- Handle(Geom2d_Curve) c2d[4];
- gp_Pnt2d pf[4];
- gp_Pnt2d pl[4];
- for (int i = 0; i < 4; i++)
- {
- c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i],
- F, quad->first[i], quad->last[i]);
- pf[i] = c2d[i]->Value(quad->first[i]);
- pl[i] = c2d[i]->Value(quad->last[i]);
- quad->isEdgeForward[i] = false;
- }
-
- double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis
- // distances si piece fausse
- int i = 0;
- if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d))
- {
- quad->isEdgeForward[0] = true;
- }
- else
- {
- double tmp = quad->first[0];
- quad->first[0] = quad->last[0];
- quad->last[0] = tmp;
- pf[0] = c2d[0]->Value(quad->first[0]);
- pl[0] = c2d[0]->Value(quad->last[0]);
- }
- for (int i = 1; i < 4; i++)
- {
- quad->isEdgeForward[i] = (pf[i].Distance(pl[i - 1]) < eps2d);
- if (!quad->isEdgeForward[i])
- {
- double tmp = quad->first[i];
- quad->first[i] = quad->last[i];
- quad->last[i] = tmp;
- pf[i] = c2d[i]->Value(quad->first[i]);
- pl[i] = c2d[i]->Value(quad->last[i]);
- //SCRUTE(pf[i].Distance(pl[i-1]));
- ASSERT(pf[i].Distance(pl[i - 1]) < eps2d);
- }
- }
- //SCRUTE(pf[0].Distance(pl[3]));
- ASSERT(pf[0].Distance(pl[3]) < eps2d);
+ // Algorithme décrit dans "Génération automatique de maillages"
+ // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
+ // traitement dans le domaine paramétrique 2d u,v
+ // transport - projection sur le carré unité
+
+// MESSAGE("StdMeshers_Quadrangle_2D::SetNormalizedGrid");
+ const TopoDS_Face& F = TopoDS::Face(aShape);
+
+ // 1 --- find orientation of the 4 edges, by test on extrema
+
+ // max min 0 x1 1
+ // |<----north-2-------^ a3 -------------> a2
+ // | | ^1 1^
+ // west-3 east-1 =right | |
+ // | | ==> | |
+ // y0 | | y1 | |
+ // | | |0 0|
+ // v----south-0--------> a0 -------------> a1
+ // min max 0 x0 1
+ // =down
+ //
+
+ Handle(Geom2d_Curve) c2d[4];
+ gp_Pnt2d pf[4];
+ gp_Pnt2d pl[4];
+ for (int i = 0; i < 4; i++)
+ {
+ c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i], F,
+ quad->first[i], quad->last[i]);
+ pf[i] = c2d[i]->Value(quad->first[i]);
+ pl[i] = c2d[i]->Value(quad->last[i]);
+ quad->isEdgeForward[i] = false;
+ }
+
+ double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis
+ // distances si piece fausse
+// int i = 0;
+ if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d))
+ {
+ quad->isEdgeForward[0] = true;
+ } else {
+ double tmp = quad->first[0];
+ quad->first[0] = quad->last[0];
+ quad->last[0] = tmp;
+ pf[0] = c2d[0]->Value(quad->first[0]);
+ pl[0] = c2d[0]->Value(quad->last[0]);
+ }
+
+ for (int i = 1; i < 4; i++)
+ {
+ quad->isEdgeForward[i] = (pf[i].Distance(pl[i - 1]) < eps2d);
+ if (!quad->isEdgeForward[i])
+ {
+ double tmp = quad->first[i];
+ quad->first[i] = quad->last[i];
+ quad->last[i] = tmp;
+ pf[i] = c2d[i]->Value(quad->first[i]);
+ pl[i] = c2d[i]->Value(quad->last[i]);
+ //SCRUTE(pf[i].Distance(pl[i-1]));
+ ASSERT(pf[i].Distance(pl[i - 1]) < eps2d);
+ }
+ }
+ //SCRUTE(pf[0].Distance(pl[3]));
+ ASSERT(pf[0].Distance(pl[3]) < eps2d);
// for (int i=0; i<4; i++)
// {
// MESSAGE(" -last "<<i<<" "<<pl[i].X()<<" "<<pl[i].Y());
// }
- // 2 --- load 2d edge points (u,v) with orientation and value on unit square
-
- for (int i = 0; i < 2; i++)
- {
- quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
- quad->edge[i], quad->first[i], quad->last[i]);
-
- // quad->isEdgeForward[i]);
- }
- for (int i = 2; i < 4; i++)
- {
- quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
- quad->edge[i], quad->last[i], quad->first[i]);
-
- // !quad->isEdgeForward[i]);
- }
-
- // 3 --- 2D normalized values on unit square [0..1][0..1]
-
- int nbdown = quad->nbPts[0];
- int nbright = quad->nbPts[1];
- quad->uv_grid = new UVPtStruct[nbright * nbdown];
-
- UVPtStruct *uv_grid = quad->uv_grid;
- UVPtStruct *uv_e0 = quad->uv_edges[0];
- UVPtStruct *uv_e1 = quad->uv_edges[1];
- UVPtStruct *uv_e2 = quad->uv_edges[2];
- UVPtStruct *uv_e3 = quad->uv_edges[3];
- gp_Pnt2d a0 = pf[0];
- gp_Pnt2d a1 = pf[1];
- gp_Pnt2d a2 = pf[2];
- gp_Pnt2d a3 = pf[3];
-
- // nodes Id on edges
-
- int j = 0;
- for (int i = 0; i < nbdown; i++)
- {
- int ij = j * nbdown + i;
- uv_grid[ij].node = uv_e0[i].node;
- }
- i = nbdown - 1;
- for (int j = 0; j < nbright; j++)
- {
- int ij = j * nbdown + i;
- uv_grid[ij].node = uv_e1[j].node;
- }
- j = nbright - 1;
- for (int i = 0; i < nbdown; i++)
- {
- int ij = j * nbdown + i;
- uv_grid[ij].node = uv_e2[i].node;
- }
- i = 0;
- for (int j = 0; j < nbright; j++)
- {
- int ij = j * nbdown + i;
- uv_grid[ij].node = uv_e3[j].node;
- }
-
- // normalized 2d values on grid
-
- for (int i = 0; i < nbdown; i++)
- for (int j = 0; j < nbright; j++)
- {
- int ij = j * nbdown + i;
- // --- droite i cste : x = x0 + y(x1-x0)
- double x0 = uv_e0[i].normParam; // bas - sud
- double x1 = uv_e2[i].normParam; // haut - nord
- // --- droite j cste : y = y0 + x(y1-y0)
- double y0 = uv_e3[j].normParam; // gauche-ouest
- double y1 = uv_e1[j].normParam; // droite - est
- // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
- double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
- double y = y0 + x * (y1 - y0);
- uv_grid[ij].x = x;
- uv_grid[ij].y = y;
- //MESSAGE("-xy-01 "<<x0<<" "<<x1<<" "<<y0<<" "<<y1);
- //MESSAGE("-xy-norm "<<i<<" "<<j<<" "<<x<<" "<<y);
- }
-
- // 4 --- projection on 2d domain (u,v)
-
- for (int i = 0; i < nbdown; i++)
- for (int j = 0; j < nbright; j++)
- {
- int ij = j * nbdown + i;
- double x = uv_grid[ij].x;
- double y = uv_grid[ij].y;
- double param_0 = uv_e0[0].param + x * (uv_e0[nbdown - 1].param - uv_e0[0].param); // sud
- double param_2 = uv_e2[0].param + x * (uv_e2[nbdown - 1].param - uv_e2[0].param); // nord
- double param_1 = uv_e1[0].param + y * (uv_e1[nbright - 1].param - uv_e1[0].param); // est
- double param_3 = uv_e3[0].param + y * (uv_e3[nbright - 1].param - uv_e3[0].param); // ouest
-
- //MESSAGE("params "<<param_0<<" "<<param_1<<" "<<param_2<<" "<<param_3);
- gp_Pnt2d p0 = c2d[0]->Value(param_0);
- gp_Pnt2d p1 = c2d[1]->Value(param_1);
- gp_Pnt2d p2 = c2d[2]->Value(param_2);
- gp_Pnt2d p3 = c2d[3]->Value(param_3);
-
- double u =
- (1 - y) * p0.X() + x * p1.X() + y * p2.X() + (1 - x) * p3.X();
- double v =
- (1 - y) * p0.Y() + x * p1.Y() + y * p2.Y() + (1 - x) * p3.Y();
-
- u -= (1 - x) * (1 - y) * a0.X() + x * (1 - y) * a1.X() +
- x * y * a2.X() + (1 - x) * y * a3.X();
- v -= (1 - x) * (1 - y) * a0.Y() + x * (1 - y) * a1.Y() +
- x * y * a2.Y() + (1 - x) * y * a3.Y();
-
- uv_grid[ij].u = u;
- uv_grid[ij].v = v;
-
- //MESSAGE("-uv- "<<i<<" "<<j<<" "<<uv_grid[ij].u<<" "<<uv_grid[ij].v);
- }
+ // 2 --- load 2d edge points (u,v) with orientation and value on unit square
+
+ bool loadOk = true;
+ for (int i = 0; i < 2; i++)
+ {
+ quad->uv_edges[i] = LoadEdgePoints(aMesh, F, quad->edge[i],
+ quad->first[i], quad->last[i]);
+ if (!quad->uv_edges[i]) loadOk = false;
+ // quad->isEdgeForward[i]);
+ }
+
+ for (int i = 2; i < 4; i++)
+ {
+ quad->uv_edges[i] = LoadEdgePoints(aMesh, F, quad->edge[i],
+ quad->last[i], quad->first[i]);
+ if (!quad->uv_edges[i]) loadOk = false;
+ // !quad->isEdgeForward[i]);
+ }
+
+ if (!loadOk)
+ {
+// MESSAGE("StdMeshers_Quadrangle_2D::SetNormalizedGrid - LoadEdgePoints failed");
+ QuadDelete( quad );
+ quad = 0;
+ return;
+ }
+ // 3 --- 2D normalized values on unit square [0..1][0..1]
+
+// int nbdown = quad->nbPts[0];
+// int nbright = quad->nbPts[1];
+ int nbhoriz = Min(quad->nbPts[0], quad->nbPts[2]);
+ int nbvertic = Min(quad->nbPts[1], quad->nbPts[3]);
+// MESSAGE("nbhoriz, nbvertic = " << nbhoriz << nbvertic);
+
+ quad->isEdgeOut[0] = (quad->nbPts[0] > quad->nbPts[2]);
+ quad->isEdgeOut[1] = (quad->nbPts[1] > quad->nbPts[3]);
+ quad->isEdgeOut[2] = (quad->nbPts[2] > quad->nbPts[0]);
+ quad->isEdgeOut[3] = (quad->nbPts[3] > quad->nbPts[1]);
+
+ quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz];
+
+ UVPtStruct *uv_grid = quad->uv_grid;
+ UVPtStruct *uv_e0 = quad->uv_edges[0];
+ UVPtStruct *uv_e1 = quad->uv_edges[1];
+ UVPtStruct *uv_e2 = quad->uv_edges[2];
+ UVPtStruct *uv_e3 = quad->uv_edges[3];
+
+ // nodes Id on "in" edges
+ if (! quad->isEdgeOut[0]) {
+ int j = 0;
+ for (int i = 0; i < nbhoriz; i++) { // down
+ int ij = j * nbhoriz + i;
+ uv_grid[ij].node = uv_e0[i].node;
+ }
+ }
+ if (! quad->isEdgeOut[1]) {
+ int i = nbhoriz - 1;
+ for (int j = 0; j < nbvertic; j++) { // right
+ int ij = j * nbhoriz + i;
+ uv_grid[ij].node = uv_e1[j].node;
+ }
+ }
+ if (! quad->isEdgeOut[2]) {
+ int j = nbvertic - 1;
+ for (int i = 0; i < nbhoriz; i++) { // up
+ int ij = j * nbhoriz + i;
+ uv_grid[ij].node = uv_e2[i].node;
+ }
+ }
+ if (! quad->isEdgeOut[3]) {
+ int i = 0;
+ for (int j = 0; j < nbvertic; j++) { // left
+ int ij = j * nbhoriz + i;
+ uv_grid[ij].node = uv_e3[j].node;
+ }
+ }
+
+ // falsificate "out" edges
+ if (quad->isEdgeOut[0]) // down
+ uv_e0 = MakeEdgePoints
+ (aMesh, F, quad->edge[0], quad->first[0], quad->last[0], nbhoriz - 1);
+ else if (quad->isEdgeOut[2]) // up
+ uv_e2 = MakeEdgePoints
+ (aMesh, F, quad->edge[2], quad->last[2], quad->first[2], nbhoriz - 1);
+
+ if (quad->isEdgeOut[1]) // right
+ uv_e1 = MakeEdgePoints
+ (aMesh, F, quad->edge[1], quad->first[1], quad->last[1], nbvertic - 1);
+ else if (quad->isEdgeOut[3]) // left
+ uv_e3 = MakeEdgePoints
+ (aMesh, F, quad->edge[3], quad->last[3], quad->first[3], nbvertic - 1);
+
+ // normalized 2d values on grid
+ for (int i = 0; i < nbhoriz; i++)
+ {
+ for (int j = 0; j < nbvertic; j++)
+ {
+ int ij = j * nbhoriz + i;
+ // --- droite i cste : x = x0 + y(x1-x0)
+ double x0 = uv_e0[i].normParam; // bas - sud
+ double x1 = uv_e2[i].normParam; // haut - nord
+ // --- droite j cste : y = y0 + x(y1-y0)
+ double y0 = uv_e3[j].normParam; // gauche-ouest
+ double y1 = uv_e1[j].normParam; // droite - est
+ // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
+ double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
+ double y = y0 + x * (y1 - y0);
+ uv_grid[ij].x = x;
+ uv_grid[ij].y = y;
+ //MESSAGE("-xy-01 "<<x0<<" "<<x1<<" "<<y0<<" "<<y1);
+ //MESSAGE("-xy-norm "<<i<<" "<<j<<" "<<x<<" "<<y);
+ }
+ }
+
+ // 4 --- projection on 2d domain (u,v)
+ gp_Pnt2d a0 = pf[0];
+ gp_Pnt2d a1 = pf[1];
+ gp_Pnt2d a2 = pf[2];
+ gp_Pnt2d a3 = pf[3];
+
+ for (int i = 0; i < nbhoriz; i++)
+ {
+ for (int j = 0; j < nbvertic; j++)
+ {
+ int ij = j * nbhoriz + i;
+ double x = uv_grid[ij].x;
+ double y = uv_grid[ij].y;
+ double param_0 = uv_e0[0].param + x * (uv_e0[nbhoriz - 1].param - uv_e0[0].param); // sud
+ double param_2 = uv_e2[0].param + x * (uv_e2[nbhoriz - 1].param - uv_e2[0].param); // nord
+ double param_1 = uv_e1[0].param + y * (uv_e1[nbvertic - 1].param - uv_e1[0].param); // est
+ double param_3 = uv_e3[0].param + y * (uv_e3[nbvertic - 1].param - uv_e3[0].param); // ouest
+
+ //MESSAGE("params "<<param_0<<" "<<param_1<<" "<<param_2<<" "<<param_3);
+ gp_Pnt2d p0 = c2d[0]->Value(param_0);
+ gp_Pnt2d p1 = c2d[1]->Value(param_1);
+ gp_Pnt2d p2 = c2d[2]->Value(param_2);
+ gp_Pnt2d p3 = c2d[3]->Value(param_3);
+
+ double u = (1 - y) * p0.X() + x * p1.X() + y * p2.X() + (1 - x) * p3.X();
+ double v = (1 - y) * p0.Y() + x * p1.Y() + y * p2.Y() + (1 - x) * p3.Y();
+
+ u -= (1 - x) * (1 - y) * a0.X() + x * (1 - y) * a1.X() +
+ x * y * a2.X() + (1 - x) * y * a3.X();
+ v -= (1 - x) * (1 - y) * a0.Y() + x * (1 - y) * a1.Y() +
+ x * y * a2.Y() + (1 - x) * y * a3.Y();
+
+ uv_grid[ij].u = u;
+ uv_grid[ij].v = v;
+
+ //MESSAGE("-uv- "<<i<<" "<<j<<" "<<uv_grid[ij].u<<" "<<uv_grid[ij].v);
+ }
+ }
}
//=============================================================================
/*!
- *
+ * LoadEdgePoints
*/
//=============================================================================
+UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
+ const TopoDS_Face& F,
+ const TopoDS_Edge& E,
+ double first, double last)
+// bool isForward)
+{
+ //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints");
+
+ SMDS_Mesh* meshDS = aMesh.GetMeshDS();
+
+ // --- IDNodes of first and last Vertex
+
+ TopoDS_Vertex VFirst, VLast;
+ TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
+
+ ASSERT(!VFirst.IsNull());
+ SMDS_NodeIteratorPtr lid = aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+ if (!lid->more())
+ {
+ MESSAGE ( "NO NODE BUILT ON VERTEX" );
+ return 0;
+ }
+ const SMDS_MeshNode* idFirst = lid->next();
+
+ ASSERT(!VLast.IsNull());
+ lid = aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+ if (!lid->more())
+ {
+ MESSAGE ( "NO NODE BUILT ON VERTEX" );
+ return 0;
+ }
+ const SMDS_MeshNode* idLast = lid->next();
+
+ // --- edge internal IDNodes (relies on good order storage, not checked)
+
+ map<double, const SMDS_MeshNode *> params;
+ SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+
+ while(ite->more())
+ {
+ const SMDS_MeshNode* node = ite->next();
+ const SMDS_EdgePosition* epos =
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ double param = epos->GetUParameter();
+ params[param] = node;
+ }
+
+ int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+ if (nbPoints != params.size())
+ {
+ MESSAGE( "BAD NODE ON EDGE POSITIONS" );
+ return 0;
+ }
+ UVPtStruct* uvslf = new UVPtStruct[nbPoints + 2];
+
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+
+ bool isForward = (((l - f) * (last - first)) > 0);
+ double paramin = 0;
+ double paramax = 0;
+ if (isForward)
+ {
+ paramin = f;
+ paramax = l;
+ gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
+ uvslf[0].x = p.X();
+ uvslf[0].y = p.Y();
+ uvslf[0].param = f;
+ uvslf[0].node = idFirst;
+ //MESSAGE("__ f "<<f<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
+ map < double, const SMDS_MeshNode* >::iterator itp = params.begin();
+ for (int i = 1; i <= nbPoints; i++) // nbPoints internal
+ {
+ double param = (*itp).first;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[i].x = p.X();
+ uvslf[i].y = p.Y();
+ uvslf[i].param = param;
+ uvslf[i].node = (*itp).second;
+ //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
+ itp++;
+ }
+ p = C2d->Value(l); // last point = Vertex Reversed
+ uvslf[nbPoints + 1].x = p.X();
+ uvslf[nbPoints + 1].y = p.Y();
+ uvslf[nbPoints + 1].param = l;
+ uvslf[nbPoints + 1].node = idLast;
+ //MESSAGE("__ l "<<l<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
+ } else
+ {
+ paramin = l;
+ paramax = f;
+ gp_Pnt2d p = C2d->Value(l); // first point = Vertex Reversed
+ uvslf[0].x = p.X();
+ uvslf[0].y = p.Y();
+ uvslf[0].param = l;
+ uvslf[0].node = idLast;
+ //MESSAGE("__ l "<<l<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
+ map < double, const SMDS_MeshNode* >::reverse_iterator itp = params.rbegin();
+
+ for (int j = nbPoints; j >= 1; j--) // nbPoints internal
+ {
+ double param = (*itp).first;
+ int i = nbPoints + 1 - j;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[i].x = p.X();
+ uvslf[i].y = p.Y();
+ uvslf[i].param = param;
+ uvslf[i].node = (*itp).second;
+ //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
+ itp++;
+ }
+ p = C2d->Value(f); // last point = Vertex Forward
+ uvslf[nbPoints + 1].x = p.X();
+ uvslf[nbPoints + 1].y = p.Y();
+ uvslf[nbPoints + 1].param = f;
+ uvslf[nbPoints + 1].node = idFirst;
+ //MESSAGE("__ f "<<f<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
+ }
+
+ ASSERT(paramin != paramax);
+ for (int i = 0; i < nbPoints + 2; i++)
+ {
+ uvslf[i].normParam = (uvslf[i].param - paramin) / (paramax - paramin);
+ //SCRUTE(uvslf[i].normParam);
+ }
+
+ return uvslf;
+}
-UVPtStruct *StdMeshers_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh & aMesh,
- const TopoDS_Face & F, const TopoDS_Edge & E, double first, double last)
- // bool isForward)
+//=============================================================================
+/*!
+ * MakeEdgePoints
+ */
+//=============================================================================
+UVPtStruct* StdMeshers_Quadrangle_2D::MakeEdgePoints (SMESH_Mesh & aMesh,
+ const TopoDS_Face& F,
+ const TopoDS_Edge& E,
+ double first, double last,
+ int nb_segm)
{
- //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints");
-
- SMDS_Mesh * meshDS = aMesh.GetMeshDS();
-
- // --- IDNodes of first and last Vertex
-
- TopoDS_Vertex VFirst, VLast;
- TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
-
- ASSERT(!VFirst.IsNull());
- SMDS_NodeIteratorPtr lid= aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode * idFirst = lid->next();
-
- ASSERT(!VLast.IsNull());
- lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode * idLast = lid->next();
-
- // --- edge internal IDNodes (relies on good order storage, not checked)
-
- int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
- //SCRUTE(nbPoints);
- UVPtStruct *uvslf = new UVPtStruct[nbPoints + 2];
-
- double f, l;
- Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
-
- map<double, const SMDS_MeshNode *> params;
- SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
-
- while(ite->more())
- {
- const SMDS_MeshNode * node = ite->next();
- const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
- double param = epos->GetUParameter();
- params[param] = node;
- }
-
- bool isForward = (((l - f) * (last - first)) > 0);
- double paramin = 0;
- double paramax = 0;
- if (isForward)
- {
- paramin = f;
- paramax = l;
- gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward
- uvslf[0].x = p.X();
- uvslf[0].y = p.Y();
- uvslf[0].param = f;
- uvslf[0].node = idFirst;
- //MESSAGE("__ f "<<f<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
- map < double, const SMDS_MeshNode* >::iterator itp = params.begin();
- for (int i = 1; i <= nbPoints; i++) // nbPoints internal
- {
- double param = (*itp).first;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[i].x = p.X();
- uvslf[i].y = p.Y();
- uvslf[i].param = param;
- uvslf[i].node = (*itp).second;
- //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
- itp++;
- }
- p = C2d->Value(l); // last point = Vertex Reversed
- uvslf[nbPoints + 1].x = p.X();
- uvslf[nbPoints + 1].y = p.Y();
- uvslf[nbPoints + 1].param = l;
- uvslf[nbPoints + 1].node = idLast;
- //MESSAGE("__ l "<<l<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
- }
- else
- {
- paramin = l;
- paramax = f;
- gp_Pnt2d p = C2d->Value(l); // first point = Vertex Reversed
- uvslf[0].x = p.X();
- uvslf[0].y = p.Y();
- uvslf[0].param = l;
- uvslf[0].node = idLast;
- //MESSAGE("__ l "<<l<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
- map < double, const SMDS_MeshNode* >::reverse_iterator itp = params.rbegin();
- for (int j = nbPoints; j >= 1; j--) // nbPoints internal
- {
- double param = (*itp).first;
- int i = nbPoints + 1 - j;
- gp_Pnt2d p = C2d->Value(param);
- uvslf[i].x = p.X();
- uvslf[i].y = p.Y();
- uvslf[i].param = param;
- uvslf[i].node = (*itp).second;
- //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
- itp++;
- }
- p = C2d->Value(f); // last point = Vertex Forward
- uvslf[nbPoints + 1].x = p.X();
- uvslf[nbPoints + 1].y = p.Y();
- uvslf[nbPoints + 1].param = f;
- uvslf[nbPoints + 1].node = idFirst;
- //MESSAGE("__ f "<<f<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
- }
-
- ASSERT(paramin != paramax);
- for (int i = 0; i < nbPoints + 2; i++)
- {
- uvslf[i].normParam = (uvslf[i].param - paramin) / (paramax - paramin);
- //SCRUTE(uvslf[i].normParam);
- }
-
- return uvslf;
+// MESSAGE("StdMeshers_Quadrangle_2D::MakeEdgePoints");
+
+ UVPtStruct* uvslf = new UVPtStruct[nb_segm + 1];
+ list<double> params;
+
+ // --- edge internal points
+ double fi, li;
+ Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, fi, li);
+ if (!Curve.IsNull()) {
+ try {
+ GeomAdaptor_Curve C3d (Curve);
+ double length = EdgeLength(E);
+ double eltSize = length / nb_segm;
+ GCPnts_UniformAbscissa Discret (C3d, eltSize, fi, li);
+ if (!Discret.IsDone()) return false;
+ int NbPoints = Discret.NbPoints();
+ for (int i = 1; i <= NbPoints; i++) {
+ double param = Discret.Parameter(i);
+ params.push_back(param);
+ }
+ }
+ catch (Standard_Failure) {
+ return 0;
+ }
+ }
+ else
+ {
+ // Edge is a degenerated Edge
+ BRep_Tool::Range(E, fi, li);
+ double du = (li - fi) / nb_segm;
+ for (int i = 1; i <= nb_segm + 1; i++)
+ {
+ double param = fi + (i - 1) * du;
+ params.push_back(param);
+ }
+ }
+
+ double f, l;
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+ ASSERT(f != l);
+
+ bool isForward = (((l - f) * (last - first)) > 0);
+ if (isForward) {
+ list<double>::iterator itU = params.begin();
+ for (int i = 0; i <= nb_segm; i++) // nbPoints internal
+ {
+ double param = *itU;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[i].x = p.X();
+ uvslf[i].y = p.Y();
+ uvslf[i].param = param;
+ uvslf[i].normParam = (param - f) / (l - f);
+ itU++;
+ }
+ } else {
+ list<double>::reverse_iterator itU = params.rbegin();
+ for (int j = nb_segm; j >= 0; j--) // nbPoints internal
+ {
+ double param = *itU;
+ int i = nb_segm - j;
+ gp_Pnt2d p = C2d->Value(param);
+ uvslf[i].x = p.X();
+ uvslf[i].y = p.Y();
+ uvslf[i].param = param;
+ uvslf[i].normParam = (param - l) / (f - l);
+ itU++;
+ }
+ }
+
+ return uvslf;
}
+
//=============================================================================
/*!
*
double first[4];
double last[4];
bool isEdgeForward[4];
+ bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite
UVPtStruct* uv_edges[4];
UVPtStruct* uv_grid;
} FaceQuadStruct;
throw (SALOME_Exception);
UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh,
- const TopoDS_Face& F,
- const TopoDS_Edge& E,
- double first,
- double last);
-// bool isForward);
+ const TopoDS_Face& F, const TopoDS_Edge& E,
+ double first, double last);
-// FaceQuadStruct _quadDesc;
+ UVPtStruct* MakeEdgePoints(SMESH_Mesh& aMesh,
+ const TopoDS_Face& F, const TopoDS_Edge& E,
+ double first, double last, int nb_segm);
};
#endif
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "StdMeshers_LocalLength.hxx"
#include "StdMeshers_NumberOfSegments.hxx"
+#include "StdMeshers_Arithmetic1D.hxx"
+#include "StdMeshers_StartEndLength.hxx"
+#include "StdMeshers_Deflection1D.hxx"
+#include "StdMeshers_Propagation.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
+#include <BRep_Tool.hxx>
+#include <BRepTools_WireExplorer.hxx>
+
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopTools_Array1OfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
#include <GeomAdaptor_Curve.hxx>
-#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_UniformAbscissa.hxx>
+#include <GCPnts_UniformDeflection.hxx>
+
+#include <Standard_ErrorHandler.hxx>
+#include <Precision.hxx>
#include <string>
-#include <algorithm>
+//#include <algorithm>
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
{
MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D");
_name = "Regular_1D";
- // _shapeType = TopAbs_EDGE;
_shapeType = (1 << TopAbs_EDGE);
+
_compatibleHypothesis.push_back("LocalLength");
_compatibleHypothesis.push_back("NumberOfSegments");
-
- _localLength = 0;
- _numberOfSegments = 0;
- _hypLocalLength = NULL;
- _hypNumberOfSegments = NULL;
+ _compatibleHypothesis.push_back("StartEndLength");
+ _compatibleHypothesis.push_back("Deflection1D");
+ _compatibleHypothesis.push_back("Arithmetic1D");
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
- //MESSAGE("StdMeshers_Regular_1D::CheckHypothesis");
-
- list <const SMESHDS_Hypothesis * >::const_iterator itl;
- const SMESHDS_Hypothesis *theHyp;
+ _hypType = NONE;
+
+ const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+ if (hyps.size() == 0)
+ {
+ aStatus = SMESH_Hypothesis::HYP_MISSING;
+ return false; // can't work without a hypothesis
+ }
+
+ // use only the first hypothesis
+ const SMESHDS_Hypothesis *theHyp = hyps.front();
+
+ string hypName = theHyp->GetName();
+
+ if (hypName == "LocalLength")
+ {
+ const StdMeshers_LocalLength * hyp =
+ dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
+ ASSERT(hyp);
+ _value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength();
+ ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
+ _hypType = LOCAL_LENGTH;
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+
+ else if (hypName == "NumberOfSegments")
+ {
+ const StdMeshers_NumberOfSegments * hyp =
+ dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
+ ASSERT(hyp);
+ _value[ NB_SEGMENTS_IND ] = hyp->GetNumberOfSegments();
+ _value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor();
+ ASSERT( _value[ NB_SEGMENTS_IND ] > 0 );
+ _hypType = NB_SEGMENTS;
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+
+ else if (hypName == "Arithmetic1D")
+ {
+ const StdMeshers_Arithmetic1D * hyp =
+ dynamic_cast <const StdMeshers_Arithmetic1D * >(theHyp);
+ ASSERT(hyp);
+ _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
+ _value[ END_LENGTH_IND ] = hyp->GetLength( false );
+ ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
+ _hypType = ARITHMETIC_1D;
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+
+ else if (hypName == "StartEndLength")
+ {
+ const StdMeshers_StartEndLength * hyp =
+ dynamic_cast <const StdMeshers_StartEndLength * >(theHyp);
+ ASSERT(hyp);
+ _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
+ _value[ END_LENGTH_IND ] = hyp->GetLength( false );
+ ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
+ _hypType = BEG_END_LENGTH;
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+
+ else if (hypName == "Deflection1D")
+ {
+ const StdMeshers_Deflection1D * hyp =
+ dynamic_cast <const StdMeshers_Deflection1D * >(theHyp);
+ ASSERT(hyp);
+ _value[ DEFLECTION_IND ] = hyp->GetDeflection();
+ ASSERT( _value[ DEFLECTION_IND ] > 0 );
+ _hypType = DEFLECTION;
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+ else
+ aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+
+ return ( _hypType != NONE );
+}
- const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
- int nbHyp = hyps.size();
- if (!nbHyp)
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool StdMeshers_Regular_1D::computeInternalParameters(const TopoDS_Edge& theEdge,
+ list<double> & theParams) const
+{
+ theParams.clear();
+
+ double f, l;
+ Handle(Geom_Curve) Curve = BRep_Tool::Curve(theEdge, f, l);
+ GeomAdaptor_Curve C3d(Curve);
+
+ double length = EdgeLength(theEdge);
+ //SCRUTE(length);
+
+ switch( _hypType )
+ {
+ case LOCAL_LENGTH:
+ case NB_SEGMENTS: {
+
+ double eltSize = 1;
+ if ( _hypType == LOCAL_LENGTH )
+ {
+ double nbseg = ceil(length / _value[ BEG_LENGTH_IND ]); // integer sup
+ if (nbseg <= 0)
+ nbseg = 1; // degenerated edge
+ eltSize = length / nbseg;
+ }
+ else
+ {
+ double epsilon = 0.001;
+ if (fabs(_value[ SCALE_FACTOR_IND ] - 1.0) > epsilon)
+ {
+ double alpha =
+ pow( _value[ SCALE_FACTOR_IND ], 1.0 / (_value[ NB_SEGMENTS_IND ] - 1));
+ double factor =
+ length / (1 - pow( alpha,_value[ NB_SEGMENTS_IND ]));
+
+ int i, NbPoints = (int) _value[ NB_SEGMENTS_IND ];
+ for ( int i = 2; i < NbPoints; i++ )
{
- aStatus = SMESH_Hypothesis::HYP_MISSING;
- return false; // can't work with no hypothesis
+ double param = factor * (1 - pow(alpha, i - 1));
+ theParams.push_back( param );
}
-
- itl = hyps.begin();
- theHyp = (*itl); // use only the first hypothesis
-
- string hypName = theHyp->GetName();
- int hypId = theHyp->GetID();
- //SCRUTE(hypName);
-
- bool isOk = false;
-
- if (hypName == "LocalLength")
- {
- _hypLocalLength = dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
- ASSERT(_hypLocalLength);
- _localLength = _hypLocalLength->GetLength();
- _numberOfSegments = 0;
- isOk = true;
- aStatus = SMESH_Hypothesis::HYP_OK;
- }
-
- else if (hypName == "NumberOfSegments")
- {
- _hypNumberOfSegments =
- dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
- ASSERT(_hypNumberOfSegments);
- _numberOfSegments = _hypNumberOfSegments->GetNumberOfSegments();
- _scaleFactor = _hypNumberOfSegments->GetScaleFactor();
- _localLength = 0;
- isOk = true;
- aStatus = SMESH_Hypothesis::HYP_OK;
- }
- else
- aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
-
- //SCRUTE(_localLength);
- //SCRUTE(_numberOfSegments);
-
- return isOk;
+ return true;
+ }
+ else
+ {
+ eltSize = length / _value[ NB_SEGMENTS_IND ];
+ }
+ }
+
+ GCPnts_UniformAbscissa Discret(C3d, eltSize, f, l);
+ if ( !Discret.IsDone() )
+ return false;
+
+ int NbPoints = Discret.NbPoints();
+ for ( int i = 2; i < NbPoints; i++ )
+ {
+ double param = Discret.Parameter(i);
+ theParams.push_back( param );
+ }
+ return true;
+ }
+
+ case BEG_END_LENGTH: {
+
+ // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = length
+
+ double a1 = _value[ BEG_LENGTH_IND ];
+ double an = _value[ END_LENGTH_IND ];
+ double q = ( length - a1 ) / ( length - an );
+
+ double U1 = Min ( f, l );
+ double Un = Max ( f, l );
+ double param = U1;
+ double eltSize = a1;
+ while ( 1 ) {
+ // computes a point on a curve <C3d> at the distance <eltSize>
+ // from the point of parameter <param>.
+ GCPnts_AbscissaPoint Discret( C3d, eltSize, param );
+ if ( !Discret.IsDone() ) break;
+ param = Discret.Parameter();
+ if ( param < Un )
+ theParams.push_back( param );
+ else
+ break;
+ eltSize *= q;
+ }
+ if ( a1 + an < length ) {
+ // compensate error
+ double Ln = GCPnts_AbscissaPoint::Length( C3d, theParams.back(), Un );
+ double dLn = an - Ln;
+ if ( dLn < 0.5 * an )
+ dLn = -dLn;
+ else {
+ theParams.pop_back();
+ Ln = GCPnts_AbscissaPoint::Length( C3d, theParams.back(), Un );
+ dLn = an - Ln;
+ if ( dLn < 0.5 * an )
+ dLn = -dLn;
+ }
+ double dUn = dLn * ( Un - U1 ) / length;
+// SCRUTE( Ln );
+// SCRUTE( dLn );
+// SCRUTE( dUn );
+ list<double>::reverse_iterator itU = theParams.rbegin();
+ int i, n = theParams.size();
+ for ( i = 1 ; i < n; itU++, i++ ) {
+ (*itU) += dUn;
+ dUn /= q;
+ }
+ }
+
+ return true;
+ }
+
+ case DEFLECTION: {
+
+ GCPnts_UniformDeflection Discret(C3d, _value[ DEFLECTION_IND ], true);
+ if ( !Discret.IsDone() )
+ return false;
+
+ int NbPoints = Discret.NbPoints();
+ for ( int i = 2; i < NbPoints; i++ )
+ {
+ double param = Discret.Parameter(i);
+ theParams.push_back( param );
+ }
+ return true;
+
+ }
+
+ case ARITHMETIC_1D: {
+ // arithmetic progression: SUM(n) = ( an - a1 + q ) * ( a1 + an ) / ( 2 * q ) = length
+
+ double a1 = _value[ BEG_LENGTH_IND ];
+ double an = _value[ END_LENGTH_IND ];
+
+ double nd = (2 * length) / (an + a1) - 1;
+ int n = int(nd);
+ if(n != nd)
+ n++;
+
+ double q = ((2 * length) / (n + 1) - 2 * a1) / n;
+ double U1 = Min ( f, l );
+ double Un = Max ( f, l );
+ double param = U1;
+ double eltSize = a1;
+
+ double L=0;
+ while ( 1 ) {
+ L+=eltSize;
+ // computes a point on a curve <C3d> at the distance <eltSize>
+ // from the point of parameter <param>.
+ GCPnts_AbscissaPoint Discret( C3d, eltSize, param );
+ if ( !Discret.IsDone() ) break;
+ param = Discret.Parameter();
+ if ( fabs(param - Un) > Precision::Confusion() && param < Un) {
+ theParams.push_back( param );
+ }
+ else
+ break;
+ eltSize += q;
+ }
+
+ return true;
+ }
+
+ default:;
+ }
+
+ return false;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
{
- MESSAGE("StdMeshers_Regular_1D::Compute");
-
- SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
-
- const TopoDS_Edge & EE = TopoDS::Edge(aShape);
- TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
-
- double f, l;
- Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
-
- TopoDS_Vertex VFirst, VLast;
- TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
-
- double length = EdgeLength(E);
- //SCRUTE(length);
-
- double eltSize = 1;
-// if (_localLength > 0) eltSize = _localLength;
- if (_localLength > 0)
- {
- double nbseg = ceil(length / _localLength); // integer sup
- if (nbseg <= 0)
- nbseg = 1; // degenerated edge
- eltSize = length / nbseg;
- }
- else
- {
- ASSERT(_numberOfSegments > 0);
- eltSize = length / _numberOfSegments;
- }
-
- ASSERT(!VFirst.IsNull());
- SMDS_NodeIteratorPtr lid= aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode * idFirst = lid->next();
-
- ASSERT(!VLast.IsNull());
- lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
- const SMDS_MeshNode * idLast = lid->next();
-
- if (!Curve.IsNull())
- {
- GeomAdaptor_Curve C3d(Curve);
- GCPnts_UniformAbscissa Discret(C3d, eltSize, f, l);
- int NbPoints = Discret.NbPoints();
- //MESSAGE("nb points on edge : "<<NbPoints);
-
- // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
- // only internal nodes receive an edge position with param on curve
-
- const SMDS_MeshNode * idPrev = idFirst;
- for (int i = 2; i < NbPoints; i++)
- {
- double param = Discret.Parameter(i);
-
- if (_numberOfSegments > 1)
- {
- double epsilon = 0.001;
- if (fabs(_scaleFactor - 1.0) > epsilon)
- {
- double alpha =
- pow(_scaleFactor, 1.0 / (_numberOfSegments - 1));
- double d =
- length * (1 - pow(alpha, i - 1)) / (1 - pow(alpha,
- _numberOfSegments));
- param = d;
- }
- }
-
- gp_Pnt P = Curve->Value(param);
-
- //Add the Node in the DataStructure
- //MESSAGE("point "<<nodeId<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" - "<<i<<" "<<param);
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnEdge(node, E);
-
- // **** edgePosition associe au point = param.
- SMDS_EdgePosition* epos =
- dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
- epos->SetUParameter(param);
-
- SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
- meshDS->SetMeshElementOnShape(edge, E);
- idPrev = node;
- }
- SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
- meshDS->SetMeshElementOnShape(edge, E);
- }
- else
- {
-// MESSAGE ("Edge Degeneree non traitee --- arret");
-// ASSERT(0);
- if (BRep_Tool::Degenerated(E))
- {
- // Edge is a degenerated Edge : We put n = 5 points on the edge.
- int NbPoints = 5;
- BRep_Tool::Range(E, f, l);
- double du = (l - f) / (NbPoints - 1);
- MESSAGE("************* Degenerated edge! *****************");
-
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(E, V1, V2);
- gp_Pnt P = BRep_Tool::Pnt(V1);
-
- const SMDS_MeshNode * idPrev = idFirst;
- for (int i = 2; i < NbPoints; i++)
- {
- double param = f + (i - 1) * du;
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnEdge(node, E);
-
-// Handle (SMDS_EdgePosition) epos
-// = new SMDS_EdgePosition(theSubMesh->GetId(),param);
-// node->SetPosition(epos);
- SMDS_EdgePosition* epos =
- dynamic_cast<SMDS_EdgePosition*>(node->GetPosition().get());
- epos->SetUParameter(param);
-
- SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
- meshDS->SetMeshElementOnShape(edge, E);
- idPrev = node;
- }
- SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
- meshDS->SetMeshElementOnShape(edge, E);
- }
- else
- ASSERT(0);
- }
- return true;
+ MESSAGE("StdMeshers_Regular_1D::Compute");
+
+ if ( _hypType == NONE )
+ return false;
+
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+ SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+ const TopoDS_Edge & EE = TopoDS::Edge(aShape);
+ TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
+
+ double f, l;
+ Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
+
+ TopoDS_Vertex VFirst, VLast;
+ TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
+
+ ASSERT(!VFirst.IsNull());
+ SMDS_NodeIteratorPtr lid= aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+ if (!lid->more())
+ {
+ MESSAGE (" NO NODE BUILT ON VERTEX ");
+ return false;
+ }
+ const SMDS_MeshNode * idFirst = lid->next();
+
+ ASSERT(!VLast.IsNull());
+ lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+ if (!lid->more())
+ {
+ MESSAGE (" NO NODE BUILT ON VERTEX ");
+ return false;
+ }
+ const SMDS_MeshNode * idLast = lid->next();
+
+ if (!Curve.IsNull())
+ {
+ list< double > params;
+ try {
+ if ( ! computeInternalParameters( E, params ))
+ return false;
+ }
+ catch ( Standard_Failure ) {
+ return false;
+ }
+
+ // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
+ // only internal nodes receive an edge position with param on curve
+
+ const SMDS_MeshNode * idPrev = idFirst;
+
+ for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++)
+ {
+ double param = *itU;
+ gp_Pnt P = Curve->Value(param);
+
+ //Add the Node in the DataStructure
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnEdge(node, E);
+
+ // **** edgePosition associe au point = param.
+ SMDS_EdgePosition* epos =
+ dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
+ epos->SetUParameter(param);
+
+ SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
+ meshDS->SetMeshElementOnShape(edge, E);
+ idPrev = node;
+ }
+ SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
+ meshDS->SetMeshElementOnShape(edge, E);
+ }
+ else
+ {
+ // Edge is a degenerated Edge : We put n = 5 points on the edge.
+ int NbPoints = 5;
+ BRep_Tool::Range(E, f, l);
+ double du = (l - f) / (NbPoints - 1);
+ //MESSAGE("************* Degenerated edge! *****************");
+
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(E, V1, V2);
+ gp_Pnt P = BRep_Tool::Pnt(V1);
+
+ const SMDS_MeshNode * idPrev = idFirst;
+ for (int i = 2; i < NbPoints; i++)
+ {
+ double param = f + (i - 1) * du;
+ SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+ meshDS->SetNodeOnEdge(node, E);
+
+ SMDS_EdgePosition* epos =
+ dynamic_cast<SMDS_EdgePosition*>(node->GetPosition().get());
+ epos->SetUParameter(param);
+
+ SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
+ meshDS->SetMeshElementOnShape(edge, E);
+ idPrev = node;
+ }
+ SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
+ meshDS->SetMeshElementOnShape(edge, E);
+ }
+ return true;
+}
+
+//=============================================================================
+/*!
+ * GetUsedHypothesis
+ */
+//=============================================================================
+
+const list <const SMESHDS_Hypothesis *> & StdMeshers_Regular_1D::GetUsedHypothesis
+ (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+{
+ _usedHypList.clear();
+ _usedHypList = GetAppliedHypothesis(aMesh, aShape); // copy
+ int nbHyp = _usedHypList.size();
+
+ // try to find being propagated hypothesis
+ string propName = StdMeshers_Propagation::GetName();
+ if (nbHyp == 0) {
+ // Get all opposite edges
+ TopTools_ListOfShape anOppositeEdges;
+ TopoDS_Shape mainShape = aMesh.GetMeshDS()->ShapeToMesh();
+ GetOppositeEdges(mainShape, aShape, anOppositeEdges);
+ TopTools_ListIteratorOfListOfShape oppIt (anOppositeEdges);
+ for (; oppIt.More(); oppIt.Next()) {
+ const TopoDS_Shape& oppE = oppIt.Value();
+
+ // Find Propagation hypothesis on the opposite edge
+ if (IsPropagated(aMesh, oppE)) {
+
+ // Get hypothesis, used by the opposite edge
+ _usedHypList = SMESH_Algo::GetUsedHypothesis(aMesh, oppE);
+ nbHyp = _usedHypList.size();
+ if (nbHyp == 1)
+ break;
+ }
+ }
+ }
+
+ // try to find relevant 1D hypothesis on ancestors
+ if (nbHyp == 0) {
+ TopTools_ListIteratorOfListOfShape ancIt (aMesh.GetAncestors(aShape));
+ for (; ancIt.More(); ancIt.Next()) {
+ const TopoDS_Shape& ancestor = ancIt.Value();
+ _usedHypList = GetAppliedHypothesis(aMesh, ancestor); // copy
+ nbHyp = _usedHypList.size();
+ if (nbHyp == 1)
+ break;
+ }
+ }
+
+ if (nbHyp > 1)
+ _usedHypList.clear(); //only one compatible hypothesis allowed
+ return _usedHypList;
+}
+
+//=============================================================================
+/*!
+ * Is Propagation hypothesis assigned to theShape or its ancestors
+ */
+//=============================================================================
+Standard_Boolean StdMeshers_Regular_1D::IsPropagated (SMESH_Mesh & theMesh,
+ const TopoDS_Shape & theShape)
+{
+ const SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
+
+ // try to find Propagation hypothesis on theShape
+ const list<const SMESHDS_Hypothesis*> & listHyp = meshDS->GetHypothesis(theShape);
+
+ list<const SMESHDS_Hypothesis*>::const_iterator it = listHyp.begin();
+ for (; it != listHyp.end(); it++) {
+ const SMESHDS_Hypothesis *anHyp = *it;
+ if (anHyp->GetName() == StdMeshers_Propagation::GetName())
+ return Standard_True;
+ }
+
+ // try to find Propagation hypothesis on ancestors
+ TopTools_ListIteratorOfListOfShape ancIt (theMesh.GetAncestors(theShape));
+ for (; ancIt.More(); ancIt.Next()) {
+ const TopoDS_Shape& ancestor = ancIt.Value();
+ const list<const SMESHDS_Hypothesis*> & listAncHyp = meshDS->GetHypothesis(ancestor);
+
+ list<const SMESHDS_Hypothesis*>::const_iterator itAnc = listAncHyp.begin();
+ for (; itAnc != listAncHyp.end(); itAnc++) {
+ const SMESHDS_Hypothesis *anHyp = *itAnc;
+ if (anHyp->GetName() == StdMeshers_Propagation::GetName())
+ return Standard_True;
+ }
+ }
+
+ return Standard_False;
+}
+
+//=============================================================================
+/*!
+ * GetOppositeEdges() - get all edges of theShape,
+ * laying on any quadrangle face in front of theEdge
+ */
+//=============================================================================
+void StdMeshers_Regular_1D::GetOppositeEdges (const TopoDS_Shape& theShape,
+ const TopoDS_Shape& theEdge,
+ TopTools_ListOfShape& theOppositeEdges) const
+{
+ TopExp_Explorer aWires (theShape, TopAbs_WIRE);
+ for (; aWires.More(); aWires.Next()) {
+ const TopoDS_Shape& aWire = aWires.Current();
+ BRepTools_WireExplorer aWE (TopoDS::Wire(aWire));
+ Standard_Integer nb = 1, found = 0;
+ TopTools_Array1OfShape anEdges (1,4);
+ for (; aWE.More(); aWE.Next(), nb++) {
+ if (nb > 4) {
+ found = 0;
+ break;
+ }
+ anEdges(nb) = aWE.Current();
+ if (anEdges(nb).IsSame(theEdge))
+ found = nb;
+ }
+ if (nb == 5 && found > 0) {
+ Standard_Integer opp = found + 2;
+ if (opp > 4) opp -= 4;
+ theOppositeEdges.Append(anEdges(opp));
+ }
+ }
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
#include "SMESH_1D_Algo.hxx"
-class StdMeshers_LocalLength;
-class StdMeshers_NumberOfSegments;
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ListOfShape.hxx>
+
+class TopoDS_Edge;
class StdMeshers_Regular_1D:
public SMESH_1D_Algo
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
+ virtual const std::list <const SMESHDS_Hypothesis *> &
+ GetUsedHypothesis (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
+
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);
friend ostream & operator << (ostream & save, StdMeshers_Regular_1D & hyp);
friend istream & operator >> (istream & load, StdMeshers_Regular_1D & hyp);
protected:
- double _localLength;
- int _numberOfSegments;
- double _scaleFactor;
- const StdMeshers_LocalLength* _hypLocalLength;
- const StdMeshers_NumberOfSegments* _hypNumberOfSegments;
+
+ Standard_Boolean IsPropagated (SMESH_Mesh & theMesh,
+ const TopoDS_Shape & theShape);
+
+ void GetOppositeEdges (const TopoDS_Shape& theShape,
+ const TopoDS_Shape& theEdge,
+ TopTools_ListOfShape& theOppositeEdges) const;
+
+ bool computeInternalParameters (const TopoDS_Edge& theEdge,
+ std::list< double > & theParameters ) const;
+
+ enum HypothesisType { LOCAL_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
+
+ enum ValueIndex {
+ NB_SEGMENTS_IND = 0,
+ SCALE_FACTOR_IND = 1,
+ BEG_LENGTH_IND = 0,
+ END_LENGTH_IND = 1,
+ DEFLECTION_IND = 0
+ };
+
+ HypothesisType _hypType;
+
+ double _value[2];
+
};
#endif
--- /dev/null
+// SMESH StdMeshers_StartEndLength : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_StartEndLength.cxx
+// Module : SMESH
+// $Header$
+
+using namespace std;
+
+#include "StdMeshers_StartEndLength.hxx"
+#include "utilities.h"
+
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_StartEndLength::StdMeshers_StartEndLength(int hypId,
+ int studyId,
+ SMESH_Gen * gen)
+ :SMESH_Hypothesis(hypId, studyId, gen)
+{
+ _begLength = 1.;
+ _endLength = 1.;
+ _name = "StartEndLength";
+ _param_algo_dim = 1; // is used by SMESH_Regular_1D
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_StartEndLength::~StdMeshers_StartEndLength()
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_StartEndLength::SetLength(double length, bool isStartLength)
+ throw(SALOME_Exception)
+{
+ if ( (isStartLength ? _begLength : _endLength) != length ) {
+ if (length <= 0)
+ throw SALOME_Exception(LOCALIZED("length must be positive"));
+ if ( isStartLength )
+ _begLength = length;
+ else
+ _endLength = length;
+
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+double StdMeshers_StartEndLength::GetLength(bool isStartLength) const
+{
+ return isStartLength ? _begLength : _endLength;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & StdMeshers_StartEndLength::SaveTo(ostream & save)
+{
+ save << _begLength << _endLength;
+ return save;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & StdMeshers_StartEndLength::LoadFrom(istream & load)
+{
+ bool isOK = true;
+ isOK = (load >> _begLength);
+ if (!isOK)
+ load.clear(ios::badbit | load.rdstate());
+ isOK = (load >> _endLength);
+ if (!isOK)
+ load.clear(ios::badbit | load.rdstate());
+ return load;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_StartEndLength & hyp)
+{
+ return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_StartEndLength & hyp)
+{
+ return hyp.LoadFrom( load );
+}
--- /dev/null
+// SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_StartEndLength.hxx
+// Module : SMESH
+// $Header$
+
+#ifndef _STDMESHERS_STARTENDLENGTH_HXX_
+#define _STDMESHERS_STARTENDLENGTH_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_StartEndLength:public SMESH_Hypothesis
+{
+ public:
+ StdMeshers_StartEndLength(int hypId, int studyId, SMESH_Gen * gen);
+ virtual ~ StdMeshers_StartEndLength();
+
+ void SetLength(double length, bool isStartLength) throw(SALOME_Exception);
+
+ double GetLength(bool isStartLength) const;
+
+ virtual ostream & SaveTo(ostream & save);
+ virtual istream & LoadFrom(istream & load);
+ friend ostream & operator <<(ostream & save, StdMeshers_StartEndLength & hyp);
+ friend istream & operator >>(istream & load, StdMeshers_StartEndLength & hyp);
+
+ protected:
+ double _begLength, _endLength;
+};
+
+#endif
LIB = libStdMeshersGUI.la
LIB_SRC = \
StdMeshersGUI.cxx \
- StdMeshersGUI_LocalLengthDlg.cxx \
- StdMeshersGUI_NbSegmentsDlg.cxx \
- StdMeshersGUI_MaxElementAreaDlg.cxx \
- StdMeshersGUI_MaxElementVolumeDlg.cxx
+ StdMeshersGUI_CreateHypothesisDlg.cxx \
+ StdMeshersGUI_CreateStdHypothesisDlg.cxx \
+ StdMeshersGUI_Parameters.cxx
LIB_MOC = \
- StdMeshersGUI_LocalLengthDlg.h \
- StdMeshersGUI_NbSegmentsDlg.h \
- StdMeshersGUI_MaxElementAreaDlg.h \
- StdMeshersGUI_MaxElementVolumeDlg.h
+ StdMeshersGUI_CreateHypothesisDlg.h \
+ StdMeshersGUI_CreateStdHypothesisDlg.h
+
+EXPORT_HEADERS = StdMeshersGUI_CreateHypothesisDlg.h
LIB_CLIENT_IDL = \
SALOME_Exception.idl \
- SMESH_Gen.idl \
- SMESH_Mesh.idl \
- SMESH_Group.idl \
- SMESH_Filter.idl \
SMESH_Hypothesis.idl \
- SMESH_BasicHypothesis.idl \
- MED.idl
+ SMESH_BasicHypothesis.idl
+
+## pb in dependencies search
+LIB_CLIENT_IDL += \
+ SALOME_GenericObj.idl
LIB_SERVER_IDL =
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
#$(OCC_CXXFLAGS)
-LDFLAGS += -lSMESHGUI $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
+LDFLAGS += -lSMESHGUI -lVTKViewer -lSalomeGUI -lSMESHObject -lSMESHFiltersSelection $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
@CONCLUDE@
// Module : SMESH
// $Header$
-using namespace std;
-
-#include <SALOMEconfig.h>
+#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_HypothesesUtils.h"
-#include "StdMeshersGUI_LocalLengthDlg.h"
-#include "StdMeshersGUI_NbSegmentsDlg.h"
-#include "StdMeshersGUI_MaxElementAreaDlg.h"
-#include "StdMeshersGUI_MaxElementVolumeDlg.h"
+#include "SMESHGUI_aParameterDlg.h"
+#include "StdMeshersGUI_Parameters.h"
+#include "StdMeshersGUI_CreateStdHypothesisDlg.h"
#include "QAD_Desktop.h"
#include "QAD_ResourceMgr.h"
#include <qobject.h>
+#include "utilities.h"
+
+using namespace std;
+
//=============================================================================
/*! class HypothesisCreator
*
// Get default name for hypothesis/algorithm creation
char* sHypType = (char*)myHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+ HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
QString aHypName;
if (aHypData)
aHypName = aHypData->Label;
// Create hypothesis/algorithm
if (isAlgo)
{
- mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo);
+ SMESH::CreateHypothesis(myHypType, aHypName, isAlgo);
}
else
{
+ if ( StdMeshersGUI_Parameters::HasParameters( myHypType ))
// Show Dialog for hypothesis creation
- if (myHypType == "LocalLength")
- StdMeshersGUI_LocalLengthDlg *aDlg = new StdMeshersGUI_LocalLengthDlg(myHypType, parent, "");
- else if (myHypType == "NumberOfSegments")
- StdMeshersGUI_NbSegmentsDlg *aDlg = new StdMeshersGUI_NbSegmentsDlg(myHypType, parent, "");
- else if (myHypType == "MaxElementArea")
- StdMeshersGUI_MaxElementAreaDlg *aDlg = new StdMeshersGUI_MaxElementAreaDlg(myHypType, parent, "");
- else if (myHypType == "MaxElementVolume")
- StdMeshersGUI_MaxElementVolumeDlg *aDlg = new StdMeshersGUI_MaxElementVolumeDlg(myHypType, parent, "");
- else if (myHypType == "LengthFromEdges")
- mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
- else if (myHypType == "NotConformAllowed")
- mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
- else ;
+ StdMeshersGUI_CreateStdHypothesisDlg *aDlg =
+ new StdMeshersGUI_CreateStdHypothesisDlg(myHypType, parent, "");
+ else
+ SMESH::CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
}
}
{
MESSAGE("StdMeshersGUI_HypothesisCreator::EditHypothesis");
- Standard_Boolean res = Standard_True;
SALOMEDS::Study::ListOfSObject_var listSOmesh =
- mySMESHGUI->GetMeshesUsingAlgoOrHypothesis(theHyp);
- QString Name = theHyp->GetName();
- if (Name.compare("LocalLength") == 0)
- {
- StdMeshers::StdMeshers_LocalLength_var LL =
- StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
- double beforeLength = LL->GetLength() ;
- double Length = mySMESHGUI->Parameter(res,
- beforeLength,
- QObject::tr("SMESH_LOCAL_LENGTH_HYPOTHESIS"),
- QObject::tr("SMESH_VALUE"),
- 1.0E-5, 1E6, 6);
- if (res && Length != beforeLength)
- {
- LL->SetLength(Length);
- for (int i=0; i<listSOmesh->length(); i++)
- {
- mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
- }
- }
- }
- else if (Name.compare("NumberOfSegments") == 0)
- {
- StdMeshers::StdMeshers_NumberOfSegments_var NOS =
- StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
- int beforeNbSeg = NOS->GetNumberOfSegments() ;
- int NbSeg = mySMESHGUI->Parameter(res,
- beforeNbSeg,
- QObject::tr("SMESH_NB_SEGMENTS_HYPOTHESIS"),
- QObject::tr("SMESH_VALUE"),
- 1, 1000000);
- if (res && NbSeg != beforeNbSeg)
- {
- NOS->SetNumberOfSegments(NbSeg);
- for (int i=0; i<listSOmesh->length(); i++)
- {
- SALOMEDS::SObject_var SO = listSOmesh[i] ;
- mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
- }
- }
- }
- else if (Name.compare("MaxElementArea") == 0)
- {
- StdMeshers::StdMeshers_MaxElementArea_var MEA =
- StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
- double beforeMaxArea = MEA->GetMaxElementArea();
- double MaxArea = mySMESHGUI->Parameter(res,
- beforeMaxArea,
- QObject::tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"),
- QObject::tr("SMESH_VALUE"),
- 1.0E-5, 1E6, 6);
- if (res && MaxArea != beforeMaxArea)
- {
- MEA->SetMaxElementArea(MaxArea);
- for (int i=0; i<listSOmesh->length(); i++)
- {
- mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
- }
- }
- }
- else if (Name.compare("MaxElementVolume") == 0)
- {
- StdMeshers::StdMeshers_MaxElementVolume_var MEV =
- StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
- double beforeMaxVolume = MEV->GetMaxElementVolume() ;
- double MaxVolume = mySMESHGUI->Parameter(res,
- beforeMaxVolume,
- QObject::tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"),
- QObject::tr("SMESH_VALUE"),
- 1.0E-5, 1E6, 6);
- if (res && MaxVolume != beforeMaxVolume)
- {
- MEV->SetMaxElementVolume(MaxVolume);
- for (int i=0; i<listSOmesh->length(); i++)
- {
- mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
- }
- }
+ SMESH::GetMeshesUsingAlgoOrHypothesis(theHyp);
+
+ list<SMESHGUI_aParameterPtr> paramList;
+ StdMeshersGUI_Parameters::GetParameters( theHyp, paramList );
+
+ bool modified = false;
+ if ( SMESHGUI_aParameterDlg::Parameters( paramList, QObject::tr("SMESH_VALUE")) )
+ modified = StdMeshersGUI_Parameters::SetParameters( theHyp, paramList );
+
+ if ( modified ) {
+ //set new Attribute Comment for hypothesis which parameters were modified
+ QString aParams = "";
+ StdMeshersGUI_Parameters::GetParameters( theHyp, paramList, aParams );
+ SALOMEDS::SObject_var SHyp = SMESH::FindSObject(theHyp);
+ if (!SHyp->_is_nil())
+ if (!aParams.isEmpty()) {
+ SMESH::SetValue(SHyp, aParams);
+ //mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
+ }
+
+ for (int i=0; i<listSOmesh->length(); i++)
+ SMESH::ModifiedMesh(listSOmesh[i], false);
}
-// else if (Name.compare("Regular_1D") == 0)
-// {}
-// else if (Name.compare("MEFISTO_2D") == 0)
-// {}
- else
- {}
}
//=============================================================================
--- /dev/null
+// SMESH StdMeshersGUI : GUI for StdMeshers plugin
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_CreateHypothesisDlg.cxx
+// Moved here from SMESHGUI_CreateHypothesisDlg.cxx
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#include "StdMeshersGUI_CreateHypothesisDlg.h"
+#include "StdMeshersGUI_Parameters.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Hypotheses.h"
+#include "SMESHGUI_HypothesesUtils.h"
+#include "SMESHGUI_Utils.h"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+
+// QT Includes
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qspinbox.h>
+
+using namespace std;
+
+//=================================================================================
+// class : StdMeshersGUI_CreateHypothesisDlg()
+// purpose : Constructs a StdMeshersGUI_CreateHypothesisDlg which is a child of 'parent', with the
+// name 'name' and widget flags set to 'f'.
+// The dialog will by default be modeless, unless you set 'modal' to
+// TRUE to construct a modal dialog.
+//=================================================================================
+StdMeshersGUI_CreateHypothesisDlg::StdMeshersGUI_CreateHypothesisDlg (const QString& hypType,
+ QWidget* parent,
+ const char* name,
+ bool modal,
+ WFlags /*fl*/)
+ : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myHypType( hypType )
+{
+}
+
+//=======================================================================
+//function : CreateDlgLayout
+//purpose :
+//=======================================================================
+
+void StdMeshersGUI_CreateHypothesisDlg::CreateDlgLayout(const QString & theCaption,
+ const QPixmap & theHypIcon,
+ const QString & theHypTypeName)
+{
+ setCaption( theCaption );
+
+ setSizeGripEnabled( TRUE );
+ QGridLayout* StdMeshersGUI_CreateHypothesisDlgLayout = new QGridLayout( this );
+ StdMeshersGUI_CreateHypothesisDlgLayout->setSpacing( 6 );
+ StdMeshersGUI_CreateHypothesisDlgLayout->setMargin( 11 );
+
+ /***************************************************************/
+ iconLabel = new QLabel( this );
+ iconLabel->setPixmap( theHypIcon );
+ iconLabel->setScaledContents( false );
+ iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ typeLabel = new QLabel( this );
+ typeLabel->setText( theHypTypeName );
+ StdMeshersGUI_CreateHypothesisDlgLayout->addWidget( iconLabel, 0, 0 );
+ StdMeshersGUI_CreateHypothesisDlgLayout->addWidget( typeLabel, 0, 1 );
+
+ /***************************************************************/
+ GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setSpacing( 0 );
+ GroupC1->layout()->setMargin( 0 );
+ QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setSpacing( 6 );
+ GroupC1Layout->setMargin( 11 );
+
+ TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
+ TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
+ GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
+
+ LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
+ GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
+
+ myParamList.clear();
+ GetParameters( myHypType, myParamList );
+ ASSERT( !myParamList.empty() );
+
+ /* Spin boxes with labels */
+ list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
+ for ( int row = 1; paramIt != myParamList.end(); paramIt++ , row++ )
+ {
+ SMESHGUI_aParameterPtr param = (*paramIt);
+ QLabel * label = new QLabel( GroupC1, "TextLabel" );
+ GroupC1Layout->addWidget( label, row, 0 );
+ label->setText( param->Label() );
+ QWidget* aSpinWidget;
+ switch ( param->GetType() ) {
+ case SMESHGUI_aParameter::DOUBLE: {
+ SMESHGUI_SpinBox* spin = new SMESHGUI_SpinBox( GroupC1 );
+ aSpinWidget = spin;
+ spin->setPrecision( 12 );
+ break;
+ }
+ case SMESHGUI_aParameter::INT: {
+ QSpinBox* spin = new QSpinBox( GroupC1 );
+ aSpinWidget = spin;
+ break;
+ }
+ default:;
+ }
+ GroupC1Layout->addWidget( aSpinWidget, row, 1 );
+ aSpinWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ aSpinWidget->setMinimumSize( 150, 0 );
+ param->InitializeWidget( aSpinWidget );
+ mySpinList.push_back( aSpinWidget );
+ }
+
+ StdMeshersGUI_CreateHypothesisDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
+
+ /***************************************************************/
+ GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "SMESH_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+ buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
+ buttonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ GroupButtonsLayout->addItem( spacer, 0, 2 );
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+ StdMeshersGUI_CreateHypothesisDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
+
+ /***************************************************************/
+ Init() ;
+}
+
+
+//=================================================================================
+// function : ~StdMeshersGUI_CreateHypothesisDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_CreateHypothesisDlg::~StdMeshersGUI_CreateHypothesisDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::Init()
+{
+ mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+
+ char* sHypType = const_cast<char*>(myHypType.latin1());
+ HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
+ LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : QString("") );
+
+ mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
+
+ /* signals and slots connections */
+ connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
+ connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
+ connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
+
+ connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+ connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+ /* Move widget on the botton right corner of main widget */
+ int x, y ;
+ mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+ this->move( x, y ) ;
+ this->show() ; /* displays Dialog */
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::ClickOnOk()
+{
+ if ( ClickOnApply() )
+ ClickOnCancel() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool StdMeshersGUI_CreateHypothesisDlg::ClickOnApply()
+{
+ if ( !mySMESHGUI || mySMESHGUI->ActiveStudyLocked() )
+ return false;
+
+ QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
+ if ( myHypName.isEmpty() ) {
+ QAD_MessageBox::warn1 (this, tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+ return false;
+ }
+
+ QAD_WaitCursor wc;
+
+ try {
+ SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
+ ( SMESH::CreateHypothesis (myHypType,
+ myHypName,
+ false )); // isAlgorithm
+
+ list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
+ list<QWidget*>::iterator widgetIt = mySpinList.begin();
+ for ( ;
+ paramIt != myParamList.end() && widgetIt != mySpinList.end();
+ paramIt++ , widgetIt++ )
+ (*paramIt)->TakeValue( *widgetIt );
+
+ SetParameters( Hyp, myParamList );
+
+ //set new Attribute Comment for hypothesis which parameters were set
+ QString aParams = "";
+ StdMeshersGUI_Parameters::GetParameters( Hyp.in(), myParamList, aParams );
+ SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
+ if (!SHyp->_is_nil())
+ if (!aParams.isEmpty()) {
+ SMESH::SetValue(SHyp, aParams);
+ mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex) {
+ wc.stop();
+ QtCatchCorbaException(S_ex);
+ return false;
+ }
+ return true;
+}
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::ClickOnCancel()
+{
+ close();
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::DeactivateActiveDialog()
+{
+// iconLabel->setEnabled(false) ;
+// typeLabel->setEnabled(false) ;
+// GroupC1->setEnabled(false) ;
+// GroupButtons->setEnabled(false) ;
+ setEnabled(false);
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::ActivateThisDialog()
+{
+ if (! isEnabled() ) {
+ mySMESHGUI->EmitSignalDeactivateDialog() ;
+// iconLabel->setEnabled(true) ;
+// typeLabel->setEnabled(true) ;
+// GroupC1->setEnabled(true) ;
+// GroupButtons->setEnabled(true) ;
+ setEnabled(true) ;
+ }
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::enterEvent(QEvent* e)
+{
+ ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::closeEvent( QCloseEvent* e )
+{
+ mySMESHGUI->ResetState();
+ QDialog::closeEvent( e );
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_CreateHypothesisDlg.h
+// Module : SMESH
+// $Header$
+
+#ifndef DIALOGBOX_CreateHypothesisDlg_H
+#define DIALOGBOX_CreateHypothesisDlg_H
+
+// QT Includes
+#include <qdialog.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESHGUI_aParameter.h"
+
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+
+//=================================================================================
+// class : StdMeshersGUI_CreateHypothesisDlg
+// purpose :
+//=================================================================================
+class StdMeshersGUI_CreateHypothesisDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ StdMeshersGUI_CreateHypothesisDlg (const QString& hypType,
+ QWidget* parent = 0,
+ const char* name = 0,
+ bool modal = FALSE,
+ WFlags fl = 0);
+ ~StdMeshersGUI_CreateHypothesisDlg ();
+
+protected:
+
+ void CreateDlgLayout(const QString & caption,
+ const QPixmap & hypIcon,
+ const QString & hypTypeName);
+
+ virtual void GetParameters(const QString & hypType,
+ std::list<SMESHGUI_aParameterPtr> & params) = 0;
+
+ virtual bool SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
+ const std::list<SMESHGUI_aParameterPtr> & params) = 0;
+
+private:
+
+ void Init() ;
+ void closeEvent( QCloseEvent* e ) ;
+ void enterEvent ( QEvent * ) ;
+
+ SMESHGUI* mySMESHGUI ;
+ QString myHypType ;
+
+ std::list<QWidget*> mySpinList;
+ std::list<SMESHGUI_aParameterPtr> myParamList;
+
+ QLabel* iconLabel;
+ QLabel* typeLabel;
+ QGroupBox* GroupC1;
+ QLabel* TextLabel_NameHypothesis ;
+ QLineEdit* LineEdit_NameHypothesis ;
+ QLabel* TextLabel_Length ;
+ QGroupBox* GroupButtons;
+ QPushButton* buttonOk;
+ QPushButton* buttonApply;
+ QPushButton* buttonCancel;
+
+private slots:
+
+ void ClickOnOk();
+ void ClickOnCancel();
+ bool ClickOnApply();
+ void DeactivateActiveDialog() ;
+ void ActivateThisDialog() ;
+};
+
+#endif // DIALOGBOX_LOCAL_LENGTH_H
--- /dev/null
+// SMESH StdMeshersGUI : GUI for StdMeshers plugin
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_CreateStdHypothesisDlg.cxx
+// Moved here from SMESHGUI_CreateStdHypothesisDlg.cxx
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshersGUI_CreateStdHypothesisDlg.h"
+#include "StdMeshersGUI_Parameters.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_Hypotheses.h"
+
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+#include "QAD_Desktop.h"
+
+//=================================================================================
+// class : StdMeshersGUI_CreateStdHypothesisDlg()
+// purpose :
+//=================================================================================
+StdMeshersGUI_CreateStdHypothesisDlg::StdMeshersGUI_CreateStdHypothesisDlg (const QString& hypType,
+ QWidget* parent,
+ const char* name,
+ bool modal,
+ WFlags fl)
+ : StdMeshersGUI_CreateHypothesisDlg (hypType, parent, name, modal, fl)
+{
+ QString hypTypeStr;
+ if (hypType.compare("LocalLength") == 0)
+ hypTypeStr = "LOCAL_LENGTH";
+ else if (hypType.compare("NumberOfSegments") == 0)
+ hypTypeStr = "NB_SEGMENTS";
+ else if (hypType.compare("MaxElementArea") == 0)
+ hypTypeStr = "MAX_ELEMENT_AREA";
+ else if (hypType.compare("MaxElementVolume") == 0)
+ hypTypeStr = "MAX_ELEMENT_VOLUME";
+ else if (hypType.compare("StartEndLength") == 0)
+ hypTypeStr = "START_END_LENGTH";
+ else if (hypType.compare("Deflection1D") == 0)
+ hypTypeStr = "DEFLECTION1D";
+ else if (hypType.compare("Arithmetic1D") == 0)
+ hypTypeStr = "ARITHMETIC_1D";
+ else
+ return;
+
+ QString caption( tr ( QString( "SMESH_%1_TITLE" ).arg( hypTypeStr )));
+ QString hypTypeName( tr ( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeStr )));
+ QString hypIconName( tr ( QString( "ICON_DLG_%1" ).arg( hypTypeStr )));
+
+ CreateDlgLayout(caption,
+ QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", hypIconName ),
+ hypTypeName);
+}
+
+//=================================================================================
+// function : ~StdMeshersGUI_CreateStdHypothesisDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_CreateStdHypothesisDlg::~StdMeshersGUI_CreateStdHypothesisDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+//=================================================================================
+// function : FillParameters()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateStdHypothesisDlg::GetParameters
+ (const QString & hypType,
+ std::list<SMESHGUI_aParameterPtr> & params)
+{
+ StdMeshersGUI_Parameters::GetParameters( hypType, params );
+}
+
+//=================================================================================
+// function : SetParameters()
+// purpose :
+//=================================================================================
+bool StdMeshersGUI_CreateStdHypothesisDlg::SetParameters
+ (SMESH::SMESH_Hypothesis_ptr theHyp, const list<SMESHGUI_aParameterPtr> & params)
+{
+ StdMeshersGUI_Parameters::SetParameters( theHyp, params );
+ return true;
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_CreateStdHypothesisDlg.h
+// Moved here from SMESHGUI_CreateStdHypothesisDlg.h
+// Author : Nicolas REJNERI
+// Module : SMESH
+// $Header$
+
+#ifndef DIALOGBOX_CreateStdHypothesisDlg_H
+#define DIALOGBOX_CreateStdHypothesisDlg_H
+
+#include "StdMeshersGUI_CreateHypothesisDlg.h"
+
+//=================================================================================
+// class : StdMeshersGUI_CreateStdHypothesisDlg
+// purpose :
+//=================================================================================
+class StdMeshersGUI_CreateStdHypothesisDlg : public StdMeshersGUI_CreateHypothesisDlg
+{
+ Q_OBJECT
+
+ public:
+ StdMeshersGUI_CreateStdHypothesisDlg (const QString& hypType,
+ QWidget* parent = 0,
+ const char* name = 0,
+ bool modal = FALSE,
+ WFlags fl = 0);
+ ~StdMeshersGUI_CreateStdHypothesisDlg ();
+
+ private:
+ virtual void GetParameters(const QString & hypType,
+ std::list<SMESHGUI_aParameterPtr> & params);
+
+ virtual bool SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
+ const std::list<SMESHGUI_aParameterPtr> & params);
+};
+
+#endif
+++ /dev/null
-// SMESH StdMeshersGUI : GUI for StdMeshers plugin
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_LocalLengthDlg.cxx
-// Moved here from SMESHGUI_LocalLengthDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "StdMeshersGUI_LocalLengthDlg.h"
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-
-// QT Includes
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-
-//=================================================================================
-// class : StdMeshersGUI_LocalLengthDlg()
-// purpose : Constructs a StdMeshersGUI_LocalLengthDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-StdMeshersGUI_LocalLengthDlg::StdMeshersGUI_LocalLengthDlg (const QString& hypType,
- QWidget* parent,
- const char* name,
- bool modal,
- WFlags fl)
- : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myHypType(hypType)
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_LOCAL_LENGTH")));
-
- if ( !name )
- setName( "StdMeshersGUI_LocalLengthDlg" );
- setCaption( tr( "SMESH_LOCAL_LENGTH_TITLE" ) );
- setSizeGripEnabled( TRUE );
- QGridLayout* StdMeshersGUI_LocalLengthDlgLayout = new QGridLayout( this );
- StdMeshersGUI_LocalLengthDlgLayout->setSpacing( 6 );
- StdMeshersGUI_LocalLengthDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- iconLabel = new QLabel( this );
- iconLabel->setPixmap( image0 );
- iconLabel->setScaledContents( false );
- iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- typeLabel = new QLabel( this );
- typeLabel->setText( tr( "SMESH_LOCAL_LENGTH_HYPOTHESIS" ) );
- StdMeshersGUI_LocalLengthDlgLayout->addWidget( iconLabel, 0, 0 );
- StdMeshersGUI_LocalLengthDlgLayout->addWidget( typeLabel, 0, 1 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
-
- TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
- TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
- GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
-
- LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
- GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
-
- TextLabel_Length = new QLabel(GroupC1 , "TextLabel_Length" );
- TextLabel_Length->setText( tr( "SMESH_LENGTH" ) );
- GroupC1Layout->addWidget( TextLabel_Length, 1, 0 );
-
- SpinBox_Length = new SMESHGUI_SpinBox( GroupC1, "SpinBox_Length" );
- GroupC1Layout->addWidget( SpinBox_Length, 1, 1 );
-
- StdMeshersGUI_LocalLengthDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer, 0, 2 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- StdMeshersGUI_LocalLengthDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
-
- /***************************************************************/
- Init() ;
-}
-
-
-//=================================================================================
-// function : ~StdMeshersGUI_LocalLengthDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-StdMeshersGUI_LocalLengthDlg::~StdMeshersGUI_LocalLengthDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::Init()
-{
- /* min, max, step and decimals for spin boxes */
- SpinBox_Length->RangeStepAndValidator( 0.001, 999.999, 1.0, 3 ) ;
- SpinBox_Length->SetValue( 1.0 ) ;
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- char* sHypType = (char*)myHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
- //_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
- if (aHypData!=0)
- {
- LineEdit_NameHypothesis->setText(aHypData->Label);
- }
- else
- {
- LineEdit_NameHypothesis->setText("");
- }
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
- connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
- connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
-
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-}
-
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::ClickOnOk()
-{
- if ( this->ClickOnApply() )
- this->ClickOnCancel() ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-bool StdMeshersGUI_LocalLengthDlg::ClickOnApply()
-{
- QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
- if ( myHypName.isEmpty() ) {
- QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
- return false;
- }
-
- double myLength = SpinBox_Length->GetValue();
-
- QAD_WaitCursor wc;
- try {
- SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
- (mySMESHGUI->CreateHypothesis(myHypType,
- myHypName,
- false)); // isAlgorithm
- StdMeshers::StdMeshers_LocalLength_var LL =
- StdMeshers::StdMeshers_LocalLength::_narrow(Hyp);
- if (!LL->_is_nil())
- LL->SetLength(myLength);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- wc.stop();
- QtCatchCorbaException(S_ex);
- return false;
- }
- return true;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::ClickOnCancel()
-{
- close();
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::DeactivateActiveDialog()
-{
- iconLabel->setEnabled(false) ;
- typeLabel->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::ActivateThisDialog()
-{
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- iconLabel->setEnabled(true) ;
- typeLabel->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::enterEvent(QEvent* e)
-{
- ActivateThisDialog() ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_LocalLengthDlg::closeEvent( QCloseEvent* e )
-{
- mySMESHGUI->ResetState();
- QDialog::closeEvent( e );
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_LocalLengthDlg.h
-// Moved here from SMESHGUI_LocalLengthDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_LOCAL_LENGTH_H
-#define DIALOGBOX_LOCAL_LENGTH_H
-
-// QT Includes
-#include <qdialog.h>
-
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class SMESHGUI;
-class SMESHGUI_SpinBox;
-
-//=================================================================================
-// class : StdMeshersGUI_LocalLengthDlg
-// purpose :
-//=================================================================================
-class StdMeshersGUI_LocalLengthDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- StdMeshersGUI_LocalLengthDlg (const QString& hypType,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0);
- ~StdMeshersGUI_LocalLengthDlg ();
-
-private:
-
- void Init() ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ;
-
- SMESHGUI* mySMESHGUI ;
- QString myHypType ;
-
- QLabel* iconLabel;
- QLabel* typeLabel;
- QGroupBox* GroupC1;
- QLabel* TextLabel_NameHypothesis ;
- QLineEdit* LineEdit_NameHypothesis ;
- QLabel* TextLabel_Length ;
- SMESHGUI_SpinBox* SpinBox_Length ;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonApply;
- QPushButton* buttonCancel;
-
-private slots:
-
- void ClickOnOk();
- void ClickOnCancel();
- bool ClickOnApply();
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-};
-
-#endif // DIALOGBOX_LOCAL_LENGTH_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_MaxElementAreaDlg.cxx
-// Moved here from SMESHGUI_MaxElementAreaDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "StdMeshersGUI_MaxElementAreaDlg.h"
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-
-// QT Includes
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-
-//=================================================================================
-// class : StdMeshersGUI_MaxElementAreaDlg()
-// purpose : Constructs a StdMeshersGUI_MaxElementAreaDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-StdMeshersGUI_MaxElementAreaDlg::StdMeshersGUI_MaxElementAreaDlg (const QString& hypType,
- QWidget* parent,
- const char* name,
- bool modal,
- WFlags fl)
- : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myHypType(hypType)
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_AREA")));
-
- if ( !name )
- setName( "StdMeshersGUI_MaxElementAreaDlg" );
- setCaption( tr( "SMESH_MAX_ELEMENT_AREA_TITLE" ) );
- setSizeGripEnabled( TRUE );
- QGridLayout* StdMeshersGUI_MaxElementAreaDlgLayout = new QGridLayout( this );
- StdMeshersGUI_MaxElementAreaDlgLayout->setSpacing( 6 );
- StdMeshersGUI_MaxElementAreaDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- iconLabel = new QLabel( this );
- iconLabel->setPixmap( image0 );
- iconLabel->setScaledContents( false );
- iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- typeLabel = new QLabel( this );
- typeLabel->setText( tr( "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS" ) );
- StdMeshersGUI_MaxElementAreaDlgLayout->addWidget( iconLabel, 0, 0 );
- StdMeshersGUI_MaxElementAreaDlgLayout->addWidget( typeLabel, 0, 1 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
-
- TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
- TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
- GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
-
- LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
- GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
-
- TextLabel_MaxElementArea = new QLabel(GroupC1 , "TextLabel_MaxElementArea" );
- TextLabel_MaxElementArea->setText( tr( "SMESH_MAX_ELEMENT_AREA" ) );
- GroupC1Layout->addWidget( TextLabel_MaxElementArea, 1, 0 );
-
- SpinBox_MaxElementArea = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementArea" ) ;
- GroupC1Layout->addWidget( SpinBox_MaxElementArea, 1, 1 );
-
- StdMeshersGUI_MaxElementAreaDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1);
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer, 0, 2 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- StdMeshersGUI_MaxElementAreaDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
-
- /***************************************************************/
- Init() ;
-}
-
-
-//=================================================================================
-// function : ~StdMeshersGUI_MaxElementAreaDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-StdMeshersGUI_MaxElementAreaDlg::~StdMeshersGUI_MaxElementAreaDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::Init()
-{
- /* min, max, step and decimals for spin boxes */
- SpinBox_MaxElementArea->setPrecision( 10 );
- SpinBox_MaxElementArea->RangeStepAndValidator( 0.001, 999999.999, 1.0, 3 ) ;
- SpinBox_MaxElementArea->SetValue( 1.0 ) ; /* is myMaxElementArea */
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- char* sHypType = (char*)myHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
- //CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
- if (aHypData!=0)
- {
- LineEdit_NameHypothesis->setText(aHypData->Label);
- }
- else
- {
- LineEdit_NameHypothesis->setText("");
- }
-
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
- connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
- connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
-
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-}
-
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::ClickOnOk()
-{
- if ( this->ClickOnApply() )
- this->ClickOnCancel() ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-bool StdMeshersGUI_MaxElementAreaDlg::ClickOnApply()
-{
- QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
- if ( myHypName.isEmpty() ) {
- QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
- return false;
- }
-
- double myMaxElementArea = SpinBox_MaxElementArea->GetValue();
-
- QAD_WaitCursor wc;
- try {
- SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
- (mySMESHGUI->CreateHypothesis(myHypType,
- myHypName,
- false)); // isAlgorithm
- StdMeshers::StdMeshers_MaxElementArea_var MaxElArea =
- StdMeshers::StdMeshers_MaxElementArea::_narrow(Hyp);
- if (!MaxElArea->_is_nil())
- MaxElArea->SetMaxElementArea(myMaxElementArea);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- wc.stop();
- QtCatchCorbaException(S_ex);
- return false;
- }
- return true;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::ClickOnCancel()
-{
- close();
-}
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::DeactivateActiveDialog()
-{
- iconLabel->setEnabled(false) ;
- typeLabel->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::ActivateThisDialog()
-{
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- iconLabel->setEnabled(true) ;
- typeLabel->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::enterEvent(QEvent* e)
-{
- ActivateThisDialog() ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementAreaDlg::closeEvent( QCloseEvent* e )
-{
- mySMESHGUI->ResetState();
- QDialog::closeEvent( e );
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_MaxElementAreaDlg.h
-// Moved here from SMESHGUI_MaxElementAreaDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_MAX_ELEMENT_AREA_H
-#define DIALOGBOX_MAX_ELEMENT_AREA_H
-
-// QT Includes
-#include <qdialog.h>
-
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class SMESHGUI;
-class SMESHGUI_SpinBox;
-
-//=================================================================================
-// class : StdMeshersGUI_MaxElementAreaDlg
-// purpose :
-//=================================================================================
-class StdMeshersGUI_MaxElementAreaDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- StdMeshersGUI_MaxElementAreaDlg (const QString& hypType,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0 );
- ~StdMeshersGUI_MaxElementAreaDlg ();
-
-private:
-
- void Init() ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ;
-
- SMESHGUI* mySMESHGUI ;
- QString myHypType ;
-
- QLabel* iconLabel;
- QLabel* typeLabel;
- QGroupBox* GroupC1;
- QLabel* TextLabel_NameHypothesis ;
- QLineEdit* LineEdit_NameHypothesis ;
- QLabel* TextLabel_MaxElementArea ;
- SMESHGUI_SpinBox* SpinBox_MaxElementArea ;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
-private slots:
-
- void ClickOnOk();
- void ClickOnCancel();
- bool ClickOnApply();
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-};
-
-#endif // DIALOGBOX_MAX_ELEMENT_AREA_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_MaxElementVolumeDlg.cxx
-// Moved here from SMESHGUI_MaxElementVolumeDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "StdMeshersGUI_MaxElementVolumeDlg.h"
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-
-// QT Includes
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-
-//=================================================================================
-// class : StdMeshersGUI_MaxElementVolumeDlg()
-// purpose : Constructs a StdMeshersGUI_MaxElementVolumeDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-StdMeshersGUI_MaxElementVolumeDlg::StdMeshersGUI_MaxElementVolumeDlg (const QString& hypType,
- QWidget* parent,
- const char* name,
- bool modal, WFlags fl)
- : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myHypType(hypType)
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_VOLUME")));
-
- if ( !name )
- setName( "StdMeshersGUI_MaxElementVolumeDlg" );
- setCaption( tr( "SMESH_MAX_ELEMENT_VOLUME_TITLE" ) );
- setSizeGripEnabled( TRUE );
- QGridLayout* StdMeshersGUI_MaxElementVolumeDlgLayout = new QGridLayout( this );
- StdMeshersGUI_MaxElementVolumeDlgLayout->setSpacing( 6 );
- StdMeshersGUI_MaxElementVolumeDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- iconLabel = new QLabel( this );
- iconLabel->setPixmap( image0 );
- iconLabel->setScaledContents( false );
- iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- typeLabel = new QLabel( this );
- typeLabel->setText( tr( "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS" ) );
- StdMeshersGUI_MaxElementVolumeDlgLayout->addWidget( iconLabel, 0, 0 );
- StdMeshersGUI_MaxElementVolumeDlgLayout->addWidget( typeLabel, 0, 1 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer, 0, 2 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- StdMeshersGUI_MaxElementVolumeDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
-
- TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
- TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
- GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
-
- LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
- GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
-
- TextLabel_MaxElementVolume = new QLabel(GroupC1 , "TextLabel_MaxElementVolume" );
- TextLabel_MaxElementVolume->setText( tr( "SMESH_MAX_ELEMENT_VOLUME" ) );
- GroupC1Layout->addWidget( TextLabel_MaxElementVolume, 1, 0 );
-
- SpinBox_MaxElementVolume = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementVolume" ) ;
- GroupC1Layout->addWidget( SpinBox_MaxElementVolume, 1, 1 );
-
- StdMeshersGUI_MaxElementVolumeDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
-
- /***************************************************************/
- Init() ;
-}
-
-
-//=================================================================================
-// function : ~StdMeshersGUI_MaxElementVolumeDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-StdMeshersGUI_MaxElementVolumeDlg::~StdMeshersGUI_MaxElementVolumeDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::Init()
-{
- /* min, max, step and decimals for spin boxes */
- SpinBox_MaxElementVolume->setPrecision( 10 );
- SpinBox_MaxElementVolume->RangeStepAndValidator( 0.001, 999999.999, 1.0, 3 ) ;
- SpinBox_MaxElementVolume->SetValue( 1.0 ) ; /* is myMaxElementVolume */
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- char* sHypType = (char*)myHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
- //_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
- if (aHypData!=0)
- {
- LineEdit_NameHypothesis->setText(aHypData->Label);
- }
- else
- {
- LineEdit_NameHypothesis->setText("");
- }
-
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
- connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
- connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
-
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-}
-
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::ClickOnOk()
-{
- if ( this->ClickOnApply() )
- this->ClickOnCancel() ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-bool StdMeshersGUI_MaxElementVolumeDlg::ClickOnApply()
-{
- QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
- if ( myHypName.isEmpty() ) {
- QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
- return false;
- }
-
- double myMaxElementVolume = SpinBox_MaxElementVolume->GetValue();
-
- QAD_WaitCursor wc;
- try {
- SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
- (mySMESHGUI->CreateHypothesis(myHypType,
- myHypName,
- false)); // isAlgorithm
- StdMeshers::StdMeshers_MaxElementVolume_var MaxElVolume =
- StdMeshers::StdMeshers_MaxElementVolume::_narrow(Hyp);
- if (!MaxElVolume->_is_nil())
- MaxElVolume->SetMaxElementVolume(myMaxElementVolume);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- wc.stop();
- QtCatchCorbaException(S_ex);
- return false;
- }
- return true;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::ClickOnCancel()
-{
- close();
-}
-
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::DeactivateActiveDialog()
-{
- iconLabel->setEnabled(false) ;
- typeLabel->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::ActivateThisDialog()
-{
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- iconLabel->setEnabled(true) ;
- typeLabel->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::enterEvent(QEvent* e)
-{
- ActivateThisDialog() ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_MaxElementVolumeDlg::closeEvent( QCloseEvent* e )
-{
- mySMESHGUI->ResetState();
- QDialog::closeEvent( e );
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_MaxElementVolumeDlg.h
-// Moved here from SMESHGUI_MaxElementVolumeDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_MAX_ELEMENT_VOLUME_H
-#define DIALOGBOX_MAX_ELEMENT_VOLUME_H
-
-// QT Includes
-#include <qdialog.h>
-
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class SMESHGUI;
-class SMESHGUI_SpinBox;
-
-//=================================================================================
-// class : StdMeshersGUI_MaxElementVolumeDlg
-// purpose :
-//=================================================================================
-class StdMeshersGUI_MaxElementVolumeDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- StdMeshersGUI_MaxElementVolumeDlg (const QString& hypType,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0 );
- ~StdMeshersGUI_MaxElementVolumeDlg ();
-
-private:
-
- void Init() ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ;
-
- SMESHGUI* mySMESHGUI ;
- QString myHypType ;
-
- QLabel* iconLabel;
- QLabel* typeLabel;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QGroupBox* GroupC1;
- QLabel* TextLabel_NameHypothesis ;
- QLineEdit* LineEdit_NameHypothesis ;
- QLabel* TextLabel_MaxElementVolume ;
- SMESHGUI_SpinBox* SpinBox_MaxElementVolume ;
-
-private slots:
-
- void ClickOnOk();
- void ClickOnCancel();
- bool ClickOnApply();
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-};
-
-#endif // DIALOGBOX_MAX_ELEMENT_VOLUME_H
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_NbSegmentsDlg.cxx
-// Moved here from SMESHGUI_NbSegmentsDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-using namespace std;
-#include "StdMeshersGUI_NbSegmentsDlg.h"
-#include "SMESHGUI.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
-
-// QT Includes
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-#include <qspinbox.h>
-
-//=================================================================================
-// class : StdMeshersGUI_NbSegmentsDlg()
-// purpose : Constructs a StdMeshersGUI_NbSegmentsDlg which is a child of 'parent', with the
-// name 'name' and widget flags set to 'f'.
-// The dialog will by default be modeless, unless you set 'modal' to
-// TRUE to construct a modal dialog.
-//=================================================================================
-StdMeshersGUI_NbSegmentsDlg::StdMeshersGUI_NbSegmentsDlg (const QString& hypType,
- QWidget* parent,
- const char* name,
- bool modal,
- WFlags fl)
- : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myHypType(hypType)
-{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_NB_SEGMENTS")));
-
- if ( !name )
- setName( "StdMeshersGUI_NbSegmentsDlg" );
- setCaption( tr( "SMESH_NB_SEGMENTS_TITLE" ) );
- setSizeGripEnabled( TRUE );
- QGridLayout* StdMeshersGUI_NbSegmentsDlgLayout = new QGridLayout( this );
- StdMeshersGUI_NbSegmentsDlgLayout->setSpacing( 6 );
- StdMeshersGUI_NbSegmentsDlgLayout->setMargin( 11 );
-
- /***************************************************************/
- iconLabel = new QLabel( this );
- iconLabel->setPixmap( image0 );
- iconLabel->setScaledContents( false );
- iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- typeLabel = new QLabel( this );
- typeLabel->setText( tr( "SMESH_NB_SEGMENTS_HYPOTHESIS" ) );
- StdMeshersGUI_NbSegmentsDlgLayout->addWidget( iconLabel, 0, 0 );
- StdMeshersGUI_NbSegmentsDlgLayout->addWidget( typeLabel, 0, 1 );
-
- /***************************************************************/
- GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setSpacing( 0 );
- GroupC1->layout()->setMargin( 0 );
- QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setSpacing( 6 );
- GroupC1Layout->setMargin( 11 );
-
- LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
- GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
-
- TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
- TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
- GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
-
- TextLabel_NbSeg = new QLabel(GroupC1 , "TextLabel_NbSeg" );
- TextLabel_NbSeg->setText( tr( "SMESH_SEGMENTS" ) );
- GroupC1Layout->addWidget( TextLabel_NbSeg, 1, 0 );
-
- SpinBox_NbSeg = new QSpinBox( GroupC1, "SpinBox_NbSeg" );
- GroupC1Layout->addWidget( SpinBox_NbSeg, 1, 1 );
-
- StdMeshersGUI_NbSegmentsDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
-
- /***************************************************************/
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
- buttonOk = new QPushButton( GroupButtons, "buttonOk" );
- buttonOk->setText( tr( "SMESH_BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- buttonApply = new QPushButton( GroupButtons, "buttonApply" );
- buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- GroupButtonsLayout->addItem( spacer, 0, 2 );
- buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
- StdMeshersGUI_NbSegmentsDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
-
- /***************************************************************/
- Init() ;
-}
-
-
-//=================================================================================
-// function : ~StdMeshersGUI_NbSegmentsDlg()
-// purpose : Destroys the object and frees any allocated resources
-//=================================================================================
-StdMeshersGUI_NbSegmentsDlg::~StdMeshersGUI_NbSegmentsDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
-//=================================================================================
-// function : Init()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::Init()
-{
- SpinBox_NbSeg->setMinValue( 1 );
- SpinBox_NbSeg->setMaxValue( 9999 );
- SpinBox_NbSeg->setValue(3) ; /* myNbSeg */
-
- mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
-
- char* sHypType = (char*)myHypType.latin1();
- HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
- //_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
- if (aHypData!=0)
- {
- LineEdit_NameHypothesis->setText(aHypData->Label);
- }
- else
- {
- LineEdit_NameHypothesis->setText("");
- }
-
- mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
-
- /* signals and slots connections */
- connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
- connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
- connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
-
- connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
- connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
-
- /* Move widget on the botton right corner of main widget */
- int x, y ;
- mySMESHGUI->DefineDlgPosition( this, x, y ) ;
- this->move( x, y ) ;
- this->show() ; /* displays Dialog */
-}
-
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::ClickOnOk()
-{
- if ( this->ClickOnApply() )
- this->ClickOnCancel() ;
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose :
-//=================================================================================
-bool StdMeshersGUI_NbSegmentsDlg::ClickOnApply()
-{
- QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
- if ( myHypName.isEmpty() ) {
- QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
- return false;
- }
-
- long myNbSeg = SpinBox_NbSeg->value();
-
- QAD_WaitCursor wc;
- try {
- SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
- (mySMESHGUI->CreateHypothesis(myHypType,
- myHypName,
- false)); // isAlgorithm
- StdMeshers::StdMeshers_NumberOfSegments_var NbS =
- StdMeshers::StdMeshers_NumberOfSegments::_narrow(Hyp);
- if (!NbS->_is_nil())
- NbS->SetNumberOfSegments(myNbSeg);
- }
- catch (const SALOME::SALOME_Exception& S_ex) {
- wc.stop();
- QtCatchCorbaException(S_ex);
- return false;
- }
- return true;
-}
-
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::ClickOnCancel()
-{
- close();
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::DeactivateActiveDialog()
-{
- iconLabel->setEnabled(false) ;
- typeLabel->setEnabled(false) ;
- GroupC1->setEnabled(false) ;
- GroupButtons->setEnabled(false) ;
-}
-
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::ActivateThisDialog()
-{
- mySMESHGUI->EmitSignalDeactivateDialog() ;
- iconLabel->setEnabled(true) ;
- typeLabel->setEnabled(true) ;
- GroupC1->setEnabled(true) ;
- GroupButtons->setEnabled(true) ;
-}
-
-
-//=================================================================================
-// function : enterEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::enterEvent(QEvent* e)
-{
- ActivateThisDialog() ;
-}
-
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void StdMeshersGUI_NbSegmentsDlg::closeEvent( QCloseEvent* e )
-{
- mySMESHGUI->ResetState();
- QDialog::closeEvent( e );
-}
+++ /dev/null
-// SMESH SMESHGUI : GUI for SMESH component
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : StdMeshersGUI_NbSegmentsDlg.h
-// Moved here from SMESHGUI_NbSegmentsDlg.h
-// Author : Nicolas REJNERI
-// Module : SMESH
-// $Header$
-
-#ifndef DIALOGBOX_NB_SEGMENTS_H
-#define DIALOGBOX_NB_SEGMENTS_H
-
-// QT Includes
-#include <qdialog.h>
-
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QSpinBox;
-class QPushButton;
-class SMESHGUI;
-
-//=================================================================================
-// class : StdMeshersGUI_NbSegmentsDlg
-// purpose :
-//=================================================================================
-class StdMeshersGUI_NbSegmentsDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- StdMeshersGUI_NbSegmentsDlg (const QString& hypType,
- QWidget* parent = 0,
- const char* name = 0,
- bool modal = FALSE,
- WFlags fl = 0);
- ~StdMeshersGUI_NbSegmentsDlg ();
-
-private:
-
- void Init() ;
- void closeEvent( QCloseEvent* e ) ;
- void enterEvent ( QEvent * ) ;
-
- SMESHGUI* mySMESHGUI ;
- QString myHypType ;
-
- QLabel* iconLabel;
- QLabel* typeLabel;
- QGroupBox* GroupC1;
- QLabel* TextLabel_NameHypothesis ;
- QLineEdit* LineEdit_NameHypothesis ;
- QLabel* TextLabel_NbSeg ;
- QSpinBox* SpinBox_NbSeg ;
- QGroupBox* GroupButtons;
- QPushButton* buttonApply;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
-private slots:
-
- void ClickOnOk();
- void ClickOnCancel();
- bool ClickOnApply();
- void DeactivateActiveDialog() ;
- void ActivateThisDialog() ;
-};
-
-#endif // DIALOGBOX_NB_SEGMENTS_H
--- /dev/null
+// SMESH StdMeshersGUI : GUI for standard meshers
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_Parameters.cxx
+// Module : SMESH
+// $Header$
+
+#include "StdMeshersGUI_Parameters.h"
+
+#include <qobject.h>
+
+using namespace std;
+
+//=======================================================================
+//function : HasParameters
+//purpose :
+//=======================================================================
+
+bool StdMeshersGUI_Parameters::HasParameters (const QString& hypType)
+{
+ return ((hypType.compare("LocalLength") == 0) ||
+ (hypType.compare("NumberOfSegments") == 0) ||
+ (hypType.compare("MaxElementArea") == 0) ||
+ (hypType.compare("MaxElementVolume") == 0) ||
+ (hypType.compare("StartEndLength") == 0) ||
+ (hypType.compare("Deflection1D") == 0) ||
+ (hypType.compare("Arithmetic1D") == 0));
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose :
+//=======================================================================
+
+#define DOUBLE_PARAM(v,l,b,t,s,d) SMESHGUI_aParameterPtr(new SMESHGUI_doubleParameter(v,l,b,t,s,d))
+#define INT_PARAM(v,l,b,t) SMESHGUI_aParameterPtr(new SMESHGUI_intParameter(v,l,b,t))
+
+void StdMeshersGUI_Parameters::GetParameters (const QString& hypType,
+ list<SMESHGUI_aParameterPtr> & paramList )
+{
+ paramList.clear();
+
+ if (hypType.compare("LocalLength") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM (1.0,
+ QObject::tr("SMESH_LOCAL_LENGTH_PARAM"),
+ 0.001, 999.999, 1.0, 3));
+ }
+ else if (hypType.compare("NumberOfSegments") == 0)
+ {
+ paramList.push_back ( INT_PARAM (3,
+ QObject::tr("SMESH_NB_SEGMENTS_PARAM"),
+ 1, 9999 ));
+ }
+ else if (hypType.compare("Arithmetic1D") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM ( 1.0,
+ QObject::tr("SMESH_START_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ paramList.push_back( DOUBLE_PARAM ( 10.0,
+ QObject::tr("SMESH_END_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+ else if (hypType.compare("MaxElementArea") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM (1.0,
+ QObject::tr("SMESH_MAX_ELEMENT_AREA_PARAM"),
+ 0.001, 999999.999, 1.0, 3));
+ }
+ else if (hypType.compare("MaxElementVolume") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM ( 1.0,
+ QObject::tr("SMESH_MAX_ELEMENT_VOLUME_PARAM"),
+ 0.001, 999999.999, 1.0, 3));
+ }
+ else if (hypType.compare("StartEndLength") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM ( 1.0,
+ QObject::tr("SMESH_START_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ paramList.push_back( DOUBLE_PARAM ( 10.0,
+ QObject::tr("SMESH_END_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+ else if (hypType.compare("Deflection1D") == 0)
+ {
+ paramList.push_back( DOUBLE_PARAM ( 1.0,
+ QObject::tr("SMESH_DEFLECTION1D_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose :
+//=======================================================================
+
+void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr theHyp,
+ list<SMESHGUI_aParameterPtr> & paramList )
+{
+ paramList.clear();
+
+ if (theHyp->_is_nil()) return;
+
+ QString hypType = theHyp->GetName();
+
+ if (hypType.compare("LocalLength") == 0)
+ {
+ StdMeshers::StdMeshers_LocalLength_var LL =
+ StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
+ double length = LL->GetLength();
+ paramList.push_back( DOUBLE_PARAM (length,
+ QObject::tr("SMESH_LOCAL_LENGTH_PARAM"),
+ 0.001, 999.999, 1.0, 3));
+ }
+ else if (hypType.compare("NumberOfSegments") == 0)
+ {
+ StdMeshers::StdMeshers_NumberOfSegments_var NOS =
+ StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
+ int NbSeg = NOS->GetNumberOfSegments() ;
+ paramList.push_back ( INT_PARAM (NbSeg,
+ QObject::tr("SMESH_NB_SEGMENTS_PARAM"),
+ 1, 9999 ));
+ }
+ else if (hypType.compare("Arithmetic1D") == 0)
+ {
+ StdMeshers::StdMeshers_Arithmetic1D_var hyp =
+ StdMeshers::StdMeshers_Arithmetic1D::_narrow(theHyp);
+ double begLength = hyp->GetLength( true ) ;
+ double endLength = hyp->GetLength( false ) ;
+ paramList.push_back( DOUBLE_PARAM ( begLength,
+ QObject::tr("SMESH_START_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ paramList.push_back( DOUBLE_PARAM ( endLength,
+ QObject::tr("SMESH_END_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+ else if (hypType.compare("MaxElementArea") == 0)
+ {
+ StdMeshers::StdMeshers_MaxElementArea_var MEA =
+ StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
+ double MaxArea = MEA->GetMaxElementArea();
+ paramList.push_back( DOUBLE_PARAM (MaxArea,
+ QObject::tr("SMESH_MAX_ELEMENT_AREA_PARAM"),
+ 0.001, 999999.999, 1.0, 3));
+ }
+ else if (hypType.compare("MaxElementVolume") == 0)
+ {
+ StdMeshers::StdMeshers_MaxElementVolume_var MEV =
+ StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
+ double MaxVolume = MEV->GetMaxElementVolume() ;
+ paramList.push_back( DOUBLE_PARAM ( MaxVolume,
+ QObject::tr("SMESH_MAX_ELEMENT_VOLUME_PARAM"),
+ 0.001, 999999.999, 1.0, 3));
+ }
+ else if (hypType.compare("StartEndLength") == 0)
+ {
+ StdMeshers::StdMeshers_StartEndLength_var hyp =
+ StdMeshers::StdMeshers_StartEndLength::_narrow(theHyp);
+ double begLength = hyp->GetLength( true ) ;
+ double endLength = hyp->GetLength( false ) ;
+ paramList.push_back( DOUBLE_PARAM ( begLength,
+ QObject::tr("SMESH_START_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ paramList.push_back( DOUBLE_PARAM ( endLength,
+ QObject::tr("SMESH_END_LENGTH_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+ else if (hypType.compare("Deflection1D") == 0)
+ {
+ StdMeshers::StdMeshers_Deflection1D_var hyp =
+ StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
+ double value = hyp->GetDeflection() ;
+ paramList.push_back( DOUBLE_PARAM ( value,
+ QObject::tr("SMESH_DEFLECTION1D_PARAM"),
+ 1.0E-5, 1E6, 1, 6));
+ }
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose :
+//=======================================================================
+void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
+ list<SMESHGUI_aParameterPtr> & paramList,
+ QString& params)
+{
+ params = "";
+ list<SMESHGUI_aParameterPtr>::iterator paramIt = paramList.begin();
+ for ( ; paramIt != paramList.end(); paramIt++) {
+ int aIntValue;
+ double aDoubleValue;
+ if (params.compare("")) params += " ; ";
+ if ((*paramIt)->GetType() == SMESHGUI_aParameter::INT) {
+ (*paramIt)->GetNewInt(aIntValue);
+ params += QString::number(aIntValue);;
+ }
+ else {
+ (*paramIt)->GetNewDouble(aDoubleValue);
+ params += QString::number(aDoubleValue);
+ }
+ }
+}
+
+//=======================================================================
+//function : SetParameters
+//purpose :
+//=======================================================================
+
+bool StdMeshersGUI_Parameters::SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
+ const list<SMESHGUI_aParameterPtr> & paramList )
+{
+ if (theHyp->_is_nil() || paramList.empty()) return false;
+
+ bool modified = false;
+
+ QString hypType = theHyp->GetName();
+
+ if (hypType.compare("LocalLength") == 0)
+ {
+ StdMeshers::StdMeshers_LocalLength_var LL =
+ StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
+ double length = LL->GetLength();
+ modified = paramList.front()->GetNewDouble( length );
+ LL->SetLength(length);
+ }
+ else if (hypType.compare("NumberOfSegments") == 0)
+ {
+ StdMeshers::StdMeshers_NumberOfSegments_var NOS =
+ StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
+ int NbSeg = NOS->GetNumberOfSegments();
+ modified = paramList.front()->GetNewInt( NbSeg );
+ NOS->SetNumberOfSegments(NbSeg);
+ }
+ else if (hypType.compare("Arithmetic1D") == 0)
+ {
+ if ( paramList.size() != 2 )
+ return false;
+ StdMeshers::StdMeshers_Arithmetic1D_var hyp =
+ StdMeshers::StdMeshers_Arithmetic1D::_narrow(theHyp);
+ double begLength = hyp->GetLength( true ) ;
+ double endLength = hyp->GetLength( false ) ;
+ modified = paramList.front()->GetNewDouble( begLength );
+ modified = paramList.back()->GetNewDouble( endLength ) || modified;
+ hyp->SetLength( begLength, true );
+ hyp->SetLength( endLength, false );
+ }
+ else if (hypType.compare("MaxElementArea") == 0)
+ {
+ StdMeshers::StdMeshers_MaxElementArea_var MEA =
+ StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
+ double MaxArea = MEA->GetMaxElementArea();
+ modified = paramList.front()->GetNewDouble( MaxArea );
+ MEA->SetMaxElementArea(MaxArea);
+ }
+ else if (hypType.compare("MaxElementVolume") == 0)
+ {
+ StdMeshers::StdMeshers_MaxElementVolume_var MEV =
+ StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
+ double MaxVolume = MEV->GetMaxElementVolume() ;
+ modified = paramList.front()->GetNewDouble( MaxVolume );
+ MEV->SetMaxElementVolume(MaxVolume);
+ }
+ else if (hypType.compare("StartEndLength") == 0)
+ {
+ if ( paramList.size() != 2 )
+ return false;
+ StdMeshers::StdMeshers_StartEndLength_var hyp =
+ StdMeshers::StdMeshers_StartEndLength::_narrow(theHyp);
+ double begLength = hyp->GetLength( true ) ;
+ double endLength = hyp->GetLength( false ) ;
+ modified = paramList.front()->GetNewDouble( begLength );
+ modified = paramList.back()->GetNewDouble( endLength ) || modified;
+ hyp->SetLength( begLength, true );
+ hyp->SetLength( endLength, false );
+ }
+ else if (hypType.compare("Deflection1D") == 0)
+ {
+ StdMeshers::StdMeshers_Deflection1D_var hyp =
+ StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
+ double value = hyp->GetDeflection() ;
+ modified = paramList.front()->GetNewDouble( value );
+ hyp->SetDeflection( value );
+ }
+ return modified ;
+}
+
--- /dev/null
+// SMESH StdMeshersGUI : GUI for standard meshers
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshersGUI_Parameters.h
+// Module : SMESH
+// $Header$
+
+#ifndef STDMESHERSGUI_PARAMETERS_H
+#define STDMESHERSGUI_PARAMETERS_H
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESHGUI_aParameter.h"
+
+#include <list>
+
+class StdMeshersGUI_Parameters
+{
+ public:
+ static bool HasParameters (const QString& hypType);
+
+ static void GetParameters (const QString& hypType,
+ std::list<SMESHGUI_aParameterPtr> & params );
+
+ static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
+ std::list<SMESHGUI_aParameterPtr> & params );
+ static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
+ std::list<SMESHGUI_aParameterPtr> & paramList,
+ QString& params);
+
+ static bool SetParameters(SMESH::SMESH_Hypothesis_ptr hyp,
+ const std::list<SMESHGUI_aParameterPtr> & params );
+};
+#endif
msgid "ICON_DLG_MAX_ELEMENT_VOLUME"
msgstr "mesh_hypo_volume.png"
+#Hypo Start End Length
+msgid "ICON_DLG_START_END_LENGTH"
+msgstr "mesh_hypo_length.png"
+
+#Hypo deflection 1D
+msgid "ICON_DLG_DEFLECTION1D"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Geometric 1D
+msgid "ICON_DLG_GEOMETRIC_1D"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Arithmetic 1D
+msgid "ICON_DLG_ARITHMETIC_1D"
+msgstr "mesh_hypo_length.png"
+
#-----------------------------------------------------------
# ObjectBrowser
#mesh_tree_hypo_nonconform
msgid "ICON_SMESH_TREE_HYPO_NotConformAllowed"
msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_start_end_length
+msgid "ICON_SMESH_TREE_HYPO_StartEndLength"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_deflection1d
+msgid "ICON_SMESH_TREE_HYPO_Deflection1D"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_Arithmetic1d
+msgid "ICON_SMESH_TREE_HYPO_Arithmetic1D"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_propagation
+msgid "ICON_SMESH_TREE_HYPO_Propagation"
+msgstr "mesh_tree_hypo_length.png"
# -------------- Local Length --------------
msgid "SMESH_LOCAL_LENGTH_HYPOTHESIS"
-msgstr "Local Length"
+msgstr "Average Length"
+
+msgid "SMESH_LOCAL_LENGTH_PARAM"
+msgstr "Length"
msgid "SMESH_LOCAL_LENGTH_TITLE"
msgstr "Hypothesis Construction"
msgid "SMESH_NB_SEGMENTS_HYPOTHESIS"
msgstr "Number of Segments"
+msgid "SMESH_NB_SEGMENTS_PARAM"
+msgstr "Number of Segments"
+
msgid "SMESH_NB_SEGMENTS_TITLE"
msgstr "Hypothesis Construction"
# ----------- Max. Element Area ------------
-msgid "SMESH_MAX_ELEMENT_AREA"
+msgid "SMESH_MAX_ELEMENT_AREA_PARAM"
msgstr "Max. Area"
msgid "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"
# ---------- Max. Element Volume -----------
-msgid "SMESH_MAX_ELEMENT_VOLUME"
+msgid "SMESH_MAX_ELEMENT_VOLUME_PARAM"
msgstr "Max. Volume"
msgid "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"
msgid "SMESH_MAX_ELEMENT_VOLUME_TITLE"
msgstr "Hypothesis Construction"
+
+
+# -------------- Start and End Length --------------
+
+msgid "SMESH_START_LENGTH_PARAM"
+msgstr "Start Length"
+
+msgid "SMESH_END_LENGTH_PARAM"
+msgstr "End Length"
+
+msgid "SMESH_START_END_LENGTH_HYPOTHESIS"
+msgstr "Start and EndLocal Length"
+
+msgid "SMESH_START_END_LENGTH_TITLE"
+msgstr "Hypothesis Construction"
+
+# -------------- Deflection 1D --------------
+
+msgid "SMESH_DEFLECTION1D_HYPOTHESIS"
+msgstr "Deflection 1D"
+
+msgid "SMESH_DEFLECTION1D_PARAM"
+msgstr "Deflection"
+
+msgid "SMESH_DEFLECTION1D_TITLE"
+msgstr "Hypothesis Construction"
+
+# -------------- Arithmetic 1D --------------
+
+msgid "SMESH_ARITHMETIC_1D_HYPOTHESIS"
+msgstr "Arithmetic 1D"
+
+msgid "SMESH_ARITHMETIC_1D_PARAM"
+msgstr "Arithmetic Reason"
+
+msgid "SMESH_ARITHMETIC_1D_TITLE"
+msgstr "Hypothesis Construction"
LIB_SRC = \
StdMeshers_i.cxx \
StdMeshers_LocalLength_i.cxx \
+ StdMeshers_StartEndLength_i.cxx \
+ StdMeshers_Arithmetic1D_i.cxx \
+ StdMeshers_NumberOfSegments_i.cxx \
+ StdMeshers_Deflection1D_i.cxx \
+ StdMeshers_Propagation_i.cxx \
StdMeshers_LengthFromEdges_i.cxx \
StdMeshers_MaxElementArea_i.cxx \
StdMeshers_MaxElementVolume_i.cxx \
- StdMeshers_NumberOfSegments_i.cxx \
StdMeshers_NotConformAllowed_i.cxx \
StdMeshers_Regular_1D_i.cxx \
StdMeshers_Quadrangle_2D_i.cxx \
LIB_CLIENT_IDL = \
SALOMEDS.idl SALOME_Exception.idl \
- GEOM_Gen.idl GEOM_Shape.idl MED.idl SALOMEDS_Attributes.idl \
+ GEOM_Gen.idl MED.idl SALOMEDS_Attributes.idl \
SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Group.idl
# Executables targets
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Arithmetic1D_i.cxx
+// Author : Damien COQUERET, OCC
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_Arithmetic1D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ * StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i
+ *
+ * Constructor
+ */
+//=============================================================================
+
+StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ MESSAGE( "StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i" );
+ myBaseImpl = new ::StdMeshers_Arithmetic1D( theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Arithmetic1D_i::~StdMeshers_Arithmetic1D_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+StdMeshers_Arithmetic1D_i::~StdMeshers_Arithmetic1D_i()
+{
+ MESSAGE( "StdMeshers_Arithmetic1D_i::~StdMeshers_Arithmetic1D_i" );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Arithmetic1D_i::SetLength
+ *
+ * Set length
+ */
+//=============================================================================
+
+void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
+ CORBA::Boolean theIsStart )
+ throw ( SALOME::SALOME_Exception )
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::SetLength" );
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetLength( theLength, theIsStart );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Arithmetic1D_i::GetLength
+ *
+ * Get length
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_Arithmetic1D_i::GetLength( CORBA::Boolean theIsStart)
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::GetLength" );
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetLength( theIsStart );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Arithmetic1D_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Arithmetic1D* StdMeshers_Arithmetic1D_i::GetImpl()
+{
+ MESSAGE( "StdMeshers_Arithmetic1D_i::GetImpl" );
+ return ( ::StdMeshers_Arithmetic1D* )myBaseImpl;
+}
+
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Arithmetic1D_i.hxx
+// Author : Damien COQUERET, OCC
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_ARITHMETIC1D_I_HXX_
+#define _SMESH_ARITHMETIC1D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_Arithmetic1D.hxx"
+
+// ======================================================
+// Arithmetic 1D hypothesis
+// ======================================================
+class StdMeshers_Arithmetic1D_i:
+ public virtual POA_StdMeshers::StdMeshers_Arithmetic1D,
+ public virtual SMESH_Hypothesis_i
+{
+public:
+ // Constructor
+ StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl );
+ // Destructor
+ virtual ~StdMeshers_Arithmetic1D_i();
+
+ // Set length
+ void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
+ throw ( SALOME::SALOME_Exception );
+ // Get length
+ CORBA::Double GetLength(CORBA::Boolean theIsStart);
+
+ // Get implementation
+ ::StdMeshers_Arithmetic1D* GetImpl();
+};
+
+#endif
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Deflection1D_i.cxx
+// Moved here from SMESH_LocalLength_i.cxx
+// Author : Paul RASCLE, EDF
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_Deflection1D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ * StdMeshers_Deflection1D_i::StdMeshers_Deflection1D_i
+ *
+ * Constructor
+ */
+//=============================================================================
+
+StdMeshers_Deflection1D_i::StdMeshers_Deflection1D_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ MESSAGE( "StdMeshers_Deflection1D_i::StdMeshers_Deflection1D_i" );
+ myBaseImpl = new ::StdMeshers_Deflection1D( theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Deflection1D_i::~StdMeshers_Deflection1D_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+StdMeshers_Deflection1D_i::~StdMeshers_Deflection1D_i()
+{
+ MESSAGE( "StdMeshers_Deflection1D_i::~StdMeshers_Deflection1D_i" );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Deflection1D_i::SetDeflection
+ *
+ * Set deflection
+ */
+//=============================================================================
+
+void StdMeshers_Deflection1D_i::SetDeflection( CORBA::Double theValue )
+ throw ( SALOME::SALOME_Exception )
+{
+ MESSAGE( "StdMeshers_Deflection1D_i::SetDeflection" );
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetDeflection( theValue );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Deflection1D_i::GetDeflection
+ *
+ * Get deflection
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_Deflection1D_i::GetDeflection()
+{
+ MESSAGE( "StdMeshers_Deflection1D_i::GetDeflection" );
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetDeflection();
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Deflection1D_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Deflection1D* StdMeshers_Deflection1D_i::GetImpl()
+{
+ MESSAGE( "StdMeshers_Deflection1D_i::GetImpl" );
+ return ( ::StdMeshers_Deflection1D* )myBaseImpl;
+}
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Deflection1D_i.hxx
+// Moved here from SMESH_LocalLength_i.hxx
+// Author : Paul RASCLE, EDF
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_Deflection1D_I_HXX_
+#define _SMESH_Deflection1D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_Deflection1D.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Local Length hypothesis
+// ======================================================
+class StdMeshers_Deflection1D_i:
+ public virtual POA_StdMeshers::StdMeshers_Deflection1D,
+ public virtual SMESH_Hypothesis_i
+{
+public:
+ // Constructor
+ StdMeshers_Deflection1D_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl );
+ // Destructor
+ virtual ~StdMeshers_Deflection1D_i();
+
+ // Set deflection
+ void SetDeflection( CORBA::Double theLength )
+ throw ( SALOME::SALOME_Exception );
+ // Get deflection
+ CORBA::Double GetDeflection();
+
+ // Get implementation
+ ::StdMeshers_Deflection1D* GetImpl();
+};
+
+#endif
+
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Propagation_i.cxx
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_Propagation_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ * StdMeshers_Propagation_i::StdMeshers_Propagation_i
+ *
+ * Constructor
+ */
+//=============================================================================
+StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ MESSAGE( "StdMeshers_Propagation_i::StdMeshers_Propagation_i" );
+ myBaseImpl = new ::StdMeshers_Propagation(theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl);
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Propagation_i::~StdMeshers_Propagation_i
+ *
+ * Destructor
+ */
+//=============================================================================
+StdMeshers_Propagation_i::~StdMeshers_Propagation_i()
+{
+ MESSAGE( "StdMeshers_Propagation_i::~StdMeshers_Propagation_i" );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_Propagation_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+::StdMeshers_Propagation* StdMeshers_Propagation_i::GetImpl()
+{
+ MESSAGE( "StdMeshers_Propagation_i::GetImpl" );
+ return ( ::StdMeshers_Propagation* )myBaseImpl;
+}
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 CEA
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_Propagation_i.hxx
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_PROPAGATION_I_HXX_
+#define _SMESH_PROPAGATION_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_Propagation.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Propagation hypothesis
+// ======================================================
+class StdMeshers_Propagation_i:
+ public virtual POA_StdMeshers::StdMeshers_Propagation,
+ public virtual SMESH_Hypothesis_i
+{
+public:
+ // Constructor
+ StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl);
+ // Destructor
+ virtual ~StdMeshers_Propagation_i();
+
+ // Get implementation
+ ::StdMeshers_Propagation* GetImpl();
+};
+
+#endif
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_StartEndLength_i.cxx
+// Moved here from SMESH_LocalLength_i.cxx
+// Author : Paul RASCLE, EDF
+// Module : SMESH
+// $Header$
+
+using namespace std;
+#include "StdMeshers_StartEndLength_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ * StdMeshers_StartEndLength_i::StdMeshers_StartEndLength_i
+ *
+ * Constructor
+ */
+//=============================================================================
+
+StdMeshers_StartEndLength_i::StdMeshers_StartEndLength_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::StdMeshers_StartEndLength_i" );
+ myBaseImpl = new ::StdMeshers_StartEndLength( theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_StartEndLength_i::~StdMeshers_StartEndLength_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+StdMeshers_StartEndLength_i::~StdMeshers_StartEndLength_i()
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::~StdMeshers_StartEndLength_i" );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_StartEndLength_i::SetLength
+ *
+ * Set length
+ */
+//=============================================================================
+
+void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength,
+ CORBA::Boolean theIsStart )
+ throw ( SALOME::SALOME_Exception )
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::SetLength" );
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetLength( theLength, theIsStart );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_StartEndLength_i::GetLength
+ *
+ * Get length
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_StartEndLength_i::GetLength( CORBA::Boolean theIsStart)
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::GetLength" );
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetLength( theIsStart );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_StartEndLength_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_StartEndLength* StdMeshers_StartEndLength_i::GetImpl()
+{
+ MESSAGE( "StdMeshers_StartEndLength_i::GetImpl" );
+ return ( ::StdMeshers_StartEndLength* )myBaseImpl;
+}
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StdMeshers_StartEndLength_i.hxx
+// Moved here from SMESH_LocalLength_i.hxx
+// Author : Paul RASCLE, EDF
+// Module : SMESH
+// $Header$
+
+#ifndef _SMESH_StartEndLength_I_HXX_
+#define _SMESH_StartEndLength_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_StartEndLength.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Local Length hypothesis
+// ======================================================
+class StdMeshers_StartEndLength_i:
+ public virtual POA_StdMeshers::StdMeshers_StartEndLength,
+ public virtual SMESH_Hypothesis_i
+{
+public:
+ // Constructor
+ StdMeshers_StartEndLength_i(PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl );
+ // Destructor
+ virtual ~StdMeshers_StartEndLength_i();
+
+ // Set length
+ void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
+ throw ( SALOME::SALOME_Exception );
+ // Get length
+ CORBA::Double GetLength(CORBA::Boolean theIsStart);
+
+ // Get implementation
+ ::StdMeshers_StartEndLength* GetImpl();
+};
+
+#endif
+
#include "utilities.h"
#include "StdMeshers_LocalLength_i.hxx"
-#include "StdMeshers_LengthFromEdges_i.hxx"
-#include "StdMeshers_NotConformAllowed_i.hxx"
+#include "StdMeshers_StartEndLength_i.hxx"
+#include "StdMeshers_Arithmetic1D_i.hxx"
#include "StdMeshers_NumberOfSegments_i.hxx"
+#include "StdMeshers_Deflection1D_i.hxx"
+#include "StdMeshers_Propagation_i.hxx"
+#include "StdMeshers_LengthFromEdges_i.hxx"
#include "StdMeshers_MaxElementArea_i.hxx"
#include "StdMeshers_MaxElementVolume_i.hxx"
+#include "StdMeshers_NotConformAllowed_i.hxx"
#include "StdMeshers_Regular_1D_i.hxx"
#include "StdMeshers_MEFISTO_2D_i.hxx"
aCreator = new HypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
else if (strcmp(aHypName, "NotConformAllowed") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
+ else if (strcmp(aHypName, "Propagation") == 0)
+ aCreator = new HypothesisCreator_i<StdMeshers_Propagation_i>;
else if (strcmp(aHypName, "MaxElementArea") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_MaxElementArea_i>;
else if (strcmp(aHypName, "MaxElementVolume") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
+ else if (strcmp(aHypName, "StartEndLength") == 0)
+ aCreator = new HypothesisCreator_i<StdMeshers_StartEndLength_i>;
+ else if (strcmp(aHypName, "Deflection1D") == 0)
+ aCreator = new HypothesisCreator_i<StdMeshers_Deflection1D_i>;
+ else if (strcmp(aHypName, "Arithmetic1D") == 0)
+ aCreator = new HypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
// Algorithms
else if (strcmp(aHypName, "Regular_1D") == 0)