]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
NRI : First integration.
authornri <nri@opencascade.com>
Fri, 16 May 2003 14:22:04 +0000 (14:22 +0000)
committernri <nri@opencascade.com>
Fri, 16 May 2003 14:22:04 +0000 (14:22 +0000)
68 files changed:
Makefile.in [new file with mode: 0644]
build_configure [new file with mode: 0755]
configure.in.base [new file with mode: 0644]
idl/Makefile.in [new file with mode: 0644]
idl/VISU_Gen.idl [new file with mode: 0644]
resources/ModuleVisu.png [new file with mode: 0644]
resources/VISU_en.xml [new file with mode: 0644]
resources/VISU_fr.xml [new file with mode: 0644]
resources/Visu_anim.png [new file with mode: 0644]
resources/Visu_cutplane.png [new file with mode: 0644]
resources/Visu_deformed.png [new file with mode: 0644]
resources/Visu_deformed_anim.png [new file with mode: 0644]
resources/Visu_eraseall.png [new file with mode: 0644]
resources/Visu_isosurfaces.png [new file with mode: 0644]
resources/Visu_plot2d.png [new file with mode: 0644]
resources/Visu_plot3d.png [new file with mode: 0644]
resources/Visu_points.png [new file with mode: 0644]
resources/Visu_sameas.png [new file with mode: 0644]
resources/Visu_scalars.png [new file with mode: 0644]
resources/Visu_scalars_anim.png [new file with mode: 0644]
resources/Visu_scaling.png [new file with mode: 0644]
resources/Visu_selectall.png [new file with mode: 0644]
resources/Visu_selectionactor.png [new file with mode: 0644]
resources/Visu_selectioncell.png [new file with mode: 0644]
resources/Visu_selectionedge.png [new file with mode: 0644]
resources/Visu_selectionpoint.png [new file with mode: 0644]
resources/Visu_selectonly.png [new file with mode: 0644]
resources/Visu_streamlines.png [new file with mode: 0644]
resources/Visu_surface.png [new file with mode: 0644]
resources/Visu_tree_visu.png [new file with mode: 0644]
resources/Visu_vectors.png [new file with mode: 0644]
resources/Visu_wireframe.png [new file with mode: 0644]
src/Makefile.in [new file with mode: 0644]
src/OBJECT/Makefile.in [new file with mode: 0644]
src/OBJECT/VISU_Actor.cxx [new file with mode: 0644]
src/OBJECT/VISU_Actor.h [new file with mode: 0644]
src/VISU_I/Makefile.in [new file with mode: 0644]
src/VISU_I/VISUConfig.hh [new file with mode: 0644]
src/VISU_I/VISU_Convertor.cxx [new file with mode: 0644]
src/VISU_I/VISU_Convertor.hxx [new file with mode: 0644]
src/VISU_I/VISU_Convertor_impl.cxx [new file with mode: 0644]
src/VISU_I/VISU_Convertor_impl.hxx [new file with mode: 0644]
src/VISU_I/VISU_CorbaMedConvertor.cxx [new file with mode: 0644]
src/VISU_I/VISU_CorbaMedConvertor.hxx [new file with mode: 0644]
src/VISU_I/VISU_DatConvertor.cxx [new file with mode: 0644]
src/VISU_I/VISU_DatConvertor.hxx [new file with mode: 0644]
src/VISU_I/VISU_Extractor.cxx [new file with mode: 0644]
src/VISU_I/VISU_Extractor.hxx [new file with mode: 0644]
src/VISU_I/VISU_FieldTransform.cxx [new file with mode: 0644]
src/VISU_I/VISU_FieldTransform.hxx [new file with mode: 0644]
src/VISU_I/VISU_Gen_i.cc [new file with mode: 0644]
src/VISU_I/VISU_Gen_i.hh [new file with mode: 0644]
src/VISU_I/VISU_LookupTable.cxx [new file with mode: 0644]
src/VISU_I/VISU_LookupTable.hxx [new file with mode: 0644]
src/VISU_I/VISU_MedConvertor.cxx [new file with mode: 0644]
src/VISU_I/VISU_MedConvertor.hxx [new file with mode: 0644]
src/VISU_I/VISU_PrsObject_i.cc [new file with mode: 0644]
src/VISU_I/VISU_PrsObject_i.hh [new file with mode: 0644]
src/VISU_I/VISU_Result_i.cc [new file with mode: 0644]
src/VISU_I/VISU_Result_i.hh [new file with mode: 0644]
src/VISU_I/VISU_ScalarBarActor.cxx [new file with mode: 0644]
src/VISU_I/VISU_ScalarBarActor.hxx [new file with mode: 0644]
src/VISU_I/VISU_Table_i.cc [new file with mode: 0644]
src/VISU_I/VISU_Table_i.hh [new file with mode: 0644]
src/VISU_I/VISU_TimeAnimation.cxx [new file with mode: 0644]
src/VISU_I/VISU_TimeAnimation.h [new file with mode: 0644]
src/VISU_I/VISU_ViewManager_i.cc [new file with mode: 0644]
src/VISU_I/VISU_ViewManager_i.hh [new file with mode: 0644]

diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..8e49624
--- /dev/null
@@ -0,0 +1,112 @@
+# -* Makefile *- 
+#
+# Author : Patrick GOLDBRONN (CEA)
+# Date : 28/06/2001
+# $Header$
+#
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=.
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl:${KERNEL_ROOT_DIR}/idl/salome
+
+
+@COMMENCE@
+
+SUBDIRS = idl src
+
+RESOURCES_FILES = \
+ModuleVisu.png \
+Visu_anim.png \
+Visu_cutplane.png \
+Visu_deformed.png \
+Visu_deformed_anim.png \
+Visu_eraseall.png \
+Visu_isosurfaces.png \
+Visu_plot2d.png \
+Visu_plot3d.png \
+Visu_points.png \
+Visu_sameas.png \
+Visu_scalars.png \
+Visu_scalars_anim.png \
+Visu_selectall.png \
+Visu_selectionactor.png \
+Visu_selectioncell.png \
+Visu_selectionedge.png \
+Visu_selectionpoint.png \
+Visu_selectonly.png \
+Visu_surface.png \
+Visu_vectors.png \
+Visu_wireframe.png \
+Visu_scaling.png \
+VISU_en.xml \
+VISU_fr.xml \
+Visu_tree_visu.png \
+Visu_streamlines.png
+
+BIN_SCRIPT=
+
+
+# copy header files in common directory
+ifeq ($(HAVE_SSTREAM),yes)
+  include_list=include/salome/SALOMEconfig.h
+else
+  include_list=include/salome/SALOMEconfig.h include/salome/sstream
+endif
+
+inc: idl $(include_list)
+
+include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.h
+       -$(RM) $@
+       $(LN_S) ../../$< $@
+
+include/salome/sstream: salome_adm/unix/sstream
+       -$(RM) $@
+       $(LN_S) ../../$< $@
+
+depend: depend_idl
+
+depend_idl:
+       (cd idl ; $(MAKE) $@) || exit 1
+
+# doc is already build : if you want to had documents, go manually to doc and run 'make doc'
+#doc:
+#      (cd doc && $(MAKE) $@) || exit 1
+
+install-end:
+# finish libtool install
+#      @$(LT) --mode=finish $(libdir)
+
+install-include: $(include_list)
+       $(INSTALL) -d  $(includedir)
+       @for f in X $(include_list); do                         \
+          if test $$f != X; then                               \
+            ($(INSTALL_DATA) $$f $(includedir)/. || exit 1);   \
+          fi;                                                  \
+       done
+
+# install script in $(bindir) :
+install-bin: $(BIN_SCRIPT)
+       $(INSTALL) -d  $(bindir)
+       if test $(BIN_SCRIPT)X != X; then                       \
+               $(INSTALL_PROGRAM) $^ $(bindir);                \
+       fi
+
+uninstall: uninstall-idl
+
+uninstall-idl:
+       $(RM) $(idldir)/*.idl
+
+distclean: distclean-other
+
+distclean-other:
+       -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old
+       -$(RM) salome_adm/unix/make_* 
+       -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h 
+       -$(RM) config.cache config.log config.status 
+
+@MODULE@
+
+install: install-bin install-include install-end
+
diff --git a/build_configure b/build_configure
new file mode 100755 (executable)
index 0000000..4edf6f4
--- /dev/null
@@ -0,0 +1,206 @@
+#!/bin/bash
+
+#
+# Tool for updating list of .in file for the SALOME project 
+# and regenerating configure script
+#
+# Author : Marc Tajchman - CEA
+# Date : 10/10/2002
+# $Header$
+#
+
+ORIG_DIR=`pwd`
+CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
+
+########################################################################
+# Test if the KERNEL_ROOT_DIR is set correctly
+
+if test ! -d "${KERNEL_ROOT_DIR}"; then
+    echo "failed : KERNEL_ROOT_DIR variable is not correct !"
+    exit
+fi
+
+# Test if the KERNEL_SRC is set correctly
+
+#if test ! -d "${KERNEL_SRC}"; then
+#    echo "failed : KERNEL_SRC variable is not correct !"
+#    exit
+#fi
+########################################################################
+# find_in - utility function
+#
+# usage :  
+#    find_in directory filename 
+#
+# Finds files following the *.in pattern, recursively in the
+# directory (first argument).
+# Results are appended into the file (second argument)
+#
+# Difference from the standard unix find is that files are tested
+# before directories
+# 
+
+find_in()
+{
+  local i
+  local f=$2
+
+# if the first argument is not a directory, returns
+
+  if [ ! -d "$1" ] ; then 
+     return 
+  fi
+
+# dont look in the CVS directories
+
+  case $1 in
+    */CVS) return ;;
+    *) ;;
+  esac
+
+# for each regular file contained in the directory
+# test if it's a .in file
+
+  for i in "$1"/*
+  do
+     if [ -f "$i" ] ; then
+       case $i in 
+         *.in) echo "  "$i" \\" >> $f;;
+         *) ;;
+        esac
+     fi
+  done
+
+# for each subdirectory of the first argument, proceeds recursively
+
+  for i in "$1"/*
+  do
+     if [ -d "$i" ] ; then
+        find_in "$i" "$f"
+     fi
+  done
+}
+
+
+#######################################################################
+# Generate list of .in files (Makefile.in, config.h.in, etc)
+# appending it in file configure.in
+
+cd ${CONF_DIR}
+ABS_CONF_DIR=`pwd`
+
+#
+# Common part of the configure.in file
+#
+chmod u+w configure.in.base
+if ! \cp -f configure.in.base configure.in_tmp1 
+then
+       echo
+       echo "error : can't create files in" ${CONF_DIR}
+       echo "aborting ..."
+        chmod u-w configure.in.base 
+       exit
+fi
+chmod u-w configure.in.base 
+
+# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in  files
+echo "" >> configure.in_tmp1
+echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
+
+echo  "" >> configure.in_tmp1
+echo "AC_OUTPUT([ \\" >> configure.in_tmp1
+
+#
+# List of .in files in the adm/unix directory
+# These files MUST be on top of AC_OUTPUT list so we
+# put them "manually"
+#
+
+echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/make_omniorb \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/make_commence \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
+echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
+
+\rm -f configure.in_tmp2 configure.in_tmp3
+touch configure.in_tmp2
+find_in . configure.in_tmp2
+sed '/^.*salome_adm/d' configure.in_tmp2 >  configure.in_tmp3
+sed '/configure.in/d' configure.in_tmp3 >  configure.in_tmp2
+sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
+
+echo  "])" >> configure.in_tmp1
+
+# delete the link created for AC_OUTPUT
+#echo "" >> configure.in_tmp1
+#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
+\mv configure.in_tmp1 configure.in_new
+\rm  -f configure.in_tmp2 configure.in_tmp3
+
+
+########################################################################
+# Create new (or replace old) configure.in file
+# Print a message if the file is write protected
+#
+
+echo
+if test ! -f configure.in
+then
+       echo -n "Creating new file 'configure.in' ... "
+       if \mv configure.in_new configure.in >& /dev/null
+       then
+               echo "done"
+       else
+               echo "error, check your file permissions"
+       fi
+else
+       echo -n "Updating 'configure.in' file ... "
+       if ! \cp configure.in configure.in_old >& /dev/null
+       then
+               echo
+               echo
+               echo "Can't backup previous configure.in"
+               echo -n "Continue (you will not be able to revert) - (Y/N) ? "
+               read R
+                case "x$R" in
+                   xn*) exit;;
+                   xN*) exit;;
+               esac
+               echo
+               echo -n "                                 "
+       fi
+       if \cp configure.in_new configure.in >& /dev/null
+       then
+               echo "done"
+       else
+               echo
+               echo "error, can't update previous configure.in"
+       fi
+fi
+
+########################################################################
+# Use autoconf to rebuild the configure script
+#
+
+if test -f configure
+then
+       echo -n "Updating 'configure' script ...  "
+else
+       echo -n "Creating 'configure' script ...  "
+fi
+
+aclocal --acdir=${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
+if autoconf
+then
+       echo "done"
+else
+       echo "failed (check file permissions and/or user quotas ...)"
+fi
+
+cd ${ORIG_DIR}
+
+echo
diff --git a/configure.in.base b/configure.in.base
new file mode 100644 (file)
index 0000000..b363a0b
--- /dev/null
@@ -0,0 +1,366 @@
+#
+#  PLEASE DO NOT MODIFY configure.in FILE
+#
+#  ALL CHANGES WILL BE DISCARDED BY THE NEXT
+#  build_configure COMMAND
+#
+#  CHANGES MUST BE MADE IN configure.in.base FILE
+#
+#
+# Author : Marc Tajchman (CEA)
+# Date : 28/06/2001
+# Modified by : Patrick GOLDBRONN (CEA)
+# Modified by : Marc Tajchman (CEA)
+#
+# Created from configure.in.base
+#
+
+AC_INIT(src)
+AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files)
+AC_CANONICAL_HOST
+
+PACKAGE=salome
+AC_SUBST(PACKAGE)
+
+VERSION=0.0.1
+AC_SUBST(VERSION)
+
+dnl
+dnl Initialize source and build root directories
+dnl
+
+ROOT_BUILDDIR=`pwd`
+ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+cd $ROOT_SRCDIR
+ROOT_SRCDIR=`pwd`
+cd $ROOT_BUILDDIR
+
+AC_SUBST(ROOT_SRCDIR)
+AC_SUBST(ROOT_BUILDDIR)
+
+echo
+echo Source root directory : $ROOT_SRCDIR
+echo Build  root directory : $ROOT_BUILDDIR
+echo
+echo
+
+if test -z "$AR"; then
+   AC_CHECK_PROGS(AR,ar xar,:,$PATH)
+fi
+AC_SUBST(AR)
+
+dnl Export the AR macro so that it will be placed in the libtool file
+dnl correctly.
+export AR
+
+echo
+echo ---------------------------------------------
+echo testing make
+echo ---------------------------------------------
+echo
+
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+dnl 
+dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques !
+
+AC_ENABLE_DEBUG(yes)
+AC_DISABLE_PRODUCTION
+
+echo ---------------------------------------------
+echo testing libtool
+echo ---------------------------------------------
+
+dnl first, we set static to no!
+dnl if we want it, use --enable-static
+AC_ENABLE_STATIC(no)
+
+AC_LIBTOOL_DLOPEN
+AC_PROG_LIBTOOL
+
+dnl Fix up the INSTALL macro if it s a relative path. We want the
+dnl full-path to the binary instead.
+case "$INSTALL" in
+   *install-sh*)
+      INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh
+      ;;
+esac
+
+echo
+echo ---------------------------------------------
+echo testing C/C++
+echo ---------------------------------------------
+echo
+
+cc_ok=no
+dnl inutil car libtool
+dnl AC_PROG_CC
+AC_PROG_CXX
+AC_DEPEND_FLAG
+# AC_CC_WARNINGS([ansi])
+cc_ok=yes
+
+dnl Library libdl :
+AC_CHECK_LIB(dl,dlopen)
+
+dnl add library libm :
+AC_CHECK_LIB(m,ceil)
+
+dnl 
+dnl Well we use sstream which is not in gcc pre-2.95.3
+dnl We must test if it exists. If not, add it in include !
+dnl
+
+AC_CXX_HAVE_SSTREAM
+
+dnl
+dnl ---------------------------------------------
+dnl testing MPICH
+dnl ---------------------------------------------
+dnl
+
+CHECK_MPICH
+
+echo
+echo ---------------------------------------------
+echo testing LEX \& YACC
+echo ---------------------------------------------
+echo
+
+lex_yacc_ok=no
+AC_PROG_YACC
+AC_PROG_LEX
+lex_yacc_ok=yes
+
+echo
+echo ---------------------------------------------
+echo testing python
+echo ---------------------------------------------
+echo
+
+CHECK_PYTHON
+
+echo
+echo ---------------------------------------------
+echo testing java
+echo ---------------------------------------------
+echo
+
+CHECK_JAVA
+
+echo
+echo ---------------------------------------------
+echo testing swig
+echo ---------------------------------------------
+echo
+
+CHECK_SWIG
+
+echo
+echo ---------------------------------------------
+echo testing threads
+echo ---------------------------------------------
+echo
+
+ENABLE_PTHREADS
+
+echo
+echo ---------------------------------------------
+echo testing omniORB
+echo ---------------------------------------------
+echo
+
+CHECK_OMNIORB
+
+echo
+echo ---------------------------------------------
+echo testing mico
+echo ---------------------------------------------
+echo
+
+CHECK_MICO
+
+echo
+echo ---------------------------------------------
+echo default ORB : omniORB
+echo ---------------------------------------------
+echo
+
+DEFAULT_ORB=omniORB
+CHECK_CORBA
+
+AC_SUBST_FILE(CORBA)
+corba=make_$ORB
+CORBA=salome_adm/unix/$corba
+
+echo
+echo ---------------------------------------------
+echo testing openGL
+echo ---------------------------------------------
+echo
+
+CHECK_OPENGL
+
+echo
+echo ---------------------------------------------
+echo testing QT
+echo ---------------------------------------------
+echo
+
+CHECK_QT
+
+echo
+echo ---------------------------------------------
+echo testing VTK
+echo ---------------------------------------------
+echo
+
+CHECK_VTK
+
+echo
+echo ---------------------------------------------
+echo testing HDF5
+echo ---------------------------------------------
+echo
+
+CHECK_HDF5
+
+echo
+echo ---------------------------------------------
+echo testing MED2
+echo ---------------------------------------------
+echo
+
+CHECK_MED2
+
+echo
+echo ---------------------------------------------
+echo Testing OpenCascade
+echo ---------------------------------------------
+echo
+
+CHECK_CAS
+
+echo
+echo ---------------------------------------------
+echo Testing qwt
+echo ---------------------------------------------
+echo
+
+CHECK_QWT
+
+echo
+echo ---------------------------------------------
+echo Testing Kernel
+echo ---------------------------------------------
+echo
+
+CHECK_KERNEL
+
+echo
+echo ---------------------------------------------
+echo Summary
+echo ---------------------------------------------
+echo
+
+echo Configure
+variables="cc_ok lex_yacc_ok python_ok java_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok mico_ok occ_ok qwt_ok Kernel_ok"
+
+for var in $variables
+do
+   printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
+   eval echo \$$var
+done
+
+echo
+echo "Default ORB   : $DEFAULT_ORB"
+echo
+
+dnl generals files which could be included in every makefile
+
+AC_SUBST_FILE(COMMENCE) COMMENCE=salome_adm/unix/make_commence
+AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
+AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
+
+dnl les dependences
+AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend
+
+dnl We don t need to say when we re entering directories if we re using
+dnl GNU make becuase make does it for us.
+if test "X$GMAKE" = "Xyes"; then
+   AC_SUBST(SETX) SETX=":"
+else
+   AC_SUBST(SETX) SETX="set -x"
+fi
+
+# make other build directories
+for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources share/salome/doc idl
+do
+#   if test ! -d $rep ; then
+#      eval mkdir $rep
+#   fi
+    $INSTALL -d $rep
+done
+
+echo 
+echo ---------------------------------------------
+echo copying resource files, shell scripts, and 
+echo xml files
+echo ---------------------------------------------
+echo
+
+
+dnl copy resources directories
+
+#for i in `find $ROOT_SRCDIR -name 'resources' -print`
+#do
+#  local_res=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"`
+#  local_res_dir=`echo $local_res | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+#  mkdir -p $local_res_dir
+#  cd $local_res_dir
+#  ln -fs $i
+#  echo $local_res
+#  cd $ROOT_BUILDDIR
+#done
+
+dnl copy shells and utilities contained in the bin directory
+dnl excluding .in files (treated in AC-OUTPUT below) and CVS 
+dnl directory
+
+cd bin
+for i in $ROOT_SRCDIR/bin/*
+do
+  local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"`
+  case "$local_bin" in
+        *.in | *~)                    ;;
+        ./bin/CVS)                    ;;
+        *) ln -fs $i; echo $local_bin ;;
+  esac
+done
+cd $ROOT_BUILDDIR
+
+AC_SUBST_FILE(ENVSCRIPT) ENVSCRIPT=salome_adm/unix/envScript
+
+dnl copy xml files to the build tree (lib directory)
+dnl pourquoi ????
+
+#cd lib
+#for i in `find $ROOT_SRCDIR -name "*.xml" -print`
+#do
+#  ln -fs $i
+#  echo `echo $i | sed -e "s,$ROOT_SRCDIR,.,"`
+#done
+#cd $ROOT_BUILDDIR
+
+
+echo
+echo ---------------------------------------------
+echo generating Makefiles and configure files
+echo ---------------------------------------------
+echo
+
+AC_OUTPUT_COMMANDS([ \
+       chmod +x ./bin/* \
+])
+
+## do not delete this line
diff --git a/idl/Makefile.in b/idl/Makefile.in
new file mode 100644 (file)
index 0000000..98f8e07
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# generate dependencies for idl file :
+#
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome
+
+@COMMENCE@
+
+IDL_FILES = \
+  SALOME_Component.idl \
+  SALOMEDS.idl \
+  SALOMEDS_Attributes.idl \
+  SALOME_Exception.idl \
+  Logger.idl \
+  SALOME_ModuleCatalog.idl \
+  SALOME_Session.idl \
+  VISU_Gen.idl \
+  MED.idl \
+  Med_Gen.idl
+
+PY_CLIENT_IDL = $(IDL_FILES)
+
+# we copy all idl file in $(top_builddir)/idl
+inc: $(IDL_FILES:%=$(top_builddir)/idl/%)
+
+$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:%
+#      $(CP) $< $@
+       cp -f $< $@
+
+
+lib: pyidl
+
+PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@
+
+pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py)
+
+$(PYTHON_BUILD_SITE):
+       $(INSTALL) -d  $@
+
+$(PYTHON_BUILD_SITE)/%_idl.py: %.idl
+       $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $<
+
+
+# install python client (generated from idl file
+install: install-pyidl install-idl
+
+# create directory $(idldir) and copy idl files into it
+install-idl: $(IDL_FILES)
+       $(INSTALL) -d  $(idldir)
+       $(INSTALL_DATA) $^ $(idldir)
+
+
+install-pyidl: $(IDL_FILES)
+       $(INSTALL) -d  $(PYTHON_SITE_INSTALL)
+       @for file in $^ dummy; do \
+         if [ $$file != "dummy" ]; then \
+           $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \
+         fi ; \
+       done ;
+
+#@ CONCLUDE @
+
+cleandep:
+       -$(RM) .dep*
+
+distclean:
+       -$(RM) *.py
+       -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%)
+       -$(RM) Makefile
+
diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl
new file mode 100644 (file)
index 0000000..fa97087
--- /dev/null
@@ -0,0 +1,939 @@
+// File :      VISU_Gen.idl
+// Created :
+// Author :    Alexey Petrov
+// Project :   SALOME
+// Copyright : OPEN CASCADE
+// $HEADERS:
+
+/*! \file VISU_Gen.idl This file conatins a set of interfaces of %VISU module.
+      This module will provide various forms of data visualization in %SALOME application.
+      These forms include data tables, XY plots, 3d representations
+      and combination of these forms.
+*/
+/*!
+ \defgroup Visu SALOME VISU module
+*/
+
+#ifndef __VISU_GEN__
+#define __VISU_GEN__
+
+#include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+#include "SALOMEDS.idl"
+#include "SALOMEDS_Attributes.idl"
+#include "MED.idl"
+
+/*! \ingroup Visu
+  The main package of interfaces of the module %VISU.
+*/
+module VISU {
+  //-------------------------------------------------------
+  const string VISU__doc__ = "Module VISU provides various forms of data visualization in SALOME application.\nThese forms include data tables, XY plots,\n3d representations and combination of these forms.";
+  typedef string IdType;
+  enum Scaling{ LINEAR, LOGARITHMIC};
+  enum Entity{ NODE, EDGE, FACE, CELL};
+  //enum Entity{ CELL, FACE, EDGE, NODE};      
+/*!
+ This enumeration contains a set of elements defining the type of the module.
+*/
+   enum VISUType{ TNONE,
+                 TCURVE, TTABLE, TCONTAINER, TMESH, TSCALARMAP,
+                 TISOSURFACE, TDEFORMEDSHAPE, TCUTPLANES, TVECTORS, TSTREAMLINES,
+                  TVISUGEN, TVIEWMANAGER, TRESULT,
+                 TXYPLOT, TTABLEVIEW, TVIEW3D,
+                 TENTITY, TFAMILY, TGROUP, TFIELD, TTIMESTAMP,
+                  TALL};
+  interface Base {
+/*!
+   Returns ID of the object.
+*/
+    IdType GetID();
+    const string GetID__doc__ = "Returns ID of the object.";
+/*!
+Returns the type of the presentable object
+*/
+    VISUType GetType();
+    const string GetType__doc__ = "Returns the type of the module interface";
+  };   
+/*! \brief Presentable object interface
+
+ It is the root class of all presentable objects.
+*/
+  interface PrsObject : Base{
+  };
+    const string PrsObject__doc__ = "It is the root class of all presentable objects.";
+  //-------------------------------------------------------
+/*! \brief %Table representation interface
+
+Presentation parameters of the %Table view.
+*/
+  interface Table : PrsObject {
+/*!
+Sets the title of the table.
+*/
+    void SetTitle(in string theTitle);
+    const string SetTitle__doc__ = "Sets the title of the table.";
+/*!
+Gets the title of the table.
+*/
+    string GetTitle();
+    const string GetTitle__doc__ = "Gets the title of the table.";
+/*!
+ This enumeration contains a set of elements defining the orientation of the table.
+*/
+    enum Orientation{ HORIZONTAL, /*!<Horizontal orientation of the table.*/
+                       VERTIACAL /*!<Vertical orientation of the table.*/
+                    };
+/*!
+Sets orientation of the table.
+*/
+    void SetOrientation(in Orientation theOrientation);
+    const string SetOrientation__doc__ = "Sets orientation of the table.";
+/*!
+Gets orientation of the table.
+*/
+    Orientation GetOrientation();
+    const string GetOrientation__doc__ = "Gets orientation of the table.";
+ /*!
+Gets the number of rows of the table
+ */
+    long GetNbRows();
+    const string GetNbRows__doc__ = "Gets the number of rows of the table.";
+ /*!
+Gets the number of columns of the table
+ */
+    long GetNbColumns();
+    const string GetNbColumns__doc__ ="Gets the number of columns of the table.";
+  };
+    const string Table__doc__ = "The Table interface contains presentation\nparameters of the %Table view.";
+  //-------------------------------------------------------
+/*! \brief Interface of curve representation.
+
+Manages presentation parameters of one curve.
+It can be used for presentation of a set of curves using a combined presentation.
+*/
+  interface Curve : PrsObject{
+/*!
+Sets the title of the curve.
+*/
+    void SetTitle(in string theTitle);
+    const string SetTitle__doc__ = "Sets the title of the curve.";
+/*!
+Gets the title of the curve.
+*/
+    string GetTitle();
+    const string GetTitle__doc__ = "Gets the title of the curve.";
+/*!
+Sets the color of the curve.
+*/
+    void SetColor(in SALOMEDS::Color theColor);
+    const string SetColor__doc__ = "Sets the color of the curve.";
+/*!
+Gets the color of the curve.
+*/
+    SALOMEDS::Color GetColor();
+    const string GetColor__doc__ = "Gets the color of the curve.";
+ /*!
+ This enumeration contains a set of elements defining the representation type of markers (data points) with help of
+which the curve is constructed on the graphics.
+*/
+    enum MarkerType{ NONE, CIRCLE, RECTANGLE, DIAMOND,
+                     DTRIANGLE, UTRIANGLE, LTRIANGLE, RTRIANGLE,
+                     CROSS, XCROSS };
+/*!
+Sets the representation type of markers (data points) with help of
+which the curve is constructed on the graphics.
+*/
+    void SetMarker(in MarkerType theType);
+    const string SetMarker__doc__ = "Sets the representation type of markers\n(data points) with help of which\nthe curve is constructed on the graphics.";
+/*!
+Gets the representation type of markers (data points) with help of
+which the curve is constructed on the graphics.
+*/
+    MarkerType GetMarker();
+    const string GetMarker__doc__ = "Gets the representation type of markers\n(data points) with help of which the\ncurve is constructed on the graphics.";
+/*!
+ This enumeration contains a set of elements defining the
+ type of representation of curve lines on the graphics.
+*/
+    enum LineType{ VOIDLINE, SOLIDLINE, DASHLINE, DOTLINE, DASHDOTLINE, DASHDOTDOTLINE};
+/*!
+Sets the type of representation of curve lines on the graphics.
+*/
+    void SetLine(in LineType theType, in long theLineWidth);
+    const string SetLine__doc__ = "Sets the type of representation of curve\nlines on the graphics.";
+/*!
+Gets the type of representation of curve lines on the graphics.
+*/
+    LineType GetLine();
+    const string GetLine__doc__ = "Gets the type of representation of curve\nlines on the graphics.";
+
+/*!
+Gets the width of the curve line.
+*/
+    long GetLineWidth();
+    const string GetLineWidth__doc__ = "Gets the width of the curve line.";
+  };
+    const string Curve__doc__ = "The curve representation interface manages\npresentation parameters of one curve. It can be used\nfor presentation of a set of curves\nusing a combined presentation.";
+//-------------------------------------------------------
+/*! \brief The %Container presentable object interface
+This interface contains a set of methods used for management of a group of curves
+which are stored in the container.
+*/
+  interface Container : PrsObject{
+/*!
+Adds a curve into the container.
+*/
+    void AddCurve(in Curve theCurve);
+    const string AddCurve__doc__ = "Adds a curve into the container.";
+/*!
+Removes a curve from the container.
+*/
+    void RemoveCurve(in Curve theCurve);
+    const string RemoveCurve__doc__ = "Removes a curve from the container.";
+/*!
+Gets the number of curves which are stored in the container.
+*/
+    long GetNbCurves();
+    const string GetNbCurves__doc__ = "Gets the number of curves which\nare stored in the container.";
+/*!
+Removes all curves from the container.
+*/
+    void Clear();
+    const string Clear__doc__ = "Removes all curves from the container.";
+
+  };
+    const string Container__doc__ = "The Container presentable object\ninterface contains a set of methods\nused for management of a group of curves which\nare stored in the container.";
+  //-------------------------------------------------------
+/*!
+ This enumeration contains a set of elements defining the
+ type of representation of the mesh.
+*/
+
+    enum PresentationType{ POINT,
+                           WIREFRAME,
+                           SHADED,
+                           SHRINK
+                         };
+/*! \brief Interface of the mesh.
+
+This interface manages the presentation parameters of the mesh.
+*/
+    interface Mesh : PrsObject{
+/*!
+Sets the color of mesh cells.
+*/
+    void SetCellColor(in SALOMEDS::Color theColor);
+    const string SetCellColor__doc__ = "Sets the color of mesh cells.";
+/*!
+Gets the color of mesh cells.
+*/
+    SALOMEDS::Color GetCellColor();
+    const string GetCellColor__doc__ = "Gets the color of mesh cells.";
+/*!
+Sets the color of mesh nodes.
+*/
+    void SetNodeColor(in SALOMEDS::Color theColor);
+    const string SetNodeColor__doc__ = "Sets the color of mesh nodes.";
+/*!
+Gets the color of mesh nodes.
+*/
+    SALOMEDS::Color GetNodeColor();
+    const string GetNodeColor__doc__ = "Gets the color of mesh nodes.";
+
+/*!
+Sets the color of mesh links.
+*/
+    void SetLinkColor(in SALOMEDS::Color theColor);
+    const string SetLinkColor__doc__ = "Sets the color of mesh links.";
+/*!
+Gets the color of mesh links.
+*/
+    SALOMEDS::Color GetLinkColor();
+    const string GetLinkColor__doc__ = "Gets the color of mesh links.";
+/*!
+Sets the type of representation of the mesh.
+*/
+    void SetPresentationType(in PresentationType theType);
+    const string SetPresentationType__doc__ = "Sets the type of representation of the mesh.";
+/*!
+Gets the type of representation of the mesh.
+*/
+    PresentationType GetPresentationType();
+    const string GetPresentationType__doc__ = "Gets the type of representation of the mesh.";
+  };
+    const string Mesh__doc__ = "The Mesh interface manages the presentation parameters\nof the mesh.";
+  //-------------------------------------------------------
+/*! \brief Interface of the %Scalar Map presentation
+
+This interface contains presentation parameters of the ScalarMap presentation
+*/
+  interface ScalarMap : PrsObject{
+    void SetScalarMode(in long theScaling);
+    long GetScalarMode();
+    void SetScaling(in Scaling theScaling);
+    const string SetScaling__doc__ = "Sets the type of scaling of the values\nreflected by this presentation.";
+/*!
+Gets the type of scaling of the values reflected by this presentation.
+*/
+    Scaling GetScaling();
+    const string GetScaling__doc__ = "Gets the type of scaling of the values\nreflected by this presentation.";
+/*!
+Sets scalar range - min and max boundaries of this presentable object.
+\param theMin  Min boundary of this presentable object.
+\param theMax  Max boundary of this presentable object.
+*/
+    void SetRange(in double theMin, in double theMax);
+    const string SetRange__doc__ = "Sets scalar range - min and max boundaries\nof this presentable object.";
+/*!
+ Gets the min boundary of this presentable object.
+*/
+    double GetMin();
+    const string GetMin__doc__ = "Gets the min boundary of this presentable object.";
+/*!
+ Gets the max boundary of this presentable object.
+*/
+    double GetMax();
+    const string GetMax__doc__ = "Gets the max boundary of this presentable object.";
+
+/*! %Orientation of this presentable object. */
+    enum Orientation{
+                     HORIZONTAL, /*!< Horizontal orientation of this presentable object.*/
+                       VERTICAL  /*!< Vertical orientation of this presentable object.*/
+                    };
+/*!
+ Sets the type of orientation of this presentable object.
+*/
+    void SetOrientation(in Orientation theOrientation);
+    const string SetOrientation__doc__ = "Sets the type of orientation of this presentable object.";
+/*!
+ Gets the type of orientation of this presentable object.
+*/
+    Orientation GetOrientation();
+    const string GetOrientation__doc__ = "Gets the type of orientation of this presentable object.";
+
+/*! \brief Position of this presentable object.
+
+Sets the position of this presentable object origin on the screen.
+\param X   Horizontal position. The value can be between 0 and 1.
+\param Y   Vertical position. The value can be between 0 and 1.
+*/
+    void SetPosition(in double X, in double Y);
+    const string SetPosition__doc__ = "Sets the position of this presentable object\norigin on the screen.";
+/*!
+  Gets horizontal position of this presentable object origin.
+*/
+    double GetPosX();
+    const string GetPosX__doc__ = "Gets horizontal position of this presentable object origin.";
+/*!
+  Gets vertical position of this presentable object origin.
+*/
+    double GetPosY();
+    const string GetPosY__doc__ = "Gets vertical position of this presentable object origin.";
+/*! \brief Size of this presentable object.
+
+Sets the size of the scalar bar.
+\param theWidth  Width of this presentable object. The value can be between 0 and 1.
+\param theHeight  Height of this presentable object. The value can be between 0 and 1.
+*/
+    void SetSize(in double theWidth, in double theHeight);
+    const string SetSize__doc__ = "Sets the size of the scalar bar.";
+/*!
+Gets the width of this presentable object.
+*/
+    double GetWidth();
+    const string GetWidth__doc__ = "Gets the width of this presentable object.";
+/*!
+Gets the height of this presentable object.
+*/
+    double GetHeight();
+    const string GetHeight__doc__ = "Gets the height of this presentable object.";
+/*!
+Sets the number of colors which will be used for presentation of this presentable object.
+*/
+    void SetNbColors(in long theNbColors);
+    const string SetNbColors__doc__ = "Sets the number of colors which will be\nused for presentation of this presentable object.";
+/*!
+Gets the number of colors which will be used for presentation of this presentable object.
+*/
+    long GetNbColors();
+    const string GetNbColors__doc__ = "Gets the number of colors which will be\nused for presentation of this presentable object.";
+/*!
+Sets the number of labels which will be used for indication of the gradation
+ of this presentable object.
+*/
+    void SetLabels(in long theNbLabels);
+    const string SetLabels__doc__ = "Sets the number of labels which will be used\nfor indication of the gradation of this presentable object.";
+/*!
+Gets the number of labels which will be used for indication of the gradation
+ of this presentable object.
+*/
+    long GetLabels();
+    const string GetLabels__doc__ = "Gets the number of labels which will be used\nfor indication of the gradation of this presentable object.";
+
+/*!
+Sets the title of this presentable object. For scalar bar by default - the name of the selected result is used.
+*/
+    void SetTitle(in string theName);
+    const string SetTitle__doc__ = "Sets the title of this presentable object. For scalar bar by default - the name of the selected result is used.";
+/*!
+Gets the title of this presentable object.
+*/
+    string GetTitle();
+    const string GetTitle__doc__ = "Gets the title of this presentable object.";
+  };
+    const string ScalarMap__doc__ = "The scalarmap interface contains presentation\nparameters of the ScalarMap presentation.";
+  //-------------------------------------------------------
+/*! \brief Deformed shape presentation interface
+
+Presentation parameters of the deformed shape presentation.
+*/
+    interface DeformedShape : ScalarMap{
+/*!
+Sets the scale of the presentatable object.
+*/
+    void SetScale(in double theScale);
+    const string SetScale__doc__ = "Sets the scale of the deformed shape.";
+/*!
+Gets the scale of the presentatable object.
+*/
+    double GetScale();
+    const string GetScale__doc__ = "Gets the scale of the deformed shape";
+  };
+    const string DeformedShape__doc__ = "The deformed shape interface contains\nthe presentation parameters of the deformed shape.";
+  //-------------------------------------------------------
+/*! \brief Cut planes interface
+
+Presentation parameters of Cut planes presentation.
+*/
+  interface CutPlanes : ScalarMap{
+/*!
+ This enumeration contains a set of elements defining the orientation in 3D space
+ of cut planes presentation.
+*/
+    enum Orientation {XY, YZ, ZX};
+/*!
+Sets the type of orientation in 3D space of cut planes presentation.
+*/
+    void SetOrientationType(in Orientation theNb);
+    const string SetOrientationType__doc__ = "Sets the type of orientation in 3D\nspace of cut planes presentation.";
+/*!
+Gets the type of orientation in 3D space of cut planes presentation.
+*/
+    Orientation GetOrientationType();
+    const string GetOrientationType__doc__ = "Gets the type of orientation in 3D\nspace of cut planes presentation.";
+/*!
+Sets the number of cut planes.
+*/
+    void SetNbPlanes(in long theNb);
+    const string SetNbPlanes__doc__ = "Sets the number of cut planes.";
+/*!
+Gets the number of cut planes.
+*/
+    long GetNbPlanes();
+    const string GetNbPlanes__doc__ = "Gets the number of cut planes.";
+/*! Rotation around X-axis.
+Sets rotation angle of the cut plane presentation.
+*/
+    void SetRotateX(in double theAngle);
+    const string SetRotateX__doc__ = "Rotation around X-axis.\nSets rotation angle of the cut plane presentation.";
+/*! Rotation around X-axis.
+Gets rotation angle of the cut plane presentation.
+*/
+    double GetRotateX();
+    const string GetRotateX__doc__ = "Rotation around X-axis.\nGets rotation angle of the cut plane presentation.";
+/*! Rotation around Y-axis.
+Sets rotation angle of the cut plane presentation.
+*/
+    void SetRotateY(in double theAngle);
+    const string SetRotateY__doc__ = "Rotation around Y-axis.\nSets rotation angle of the cut plane presentation.";
+/*! Rotation around Y-axis.
+Sets rotation angle of the cut plane presentation.
+*/
+    double GetRotateY();
+    const string GetRotateY__doc__ = "Rotation around Y-axis.\nGets rotation angle of the cut plane presentation.";
+  };
+    const string CutPlanes__doc__ = "The cut planes interface contains\nthe presentation parameters of cut planes presentation.";
+  //-------------------------------------------------------
+  /*! \brief Interface of the stream lines representation    
+  This interface contains presentation parameters of
+  stream lines presentations.
+  */
+  interface StreamLines : DeformedShape{
+    enum Direction{ FORWARD,
+                   BACKWARD,
+                   BOTH
+    };
+  };
+  const string StreamLines__doc__ = "";
+
+
+/*! \brief Interface of the isometric surface representation
+
+   This interface contains presentation parameters of
+    isometric surface presentations.
+*/
+  interface IsoSurfaces : ScalarMap{
+/*!
+   Sets the number of isometric surfaces.
+*/
+    void SetNbSurfaces(in long theNb);
+    const string SetNbSurfaces__doc__ = "Sets the number of isometric surfaces.";
+/*!
+   Gets the number of isometric surfaces
+*/
+    long GetNbSurfaces();
+    const string GetNbSurfaces__doc__ = "Gets the number of isometric surfaces.";
+  };
+    const string IsoSurfaces__doc__ = "The isometric surface interface contains\nthe presentation parameters of the isometric surface presentations.";
+  //-------------------------------------------------------
+/*! \brief Interface of the vector presentation.
+
+This interface contains presentation parameters of the vector.
+*/
+  interface Vectors : DeformedShape{
+/*!
+Sets the width of the line of the vector.
+*/
+    void SetLineWidth(in double theWidth);
+    const string SetLineWidth__doc__ = "Sets the width of the line of the vector.";
+/*!
+Gets the width of the line of the vector.
+*/
+    double GetLineWidth();
+    const string GetLineWidth__doc__ = "Gets the width of the line of the vector.";
+/*!
+ This enumeration contains a set of elements defining the type of representation of the vector head.
+*/
+    enum GlyphType{ ARROW,
+                    CONE2,
+                    CONE6,
+                    NONE
+                  };
+/*!
+Sets the type of representation of the vector head.
+*/
+    void SetGlyphType(in GlyphType theType);
+    const string SetGlyphType__doc__ = "Sets the type of representation of the vector head.";
+/*!
+Gets the type of representation of the vector head.
+*/
+    GlyphType GetGlyphType();
+    const string GetGlyphType__doc__ = "Gets the type of representation of the vector head.";
+/*!
+ This enumeration contains a set of elements defining the position of the vector head.
+*/
+
+    enum GlyphPos{ CENTER, /*!<In the center of the vector.*/
+                   TAIL,   /*!<In the tail of the vector.*/
+                   HEAD  /*!<In the head of the vector.*/
+                 };
+/*!
+Sets the position of the vector head.
+*/
+    void SetGlyphPos(in GlyphPos thePos);
+    const string SetGlyphPos__doc__ = "Sets the position of the vector head.";
+/*!
+Gets the position of the vector head.
+*/
+    GlyphPos GetGlyphPos();
+    const string GetGlyphPos__doc__ = "Gets the position of the vector head.";
+  };
+    const string Vectors__doc__ = "Interface of the vector presentation contains\nthe presentation parameters of the vector.";
+  //-------------------------------------------------------
+/*! \brief Interface %Result
+
+This interface serves for inner representation of data generated in other sources. (MED object or file)
+This data is needed for further construction of graphical presentations.
+*/
+  interface Result : Base {
+  };
+    const string Result__doc__ = "This interface serves for inner representation\nof data generated in other sources. (MED object or file) This data is needed for further construction of graphical presentations.";
+  //-------------------------------------------------------
+  interface ViewManager;
+/*! \brief %VISU_Gen interface
+
+This is the main interface of %VISU component. It is necessary for creation of
+post-processing presentations from given %Result and %Table object reference, using the views
+provided by %ViewManager.
+*/
+   interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base{
+     void SetCurrentStudy(in SALOMEDS::Study theStudy);
+     SALOMEDS::Study GetCurrentStudy();
+/*!
+    Gets the %ViewManager which is used for creation of
+    post-processing presentations.
+*/
+    ViewManager GetViewManager();
+    const string GetViewManager__doc__ = "Gets the ViewManager which is used for creation\nof post-processing presentations.";
+
+/*!
+Imports tables from a file and create TableAttribute in Sudy
+*/
+    SALOMEDS::SObject ImportTables(in string theFileName);
+/*!
+Imports data from a file.
+*/
+    Result ImportFile(in string theFileName);
+    const string ImportFile__doc__ = "Imports data from a file.";
+/*!
+Imports data from a %MED object field.
+*/
+    Result ImportMed(in SALOMEDS::SObject theMedSObject);
+    const string ImportMed__doc__ = "Imports data from a MED object field.";
+
+/*!
+Creates a %Mesh on the basis of the data generated in other sources (MED object or file).
+*/
+    const string CreateMesh__doc__ = "Creates a Mesh on the basis of the data\ngenerated in other sources (MED object or file).";
+    Mesh MeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity);
+    Mesh FamilyMeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity, in string theFamilyName);
+    Mesh GroupMesh(in Result theResult, in string theMeshName, in string theGroupName);
+/*!
+Creates a scalar bar presentation.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/
+    ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateScalarMap__doc__ = "Creates a scalar bar presentation.";
+/*!
+Creates a deformed shape presentation.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/
+    DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateDeformedShape__doc__ = "Creates a deformed shape presentation.";
+/*!
+Creates a vector presentation.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/
+
+    Vectors VectorsOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateVectors__doc__ = "Creates a vector presentation.";
+/*!
+Creates an iso surface presentation.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/
+
+    IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateIsoSurfaces__doc__ = "Creates an iso surface presentation.";
+/*!
+Creates an stream lines presentation.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/    
+    StreamLines StreamLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateStreamLines__doc__ = "Creates an stream lines presentation.";
+
+/*!
+Creates a presentation of cut planes.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
+\param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
+\param theIteration  Number of iteration on the field
+*/
+    CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
+    const string CreateCutPlanes__doc__ = "Creates a presentation of cut planes.";
+/*!
+Creates a table presentation.
+*/
+    Table CreateTable(in string theTableEntry);
+    const string CreateTable__doc__ = "Creates a table prasentation containing the data.";
+/*!
+Creates a curve on the basis of points, whose values are taken from the table.
+\param theTable  Table containing the data for construction of curves.
+\param HRow  Index of the row in the table:  abscissa of the point.
+\param VRow  Index of the row in the table:  ordinate of the point.
+*/
+    Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow);
+    const string CreateCurve__doc__ = "Creates a curve on the basis of points, whose values\nare taken from the table.";
+/*!
+Creates a presentation form containing an array of references to the curves.
+*/
+     Container CreateContainer();
+     const string CreateContainer__doc__ = "Creates a presentation form containing an array\nof references to the curves.";
+  };
+     const string VISU_Gen__doc__ = "This is the main interface of the VISU component. It is\nnecessary for creation of post-processing presentations from given result and table object reference, using the views provided by the viewmanager.";
+/*! \brief %View interface
+
+ Contains a set of methods used by the %View frame, which can be one of
+ the following types: 3d, Table, XY plot.
+ %View interface is a base for all types of %view interfaces.
+*/
+  interface View: Base{
+/*!
+Sets the title of the %View frame.
+*/
+    void SetTitle(in string theTitle);
+    const string SetTitle__doc__ = "Sets the title of the view frame.";
+/*!
+Gets the title of the %View frame.
+*/
+    string GetTitle();
+    const string GetTitle__doc__ = "Gets the title of the view frame.";
+/*!
+Sets background color of the %View frame.
+*/
+    void SetBackground(in SALOMEDS::Color theColor);
+    const string SetBackground__doc__ = "Sets background color of the view frame.";
+/*!
+Gets background color of the %View frame.
+*/
+    SALOMEDS::Color GetBackground();
+    const string GetBackground__doc__ = "Gets background color of the view frame.";
+/*!
+Minimizes to the task bar or to the bottom of the Desktop the %View frame.
+*/
+    void Minimize();
+    const string Minimize__doc__ = "Minimizes to the task bar or to the bottom of the\nDesktop the view frame.";
+/*!
+Restores the %View frame.
+*/
+    void Restore();
+    const string Restore__doc__ = "Restores the view frame.";
+/*!
+Maximizes the %View frame.
+*/
+    void Maximize();
+    const string Maximize__doc__ = "Maximizes the view frame.";
+/*!
+Removes all presentations (presentable objects) from the %view.
+*/
+    void EraseAll();
+    const string EraseAll__doc__ = "Removes all presentations (presentable objects) from the view.";
+/*!
+Displays all presentations (presentable objects) in the %view.
+*/
+    void DisplayAll();
+    const string DisplayAll__doc__ = "Displays all presentations (presentable objects) in the view.";
+/*!
+Removes a definite presentation (presentable object) from the %view.
+*/
+    void Erase(in PrsObject thePrsObj);
+    const string Erase__doc__ = "Removes a definite presentation (presentable object) from the view.";
+/*!
+Displays a definite presentation (presentable object) in the %view.
+*/
+    void Display(in PrsObject thePrsObj);
+    const string Display__doc__ = "Displays a definite presentation (presentable object) in the view.";
+/*!
+Allows to display only a definite presentation (presentable object) in the %view.
+All other presentations are removed from the %view.
+*/
+    void DisplayOnly(in PrsObject thePrsObj);
+    const string DisplayOnly__doc__ = "Allows to display only a definite presentation\n(presentable object) in the view. All other presentations are\nremoved from the view.";
+/*!
+Updates the view.
+*/
+    void Update();
+    const string Update__doc__ = "Updates the view.";
+
+/*!
+Saves the view.
+*/
+    boolean SavePicture(in string theFileName);
+    const string SavePicture__doc__ = "Saves the view contents into image file.";
+  };
+
+    const string View__doc__ = "Contains a set of methods used by the view frame,\nwhich can be one of the following types:\n3d, table, XY plot.";
+  //-------------------------------------------------------
+/*! \brief 3D view interface
+
+This interface contains a set of methods necessary for representation of objects in 3D space.
+*/
+
+  interface View3D : View {
+/*!
+This enumeration contains a set of elements determining a predefined point of view
+  (position of the camera in 3D space relative to the presentable object).
+*/
+    enum ViewType{ FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM};
+/*!
+This enumeration contains a set of elements determining the axis
+*/
+    enum Axis{ XAxis, YAxis, ZAxis};
+/*!
+Data type defining coordinates in 3D space.
+*/
+    typedef double XYZ[3];
+
+/*!
+ Makes all presentations, which are currently present in the %view, completely visible.
+*/
+
+    void FitAll();
+    const string FitAll__doc__ = "Makes all presentations, which are currently present in the\nview, completely visible.";
+
+/*!
+Sets a predefined point of view (FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM). (In other words it means
+ a predefined position of the camera in 3D space with respect to the object which is represented.)
+*/
+    void SetView(in ViewType theType);
+    const string SetView__doc__ = "Sets a predefined point of view\n(FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM).";
+
+/*!
+Sets the position of the camera in 3D space. This point is used as the first point of the vector defining
+the view direction of the camera.
+*/
+    void SetPointOfView(in XYZ theCoord);
+    const string SetPointOfView__doc__ = "Sets the position of the camera in 3D space.";
+/*!
+Gets the position of the camera in 3D space.This point is used as the first point of the vector defining
+the view direction of the camera.
+*/
+    XYZ GetPointOfView();
+    const string GetPointOfView__doc__ = "Gets the position of the camera in 3D space.";
+/*!
+Sets the vertical line of the camera in 3D space.
+*/
+    void SetViewUp(in XYZ theDir);
+    const string SetViewUp__doc__ = "Sets the vertical line of the camera in 3D space.";
+/*!
+Gets the vertical line of the camera in 3D space.
+*/
+    XYZ GetViewUp();
+    const string GetViewUp__doc__ = "Gets the vertical line of the camera in 3D space.";
+/*!
+Sets the point of sight of the camera. This point is used as the second point of the vector defining
+the view direction of the camera.
+*/
+    void SetFocalPoint(in XYZ theDir);
+    const string SetFocalPoint__doc__ = "Sets the point of sight of the camera.";
+/*!
+Gets the point of sight of the camera. This point is used as the second point of the vector defining
+the view direction of the camera.
+*/
+    XYZ GetFocalPoint();
+    const string GetFocalPoint__doc__ = "Gets the point of sight of the camera.";
+/*!
+Zooming of the presentable object. Sets the scale.
+*/
+    void SetParallelScale(in double theScale);
+    const string SetParallelScale__doc__ = "Zooming of the presentable object. Sets the scale.";
+/*!
+Zooming of the presentable object. Gets the scale.
+*/
+    double GetParallelScale();
+    const string GetParallelScale__doc__ = "Zooming of the presentable object. Gets the scale.";
+/*!
+Scaling of the view along a definite axis.
+\param theAxis The axis of the scaling
+\param theParam The coefficient of the scaling
+*/
+    void ScaleView(in Axis theAxis, in double theParam);
+    const string ScaleView__doc__ = "Scaling of the view along a definite axis and with a\ndefinite coefficient of the scaling.";
+/*!
+Removes the scaling of the view.
+*/
+    void RemoveScale();
+    const string RemoveScale__doc__ = "Removes the scaling of the view.";
+/*!
+Returns True if the view parameters have been created, False if the parameters have been modified.
+*/
+    boolean SaveViewParams(in string theName);
+    const string SaveViewParams__doc__ = "Returns True if the view parameters have been created,\nFalse if the parameters have been modified.";
+/*!
+Returns True if the view parameters have been found and applied to the view,
+False if the parameters with this name don't exist.
+*/
+    boolean RestoreViewParams(in string theName);
+    const string RestoreViewParams__doc__ = "Returns True if the view parameters have been found and\napplied to the view, False if the parameters with this name don't exist.";
+  };
+    const string View3D__doc__ = "This interface contains a set of methods necessary for representation\nof objects in 3D space.";
+
+
+  //-------------------------------------------------------
+  interface TableView : View {
+   
+  };
+
+
+  //-------------------------------------------------------
+  interface XYPlot : View {
+    void SetSubTitle(in string theTitle);
+    string GetSubTitle();
+
+    enum CurveType { POINTS, MULTYLINE, SPLINE};
+    void SetCurveType(in CurveType theType);
+    CurveType GetCurveType();
+       
+    void SetMarkerSize(in long theSize);
+    long GetMarkerSize();
+
+    void EnableXGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor);
+    void EnableYGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor);
+    void SetHorScaling(in Scaling theScaling);
+    Scaling GetHorScaling();
+    void SetVerScaling(in Scaling theScaling);
+    Scaling GetVerScaling();
+
+    void SetXTitle(in string theTitle);
+    string GetXTitle();
+
+    void SetYTitle(in string theTitle);
+    string GetYTitle();
+
+    void ShowLegend(in boolean theShowing);
+
+    void FitAll();
+  };
+
+  //-------------------------------------------------------
+/*! \brief Interface of the %ViewManager
+
+   The %ViewManager is necessary for work with view windows (creation and deletion).
+*/
+
+    interface ViewManager: Base{
+/*! \brief Getting an active %View Frame
+
+ Returns an object reference to the active %View Frame.
+ Type of the %View must be checked.
+ \note <BR>Returns nil if there are no views currently opened.
+*/
+
+    View GetCurrentView();
+    const string GetCurrentView__doc__ = "Getting an active View Frame.\nReturns an object reference to the active view frame.";
+/*! \brief Creation of a 3d %View.
+
+ Returns an object reference to the newly created 3d %View.
+*/
+    View3D Create3DView();
+    const string Create3DView__doc__ = "Creation of a 3d view.\nReturns an object reference to the newly created 3d view.";
+
+    TableView CreateTableView(in Table theTable);
+
+    const string CreateTableView__doc__ = "Creation of a table view.\nReturns an object reference to the newly created table view.";
+    XYPlot CreateXYPlot();
+
+    const string CreateXYPlot__doc__ = "Creation of a 2d view.\nReturns an object reference to the newly created XYPlot view.";
+    void Destroy(in View theView);
+
+    const string Destroy__doc__ = "Destroying of the view";
+
+
+ };
+    const string ViewManager__doc__ = "The ViewManager interface is necessary for work\nwith view windows (creation and deletion).";
+};
+#endif
+
+
diff --git a/resources/ModuleVisu.png b/resources/ModuleVisu.png
new file mode 100644 (file)
index 0000000..7990d93
Binary files /dev/null and b/resources/ModuleVisu.png differ
diff --git a/resources/VISU_en.xml b/resources/VISU_en.xml
new file mode 100644 (file)
index 0000000..121d712
--- /dev/null
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE application PUBLIC "" "desktop.dtd">
+
+<!--  GUI customization for VISU component  -->
+
+<application> <!-- APPLICATION BEGIN  -->
+
+       title="Visu component"
+       date="24/07/2001"
+       author="Laurent CORNABE"
+       appId="Visu for Salome" >
+
+<desktop>  <!-- DESKTOP BEGIN  -->
+<menubar>  <!-- MENUBAR BEGIN  --> 
+
+<!-- ************************* File  (menubar) ************************************** -->
+<menu-item label-id="File" item-id="1" pos-id="1">
+  <popup-item item-id="199" pos-id="8" label-id="Import table from File" icon-id="" tooltip-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="112" pos-id="8" label-id="Import from File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/>
+  <popup-item item-id="113" pos-id="9" label-id="Explore MED File" icon-id="" tooltip-id="" accel-id="Ctrl+M" toggle-id="" execute-action=""/>
+  <!--popup-item item-id="122" pos-id="10" label-id="Export to File" icon-id="" tooltip-id="" accel-id="Ctrl+E" toggle-id="" execute-action=""/-->
+  <separator pos-id="11"/> 
+</menu-item>
+  
+<!-- ************************* Visualization (menubar) ************************************** -->
+<menu-item label-id="Visualization" item-id="401" pos-id="3">
+  <popup-item item-id="4011" pos-id="" label-id="Scalar Map" icon-id="Visu_scalars.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4012" pos-id="" label-id="Deformed Shape" icon-id="Visu_deformed.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4013" pos-id="" label-id="Vectors" icon-id="Visu_vectors.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <!--popup-item item-id="4017" pos-id="" label-id="Same As..." icon-id="Visu_sameas.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/-->
+</menu-item>
+                       
+<!-- ************************* Selection (menubar) ************************************** -->
+<menu-item label-id="Selection" item-id="41" pos-id="4">
+  <submenu label-id="Cell" item-id="411" pos-id="">
+    <popup-item item-id="4111" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4112" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <submenu label-id="Point" item-id="412" pos-id="">
+    <popup-item item-id="4121" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4122" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <popup-item item-id="413" pos-id="" label-id="Shape" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+</menu-item>
+
+<!-- ************************* Representation (menubar) ************************************** -->
+<menu-item label-id="Representation" item-id="42" pos-id="5">
+  <submenu label-id="Display Selection" item-id="421" pos-id="">
+    <popup-item item-id="4213" pos-id="" label-id="Points" icon-id="Visu_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4211" pos-id="" label-id="Wireframe" icon-id="Visu_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4212" pos-id="" label-id="Surface" icon-id="Visu_surface.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <popup-item item-id="422" pos-id="" label-id="Erase All" icon-id="Visu_eraseall.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+</menu-item>
+
+</menubar> <!-- MENUBAR END  -->
+
+<!-- ************************* Preferences (menubar) ************************************** -->
+<menu-item label-id="Preferences" item-id="4" pos-id="">
+  <submenu label-id="Visu" item-id="" pos-id="-1">
+    <popup-item item-id="51" pos-id="" label-id="Scalar Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="52" pos-id="" label-id="Sweeping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu />   
+  <separator pos-id="-1"/> 
+</menu-item>
+  
+<!-- ################################# ICONS IN TOOLBAR #################################  -->   
+<toolbar label-id="Representation Toolbar">
+  <toolbutton-item item-id="4213" pos-id="" label-id="Points" icon-id="Visu_points.png" tooltip-id="Points" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4211" pos-id="" label-id="Wireframe" icon-id="Visu_wireframe.png" tooltip-id="Wireframe" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4212" pos-id="" label-id="Surface" icon-id="Visu_surface.png" tooltip-id="Surface" accel-id="" toggle-id="" execute-action=""/>
+  <separatorTB/>
+  <toolbutton-item item-id="422" pos-id="" label-id="Erase All" icon-id="Visu_eraseall.png" tooltip-id="Erase All" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="Global Selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="Partial Selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="Scaling" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+
+<toolbar label-id="Visualization Toolbar">
+  <toolbutton-item item-id="4011" pos-id="" label-id="Scalar Map" icon-id="Visu_scalars.png" tooltip-id="Scalar Map" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4012" pos-id="" label-id="Deformed shape" icon-id="Visu_deformed.png" tooltip-id="Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4013" pos-id="" label-id="Vectors" icon-id="Visu_vectors.png" tooltip-id="Vectors" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="Iso Surfaces" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="Cut Planes" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4016" pos-id="" label-id="Stream Lines" icon-id="Visu_streamlines.png" tooltip-id="Stream Lines" accel-id="" toggle-id="" execute-action=""/>
+  <!--toolbutton-item item-id="4017" pos-id="" label-id="Same As..." icon-id="Visu_sameas.png" tooltip-id="Same As" accel-id="" toggle-id="" execute-action=""/-->
+</toolbar>
+
+<toolbar label-id="Selection Toolbar">
+  <toolbutton-item item-id="101" pos-id="" label-id="Point" icon-id="Visu_selectionpoint.png" tooltip-id="Point selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="102" pos-id="" label-id="Edge" icon-id="Visu_selectionedge.png" tooltip-id="Edge selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="103" pos-id="" label-id="Cell" icon-id="Visu_selectioncell.png" tooltip-id="Cell selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="104" pos-id="" label-id="Actor" icon-id="Visu_selectionactor.png" tooltip-id="Actor selection" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+  
+</desktop>      <!--   DESKTOP END    -->  
+</application>  <!-- APPLICATION END  -->
diff --git a/resources/VISU_fr.xml b/resources/VISU_fr.xml
new file mode 100644 (file)
index 0000000..7ff81e2
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE application PUBLIC "" "desktop.dtd">
+
+<!--  GUI customization for VISU component  -->
+
+<application> <!-- APPLICATION BEGIN  -->
+
+       title="Visu component"
+       date="24/07/2001"
+       author="Laurent CORNABE"
+       appId="Visu for Salome" >
+
+<desktop>  <!-- DESKTOP BEGIN  -->
+<menubar>  <!-- MENUBAR BEGIN  --> 
+
+<!-- ************************* File  (menubar) ************************************** -->
+<menu-item label-id="File" item-id="1" pos-id="1">
+  <popup-item item-id="112" pos-id="8" label-id="Import from File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/>
+  <!-- popup-item item-id="122" pos-id="9" label-id="Export to File" icon-id="" tooltip-id="" accel-id="Ctrl+E" toggle-id="" execute-action=""/-->
+  <separator pos-id="10"/> 
+</menu-item>
+  
+<!-- ************************* Visualization (menubar) ************************************** -->
+<menu-item label-id="Visualization" item-id="401" pos-id="3">
+  <popup-item item-id="4011" pos-id="" label-id="Scalar Map" icon-id="Visu_scalars.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4012" pos-id="" label-id="Deformed Shape" icon-id="Visu_deformed.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4013" pos-id="" label-id="Vectors" icon-id="Visu_vectors.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <!--popup-item item-id="4016" pos-id="" label-id="Same As..." icon-id="Visu_sameas.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/-->
+</menu-item>
+                       
+<!-- ************************* Selection (menubar) ************************************** -->
+<menu-item label-id="Selection" item-id="41" pos-id="4">
+  <submenu label-id="Cell" item-id="411" pos-id="">
+    <popup-item item-id="4111" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4112" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <submenu label-id="Point" item-id="412" pos-id="">
+    <popup-item item-id="4121" pos-id="" label-id="Select by number" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4122" pos-id="" label-id="Return attributes" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <popup-item item-id="413" pos-id="" label-id="Shape" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+</menu-item>
+
+<!-- ************************* Representation (menubar) ************************************** -->
+<menu-item label-id="Representation" item-id="42" pos-id="5">
+  <submenu label-id="Display Selection" item-id="421" pos-id="">
+    <popup-item item-id="4213" pos-id="" label-id="Points" icon-id="Visu_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4211" pos-id="" label-id="Wireframe" icon-id="Visu_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="4212" pos-id="" label-id="Surface" icon-id="Visu_surface.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu /> 
+  <popup-item item-id="422" pos-id="" label-id="Erase All" icon-id="Visu_eraseall.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  <popup-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+</menu-item>
+
+</menubar> <!-- MENUBAR END  -->
+
+<!-- ************************* Preferences (menubar) ************************************** -->
+<menu-item label-id="Preferences" item-id="4" pos-id="">
+  <submenu label-id="Visu" item-id="" pos-id="-1">
+    <popup-item item-id="51" pos-id="" label-id="Scalar Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+    <popup-item item-id="52" pos-id="" label-id="Sweeping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+  </submenu>
+  <endsubmenu />   
+  <separator pos-id="-1"/> 
+</menu-item>
+  
+<!-- ################################# ICONS IN TOOLBAR #################################  -->   
+<toolbar label-id="Representation Toolbar">
+  <toolbutton-item item-id="4213" pos-id="" label-id="Points" icon-id="Visu_points.png" tooltip-id="Points" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4211" pos-id="" label-id="Wireframe" icon-id="Visu_wireframe.png" tooltip-id="Wireframe" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4212" pos-id="" label-id="Surface" icon-id="Visu_surface.png" tooltip-id="Surface" accel-id="" toggle-id="" execute-action=""/>
+  <separatorTB/>
+  <toolbutton-item item-id="422" pos-id="" label-id="Erase All" icon-id="Visu_eraseall.png" tooltip-id="Erase All" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="423" pos-id="" label-id="Global Selection" icon-id="Visu_selectall.png" tooltip-id="Global Selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="424" pos-id="" label-id="Partial Selection" icon-id="Visu_selectonly.png" tooltip-id="Partial Selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="430" pos-id="" label-id="Scaling" icon-id="Visu_scaling.png" tooltip-id="Scaling" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+
+<toolbar label-id="Visualisation Toolbar">
+  <toolbutton-item item-id="4011" pos-id="" label-id="Scalar Map" icon-id="Visu_scalars.png" tooltip-id="Scalar Map" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4012" pos-id="" label-id="Deformed shape" icon-id="Visu_deformed.png" tooltip-id="Deformed Shape" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4013" pos-id="" label-id="Vectors" icon-id="Visu_vectors.png" tooltip-id="Vectors" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4014" pos-id="" label-id="Iso Surfaces" icon-id="Visu_isosurfaces.png" tooltip-id="Iso Surfaces" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="4015" pos-id="" label-id="Cut Planes" icon-id="Visu_cutplane.png" tooltip-id="Cut Planes" accel-id="" toggle-id="" execute-action=""/>
+  <!--toolbutton-item item-id="4016" pos-id="" label-id="Same As..." icon-id="Visu_sameas.png" tooltip-id="Same As" accel-id="" toggle-id="" execute-action=""/-->
+</toolbar>
+
+<toolbar label-id="Selection Toolbar">
+  <toolbutton-item item-id="101" pos-id="" label-id="Point" icon-id="Visu_selectionpoint.png" tooltip-id="Point selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="102" pos-id="" label-id="Edge" icon-id="Visu_selectionedge.png" tooltip-id="Edge selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="103" pos-id="" label-id="Cell" icon-id="Visu_selectioncell.png" tooltip-id="Cell selection" accel-id="" toggle-id="" execute-action=""/>
+  <toolbutton-item item-id="104" pos-id="" label-id="Actor" icon-id="Visu_selectionactor.png" tooltip-id="Actor selection" accel-id="" toggle-id="" execute-action=""/>
+</toolbar>
+  
+</desktop>      <!--   DESKTOP END    -->  
+</application>  <!-- APPLICATION END  -->
diff --git a/resources/Visu_anim.png b/resources/Visu_anim.png
new file mode 100644 (file)
index 0000000..86a5ffb
Binary files /dev/null and b/resources/Visu_anim.png differ
diff --git a/resources/Visu_cutplane.png b/resources/Visu_cutplane.png
new file mode 100644 (file)
index 0000000..5e92cf6
Binary files /dev/null and b/resources/Visu_cutplane.png differ
diff --git a/resources/Visu_deformed.png b/resources/Visu_deformed.png
new file mode 100644 (file)
index 0000000..def8c33
Binary files /dev/null and b/resources/Visu_deformed.png differ
diff --git a/resources/Visu_deformed_anim.png b/resources/Visu_deformed_anim.png
new file mode 100644 (file)
index 0000000..4cee800
Binary files /dev/null and b/resources/Visu_deformed_anim.png differ
diff --git a/resources/Visu_eraseall.png b/resources/Visu_eraseall.png
new file mode 100644 (file)
index 0000000..9cf1518
Binary files /dev/null and b/resources/Visu_eraseall.png differ
diff --git a/resources/Visu_isosurfaces.png b/resources/Visu_isosurfaces.png
new file mode 100644 (file)
index 0000000..2946029
Binary files /dev/null and b/resources/Visu_isosurfaces.png differ
diff --git a/resources/Visu_plot2d.png b/resources/Visu_plot2d.png
new file mode 100644 (file)
index 0000000..e6d2089
Binary files /dev/null and b/resources/Visu_plot2d.png differ
diff --git a/resources/Visu_plot3d.png b/resources/Visu_plot3d.png
new file mode 100644 (file)
index 0000000..ea7b574
Binary files /dev/null and b/resources/Visu_plot3d.png differ
diff --git a/resources/Visu_points.png b/resources/Visu_points.png
new file mode 100644 (file)
index 0000000..92d535b
Binary files /dev/null and b/resources/Visu_points.png differ
diff --git a/resources/Visu_sameas.png b/resources/Visu_sameas.png
new file mode 100644 (file)
index 0000000..3611ef4
Binary files /dev/null and b/resources/Visu_sameas.png differ
diff --git a/resources/Visu_scalars.png b/resources/Visu_scalars.png
new file mode 100644 (file)
index 0000000..f048e92
Binary files /dev/null and b/resources/Visu_scalars.png differ
diff --git a/resources/Visu_scalars_anim.png b/resources/Visu_scalars_anim.png
new file mode 100644 (file)
index 0000000..e618816
Binary files /dev/null and b/resources/Visu_scalars_anim.png differ
diff --git a/resources/Visu_scaling.png b/resources/Visu_scaling.png
new file mode 100644 (file)
index 0000000..5d34436
Binary files /dev/null and b/resources/Visu_scaling.png differ
diff --git a/resources/Visu_selectall.png b/resources/Visu_selectall.png
new file mode 100644 (file)
index 0000000..ec58903
Binary files /dev/null and b/resources/Visu_selectall.png differ
diff --git a/resources/Visu_selectionactor.png b/resources/Visu_selectionactor.png
new file mode 100644 (file)
index 0000000..6d6cdfb
Binary files /dev/null and b/resources/Visu_selectionactor.png differ
diff --git a/resources/Visu_selectioncell.png b/resources/Visu_selectioncell.png
new file mode 100644 (file)
index 0000000..f83268f
Binary files /dev/null and b/resources/Visu_selectioncell.png differ
diff --git a/resources/Visu_selectionedge.png b/resources/Visu_selectionedge.png
new file mode 100644 (file)
index 0000000..bd6d9df
Binary files /dev/null and b/resources/Visu_selectionedge.png differ
diff --git a/resources/Visu_selectionpoint.png b/resources/Visu_selectionpoint.png
new file mode 100644 (file)
index 0000000..0ac7cd4
Binary files /dev/null and b/resources/Visu_selectionpoint.png differ
diff --git a/resources/Visu_selectonly.png b/resources/Visu_selectonly.png
new file mode 100644 (file)
index 0000000..3d7b24e
Binary files /dev/null and b/resources/Visu_selectonly.png differ
diff --git a/resources/Visu_streamlines.png b/resources/Visu_streamlines.png
new file mode 100644 (file)
index 0000000..344ca19
Binary files /dev/null and b/resources/Visu_streamlines.png differ
diff --git a/resources/Visu_surface.png b/resources/Visu_surface.png
new file mode 100644 (file)
index 0000000..98de1fd
Binary files /dev/null and b/resources/Visu_surface.png differ
diff --git a/resources/Visu_tree_visu.png b/resources/Visu_tree_visu.png
new file mode 100644 (file)
index 0000000..56ce446
Binary files /dev/null and b/resources/Visu_tree_visu.png differ
diff --git a/resources/Visu_vectors.png b/resources/Visu_vectors.png
new file mode 100644 (file)
index 0000000..caac159
Binary files /dev/null and b/resources/Visu_vectors.png differ
diff --git a/resources/Visu_wireframe.png b/resources/Visu_wireframe.png
new file mode 100644 (file)
index 0000000..8406b9b
Binary files /dev/null and b/resources/Visu_wireframe.png differ
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644 (file)
index 0000000..d01b6f4
--- /dev/null
@@ -0,0 +1,20 @@
+#==============================================================================
+#  File      : Makefile.in
+#  Created   : ven déc  7 13:32:20 CET 2001
+#  Author    : Paul RASCLE, EDF
+#  Project   : SALOME
+#  Copyright : EDF 2001
+#  $Header$
+#==============================================================================
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+@COMMENCE@
+
+SUBDIRS = OBJECT VISU_I VISUGUI VISU_SWIG
+
+@MODULE@
diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in
new file mode 100644 (file)
index 0000000..54a6cbc
--- /dev/null
@@ -0,0 +1,33 @@
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:$(srcdir):$(top_srcdir)/idl:$(top_builddir)/idl
+
+
+@COMMENCE@
+
+EXPORT_HEADERS = VISU_Actor.h
+
+
+# Libraries targets
+
+LIB = libVisuObject.la
+LIB_SRC = VISU_Actor.cxx 
+
+LIB_CLIENT_IDL = 
+
+# Executables targets
+BIN = 
+BIN_SRC        =
+
+CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
+       $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS+=$(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) \
+       -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome
+
+%_moc.cxx: %.h
+       $(MOC) $< -o $@
+
+
+@CONCLUDE@
diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx
new file mode 100644 (file)
index 0000000..a94fb9d
--- /dev/null
@@ -0,0 +1,118 @@
+using namespace std;
+//  File      : VISU_Actor.cxx
+//  Created   : Wed Feb 20 18:04:42 CET 2002
+//  Author    : Laurent CORNABE with help of Nicolas REJNERI
+//  Project   : SALOME
+//  Module    : VISU
+//  Copyright : PRINCIPIA RD
+//  $Header$
+
+#include "VISU_Actor.h"
+#include "utilities.h"
+// VTK Includes
+#include <vtkObjectFactory.h>
+
+VISU_Actor* VISU_Actor::New(){
+  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_Actor");
+  if(ret) return (VISU_Actor*)ret;
+  return new VISU_Actor;
+} 
+VISU_Actor::VISU_Actor(){
+  this->Device = vtkActor::New();
+
+  this->EdgeDevice = NULL;
+  //this->EdgeDevice = SALOME_Actor::New();
+  //EdgeDevice->VisibilityOff();
+  //EdgeDevice->PickableOff();
+
+  this->DataSource = NULL;
+  myScalarBar = NULL;
+  this->myIO = NULL;
+  this->myName = "";
+  this->IsDefined = false;
+  this->IsShrunk = false;
+  this->IsShrinkable = false;
+  this->VisuActorType = 0;
+  this->Presentation = NULL;
+  myHasScalarBar = false;
+  this->HighlightProperty = NULL;
+  this->ishighlighted = false;
+  this->IsHighlighting = true;
+  this->ResultAtNode = false;
+  this->VectorComponent = -1;
+  for (int i=0; i<6; i++)
+         this->VABounds[i] = 0.;
+  strcpy(this->FieldName,"");
+}
+
+
+VISU_Actor::~VISU_Actor()
+{
+  if (EdgeDevice != NULL)
+    this->EdgeDevice->Delete();  
+}
+
+
+void VISU_Actor::setScalarBar(VISU_ScalarBarActor* theBar) {
+  if (theBar) {
+    myScalarBar = theBar;
+    myHasScalarBar = true;
+  } else {
+    myScalarBar = NULL;
+    myHasScalarBar = false;
+  }
+}
+
+
+void VISU_Actor::setActor(vtkActor *Actor){
+  this->Device=Actor;
+}
+
+void VISU_Actor::ShallowCopy(vtkProp *prop){
+  VISU_Actor *f = VISU_Actor::SafeDownCast(prop);
+  if ( f != NULL )
+    {
+      setName( f->getName() );
+      if ( f->hasIO() )
+       setIO( f->getIO() );
+    }
+  SALOME_Actor::ShallowCopy(prop);
+}
+
+void VISU_Actor::highlight(Standard_Boolean highlight) {
+  if (this->IsHighlighting) {
+    if(highlight && !ishighlighted) {
+      ishighlighted=true;
+      // build highlight property is necessary
+      if(HighlightProperty==NULL) {
+       HighlightProperty = vtkProperty::New();
+       HighlightProperty->SetAmbient(0.5);
+       HighlightProperty->SetDiffuse(0.3);
+       HighlightProperty->SetSpecular(0.2);
+       HighlightProperty->SetRepresentationToSurface();
+       HighlightProperty->SetAmbientColor(1, 1, 1);
+       HighlightProperty->SetDiffuseColor(1, 1, 1);
+       HighlightProperty->SetSpecularColor(0.5, 0.5, 0.5);
+      }
+      this->Property = HighlightProperty;
+    }else if (!highlight) {
+      if(ishighlighted) {
+       ishighlighted=false;
+      }
+    }
+  }
+}
+
+
+void VISU_Actor::setVABounds(const float bounds[6]){
+  for (int i=0; i<6; i++)
+    VABounds[i] = bounds[i];
+}
+
+
+void VISU_Actor::getVABounds(float bounds[6]){
+  for (int i=0; i<6; i++)
+    bounds[i] = VABounds[i];
+}
+
diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h
new file mode 100644 (file)
index 0000000..298f25c
--- /dev/null
@@ -0,0 +1,110 @@
+//  File      : VISU_Actor.h
+//  Created   : Wed Feb 20 18:04:42 CET 2002
+//  Author    : Laurent CORNABE with the help of Nicolas REJNERI
+//  Project   : SALOME
+//  Module    : VISU
+//  Copyright : PRINCIPIA RD
+//  $Header$
+
+
+#ifndef VISU_ACTOR_H
+#define VISU_ACTOR_H
+
+#include "SALOME_Actor.h"
+
+#include <string>
+// VTK Includes
+#include <vtkActor.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkProperty.h>
+
+#ifdef _WIN_32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT
+#endif
+
+#define VisuActorType_Mesh 1
+#define VisuActorType_BoundingBox 2
+#define VisuActorType_DeformedShape 3
+#define VisuActorType_Vectors 4
+#define VisuActorType_ScalarMap 5
+#define VisuActorType_IsoSurfaces 6
+#define VisuActorType_CutPlanes 7
+#define VisuActorType_Plot2D 8
+#define VisuActorType_StreamLines 9
+
+
+
+namespace VISU { 
+  class Prs3d_i;
+}
+
+class VISU_ScalarBarActor;
+
+class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
+  friend class VISU::Prs3d_i;
+ public:
+  vtkTypeMacro(VISU_Actor,SALOME_Actor);
+
+  Standard_Boolean IsHighlighting;
+
+  static VISU_Actor* New();
+
+  void setActor(vtkActor *Actor);
+
+  void ShallowCopy(vtkProp *prop);
+
+  void highlight(Standard_Boolean highlight);
+  Standard_Boolean isHighlighted() { return true; };
+
+  void  SetOpacity(float opa) {};
+  float GetOpacity() 
+    { return 0;};
+
+  Standard_Boolean HasScalarBar()
+    { return myHasScalarBar; }
+
+  void setScalarBar(VISU_ScalarBarActor* theBar);
+  VISU_ScalarBarActor* getScalarBar()
+    { return myScalarBar; }
+
+
+  void setIO(const Handle(SALOME_InteractiveObject)& io) 
+    { SALOME_Actor::setIO(io); myName = io->getName(); }
+    
+
+  VISU::Prs3d_i* getPrs3d() { return Presentation; }
+  void setPrs3d(VISU::Prs3d_i* thePrs) { Presentation = thePrs; }
+    
+  vtkDataSet *DataSource;
+  VISU_Actor*   EdgeDevice;
+
+  Standard_Boolean IsShrinkable;
+  Standard_Boolean IsShrunk;
+  int VisuActorType;
+  Standard_Boolean ResultAtNode;
+  int VectorComponent;
+  char FieldName[40];
+
+  Standard_Boolean IsDefined;
+
+  float VABounds[6];
+  void setVABounds(const float bounds[6]);
+  void getVABounds(float bounds[6]);
+
+  ~VISU_Actor();
+ protected:
+  VISU_Actor();
+  
+  Standard_Boolean myHasScalarBar;
+  VISU_ScalarBarActor* myScalarBar;
+  VISU::Prs3d_i* Presentation;
+
+ private:
+  vtkProperty* HighlightProperty;
+
+};
+#endif //VISU_ACTOR_H
diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in
new file mode 100644 (file)
index 0000000..f1180d0
--- /dev/null
@@ -0,0 +1,65 @@
+# -* Makefile *- 
+#
+# Author : Alexey Petrov
+# Date : 
+# $Header: 
+#
+
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:$(srcdir):$(top_srcdir)/idl:$(top_builddir)/idl
+
+
+@COMMENCE@
+
+# Libraries targets
+LIB = libVISUEngine.la
+LIB_SRC = VISU_Gen_i.cc VISU_Result_i.cc \
+       VISU_PrsObject_i.cc VISU_ViewManager_i.cc VISU_Table_i.cc \
+       VISU_Extractor.cxx VISU_FieldTransform.cxx \
+       VISU_Convertor.cxx VISU_MedConvertor.cxx VISU_DatConvertor.cxx \
+       VISU_Convertor_impl.cxx VISU_CorbaMedConvertor.cxx \
+       VISU_LookupTable.cxx VISU_ScalarBarActor.cxx \
+       VISU_TimeAnimation.cxx
+
+LIB_MOC = VISU_TimeAnimation.h
+
+LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl SALOME_Exception.idl SALOME_Session.idl MED.idl
+LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
+
+# Executables targets
+BIN = VISU_Convertor
+BIN_SRC = VISU_Convertor_impl.cxx VISU_MedConvertor.cxx 
+#BIN_SRC = VISU_Convertor_impl.cxx VISU_MedConvertor.cxx VISU_DatConvertor.cxx
+#BIN = VISU_Convertor
+#BIN_SRC = VISU_Convertor_impl.cxx VISU_MedConvertor.cxx VISU_DatConvertor.cxx \
+#       VISU_LookupTable.cxx VISU_ScalarBarActor.cxx
+
+BIN_CLIENT_IDL =  
+BIN_SERVER_IDL =
+EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh VISU_Result_i.hh \
+       VISU_PrsObject_i.hh VISU_ViewManager_i.hh VISU_Table_i.hh \
+       VISU_Extractor.hxx VISU_FieldTransform.hxx VISU_Convertor.hxx \
+       VISU_LookupTable.hxx VISU_ScalarBarActor.hxx \
+       VISU_TimeAnimation.h
+# additionnal information to compil and link file
+CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
+       $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS  += $(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lSalomeDS \
+       -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer -lVisuObject \
+       -L${KERNEL_ROOT_DIR}/lib/salome
+
+LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d -lSalomeHDFPersist -lSalomeLoggerServer -lRegistry -lqsplitterP -lSalomeLifeCycleCORBA -lSalomeObject -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome
+
+# additional file to be cleaned
+MOSTLYCLEAN =
+CLEAN =
+DISTCLEAN =
+
+@CONCLUDE@
+
+
+
diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh
new file mode 100644 (file)
index 0000000..9b73f05
--- /dev/null
@@ -0,0 +1,105 @@
+// File:       VISU_Common.hh
+// Created:    Tue Dec 24 17:13:35 2002
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+#ifndef __VISU_CONFIG_H__
+#define __VISU_CONFIG_H__
+
+// standard C++ headers
+#include <stdio.h>
+#include <iostream.h>
+#include <string>
+#include <qstring.h> 
+#include <qthread.h> 
+#include <qfileinfo.h>
+#include <qapplication.h>
+
+using namespace std;
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+#include <stdexcept>
+#include <strstream>   
+
+namespace VISU{
+  //===========================================================================
+  class VISU_Gen_i;
+  class Base_i : public virtual POA_VISU::Base,
+                 public virtual PortableServer::RefCountServantBase
+  {
+  public:
+    virtual ~Base_i();
+    virtual char* GetID();
+    virtual VISU::VISUType GetType()=0;
+  protected:
+    static QMutex* myMutex;
+    static CORBA::ORB_var myOrb;
+    static PortableServer::POA_var myPOA;
+    static SALOME_NamingService* myNamingService;
+    static VISU_Gen_i* myVisuGenImpl;
+    static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
+  public:
+    static CORBA::ORB_ptr GetORB() { return myOrb;}
+    static PortableServer::POA_ptr GetPOA() { return myPOA;}
+    static SALOME_NamingService* GetNS() { return myNamingService;}
+    static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
+    static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
+    static VISU_Gen_var GetVisuGenInter();
+  };
+  //===========================================================================
+  class Mutex{
+    QMutex* myMutex;
+    QApplication* myQApp;
+    int isQAppLocked, isSessionLocked;
+  public:
+    Mutex(QMutex* theMutex, QApplication* theQApp);
+    ~Mutex();
+  };
+  //===========================================================================
+  class Storable : public virtual Base_i {
+  protected:
+    virtual void ToStream(ostrstream& theStr) = 0;
+  public:
+    string ToString();
+    virtual const char* GetComment() const = 0;
+    typedef map<string,QString> TRestoringMap;
+    typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, 
+                                        const string& thePrefix, const TRestoringMap& theMap);
+    typedef map<string,TStorableEngine> TCallbackMap;
+    static void Registry(const char* theComment, TStorableEngine theEngine) 
+      throw(std::logic_error&);
+    static Storable* Create(SALOMEDS::SObject_ptr, const string& thePrefix, const string& theString) 
+      throw(std::runtime_error&);
+    static const QString& FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind = NULL)
+      throw(std::logic_error&);
+    static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
+    static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
+    static void DataToStream(ostrstream& theStr, const QString& theName, const QString& theVal);
+    static void DataToStream(ostrstream& theStr, const QString& theName, const int theVal);
+    static void DataToStream(ostrstream& theStr, const QString& theName, const double theVal);
+  };
+  //===========================================================================
+  const CORBA::Boolean IsMultifile();
+  PortableServer::Servant GetServant(CORBA::Object_ptr theObject);
+  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
+  SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
+  string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, 
+                         const char* theFatherEntry, const char* theRefFatherEntry,
+                         const char* theIOR, const char* theName, 
+                         const char* thePersistentRef, const char* theComment,
+                         CORBA::Boolean theCreateNew = true);
+  string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
+                             const char* theComment, int IsAllLevels = true);
+}
+
+#endif
diff --git a/src/VISU_I/VISU_Convertor.cxx b/src/VISU_I/VISU_Convertor.cxx
new file mode 100644 (file)
index 0000000..46a36f9
--- /dev/null
@@ -0,0 +1,483 @@
+using namespace std;
+
+// File:       VISU_Convertor.cxx
+// Created:    Wed Jan 15 17:43:32 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_Convertor.hxx"
+#include <fstream>     
+#include <strstream>
+#include <vtkCellType.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+#include <memory>      
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 1;
+#endif
+
+namespace VISU{
+  TVtkCellInfoMap aVtkCellInfoMap;
+  static int INIT = (
+                    aVtkCellInfoMap[VTK_VERTEX] = TVtkCellInfo("VTK_VERTEX",1),
+                    aVtkCellInfoMap[VTK_LINE] = TVtkCellInfo("VTK_LINE",2),
+                    aVtkCellInfoMap[VTK_TRIANGLE] = TVtkCellInfo("VTK_TRIANGLE",3),
+                    aVtkCellInfoMap[VTK_QUAD] = TVtkCellInfo("VTK_QUAD",4),
+                    aVtkCellInfoMap[VTK_TETRA] = TVtkCellInfo("VTK_TETRA",4),
+                    aVtkCellInfoMap[VTK_HEXAHEDRON] = TVtkCellInfo("VTK_HEXAHEDRON",8),
+                    aVtkCellInfoMap[VTK_WEDGE] = TVtkCellInfo("VTK_WEDGE",6),
+                    aVtkCellInfoMap[VTK_PYRAMID] = TVtkCellInfo("VTK_PYRAMID",5),
+                    1);
+
+  pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
+    throw(std::runtime_error&)
+      {
+       bool isFamilyPresent = (theFamilyName != "");
+       int aNbCells = 0, aCellsSize = 0;
+       if(!isFamilyPresent){
+         TCellsConn::const_iterator aCellsConnIter = myCellsConn.begin();
+         for(; aCellsConnIter != myCellsConn.end(); aCellsConnIter++){
+           const TConnForCellType& aConnForCellType = aCellsConnIter->second;
+           if(!aConnForCellType.empty()){
+             aNbCells += aConnForCellType.size();
+             aCellsSize += aConnForCellType.size()*(aConnForCellType[0].size()+1);
+           }
+         }
+       }else{
+         TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
+         if(aFamilyMapIter == myFamilyMap.end())
+           throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
+         const TFamily& aFamily = aFamilyMapIter->second; 
+         const TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+         TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.begin();
+         for(; aSubMeshIter != aSubMesh.end(); aSubMeshIter++){
+           const TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+           if(!aSubMeshOnCellType.empty()){
+             int tmp = aSubMeshOnCellType.size();
+             aNbCells += tmp;
+             int aVtkType = aSubMeshIter->first;
+             int aVtkSize = aVtkCellInfoMap[aVtkType].mySize;
+             aCellsSize += tmp*(aVtkSize+1);
+           }
+         }
+       }
+       return make_pair(aNbCells,aCellsSize);
+      }
+
+  void TMesh::CreateMeshOnNodes(){
+    TMeshOnEntity& aMeshOnEntity = myMeshOnEntityMap[NODE_ENTITY];
+    TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
+    int jEnd = myPointsCoord.size()/myDim;
+    aConnForCellType.resize(jEnd);
+    for (int j = 0; j < jEnd; j++) aConnForCellType[j] = TMeshOnEntity::TConnect(1,j);
+  }
+
+  const TField* TMesh::GetField(const string& theFieldName) const {
+    TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin();
+    for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+      const TFieldMap& aFieldMap = (aMeshOnEntityMapIter->second).myFieldMap;
+      TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+      for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
+       if(theFieldName == aFieldMapIter->first) return &(aFieldMapIter->second);
+    }
+    return NULL;
+  }
+
+  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+    throw(std::runtime_error&) 
+      {
+       if(theFamilyName == "") return NULL;
+       const VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
+       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+       if(aFamilyMapIter == aFamilyMap.end())
+         throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
+       const VISU::TFamily& aFamily = aFamilyMapIter->second;
+       return &aFamily;
+      }
+  
+  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+    throw(std::runtime_error&) 
+      {
+       if(theFamilyName == "") return NULL;
+       VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
+       VISU::TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+       if(aFamilyMapIter == aFamilyMap.end())
+         throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
+       VISU::TFamily& aFamily = aFamilyMapIter->second;
+       return &aFamily;
+      }
+  
+  void TField::ShallowCopy(const TField& aField){
+    myEntity = aField.myEntity;
+    myMeshName = aField.myMeshName;
+    myNbComp = aField.myNbComp;
+    VISU::TField::TValField::const_iterator iter = aField.myValField.begin();
+    for(; iter != aField.myValField.end(); iter++)
+      myValField[iter->first];
+  }
+}
+
+const VISU::TMeshMap& VISU_Convertor::GetMeshMap() throw(std::runtime_error&){ 
+  if(!myIsDone) { myIsDone = true;  Build();}
+  return myMeshMap;
+}
+
+const VISU::TField& VISU_Convertor::GetField(const string& theMeshName, 
+                                            VISU::TEntity theEntity, 
+                                            const string& theFieldName) 
+     throw (std::runtime_error&)
+{
+  if(!myIsDone) { myIsDone = true;  Build();}
+  VISU::TMeshMap::const_iterator aMeshMapIter = myMeshMap.find(theMeshName);
+  if(aMeshMapIter == myMeshMap.end())
+    throw std::runtime_error("GetField >> There is no mesh with the name !!!");
+  const VISU::TMesh& aMesh = aMeshMapIter->second;
+  VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMesh.myMeshOnEntityMap.find(theEntity);
+  if(aMeshOnEntityMapIter == aMesh.myMeshOnEntityMap.end())
+    throw std::runtime_error("GetField >> There is no mesh with the entity !!!");
+  const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+  const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+  VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.find(theFieldName);
+  if(aFieldMapIter == aFieldMap.end())
+    throw std::runtime_error("GetField >> There is no field with the name !!!");
+  return aFieldMapIter->second;
+}
+
+string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
+  static QString aName;
+  const string aUnits = aTime.second, tmp(aUnits.size(),' ');
+  if(aUnits == "" || aUnits == tmp)
+    aName.sprintf("%g, ---",aTime.first);
+  else
+    aName.sprintf("%g, %s",aTime.first,aTime.second.c_str());
+  aName = aName.simplifyWhiteSpace();
+  return aName.latin1();
+}
+
+string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeId) {
+  static QString aName;
+  aName = QString(theName.c_str()).simplifyWhiteSpace();
+  int iEnd = strlen(aName);
+  static int VtkHighLevelLength = 12; //25
+  if(iEnd > VtkHighLevelLength) iEnd = VtkHighLevelLength;
+  char aNewName[iEnd+1];
+  aNewName[iEnd] = '\0';
+  strncpy(aNewName,aName,iEnd);
+  replace(aNewName,aNewName+iEnd,' ','_');
+  if(true || theTimeId == 0)
+    aName = aNewName;
+  else
+    aName.sprintf("%s_%d",aNewName,theTimeId);
+  return aName.latin1();
+}
+
+void parseFile(const char* theFileName) throw(std::runtime_error&){
+  try{
+    auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
+    const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+    VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      const string& aMeshName = aMeshMapIter->first;
+      const VISU::TMesh& aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+      //Import fields
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+         const string& aFieldName = aFieldMapIter->first;
+         const VISU::TField& aField = aFieldMapIter->second;
+         const VISU::TField::TValField& aValField = aField.myValField;
+         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         for(; aValFieldIter != aValField.end(); aValFieldIter++){
+           int aTimeStamp = aValFieldIter->first;
+           aCon->GetFieldOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+         }
+       }
+      }
+      //Importing groups
+      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+      for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+       const string& aGroupName = aGroupMapIter->first;
+       aCon->GetMeshOnGroup(aMeshName,aGroupName);
+      }
+      //Import families
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       //aCon->GetMeshOnEntity(aMeshName,anEntity);
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+         const string& aFamilyName = aFamilyMapIter->first;
+         aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+       }
+      }
+      //Import mesh on entity
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       aCon->GetMeshOnEntity(aMeshName,anEntity);
+      }
+    }
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured in file:"<<theFileName<<"\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured in VISU_Convertor_impl in file:"<<theFileName);
+  } 
+}
+
+struct TRow{
+  string myTitle;
+  string myUnit;
+  vector<float> myValues;
+};
+
+struct TTable2D{
+  string myTitle;
+  vector<string> myColumnUnits;
+  vector<string> myColumnTitles;
+  vector<TRow> myRows;
+};
+
+vector<TTable2D> aTables;
+
+int GetLine(ifstream& theStmIn, QString& theString){
+  char tmp;
+  ostrstream aStrOut;
+  while(theStmIn.get(tmp)){
+    aStrOut<<tmp;
+    if(tmp == '\n') break;
+  }
+  aStrOut<<ends;
+  auto_ptr<char> aRet(aStrOut.str());
+  theString = aRet.get();
+  return !theStmIn.eof();
+}
+
+int main(int argc, char** argv){ 
+  try{
+    if(argc > 1){
+      ifstream aStmIn;
+      aStmIn.open(argv[1]);
+      QString aTmp;
+      while(!aStmIn.eof()){
+       //Find beginning of Table
+       while(GetLine(aStmIn,aTmp) && aTmp.find("#TITLE:") != 0);
+       if(aStmIn.eof()) return 0;
+       cout<<"\n There is new Table2D with Title = ";
+       TTable2D aTable2D;
+       while(!aStmIn.eof() && aTmp != "\n"){
+         if(aTmp.find("#TITLE:") == 0){
+           int aLen = aTmp.find(":") + 1;
+           aTmp.remove(0,aLen);
+           QString aTitle = aTmp.stripWhiteSpace();
+           aTable2D.myTitle = aTitle;
+           cout<<aTitle<<endl;
+         }else if(aTmp.find("#COLUMN_TITLES:") == 0){
+           int aLen = aTmp.find(":") + 1;
+           aTmp.remove(0,aLen);
+           QStringList aStrList = QStringList::split("|",aTmp);
+           cout<<"Its Column Titles : ";
+           for(int i = 0; i < aStrList.count(); i++){
+             aTmp = aStrList[i].stripWhiteSpace();
+             aTable2D.myColumnTitles.push_back(aTmp.latin1());
+             cout<<"\t"<<aTmp;
+           }
+           cout<<endl;
+         }else if(aTmp.find("#COLUMN_UNITS:") == 0){
+           int aLen = aTmp.find(":") + 1;
+           aTmp.remove(0,aLen);
+           QStringList aStrList = QStringList::split(" ",aTmp);
+           cout<<"Its Column Units : ";
+           for(int i = 0; i < aStrList.count(); i++){
+             aTmp = aStrList[i].stripWhiteSpace();
+             aTable2D.myColumnUnits.push_back(aTmp.latin1());
+             cout<<"\t"<<aTmp;
+           }
+           cout<<endl;
+         }else if(aTmp.find("#") == 0){
+           //It is a comment
+         }else if(aTmp.find("#TITLE:") > 0){
+           QStringList aStrList = QStringList::split("#TITLE:",aTmp);
+           QString aTitle = aStrList[1].stripWhiteSpace();
+           TRow aRow; 
+           aRow.myTitle = aTitle;
+           cout<<aTitle<<" : ";
+           QStringList aValList = QStringList::split(" ",aStrList[0]);
+           for(int i = 0; i < aValList.count(); i++){
+             float aVal = aValList[i].toFloat();
+             aRow.myValues.push_back(aVal);
+             cout<<"\t"<<aVal;
+           }
+           aTable2D.myRows.push_back(aRow);
+           cout<<endl;
+         }else{
+           QStringList aValList = QStringList::split(" ",aTmp);
+           TRow aRow; 
+           for(int i = 0; i < aValList.count(); i++){
+             float aVal = aValList[i].toFloat();
+             aRow.myValues.push_back(aVal);
+             cout<<"\t"<<aVal;
+           }
+           aTable2D.myRows.push_back(aRow);
+           cout<<endl;
+         }
+         GetLine(aStmIn,aTmp);
+       }
+      }
+      /*
+      for(int i = 0; i < 1; i++){
+       QFileInfo fi(argv[1]);
+       if ( fi.exists() ) {
+          if ( fi.isDir() ) {
+           QDir aDir(fi.absFilePath());
+           cout<<aDir.absPath()<<endl;
+           QStringList aStringList = aDir.entryList("*.med",QDir::Files);
+           int jEnd = aStringList.count();
+           for(int j = 0; j < jEnd; j++)
+              parseFile(aDir.filePath(aStringList[j]).latin1());
+          }else
+           parseFile(argv[1]);
+       }
+      }
+      */
+      aStmIn.close();
+      return 0;
+    }
+  }catch(std::runtime_error& exc){
+    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+  }catch(...){
+    cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
+  } 
+  return 1;
+}
+
+/*
+#include "VISU_Extractor.hxx"
+#include "VISU_FieldTransform.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_ScalarBarActor.hxx"
+
+#include <vtkRenderWindow.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkActor.h>
+
+#include <vtkUnstructuredGridReader.h>
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSet.h>
+#include <vtkUnstructuredGridWriter.h>
+
+int main(int argc, char** argv){ 
+  vtkRenderWindow *renWin = vtkRenderWindow::New();
+  vtkRenderer *ren = vtkRenderer::New();
+  renWin->AddRenderer(ren);
+  ren->GetActiveCamera()->ParallelProjectionOn();
+  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
+  iren->SetRenderWindow(renWin);
+  VISU_Convertor* aConvertor = CreateConvertor(argv[1]);
+  float aScalarRange[2];
+  int aFieldIndex = 1, aNumberOfColors = 64, aNumberOfLabels = 5;
+  FieldInfo aFieldInfo = *(aConvertor->GetFieldInfo(aFieldIndex));
+  VISU_Extractor *anExtractor = VISU_Extractor::New();
+  anExtractor->Extract(aConvertor->GetOutput(),aFieldInfo.myName.c_str(),0,
+                      aFieldInfo.myNumComponent,aFieldInfo.myType);
+  vtkUnstructuredGrid *aDataSet = anExtractor->GetUnstructuredGridOutput();
+  VISU_FieldTransform* aFieldTransform = VISU_FieldTransform::New();
+  aFieldTransform->SetInput(aDataSet);
+  if(argc > 2) 
+    aFieldTransform->SetTransformFunction(&log10);
+  vtkDataSetMapper *aMapper = vtkDataSetMapper::New();
+  aMapper->SetInput(aFieldTransform->GetUnstructuredGridOutput());
+  aMapper->ScalarVisibilityOn();
+  anExtractor->GetUnstructuredGridOutput()->GetScalarRange(aScalarRange);
+
+  VISU_LookupTable* aActorLookupTbl = VISU_LookupTable::New();
+  cout<<"aActorLookupTbl = "<<aActorLookupTbl<<endl;
+  if(argc > 2) 
+    aActorLookupTbl->SetLog(true);
+  aActorLookupTbl->SetHueRange(0.667,0.0);
+  aActorLookupTbl->SetNumberOfColors(aNumberOfColors);
+  aActorLookupTbl->SetTableRange(aScalarRange[0],aScalarRange[1]); //
+  aActorLookupTbl->SetMapScale(1.);
+  aActorLookupTbl->Build();
+  aMapper->SetLookupTable(aActorLookupTbl);   
+  aMapper->SetScalarRange(aScalarRange);
+  aActorLookupTbl->Delete();
+
+  vtkActor* aActor = vtkActor::New();
+  aActor->SetMapper(aMapper);
+
+  VISU_ScalarBarActor* aBar = VISU_ScalarBarActor::New();
+  VISU_LookupTable* aBarLookupTbl = VISU_LookupTable::New();
+  cout<<"aBarLookupTbl = "<<aBarLookupTbl<<endl;
+  if(argc > 2) 
+    aBarLookupTbl->SetLog(true);
+  aBarLookupTbl->SetHueRange(0.667,0.0);
+  aBarLookupTbl->SetNumberOfColors(aNumberOfColors);
+  aBarLookupTbl->SetTableRange(aScalarRange[0],aScalarRange[1]); //
+  aBarLookupTbl->Build();
+  aBar->SetLookupTable(aBarLookupTbl);
+  aBarLookupTbl->Delete();
+
+  aBar->SetTitle((aFieldInfo.myName).c_str());
+  aBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+  aBar->SetNumberOfLabels(aNumberOfLabels);
+
+  vtkProperty* aProperty = aActor->GetProperty();
+  aProperty->SetSpecularColor( 1, 1, 1);
+  aProperty->SetSpecular( 0.3 );
+  aProperty->SetSpecularPower( 20 );
+  aProperty->SetAmbient( 0.2);
+  aProperty->SetDiffuse( 0.8 );
+  aProperty->EdgeVisibilityOn();     
+
+  ren->AddActor(aActor);
+  ren->AddActor2D(aBar);
+  
+  renWin->Render();
+  iren->Start();
+  return 0;
+}
+*/
+
+/*
+#include <fstream>     
+#include <stdlib.h>
+
+int main(int argc, char** argv){ 
+  try{
+    if(argc > 1){
+      int iEnd = 1;
+      if(argc > 2) iEnd = atoi(argv[2]);
+      string aFileName("/tmp/AAA");
+      ofstream stmOut(aFileName.c_str(),ios::out);
+      for(int i = 0; i < iEnd;  i++){
+       MESSAGE("\n--------------------------- "<<i<<" ---------------------------");
+       stmOut<<CreateConvertor(argv[1])->ToString();
+      }
+    }
+    return 0;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+    return 1;
+  }catch(...){
+    MESSAGE("Unknown exception was accured in VISU_Convertor_impl");
+    return 1;
+  } 
+}
+*/
diff --git a/src/VISU_I/VISU_Convertor.hxx b/src/VISU_I/VISU_Convertor.hxx
new file mode 100644 (file)
index 0000000..a0f5efc
--- /dev/null
@@ -0,0 +1,204 @@
+// File:       VISU_Convertor.hxx
+// Created:    Fri Jan 10 11:37:50 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+#ifndef VISU_Convertor_HeaderFile
+#define VISU_Convertor_HeaderFile
+
+#include <stdio.h>
+
+#include <algorithm>
+#include <iterator>
+#include <list>
+#include <map>
+#include <memory>
+#include <numeric>
+#include <set>
+#include <utility>
+#include <vector>
+#include <string>
+#include <stdexcept>
+
+#include <qstring.h>
+
+#include "utilities.h"
+#ifndef MESSAGE
+#define MESSAGE(msg) cout<<msg<<endl
+#endif
+
+
+//class vtkUnstructuredGridReader;
+#include "vtkUnstructuredGridReader.h"
+
+namespace VISU{
+  class TVtkCellInfo{
+  public:
+    TVtkCellInfo() {}
+    TVtkCellInfo(const char* theName, int theSize) : 
+      myName(theName), mySize(theSize) {}
+    const char* myName;
+    int mySize;
+  };
+  typedef std::map<int,TVtkCellInfo> TVtkCellInfoMap;
+  extern TVtkCellInfoMap aVtkCellInfoMap;
+
+  enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+  //enum  TEntity {CELL_ENTITY, FACE_ENTITY, EDGE_ENTITY, NODE_ENTITY};
+  template <class _Tp> class vtk_ptr {
+  private:
+    _Tp* _M_ptr;
+  public:
+    typedef _Tp element_type;
+    explicit vtk_ptr(_Tp* __p = 0) : _M_ptr(__p) {}
+    vtk_ptr(const vtk_ptr& __a) : _M_ptr(0) {}
+    vtk_ptr(vtk_ptr& __a) : _M_ptr(__a.release()) {}
+    vtk_ptr& operator=(const vtk_ptr& __a) { return *this;}
+    vtk_ptr& operator=(vtk_ptr& __a) {
+      if (&__a != this) {
+       if(_M_ptr) _M_ptr->Delete(); 
+       _M_ptr = __a.release();
+      }
+      return *this;
+    }
+    ~vtk_ptr() { 
+      if(_M_ptr) _M_ptr->Delete(); 
+      _M_ptr = 0;
+    }
+    _Tp& operator*() const { return *_M_ptr;}
+    _Tp* operator->() const { return _M_ptr;}
+    _Tp* get() const { return _M_ptr;}
+    _Tp* release() {
+      _Tp* __tmp = _M_ptr;
+      _M_ptr = 0;
+      return __tmp;
+    }
+    void reset(_Tp* __p = 0) {
+      if(_M_ptr) _M_ptr->Delete();
+      _M_ptr = __p;
+    }
+  };
+  typedef vtk_ptr<vtkUnstructuredGridReader> TVTKReader;
+
+  typedef std::set<std::string> TBindGroups;
+
+  struct TFamily{
+    TVTKReader myStorage;
+    int myId;
+    string myName;
+    TEntity myEntity;
+    TBindGroups myGroups;
+    typedef std::set<int> TSubMeshOnCellType;
+    typedef std::map<int,TSubMeshOnCellType> TSubMesh;
+    TSubMesh mySubMesh;
+  };
+  typedef std::map<std::string,TFamily> TFamilyMap;
+
+  struct TField{
+    int myId;
+    string myName;
+    TEntity myEntity;
+    string myMeshName;
+    int myNbComp;
+    typedef std::vector<float> TValForCellsWithType;
+    typedef std::map<int,TValForCellsWithType> TValForCells;
+    typedef std::pair<double,std::string> TTime;
+    struct TValForTime{
+      TVTKReader myStorage;
+      int myId;
+      TTime myTime;
+      TValForCells myValForCells;
+    };
+    typedef std::map<int,TValForTime> TValField;
+    TValField myValField;
+    void ShallowCopy(const TField& aField);
+  };
+  typedef map<string,TField> TFieldMap;
+
+  struct TMeshOnEntity{
+    TVTKReader myStorage;
+    string myMeshName;
+    TEntity myEntity;
+    typedef vector<int> TConnect;
+    typedef vector<TConnect> TConnForCellType;
+    typedef map<int,TConnForCellType> TCellsConn;
+    TCellsConn myCellsConn;
+    TFamilyMap myFamilyMap;
+    TFieldMap myFieldMap;
+    pair<int,int> GetCellsDims(const string& theFamilyName = "") const
+      throw(std::runtime_error&); 
+  };
+  typedef std::map<TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, 
+                    const string& theFamilyName)
+    throw(std::runtime_error&); 
+  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, 
+                    const string& theFamilyName)
+    throw(std::runtime_error&); 
+
+  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
+  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
+  struct TGroup{
+    TVTKReader myStorage;
+    string myName;
+    string myMeshName;
+    TFamilyAndEntitySet myFamilyAndEntitySet;
+  };
+  typedef std::map<std::string,TGroup> TGroupMap;
+
+  struct TMesh{
+    int myDim;
+    string myName;
+    typedef vector<float> TPointsCoord;
+    TPointsCoord myPointsCoord;
+    TMeshOnEntityMap myMeshOnEntityMap;
+    TGroupMap myGroupMap;
+    void CreateMeshOnNodes();
+    const TField* GetField(const string& theFieldName) const;
+  };
+  typedef std::map<std::string,TMesh> TMeshMap;
+};
+
+class VISU_Convertor{
+protected:
+  std::string myName;
+  VISU::TMeshMap myMeshMap;
+  int myIsDone;
+public:
+  virtual ~VISU_Convertor(){};
+  virtual const string& GetName() { return myName;}
+  virtual int IsDone() const { return myIsDone;}
+  typedef vtkUnstructuredGridReader OutputType;
+  virtual VISU_Convertor* Build() throw (std::runtime_error&) = 0;
+  virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
+                                     const VISU::TEntity& theEntity,
+                                     const string& theFamilyName = "")
+    throw(std::runtime_error&) = 0;
+  virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
+                                    const string& theGroupName)
+    throw(std::runtime_error&) = 0;
+  virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
+                                    const VISU::TEntity& theEntity,
+                                    const string& theFieldName,
+                                    int theStampsNum)
+    throw(std::runtime_error&) = 0;
+  virtual const VISU::TMeshMap& GetMeshMap() throw(std::runtime_error&);
+  virtual const VISU::TField& GetField(const string& theMeshName, VISU::TEntity theEntity, 
+                                      const string& theFieldName)
+    throw(std::runtime_error&);
+  static string GenerateName(const VISU::TField::TTime& aTime);
+  static string GenerateName(const string& theName, unsigned int theTimeId);
+};
+
+template<class T> std::string dtos(const string& fmt, T val){
+  static QString aString;
+  aString.sprintf(fmt.c_str(),val);
+  return aString.latin1();
+}
+extern "C"{
+  VISU_Convertor* CreateMedConvertor(const std::string& theFileName) throw(std::runtime_error&);
+  VISU_Convertor* CreateDatConvertor(const std::string& theFileName) throw(std::runtime_error&);
+  VISU_Convertor* CreateConvertor(const std::string& theFileName) throw(std::runtime_error&);
+};
+
+#endif
diff --git a/src/VISU_I/VISU_Convertor_impl.cxx b/src/VISU_I/VISU_Convertor_impl.cxx
new file mode 100644 (file)
index 0000000..a8f0dcb
--- /dev/null
@@ -0,0 +1,427 @@
+using namespace std;
+
+// File:       VISU_Convertor_impl.cxx
+// Created:    Fri Jan 10 11:44:54 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_Convertor_impl.hxx"
+
+#include <vtkUnstructuredGridReader.h>
+#include <qstring.h>
+#include <qfileinfo.h>
+#include <vtkCellType.h>
+#include <valarray>    
+#include <memory>
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+static int PRECISION = 7;
+
+#define MED2VTK(MEDTYPE,VTKTYPE,VTKNBNODES) \
+ {MEDTYPE,#MEDTYPE,getNbMedNodes(MEDTYPE),VTKTYPE,#VTKTYPE,VTKNBNODES}
+Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE] = {
+  MED2VTK(MED_POINT1,VTK_VERTEX,1),
+  MED2VTK(MED_SEG2,VTK_LINE,2),
+  MED2VTK(MED_SEG3,VTK_LINE,2),
+  MED2VTK(MED_TRIA3,VTK_TRIANGLE,3),
+  MED2VTK(MED_TRIA6,VTK_TRIANGLE,3),
+  MED2VTK(MED_QUAD4,VTK_QUAD,4),
+  MED2VTK(MED_QUAD8,VTK_QUAD,4),
+  MED2VTK(MED_TETRA4,VTK_TETRA,4),
+  MED2VTK(MED_TETRA10,VTK_TETRA,4),
+  MED2VTK(MED_HEXA8,VTK_HEXAHEDRON,8),
+  MED2VTK(MED_HEXA20,VTK_HEXAHEDRON,8),
+  MED2VTK(MED_PENTA6,VTK_WEDGE,6),
+  MED2VTK(MED_PENTA15,VTK_WEDGE,6),
+  MED2VTK(MED_PYRA5,VTK_PYRAMID,5),
+  MED2VTK(MED_PYRA13,VTK_PYRAMID,5)
+};
+#undef MED2VTK
+
+extern "C" {
+  VISU_Convertor* CreateConvertor(const string& theFileName) throw(std::runtime_error&){
+    if(QFileInfo(theFileName.c_str()).extension(false) == "med")
+      return CreateMedConvertor(theFileName);
+    else
+      return CreateDatConvertor(theFileName);
+  }
+
+  int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim){
+    int anElemDim = theMedType / 100, nsup = 0;
+    if(theMedEntity == VISU::CELL_ENTITY && anElemDim < theMeshDim) nsup = 1;
+    return nsup + theMedType % 100;
+  }
+
+  int getNbMedNodes(int geom){ 
+    return geom % 100;
+  } 
+
+  int getIdMedType(int medType){
+    for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+      if(med2vtk[i].medType == medType) return i;
+    return -1;
+  }
+}
+
+VISU_Convertor_impl::VISU_Convertor_impl() {
+  myIsDone = false;
+}
+
+VISU_Convertor_impl::~VISU_Convertor_impl() {}
+
+VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName, 
+                                                                const VISU::TEntity& theEntity,
+                                                                const string& theFamilyName)
+  throw (std::runtime_error&)
+{
+  if(!myIsDone) { myIsDone = true;  Build();}
+  if(MYDEBUG) 
+    MESSAGE("GetMeshOnEntity - theMeshName = '"<<theMeshName<<
+           "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+  //Cheching possibility do the query
+  if(myMeshMap.find(theMeshName) == myMeshMap.end())
+    throw std::runtime_error("MeshOnEntityToString >> There is no mesh with the name!!!");
+  VISU::TMesh& aMesh = myMeshMap[theMeshName];
+  VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+  if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
+    throw std::runtime_error("MeshOnEntityToString >> There is no mesh on the entity!!!");
+  VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMap[theEntity];
+  VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
+  VISU::TVTKReader* pReader;
+  if(pFamily != NULL)
+    pReader = &(pFamily->myStorage);
+  else
+    pReader = &(aMeshOnEntity.myStorage);
+  VISU::TVTKReader& aReader = *pReader;
+  //Main part of code
+  if(aReader.get() == NULL){
+    LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
+    ostrstream strOut;
+    strOut<<GetHead(theMeshName + dtos("-%d-",theEntity) + theFamilyName);
+    strOut<<GetPoints(aMesh);
+    pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(theFamilyName);
+    int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
+    ostrstream strCellsOut, strTypesOut;
+    GetCells(strCellsOut,strTypesOut,aMeshOnEntity,theFamilyName);
+    strCellsOut<<ends;
+    strTypesOut<<ends;
+    strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
+    strOut<<"CELL_TYPES "<<aNbCells<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
+    strOut<<ends;
+    aReader.reset(OutputType::New());
+    //aReader = OutputType::New();
+    //aReader->DebugOn();
+    aReader->ReadFromInputStringOn();
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
+    //aReader->Update();
+    //aReader->Print(cout);
+    if(MYDEBUGWITHFILES){
+      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+      string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
+      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+      aFileName += aMeshName + dtos("-%d-",theEntity) + aFamilyName + "-Conv.vtk";
+      ofstream stmOut(aFileName.c_str(),ios::out);
+      stmOut<<aRet.get();
+    }
+  }
+  return aReader.get();
+  //return aReader;
+}
+
+VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName, 
+                                                               const string& theGroupName)
+     throw(std::runtime_error&)
+{
+  if(!myIsDone) { myIsDone = true;  Build();}
+  if(MYDEBUG) MESSAGE("GetMeshOnGroup - theMeshName = '"<<theMeshName<<
+                     "'; theGroupName = '"<<theGroupName<<"'");
+  //Cheching possibility do the query
+  if(myMeshMap.find(theMeshName) == myMeshMap.end())
+    throw std::runtime_error("GetMeshOnGroup >> There is no mesh with the name!!!");
+  VISU::TMesh& aMesh = myMeshMap[theMeshName];
+  VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+  VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
+  if(aGroupMapIter == aGroupMap.end())
+    throw std::runtime_error("GetMeshOnGroup >> There is no the group in the mesh!!!");
+  VISU::TGroup& aGroup = aGroupMapIter->second;
+  const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+  VISU::TVTKReader& aReader = aGroup.myStorage;
+  if(aReader.get() == NULL){
+    LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
+    ostrstream strOut;
+    strOut<<GetHead(theMeshName + "-" + theGroupName);
+    strOut<<GetPoints(aMesh);
+    VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
+    int aNbCells = 0, aCellsSize = 0;
+    ostrstream strCellsOut, strTypesOut;
+    for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+      const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+      const string& aFamilyName = aFamilyAndEntity.first;
+      const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+      VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+      pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(aFamilyName);
+      aNbCells += aCellsDim.first;
+      aCellsSize += aCellsDim.second;
+      GetCells(strCellsOut,strTypesOut,aMeshOnEntity,aFamilyName);
+    }
+    strCellsOut<<ends;
+    strTypesOut<<ends;
+    strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
+    strOut<<"CELL_TYPES "<<aNbCells<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
+    strOut<<ends;
+    aReader.reset(OutputType::New());
+    //aReader = OutputType::New();
+    aReader->ReadFromInputStringOn();
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
+    if(MYDEBUGWITHFILES){
+      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+      string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
+      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+      aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
+      ofstream stmOut(aFileName.c_str(),ios::out);
+      stmOut<<aRet.get();
+    }
+  }
+  return aReader.get();
+  //return aReader;
+}
+
+VISU_Convertor::OutputType* VISU_Convertor_impl::GetFieldOnMesh(const string& theMeshName, 
+                                                               const VISU::TEntity& theEntity,
+                                                               const string& theFieldName,
+                                                               int theStampsNum)
+     throw(std::runtime_error&)
+{
+  if(!myIsDone) { myIsDone = true;  Build();}
+  if(MYDEBUG){
+    MESSAGE("GetFieldOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
+    MESSAGE("GetFieldOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+  }
+  //Cheching possibility do the query
+  if(myMeshMap.find(theMeshName) == myMeshMap.end())
+    throw std::runtime_error("GetFieldOnMesh >> There is no mesh with the name!!!");
+  VISU::TMesh& aMesh = myMeshMap[theMeshName];
+  VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+  if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
+    throw std::runtime_error("GetFieldOnMesh >> There is no mesh on the entity!!!");
+  VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMap[theEntity];
+  VISU::TMeshOnEntity* pVtkMeshOnEntity = &aMeshOnEntity;
+  if(theEntity == VISU::NODE_ENTITY){
+    if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) == aMeshOnEntityMap.end())
+      throw std::runtime_error("GetFieldOnMesh >> There is no mesh on CELL_ENTITY!!!");
+    pVtkMeshOnEntity = &aMeshOnEntityMap[VISU::CELL_ENTITY];
+  }
+  VISU::TMeshOnEntity& aVtkMeshOnEntity = *pVtkMeshOnEntity;
+  VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+  if(aFieldMap.find(theFieldName) == aFieldMap.end())
+    throw std::runtime_error("GetFieldOnMesh >> There is no field on the mesh!!!");
+  VISU::TField& aField = aFieldMap[theFieldName];
+  VISU::TField::TValField& aValField = aField.myValField;
+  if(aValField.find(theStampsNum) == aValField.end())
+    throw std::runtime_error("GetFieldOnMesh >> There is no field with the timestamp!!!");
+  VISU::TField::TValForTime& aValForTime = aValField[theStampsNum];
+  VISU::TVTKReader& aReader = aValForTime.myStorage;
+  //Main part of code
+  if(aReader.get() == NULL){
+    LoadMeshOnEntity(aVtkMeshOnEntity);
+    LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
+    ostrstream strOut;
+    strOut<<GetHead(theMeshName + dtos("-%d-",theEntity) + theFieldName + dtos("-%d",theStampsNum));
+    strOut<<GetPoints(aMesh);
+    pair<int,int> aCellsDim = aVtkMeshOnEntity.GetCellsDims();
+    int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
+    ostrstream strCellsOut, strTypesOut;
+    GetCells(strCellsOut,strTypesOut,aVtkMeshOnEntity);
+    strCellsOut<<ends;
+    strTypesOut<<ends;
+    strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
+    strOut<<"CELL_TYPES "<<aNbCells<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
+    int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+    strOut<<GetField(aField,aValForTime,aMesh.myDim,aNbPoints,aNbCells);
+    strOut<<ends;
+    aReader.reset(OutputType::New());
+    //aReader = OutputType::New();
+    aReader->ReadFromInputStringOn();
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
+    if(MYDEBUGWITHFILES){
+      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+      string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+      aFileName += aMeshName + dtos("-%d-",theEntity) + aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
+      ofstream stmOut(aFileName.c_str(),ios::out);
+      stmOut<<aRet.get();
+    }
+  }
+  return aReader.get();
+  //return aReader;
+}
+
+inline void PrintCells(ostrstream& strCellsOut, const VISU::TMeshOnEntity::TConnect& theVector,
+                      ostrstream& strTypesOut, const int theVtkType)
+{
+  strTypesOut<<theVtkType<<"\n";
+  int kEnd = theVector.size();
+  strCellsOut<<kEnd<<"\t";
+  for(int k = 0; k < kEnd; k++)
+    strCellsOut<<theVector[k]<<"\t";
+  strCellsOut<<endl;
+}
+
+int VISU_Convertor_impl::GetCells(ostrstream& strCellsOut, ostrstream& strTypesOut,
+                                 const VISU::TMeshOnEntity& theMeshOnEntity, 
+                                 const string& theFamilyName) const 
+       throw (std::runtime_error&)
+{
+  //Check on existing family
+  const VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
+  bool isFamilyPresent = (pFamily != NULL);
+  const VISU::TFamily& aFamily = *pFamily;
+  //Main part of code
+  if(MYDEBUG) MESSAGE("GetCells - isFamilyPresent = "<<isFamilyPresent);
+  const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
+  VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+  for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+    const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+    int aVtkType = aCellsConnIter->first;
+    if(MYDEBUG) MESSAGE("GetCells - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+    if(!isFamilyPresent)
+      for(int j = 0, jEnd = anArray.size(); j < jEnd; j++)
+       PrintCells(strCellsOut,anArray[j],strTypesOut,aVtkType);
+    else{
+      const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+      if(aSubMesh.empty()) throw std::runtime_error("GetCells >> There is no elements on the family !!!");
+      VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+      if(aSubMeshIter == aSubMesh.end()) continue;
+      const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+      if(MYDEBUG) MESSAGE("GetCells - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
+      VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
+      for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++)
+       PrintCells(strCellsOut,anArray[*aSubMeshOnCellTypeIter],strTypesOut,aVtkType);
+    }
+  }
+  return 1; 
+}
+
+string VISU_Convertor_impl::GetHead(const string& theMeshName) const throw (std::runtime_error&){
+  ostrstream strOut;
+  strOut<<"# vtk DataFile Version 3.2\n";
+  strOut<<theMeshName<<endl;
+  strOut<<"ASCII\n";
+  strOut<<"DATASET UNSTRUCTURED_GRID\n";
+  strOut<<ends;
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
+}
+
+string VISU_Convertor_impl::GetPoints(const VISU::TMesh& theMesh) const 
+       throw (std::runtime_error&)
+{
+  ostrstream strOut;
+  strOut.setf(ios::scientific,ios::floatfield);  strOut.precision(PRECISION);
+  const VISU::TMesh::TPointsCoord& anArray = theMesh.myPointsCoord;
+  int iEnd = theMesh.myPointsCoord.size();
+  int aNbPoints = iEnd/theMesh.myDim;
+  strOut<<"POINTS "<<aNbPoints<<" float\n";
+  if(MYDEBUG) 
+    MESSAGE("GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
+  switch(theMesh.myDim) {
+  case 1:
+    for (int i = 0; i < iEnd;) 
+      strOut<<anArray[i++]<<"\n";
+    break;
+  case 2:
+    for (int i = 0; i < iEnd;){
+      strOut<<anArray[i++]<<"\t";
+      strOut<<anArray[i++]<<"\t";
+      strOut<<0.0<<"\n";
+    }
+    break;
+  case 3: 
+    for (int i = 0; i < iEnd;){
+      strOut<<anArray[i++]<<"\t";
+      strOut<<anArray[i++]<<"\t";
+      strOut<<anArray[i++]<<"\n";
+    }
+    break;
+  }
+  strOut<<ends;
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
+}
+
+string VISU_Convertor_impl::GetField(const VISU::TField& theField, 
+                                    const VISU::TField::TValForTime& theValForTime,
+                                    int theDim, int theNbPoints, int theNbCells) const 
+       throw (std::runtime_error&)
+{
+  ostrstream strOut;
+  strOut.setf(ios::scientific,ios::floatfield);  strOut.precision(PRECISION);
+  string aName = GenerateName(theField.myName,theValForTime.myId);
+  if(MYDEBUG) MESSAGE("GetField - aTime = "<<theValForTime.myId<<"; aName = "<<aName);
+  switch(theField.myEntity) {
+  case VISU::NODE_ENTITY :
+    strOut<<"POINT_DATA "<<theNbPoints<<"\n";
+    break;
+  default:
+    strOut<<"CELL_DATA "<<theNbCells<<"\n";
+  }
+  switch(theField.myNbComp) {
+  case 1:
+    strOut<<"SCALARS "<<aName<<" float\n";
+    strOut<<"LOOKUP_TABLE default\n";
+    break;
+  default:
+    strOut<<"VECTORS "<<aName<<" float\n";
+    break;
+  }
+  const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
+  VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
+  for(; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
+    const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
+    int iEnd = anArray.size()/theField.myNbComp;
+    int aVtkType = aValForCellsIter->first;
+    if(MYDEBUG) MESSAGE("GetField -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType<<"; theDim = "<<theDim);
+    if(theField.myNbComp == 1){
+      for (int i = 0; i < iEnd;) strOut<<anArray[i++]<<"\n";
+    }else if(theDim == 2){
+      for (int i = 0, ji = 0; i < iEnd; ji = (++i)*theField.myNbComp){
+       strOut<<anArray[ji++]<<"\t";
+       strOut<<anArray[ji++]<<"\t";
+       strOut<<0.0<<"\n";
+      }
+    }else if(theDim == 3){
+      for (int i = 0, ji = 0; i < iEnd; ji = (++i)*theField.myNbComp){
+       strOut<<anArray[ji++]<<"\t";
+       strOut<<anArray[ji++]<<"\t";
+       strOut<<anArray[ji++]<<"\n";
+      }
+    }else
+      throw std::runtime_error("GetField - There is algorithm for representation the field !!!");
+  }
+  strOut<<ends;
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
+}
diff --git a/src/VISU_I/VISU_Convertor_impl.hxx b/src/VISU_I/VISU_Convertor_impl.hxx
new file mode 100644 (file)
index 0000000..68b69e1
--- /dev/null
@@ -0,0 +1,82 @@
+// File:       VISU_Convertor_impl.hxx
+// Created:    Fri Jan 10 11:36:46 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_Convertor_impl_HeaderFile
+#define VISU_Convertor_impl_HeaderFile
+
+#include "VISU_Convertor.hxx"
+
+extern "C"{
+#include <med.h>
+}  
+
+#include <qstring.h>
+#include <qfileinfo.h>
+
+#include <fstream>     
+#include <strstream>   
+using namespace std;
+
+class VISU_Convertor_impl: public VISU_Convertor{
+ private:
+  string GetHead(const string& theMeshName) const throw (std::runtime_error&);
+  string GetPoints(const VISU::TMesh& theMesh) const throw (std::runtime_error&);
+  int GetCells(ostrstream& strCellsOut, ostrstream& strTypesOut,
+              const VISU::TMeshOnEntity& theMeshOnEntity, 
+              const string& theFamilyName = "") const throw (std::runtime_error&);
+  string GetField(const VISU::TField& theField, 
+                 const VISU::TField::TValForTime& theValForTime,
+                 int theDim, int theNbPoints, int theNbCells) const 
+                   throw (std::runtime_error&);
+ public:
+  VISU_Convertor_impl();
+  virtual ~VISU_Convertor_impl();
+  virtual VISU_Convertor* Build() throw (std::runtime_error&) { return this;};
+  virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
+                                     const VISU::TEntity& theEntity,
+                                     const string& theFamilyName = "")
+    throw(std::runtime_error&);
+  virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
+                                    const string& theGroupName)
+    throw(std::runtime_error&);
+  virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
+                                    const VISU::TEntity& theEntity,
+                                    const string& theFieldName,
+                                    int theStampsNum)
+    throw(std::runtime_error&);
+
+ protected:
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&) = 0;
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&) = 0;
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&) = 0;
+};
+
+extern "C"{
+  int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
+  int getNbMedNodes(int theMedType);
+  int med2vtkCellType(int theMedType);
+  int vtk2medCellType(int theVtkType);
+  int getIdMedType(int medType);
+}
+
+struct Med2vtk {
+  med_geometrie_element medType;
+  const char *medName;
+  int medNbNodes;
+  int vtkType;
+  const char *vtkName;
+  int vtkNbNodes;
+};
+extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
+#endif
diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx
new file mode 100644 (file)
index 0000000..46ccae6
--- /dev/null
@@ -0,0 +1,635 @@
+using namespace std;
+// File:       VISU_CorbaMedConvertor.cxx
+// Created:    Fri Jan 10 12:04:54 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_CorbaMedConvertor.hxx"
+using namespace VISU;
+#include <valarray>    
+#include <vtkCellType.h>
+
+#define USER_INTERLACE MED_FULL_INTERLACE
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+static med_err ret = 0;
+
+extern "C"
+  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&){
+    return new VISU_MEDConvertor(theMedSObject);
+  }
+
+typedef map<VISU::TEntity,SALOME_MED::medEntityMesh> TVisu2MedEntity;
+static TVisu2MedEntity aVisu2MedEntity;
+typedef map<SALOME_MED::medEntityMesh,VISU::TEntity> TMed2VisuEntity;
+static TMed2VisuEntity aMed2VisuEntity;
+static int INIT = (
+                  aVisu2MedEntity[VISU::CELL_ENTITY] = SALOME_MED::MED_CELL,
+                  aVisu2MedEntity[VISU::FACE_ENTITY] = SALOME_MED::MED_FACE,
+                  aVisu2MedEntity[VISU::EDGE_ENTITY] = SALOME_MED::MED_EDGE,
+                  aVisu2MedEntity[VISU::NODE_ENTITY] = SALOME_MED::MED_NODE,
+
+                  aMed2VisuEntity[SALOME_MED::MED_CELL] = VISU::CELL_ENTITY,
+                  aMed2VisuEntity[SALOME_MED::MED_FACE] = VISU::FACE_ENTITY,
+                  aMed2VisuEntity[SALOME_MED::MED_EDGE] = VISU::EDGE_ENTITY,
+                  aMed2VisuEntity[SALOME_MED::MED_NODE] = VISU::NODE_ENTITY,
+
+                  1);
+
+static int CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
+  SALOME_MED::MED_POINT1,
+  SALOME_MED::MED_SEG2,
+  SALOME_MED::MED_SEG3,
+  SALOME_MED::MED_TRIA3,
+  SALOME_MED::MED_QUAD4,
+  SALOME_MED::MED_TRIA6,
+  SALOME_MED::MED_QUAD8,
+  SALOME_MED::MED_TETRA4,
+  SALOME_MED::MED_PYRA5,
+  SALOME_MED::MED_PENTA6,
+  SALOME_MED::MED_TETRA10,
+  SALOME_MED::MED_HEXA8,
+  SALOME_MED::MED_PYRA13,
+  SALOME_MED::MED_PENTA15,
+  SALOME_MED::MED_HEXA20
+};
+
+static const int VTKCELLGEOMEND = 8;
+static int VTKCELLGEOM[VTKCELLGEOMEND] = {
+  SALOME_MED::MED_POINT1,
+  SALOME_MED::MED_SEG2,
+  SALOME_MED::MED_TRIA3,
+  SALOME_MED::MED_QUAD4,
+  SALOME_MED::MED_TETRA4,
+  SALOME_MED::MED_PYRA5,
+  SALOME_MED::MED_PENTA6,
+  SALOME_MED::MED_HEXA8
+};
+
+static int FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
+  SALOME_MED::MED_TRIA3,
+  SALOME_MED::MED_QUAD4,
+  SALOME_MED::MED_TRIA6,
+  SALOME_MED::MED_QUAD8
+};
+
+static int EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
+  SALOME_MED::MED_SEG2,
+  SALOME_MED::MED_SEG3
+};
+
+static int NODEGEOM[1] = {
+  SALOME_MED::MED_POINT1,
+};
+
+void GetEntity2Geom(const VISU::TEntity& theEntity, int*& theVector, int* theEnd)
+     throw (std::runtime_error&)
+{
+  switch(theEntity){
+  case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
+  case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
+  case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
+  case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
+  default:
+    throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect !!!");
+  }
+}
+
+struct SalomeMed2vtk {
+  SALOME_MED::medGeometryElement medType;
+  char *medName;
+  int medNbNodes;
+  int vtkType;
+  char *vtkName;
+  int vtkNbNodes;
+};
+
+#define CORBAMED2VTK(MEDTYPE,VTKTYPE,VTKNBNODES) \
+ {SALOME_MED::MEDTYPE,#MEDTYPE,getNbMedNodes(MEDTYPE),VTKTYPE,#VTKTYPE,VTKNBNODES}
+static SalomeMed2vtk salome_med2vtk[SALOME_MED::MED_ALL_ELEMENTS] = {
+  {SALOME_MED::MED_NONE,"MED_NONE",0,VTK_EMPTY_CELL,"VTK_EMPTY_CELL",0},
+  CORBAMED2VTK(MED_POINT1,VTK_VERTEX,1),
+  CORBAMED2VTK(MED_SEG2,VTK_LINE,2),
+  CORBAMED2VTK(MED_SEG3,VTK_LINE,2),
+  CORBAMED2VTK(MED_TRIA3,VTK_TRIANGLE,3),
+  CORBAMED2VTK(MED_QUAD4,VTK_QUAD,4),
+  CORBAMED2VTK(MED_TRIA6,VTK_TRIANGLE,3),
+  CORBAMED2VTK(MED_QUAD8,VTK_QUAD,4),
+  CORBAMED2VTK(MED_TETRA4,VTK_TETRA,4),
+  CORBAMED2VTK(MED_PYRA5,VTK_PYRAMID,5),
+  CORBAMED2VTK(MED_PENTA6,VTK_WEDGE,6),
+  CORBAMED2VTK(MED_TETRA10,VTK_TETRA,4),
+  CORBAMED2VTK(MED_HEXA8,VTK_HEXAHEDRON,8),
+  CORBAMED2VTK(MED_PYRA13,VTK_PYRAMID,5),
+  CORBAMED2VTK(MED_PENTA15,VTK_WEDGE,6),
+  CORBAMED2VTK(MED_HEXA20,VTK_HEXAHEDRON,8)
+};
+#undef CORBAMED2VTK
+
+int GetIdMEDType(int medType){
+  for(int i = 0; i < SALOME_MED::MED_ALL_ELEMENTS; i++)
+    if(salome_med2vtk[i].medType == medType) return i;
+  return -1;
+}
+
+string GetName(SALOMEDS::SObject_ptr aSObject){
+  SALOMEDS::GenericAttribute_var anAttr;
+  if (aSObject->FindAttribute(anAttr,"AttributeName")) {
+    SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+    CORBA::String_var aString = aName->Value();
+    return aString.in();
+  }
+  return "";
+}
+
+VISU_Convertor* VISU_MEDConvertor::Build() throw (std::runtime_error&){
+  if(mySObject->_is_nil()) 
+    throw std::runtime_error("VISU_MEDConvertor::Build >> mySObject->_is_nil() !!!");
+  myStudy = mySObject->GetStudy();
+  CORBA::Short aTag = mySObject->Tag();
+  SALOMEDS::SObject_var aMedCompSObj = mySObject->GetFather();
+  SALOMEDS::SObject_var aMeshSObj;
+  CORBA::Boolean aBool = aMedCompSObj->FindSubObject(aTag+1,aMeshSObj);
+  if(!aBool) throw std::runtime_error("VISU_MEDConvertor::Build >> Cann't find MEDMESH label !!!");
+  if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - MEDMESH found.");
+  SALOMEDS::ChildIterator_var aMeshIterator = myStudy->NewChildIterator(aMeshSObj);
+  for(; aMeshIterator->More(); aMeshIterator->Next()){
+    aMeshSObj = aMeshIterator->Value();
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshSObj = '"<<::GetName(aMeshSObj)<<"'");
+    CORBA::Object_var aMedMesh = SObjectToObject(aMeshSObj);
+    if(CORBA::is_nil(aMedMesh)) continue;
+    SALOME_MED::MESH_var aMEDMesh = SALOME_MED::MESH::_narrow(aMedMesh);
+    if(aMEDMesh->_is_nil()) continue;
+    CORBA::String_var aMeshName = aMEDMesh->getName();
+    VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
+    aMesh.myDim = aMEDMesh->getSpaceDimension();
+    aMesh.myName = aMeshName.in();
+    VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
+    aMesh2.myMesh = aMEDMesh;
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
+    SALOMEDS::ChildIterator_var aSupportIterator = myStudy->NewChildIterator(aMeshSObj);
+    for(; aSupportIterator->More(); aSupportIterator->Next()){
+      SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
+      CORBA::Object_var aMedSupport = SObjectToObject(aSupportSObj);
+      if(CORBA::is_nil(aMedSupport)) continue;
+      SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport); 
+      if(aMEDSupport->_is_nil()) continue;
+      SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
+      VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+      CORBA::String_var aSupportName = aMEDSupport->getName();
+      bool isDataPresent = false;
+      if(aMEDSupport->isOnAllElements()){
+       if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' anEntity = "<<anEntity);
+       //Check, if there is any data on the support?
+       SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
+       if(anEntity == VISU::NODE_ENTITY){
+         if(aMeshOnSupport->getNumberOfNodes() > 0) 
+           isDataPresent = true;
+       }else{
+         int iGeomElemEnd;
+         int* aGeomElemVector;
+         GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+         const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[anEntity];
+         for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+           int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
+           SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+           med_int iNumElemEnd = aMeshOnSupport->getNumberOfElements(aMedEntity,aMedType);
+           if(iNumElemEnd > 0) {
+             isDataPresent = true;
+             break;
+           }
+         }
+       }
+       if(!isDataPresent) continue;
+       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+       aMeshOnEntity.myEntity = anEntity;
+       aMeshOnEntity.myMeshName = aMeshName.in();
+       VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+       aMeshOnEntity2.mySupport = aMEDSupport;
+      }else{
+       SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
+       if(!aMEDFamily->_is_nil()) {
+         if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' anEntity = "<<anEntity);
+         VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+         VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aSupportName.in()];
+         aFamily.myName = aSupportName.in();
+         aFamily.myEntity = anEntity;
+         aFamily.myId = aMEDFamily->getIdentifier();
+         VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+         VISUMED::TFamily& aFamily2 = aMeshOnEntity2.myFamilyMap[aSupportName.in()];
+         aFamily2.myFamily = aMEDFamily;
+       }
+       SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
+       if(!aMEDGroup->_is_nil()) {
+         if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' anEntity = "<<anEntity);
+         VISUMED::TGroupMap& aGroupMap2 = aMesh2.myGroupMap;
+         VISUMED::TGroup& aGroup2 = aGroupMap2[aSupportName.in()];
+         aGroup2.myGroup = aMEDGroup;
+         //VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+         //VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+         //VISU::TGroup& aGroup = aGroupMap[aSupportName.in()];
+         //aGroup.myName = aSupportName.in();
+         //aGroup.myMeshName = aMesh.myName;
+         SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
+         int iFamilyEnd = aFamilies->length();
+         for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
+           aMEDFamily = aFamilies[iFamaily];
+           CORBA::String_var aFamilyName = aMEDFamily->getName();
+           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+           VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName.in()];
+           VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+           aBindGroups.insert(aSupportName.in());
+         }
+       }
+      }
+    }
+    //Correction of TMesh.TGroupMap
+    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+    if(aMeshOnEntityMap.empty()) continue;
+    VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+      const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+      if(aFamilyMap.empty()) continue;
+      VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+      for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+       const VISU::TFamily& aFamily = aFamilyMapIter->second;
+       const VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+       if(aBindGroups.empty()) continue;
+       VISU::TBindGroups::const_iterator aBindGroupsIter = aBindGroups.begin();
+       for(; aBindGroupsIter != aBindGroups.end(); aBindGroupsIter++){
+         const string& aGroupName = *aBindGroupsIter;
+         VISU::TGroup& aGroup = aGroupMap[aGroupName];
+         aGroup.myName = aGroupName;
+         aGroup.myMeshName = aMesh.myName;
+         VISU::TFamilyAndEntity aFamilyAndEntity(aFamily.myName,aFamily.myEntity);
+         aGroup.myFamilyAndEntitySet.insert(aFamilyAndEntity);
+       }
+      }
+    }
+  }
+  SALOMEDS::SObject_var aFieldSObj;
+  aBool = aMedCompSObj->FindSubObject(aTag+2,aFieldSObj);
+  if(aBool){
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - MEDFIELD found.");
+    SALOMEDS::ChildIterator_var aFieldIterator = myStudy->NewChildIterator(aFieldSObj);
+    for(int iField = 0; aFieldIterator->More(); aFieldIterator->Next(), iField++){
+      aFieldSObj = aFieldIterator->Value();
+      if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<::GetName(aFieldSObj)<<"'");
+      SALOMEDS::ChildIterator_var aTimeStampIterator = myStudy->NewChildIterator(aFieldSObj);
+      for(; aTimeStampIterator->More(); aTimeStampIterator->Next()){
+       SALOMEDS::SObject_var aTimeStampSObj = aTimeStampIterator->Value();
+       if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<::GetName(aTimeStampSObj)<<"'");
+       CORBA::Object_var aMedField = SObjectToObject(aTimeStampSObj);
+       if(CORBA::is_nil(aMedField)) continue;
+       SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
+       if(aMEDField->_is_nil()) continue;
+       SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
+       if(aMEDSupport->_is_nil()) continue;
+       SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
+       VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+       SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
+       if(aMEDMesh->_is_nil()) continue;
+       CORBA::String_var aMeshName = aMEDMesh->getName();
+       CORBA::String_var aFieldName = aMEDField->getName();
+       VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
+       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+       VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
+       aField.myId = iField;
+       aField.myName = aFieldName.in();
+       aField.myEntity = anEntity;
+       aField.myMeshName = aMeshName.in();
+       aField.myNbComp = aMEDField->getNumberOfComponents();
+       //int iTimeStamp = aMEDField->getOrderNumber();
+       int iTimeStamp = aMEDField->getIterationNumber();
+       VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
+       aValForTime.myId = iTimeStamp;
+       double dt = aMEDField->getTime();
+       aValForTime.myTime = VISU::TField::TTime(dt,"");
+       VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
+       VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+       VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[aFieldName.in()];
+       VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[iTimeStamp];
+       aValForTime2.myField = aMEDField;
+       if(MYDEBUG) 
+         MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<"'; myEntity = "<<anEntity<<"; myTime = "<<dt);
+      }      
+    }
+  }
+  return this; 
+}
+
+int VISU_MEDConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                                       const string& theFamilyName)
+     throw (std::runtime_error&) 
+{
+  //Main part of code
+  const string& aMeshName = theMeshOnEntity.myMeshName;
+  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
+  VISU::TMesh& aMesh = myMeshMap[aMeshName];
+  int isPointsUpdated;
+  if(anEntity == VISU::NODE_ENTITY) 
+    isPointsUpdated = LoadPoints(aMesh,theFamilyName);
+  else 
+    isPointsUpdated = LoadPoints(aMesh);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity,theFamilyName);
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+  
+int VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+     throw (std::runtime_error&)
+{
+  //Main part of code
+  int isPointsUpdated = 0;
+  int isCellsOnEntityUpdated = 0;
+  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
+  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+    const string& aFamilyName = aFamilyAndEntitySetIter->first;
+    const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
+    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
+    if(anEntity == VISU::NODE_ENTITY){
+      isPointsUpdated += LoadPoints(theMesh,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity);
+    }else{
+      isPointsUpdated += LoadPoints(theMesh);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity,aFamilyName);
+    }
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+int VISU_MEDConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                                      VISU::TMeshOnEntity& theMeshOnEntity, 
+                                      VISU::TField& theField, 
+                                      VISU::TField::TValForTime& theValForTime)
+  throw (std::runtime_error&)
+{
+  //Main part of code
+  int isPointsUpdated = LoadPoints(theMesh);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity);
+  int isFieldUpdated = LoadField(theMeshOnEntity,theField,theValForTime);
+  
+  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
+}
+
+int VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
+  throw (std::runtime_error&) 
+{
+  //Check on existing family
+  VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
+  aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
+  aMeshOnEntity.myMeshName = theMesh.myName;
+  VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
+  bool isFamilyPresent = (pFamily != NULL);
+  VISU::TFamily& aFamily = *pFamily;
+  //Check on loading already done
+  bool isPointsLoaded = !theMesh.myPointsCoord.empty();
+  if(isPointsLoaded) 
+    if(!isFamilyPresent) return 0;
+    else if(!aFamily.mySubMesh.empty()) return 0;
+  VISUMED::TMesh& aMesh2 = myMeshMap2[theMesh.myName];
+  SALOME_MED::MESH_var& aMedMesh = aMesh2.myMesh;
+  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[VISU::NODE_ENTITY];
+  if(MYDEBUG) 
+    MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
+  theMesh.myDim = aMedMesh->getSpaceDimension();
+  int iNumElemEnd = aMedMesh->getNumberOfNodes();
+  VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
+  if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
+  if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
+  aPointsCoord.resize(theMesh.myDim*iNumElemEnd,0.0);
+  Engines::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
+  if(!isPointsLoaded){
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+      for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
+       aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
+    if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+    VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
+    aConnForCellType.resize(iNumElemEnd);
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+      aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
+  }
+  if(isFamilyPresent){
+    if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
+    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
+    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
+    VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
+    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
+    Engines::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
+    int iNumElemEndTmp = iNumElemEnd;
+    iNumElemEnd = aCellNumForType->length();
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+      int tmp = aCellNumForType[iNumElem]-1;
+      if(0 > tmp || tmp >= iNumElemEndTmp) {
+       static QString aString;
+       aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
+       throw std::runtime_error(aString.latin1());
+      }
+      aSubMeshOnCellType.insert(tmp);
+    }
+  }
+  return 1;
+}
+
+int VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+     throw (std::runtime_error&) 
+{
+  //Check on existing family
+  VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
+  bool isFamilyPresent = (pFamily != NULL);
+  VISU::TFamily& aFamily = *pFamily;
+  //Check on loading already done
+  bool isCellsLoaded = !theMeshOnEntity.myCellsConn.empty();
+  if(isCellsLoaded) 
+    if(!isFamilyPresent) return 0;
+    else if(!aFamily.mySubMesh.empty()) return 0;
+  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
+  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
+  SALOME_MED::SUPPORT_var& aMedSupport = aMeshOnEntity2.mySupport;
+  SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
+  if(MYDEBUG) {
+    MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
+    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
+  }
+  //Main part of code
+  int iGeomElemEnd;
+  int* aGeomElemVector;
+  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
+  GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+  const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[anEntity];
+  VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
+  int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+  if(!isCellsLoaded){
+    for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+      int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
+      int nbMedNodes = salome_med2vtk[medId].medNbNodes;
+      int nbVtkNodes = salome_med2vtk[medId].vtkNbNodes;
+      int aVtkType = salome_med2vtk[medId].vtkType;
+      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+      med_int iNumElemEnd = aMedMesh->getNumberOfElements(aMedEntity,aMedType);
+      if (iNumElemEnd > 0) {
+       Engines::long_array_var conn = 
+         aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMedEntity,aMedType);
+       VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
+       //APO - aConnForCellType.resize(iNumElemEnd);
+       valarray<med_int> aConnect(nbMedNodes);
+       int aNbConnForElem = conn->length()/iNumElemEnd;
+       if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
+                           "; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
+       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+         //APO - VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
+         //APO - anArray.resize(nbVtkNodes);
+         VISU::TMeshOnEntity::TConnect anArray(nbVtkNodes);
+         for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
+           aConnect[k] = conn[kj+k] - 1;
+         }
+         switch(aMedType){
+         case SALOME_MED::MED_TETRA4 :
+         case SALOME_MED::MED_TETRA10 :
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[1];
+           anArray[2] = aConnect[3];  
+           anArray[3] = aConnect[2];  
+           break;
+         case SALOME_MED::MED_PYRA5 :
+         case SALOME_MED::MED_PYRA13 :
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[3];  
+           anArray[2] = aConnect[2];
+           anArray[3] = aConnect[1];  
+           anArray[4] = aConnect[4];
+           break;
+         default:
+           for (int k = 0; k < nbVtkNodes; k++) 
+             anArray[k] = aConnect[k];
+         }
+         for (int k = 0; k < nbVtkNodes; k++) 
+           if(anArray[k] < 0 || aNbPoints <= anArray[k]){
+             static QString aString;
+             aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
+             throw std::runtime_error(aString.latin1());
+           }
+         aConnForCellType.push_back(anArray);
+       }
+       //Workaround for MED Component data structure
+       int aSize = aConnForCellType.size();
+       aMeshOnEntity2.myCellsFirstIndex[aMedType] = VISUMED::TMeshOnEntity::TIndexAndSize(aCounter,aSize);
+       aCounter += aSize;
+      }
+    }
+  }
+  //Filling aFamily SubMesh
+  if(isFamilyPresent){
+    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
+    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
+    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
+    iGeomElemEnd = aGeom->length();
+    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomElemEnd = "<<iGeomElemEnd);
+    for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+      SALOME_MED::medGeometryElement aGeomType = aGeom[iGeomElem];
+      Engines::long_array_var aCellNumForType = aMedFamily->getNumber(aGeomType);
+      int medId = GetIdMEDType(aGeomType);
+      int aVtkType = salome_med2vtk[medId].vtkType;
+      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+      VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVtkType]; 
+      med_int iNumElemEndTmp = theMeshOnEntity.myCellsConn[aVtkType].size();
+      med_int iNumElemEnd = aCellNumForType->length();
+      int aCounter = aMeshOnEntity2.myCellsFirstIndex[aMedType].first;
+      if(MYDEBUG) 
+       MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
+               "; iNumElemEnd = "<<iNumElemEnd<<"; aCounter = "<<aCounter);
+      for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+       int tmp = aCellNumForType[iNumElem]-aCounter-1;
+       if(0 > tmp || tmp >= iNumElemEndTmp) {
+         static QString aString;
+         aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+         throw std::runtime_error(aString.latin1());
+       }
+       aSubMeshOnCellType.insert(tmp);
+      }
+    }
+  }
+  return 1;
+}
+
+template<class TArray> int ImportField(TArray& theArray, 
+                                      const VISU::TMesh& theMesh,
+                                      const VISU::TField& theField,
+                                      VISU::TField::TValForTime& theValForTime,
+                                      const VISU::TMeshOnEntity& theMeshOnEntity,
+                                      const VISUMED::TMeshOnEntity& theMeshOnEntity2)
+{
+  if(theField.myEntity == VISU::NODE_ENTITY){
+    VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[VTK_VERTEX];
+    int iNumElemEnd = theMesh.myPointsCoord.size()/theMesh.myDim*theField.myNbComp;
+    if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
+    aValForCellsWithType.resize(iNumElemEnd);
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+      aValForCellsWithType[iNumElem] = theArray[iNumElem];
+  }else{
+    int iGeomElemEnd;
+    int* aGeomElemVector;
+    const VISU::TEntity& anEntity = theField.myEntity;
+    GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+    for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+      int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
+      int aVtkType = salome_med2vtk[medId].vtkType;
+      SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+      const VISUMED::TMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity2.myCellsFirstIndex;
+      VISUMED::TMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMedType);
+      if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
+       const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
+       VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
+       const VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aCellsConnIter->second;
+       const VISUMED::TMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
+       int iNumElemEnd = aIndexAndSize.second;
+       if(MYDEBUG) 
+         MESSAGE("ImportField - medName = "<<salome_med2vtk[medId].medName<<
+                 "; aIndexAndSize = {"<<aIndexAndSize.first<<","<<aIndexAndSize.second<<"}");
+       VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[aVtkType];
+       aValForCellsWithType.resize(iNumElemEnd*theField.myNbComp);
+       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+         for (int k = 0, kj = iNumElem*theField.myNbComp; k < theField.myNbComp; k++)
+           aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField.myNbComp+kj+k];
+      }
+    }
+  }
+  return 1;
+}
+
+int VISU_MEDConvertor::LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
+                                const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+     throw (std::runtime_error&)
+{
+  //Check on loading already done
+  if(!theValForTime.myValForCells.empty()) return 0;
+  VISU::TMesh& aMesh = myMeshMap[theMeshOnEntity.myMeshName];
+  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
+  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
+  VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[theField.myName];
+  VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[theValForTime.myId];
+  SALOME_MED::FIELD_var aMEDField = aValForTime2.myField;
+  //Main part of code
+  SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
+  if(!aFieldDouble->_is_nil()){
+    Engines::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
+    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+  }
+  SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
+  if(!aFieldInt->_is_nil()){
+    Engines::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
+    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+  }
+  return 1;
+}
diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx
new file mode 100644 (file)
index 0000000..4fb887f
--- /dev/null
@@ -0,0 +1,88 @@
+// File:       VISU_CorbaMedConvertor.hxx
+// Created:    Fri Jan 10 12:02:49 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_CorbaMedConvertor_HeaderFile
+#define VISU_CorbaMedConvertor_HeaderFile
+
+#include "VISUConfig.hh"
+#include "VISU_Convertor_impl.hxx"
+
+extern "C"{
+#include <med.h>
+}  
+
+namespace VISUMED{
+  struct TFamily{
+    SALOME_MED::FAMILY_var myFamily;
+  };
+  typedef std::map<std::string,TFamily> TFamilyMap;
+  
+  struct TField{
+    struct TValForTime{
+      SALOME_MED::FIELD_var myField;
+    };
+    typedef std::map<int,TValForTime> TValField;
+    TValField myValField;
+  };
+  typedef map<string,TField> TFieldMap;
+
+  struct TMeshOnEntity{
+    SALOME_MED::SUPPORT_var mySupport;
+    typedef pair<int,int> TIndexAndSize;
+    typedef map<int,TIndexAndSize> TCellsFirstIndex;
+    TCellsFirstIndex myCellsFirstIndex;
+    TFamilyMap myFamilyMap;
+    TFieldMap myFieldMap;
+  };
+  typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  
+  struct TGroup{
+    SALOME_MED::GROUP_var myGroup;
+  };
+  typedef std::map<std::string,TGroup> TGroupMap;
+
+  struct TMesh{
+    SALOME_MED::MESH_var myMesh;
+    TMeshOnEntityMap myMeshOnEntityMap;
+    TGroupMap myGroupMap;
+  };
+  typedef std::map<std::string,TMesh> TMeshMap;
+}
+
+
+class VISU_MEDConvertor: public VISU_Convertor_impl{
+ protected:
+  VISUMED::TMeshMap myMeshMap2;
+  SALOMEDS::SObject_var mySObject;
+  SALOMEDS::Study_var myStudy;
+ public:
+  VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+ protected:
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&);
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&);
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&);
+  int LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName = "") 
+    throw (std::runtime_error&);
+  int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "")
+    throw (std::runtime_error&);
+  int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
+               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&);
+};
+
+extern "C"
+  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&);
+#endif
+
diff --git a/src/VISU_I/VISU_DatConvertor.cxx b/src/VISU_I/VISU_DatConvertor.cxx
new file mode 100644 (file)
index 0000000..2fb3b14
--- /dev/null
@@ -0,0 +1,252 @@
+using namespace std;
+
+// File:       VISU_DatConvertor.cxx
+// Created:    Fri Jan 10 12:15:57 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_DatConvertor.hxx"
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+static int PRECISION = 7;
+
+extern "C"
+VISU_Convertor* CreateDatConvertor(const string& theFileName) throw(std::runtime_error&){
+  VISU_DatConvertor* aConvertor = new VISU_DatConvertor(theFileName);
+  aConvertor->Build();
+  return aConvertor;
+}
+VISU_DatConvertor::VISU_DatConvertor(const string& theFileName) throw(std::runtime_error&){
+  myFileInfo.setFile(QString(theFileName.c_str()));
+  myName = myFileInfo.baseName();
+}
+
+VISU_Convertor* VISU_DatConvertor::Build() throw (std::runtime_error&){
+  /*
+  ifstream stmIn(myFileInfo.absFilePath());
+  if(!stmIn.good())
+    throw std::runtime_error(string("VISU_DatConvertor::CreateResult() >> can't open file - ") + 
+                            (const char*)myFileInfo.absFilePath());
+  int aNbPoints, aNbCells, aNbFields;
+  ImportHead(&stmIn,&aNbPoints,&aNbCells,&aNbFields);
+  ImportPoints(&stmIn,aNbPoints);
+  vector<int> aCellsType(aNbCells);
+  ImportCells(&stmIn,&aCellsType);
+  for(int i = 0; i < aNbFields; i++)
+    ImportField(&stmIn,aNbPoints,&aCellsType);
+  myIsDone = true;
+  */
+  return this; 
+}
+
+int VISU_DatConvertor::ImportField(ifstream* pStmIn, int theNbPoints, vector<int>* pCellsType)
+     throw (std::runtime_error&)
+{
+  /*
+  ifstream &stmIn = *pStmIn;
+  vector<int>& aCellsType = *pCellsType;
+  int aNbCells = aCellsType.size();
+  string aName;  stmIn>>aName; stmIn>>aName; 
+  VISU::TMesh& aMesh = myMeshMap[myName];
+  VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[VISU::CELL_ENTITY];
+  VISU::TField& aField = aMeshOnEntity.myFieldMap[aName];
+  aField.myMeshName = myName;
+  stmIn>>(aField.myNbComp); 
+  aField.myNbComp %= 100;
+  int iEnd;  stmIn>>iEnd; 
+  if(iEnd == theNbPoints)
+    aField.myEntity = VISU::NODE_ENTITY; 
+  else if(iEnd == aNbCells)
+    aField.myEntity = VISU::CELL_ENTITY;
+  else
+    throw std::runtime_error("ImportChamp >> elements doesn't connected to points or cells");
+  if(MYDEBUG)
+    MESSAGE("FieldInfo - myMeshName = "<<aField.myMeshName<<"; myNbComp = "<<aField.myNbComp);
+  for(int i = 0, tmp; i < iEnd; i++) {
+    stmIn>>tmp;
+    VISU::TField::TTime aTime(0.0,"");
+    VISU::TField::TValForCellsWithType &anArray = aField.myValField[aTime][aCellsType[i]];
+    for(int j = 0; j < aField.myNbComp; j++){
+      float tmp;  stmIn>>tmp;
+      anArray.push_back(tmp);
+    }
+  }
+  */
+  return 0; 
+}
+
+int VISU_DatConvertor::ImportHead(ifstream* pStmIn, int* theNbPoints, 
+                                 int* theNbCells, int* theNbFields) 
+     throw (std::runtime_error&)
+{
+  /*
+  ifstream &stmIn = *pStmIn;
+  const int BUFSIZE = 256;
+  char buf[BUFSIZE];
+  stmIn.getline(buf,BUFSIZE);
+  istrstream strIn(buf);
+  VISU::TMesh& aMesh = myMeshMap[myName];
+  *theNbFields = 0;
+  strIn>>(*theNbPoints); strIn>>(*theNbCells); strIn>>(*theNbFields);
+  if(MYDEBUG)
+    MESSAGE("ImportHead - theNbPoints = "<<(*theNbPoints)<<
+           "; theNbCells = "<<(*theNbCells)<<
+           "; theNbFields = "<<(*theNbFields));
+  */
+  return 0;
+}
+
+int VISU_DatConvertor::ImportPoints(ifstream* pStmIn, int theNbPoints) 
+     throw (std::runtime_error&)
+{
+  /*
+  ifstream &stmIn = *pStmIn;
+  VISU::TMesh& aMesh = myMeshMap[myName];
+  aMesh.myName = myName;
+  aMesh.myDim = 3;
+  int iEnd = aMesh.myDim*theNbPoints;
+  if(MYDEBUG) MESSAGE("ImportPoints - iEnd = "<<iEnd);
+  vector<float> &aPointsCoord = aMesh.myPointsCoord;
+  aPointsCoord.resize(iEnd);
+  for(int i = 0, tmp; i < iEnd;){
+    stmIn>>tmp;  
+    stmIn>>aPointsCoord[i++]; stmIn>>aPointsCoord[i++]; stmIn>>aPointsCoord[i++];
+  }
+  */
+  return 0;
+}
+
+int VISU_DatConvertor::ImportCells(ifstream* pStmIn, vector<int>* pCellsType) 
+     throw (std::runtime_error&)
+{
+  /*
+  ifstream &stmIn = *pStmIn;
+  vector<int>& aCellsType = *pCellsType;
+  int aNbCells = aCellsType.size();
+  if(MYDEBUG) MESSAGE("ImportCells - theNbCells - Beginning");
+  VISU::TMesh& aMesh = myMeshMap[myName];
+  VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[VISU::CELL_ENTITY];
+  aMeshOnEntity.myEntity = VISU::CELL_ENTITY;
+  aMeshOnEntity.myMeshName = myName;
+  for(int i = 0, aMedType, aVtkType; i < aNbCells; i++){
+    stmIn>>aMedType; stmIn>>aMedType;
+    aCellsType[i] = aVtkType = med2vtkCellType(aMedType);
+    VISU::TMeshOnEntity::TConnForCellType& anArray = aMeshOnEntity.myCellsConn[aVtkType];
+    anArray.push_back(VISU::TMeshOnEntity::TConnect());
+    VISU::TMeshOnEntity::TConnect& aVector = anArray.back();
+    int jEnd = getNbMedNodes(aMedType);
+    aVector.resize(jEnd);
+    for(int j = 0, tmp; j < jEnd; j++){
+      stmIn>>tmp; 
+      aVector[j] = tmp - 1;
+    }
+  }
+  if(MYDEBUG) MESSAGE("ImportCells - theNbCells - End");
+  */
+  return 0;
+}
+
+/*
+int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime_error&){
+  if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - "<<theFileName);
+  if(!myIsDone && Build() != NULL) myIsDone = true;
+  ofstream stmOut(theFileName.c_str(),ios::out);
+  stmOut.precision(PRECISION);
+  stmOut.setf(ios::scientific,ios::floatfield);
+  
+  VISU::TMeshMap::const_iterator aMeshIter = myMeshMap.begin();
+  if(aMeshIter != myMeshMap.end()){
+    const VISU::TMesh &aMesh = aMeshIter->second;
+    if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - aMeshName = "<<aMeshIter->first);
+    VISU::TFieldMap aFieldMap = GetFieldMapForMesh(aMeshIter->first);
+    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(VISU::CELL_ENTITY);
+    if(aMeshOnEntityMapIter != aMeshOnEntityMap.end()){
+      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+      int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+      int aNbCells = aMeshOnEntity.GetCellsDims().first;
+      stmOut<<aNbPoints<<"\t"<<aNbCells<<"\t"<<aFieldMap.size()<<endl;
+      if(MYDEBUG) 
+       MESSAGE("VISU_Convertor_impl::ToDatFile - aNbPoints = "<<aNbPoints<<
+               "; aNbCells = "<<aNbCells<<"; aNbFields = "<<aFieldMap.size());
+      for(int i = 0, j = 0; i < aNbPoints; i++, j = 3*i){
+       stmOut<<(i+1)<<"\t"; 
+       stmOut<<aMesh.myPointsCoord[j]<<"\t"; 
+       stmOut<<aMesh.myPointsCoord[j+1]<<"\t";
+       stmOut<<aMesh.myPointsCoord[j+2]<<endl;
+      } 
+      const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
+      VISU::TMeshOnEntity::TCellsConn::const_iterator iter = aCellsConn.begin();
+      for(int i = 0; iter != aCellsConn.end(); iter++){
+       if(MYDEBUG) 
+         MESSAGE("VISU_Convertor_impl::ToDatFile - vtkCellType = "<<iter->first);
+       const VISU::TMeshOnEntity::TConnForCellType& anArray = iter->second;
+       for(int j = 0, jEnd = anArray.size(); j < jEnd; j++){
+         stmOut<<(++i)<<"\t";
+         stmOut<<vtk2medCellType(iter->first)<<"\t";
+         const vector<int>& aVector = anArray[j];
+         int kEnd = aVector.size();
+         for(int k = 0; k < kEnd; k++)
+           stmOut<<aVector[k]<<"\t";
+         stmOut<<endl;
+       }
+      }
+      if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - Beginning of Field Conversion");
+      VISU::TFieldMap::const_iterator aFieldIter = aFieldMap.begin();
+      for(int i = 0; aFieldIter != aFieldMap.end(); aFieldIter++){
+       const VISU::TField &aField = aFieldIter->second;
+       const VISU::TField::TValField &aValField = aField.myValField;
+       VISU::TField::TValField::const_reverse_iterator iter = aField.myValField.rbegin();
+       for(int i = 0; iter != aValField.rend(); iter++, i++) {
+         if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - aTime = "<<i);
+         const VISU::TField::TValForTime& aValForTime = iter->second;
+         VISU::TField::TValForTime::const_iterator jter = aValForTime.begin();
+         stmOut<<(++i)<<endl;
+         int prefix = (aField.myEntity == VISU::CELL_ENTITY? 100: 200);
+         int jEnd = (aField.myEntity == VISU::CELL_ENTITY? aNbCells: aNbPoints);
+         string aName = GenerateName((aFieldIter->first).c_str(),i);
+         stmOut<<aName<<endl;
+         stmOut<<(prefix + aField.myNbComp)<<"\t"<<jEnd<<endl;
+         if(MYDEBUG) 
+           MESSAGE("VISU_Convertor_impl::ToDatFile - aName = "<<aName<<"; jEnd = "<<jEnd);
+         for(int j = 0; jter != aValForTime.end(); jter++) {
+           const VISU::TField::TValForCellsWithType& anArray = jter->second;
+           int kEnd = anArray.size(), aVtkType = jter->first;
+           switch(aField.myNbComp) {
+           case 1:
+             for (int k = 0; k < kEnd;) {
+               stmOut<<(++j)<<"\t";
+               stmOut<<anArray[k++]<<"\n";
+             }
+             break;
+           case 2:
+             for (int k = 0; k < kEnd;){
+               stmOut<<(++j)<<"\t";
+               stmOut<<anArray[k++]<<"\t";
+               stmOut<<anArray[k++]<<"\t";
+               stmOut<<0.0<<"\n";
+             }
+             break;
+           case 3: 
+             for (int k = 0; k < kEnd;){
+               stmOut<<(++j)<<"\t";
+               stmOut<<anArray[k++]<<"\t";
+               stmOut<<anArray[k++]<<"\t";
+               stmOut<<anArray[k++]<<"\n";
+             }
+             break;
+           }
+         }
+       }
+      }
+    }
+  }
+  return 1;
+}
+*/
diff --git a/src/VISU_I/VISU_DatConvertor.hxx b/src/VISU_I/VISU_DatConvertor.hxx
new file mode 100644 (file)
index 0000000..d23a181
--- /dev/null
@@ -0,0 +1,43 @@
+// File:       VISU_DatConvertor.hxx
+// Created:    Fri Jan 10 12:13:58 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_DatConvertor_HeaderFile
+#define VISU_DatConvertor_HeaderFile
+
+#include "VISU_Convertor_impl.hxx"
+#include <fstream>     
+
+class VISU_DatConvertor: public VISU_Convertor_impl{
+  VISU_DatConvertor();
+  VISU_DatConvertor(const VISU_DatConvertor&);
+public:
+  VISU_DatConvertor(const string& theFileName) throw (std::runtime_error&);
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+protected:
+  QFileInfo myFileInfo;
+  int ImportHead(ifstream* pStmIn, int* theNbPoints, int* theNbCells, int* theNbFields) 
+    throw (std::runtime_error&);
+  int ImportPoints(ifstream*, int theNbPoints) 
+    throw (std::runtime_error&);
+  int ImportCells(ifstream*, vector<int>* aCellsType) 
+    throw (std::runtime_error&);
+  int ImportField(ifstream*, int theNbPoints, vector<int>* aCellsType) 
+    throw (std::runtime_error&);
+ protected:
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&) {return 1;}
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&) {return 1;}
+};
+
+#endif
diff --git a/src/VISU_I/VISU_Extractor.cxx b/src/VISU_I/VISU_Extractor.cxx
new file mode 100644 (file)
index 0000000..4ca6929
--- /dev/null
@@ -0,0 +1,84 @@
+using namespace std;
+#include "VISU_Extractor.hxx"   
+
+#include <vtkObjectFactory.h>
+#include <vtkScalars.h>
+#include <vtkVectors.h>
+#include <vtkUnstructuredGridReader.h>
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+VISU_Extractor::VISU_Extractor(){
+  myNbComp = 0;
+  myScalarMode = 0;
+}
+VISU_Extractor::~VISU_Extractor() {}
+VISU_Extractor* VISU_Extractor::New(){
+  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_Extractor");
+  if(ret) return (VISU_Extractor*)ret;
+  return new VISU_Extractor;
+}  
+void VISU_Extractor::Extract(vtkUnstructuredGridReader* theReader, 
+                            const string& theFieldName, int theScalarMode,
+                            int theNbComp, const VISU::TEntity& theEntity)
+{
+  myScalarMode = theScalarMode;
+  myNbComp = theNbComp;
+  myEntity = theEntity;
+  if(myNbComp == 1)
+    theReader->SetScalarsName(theFieldName.c_str());
+  else
+    theReader->SetVectorsName(theFieldName.c_str());
+  SetInput(theReader->GetOutput());
+  Update();
+}
+template<typename TypeData> void
+execute(int theNbComp, int theScalarMode, TypeData* theInputData, TypeData* theOutputData){
+  vtkVectors *inVectors = theInputData->GetVectors();
+  if ( !inVectors || theNbComp < 1 ) 
+    return; 
+  vtkScalars *newScalars = vtkScalars::New();
+  newScalars->SetNumberOfScalars(theNbComp);
+  for (int ptId = 0; ptId < theNbComp; ptId++) {
+    float v[3], s;
+    inVectors->GetVector(ptId,v);
+    if ( theScalarMode < 1 || theScalarMode > 3)
+      s = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+    else
+      s = v[theScalarMode - 1];
+    newScalars->SetScalar(ptId, s);
+  }
+  theOutputData->SetScalars(newScalars);
+  newScalars->Delete();
+}
+void VISU_Extractor::Execute(){
+  vtkDataSet *input = this->GetInput(), *output = this->GetOutput();
+  output->CopyStructure(input);
+  output->GetPointData()->CopyAllOff();
+  output->GetCellData()->CopyAllOff();
+  if(myEntity == VISU::NODE_ENTITY){
+    output->GetPointData()->CopyVectorsOn();
+    int nbComp = input->GetNumberOfPoints();
+    vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData();
+    if(myNbComp > 1)
+      execute(nbComp,myScalarMode,inData,outData);
+    else
+      output->GetPointData()->CopyScalarsOn();
+    outData->PassData(inData);
+  }else{
+    output->GetCellData()->CopyVectorsOn();
+    int nbComp = input->GetNumberOfCells();
+    vtkCellData *inData = input->GetCellData(), *outData = output->GetCellData();
+    if(myNbComp > 1)
+      execute(nbComp,myScalarMode,inData,outData);
+    else
+      output->GetCellData()->CopyScalarsOn();
+    outData->PassData(inData);
+  }
+}
+
+
diff --git a/src/VISU_I/VISU_Extractor.hxx b/src/VISU_I/VISU_Extractor.hxx
new file mode 100644 (file)
index 0000000..ab6eaaf
--- /dev/null
@@ -0,0 +1,34 @@
+// File:       VISU_Extractor.hxx
+// Created:    Fri Jan 10 16:37:54 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_Extractor_HeaderFile
+#define VISU_Extractor_HeaderFile
+
+#include <vtkObjectFactory.h>
+#include <vtkDataSetToDataSetFilter.h>
+#include "VISU_Convertor.hxx"
+class vtkUnstructuredGridReader;
+
+class VTK_EXPORT VISU_Extractor : public vtkDataSetToDataSetFilter{
+public:
+  vtkTypeMacro(VISU_Extractor,vtkDataSetToDataSetFilter);
+  static VISU_Extractor *New();
+  void Extract(vtkUnstructuredGridReader* theReader, 
+              const string& theFieldName, int theScalarMode,
+              int theNbComp, const VISU::TEntity& theEntity);
+protected:
+  VISU_Extractor();
+  virtual ~VISU_Extractor();
+  VISU_Extractor(const VISU_Extractor&) {};
+  void operator=(const VISU_Extractor&) {};
+  void Execute();
+
+  int myNbComp;
+  int myScalarMode;
+  VISU::TEntity myEntity;
+};
+
+#endif
diff --git a/src/VISU_I/VISU_FieldTransform.cxx b/src/VISU_I/VISU_FieldTransform.cxx
new file mode 100644 (file)
index 0000000..5862652
--- /dev/null
@@ -0,0 +1,110 @@
+using namespace std;
+#include "VISU_FieldTransform.hxx"   
+#include "utilities.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkScalars.h>
+#include <vtkVectors.h>
+#include <vtkUnstructuredGridReader.h>
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 1;
+#endif
+
+extern "C" {
+double Identical(double theArg) { 
+  return theArg;
+}
+
+double Logarithmic10(double theArg) { 
+  if(theArg == 0.0) return 0.0;
+  double aResult; 
+  if(theArg < 0.0) return -log10(-theArg);
+  return log10(theArg);
+}
+
+}
+
+VISU_FieldTransform::VISU_FieldTransform(){
+  myFunction = &Identical;
+}
+
+VISU_FieldTransform::~VISU_FieldTransform() {}
+
+VISU_FieldTransform* VISU_FieldTransform::New(){
+  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_FieldTransform");
+  if(ret) return (VISU_FieldTransform*)ret;
+  return new VISU_FieldTransform;
+}  
+
+void VISU_FieldTransform::SetTransformFunction(TTransformFun theFunction) { 
+  //if(MYDEBUG)  MESSAGE("VISU_FieldTransform::SetTransformFunction");
+  myFunction = theFunction;
+  if(myFunction == NULL) myFunction = &Identical;
+  Modified();
+}
+
+template<typename TypeData> void
+ExecVectors(VISU_FieldTransform::TTransformFun theFunction, int theNbComponent, 
+           TypeData* theInputData, TypeData* theOutputData)
+{
+  vtkVectors *inVectors = theInputData->GetVectors();
+  if ( !inVectors || theNbComponent < 1 ) 
+    return; 
+  vtkVectors *newVectors = vtkVectors::New();
+  newVectors->SetNumberOfVectors(theNbComponent);
+  for (int ptId = 0; ptId < theNbComponent; ptId++) {
+    float v[3], val, res;
+    inVectors->GetVector(ptId,v);
+//    v[0] = (*theFunction)(v[0]);
+//    v[1] = (*theFunction)(v[1]);
+//    v[2] = (*theFunction)(v[2]);
+    val = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+    res = (*theFunction)(val);
+    if(val > 1.0) res /= val; else res *= val;
+    v[0] *= res;
+    v[1] *= res;
+    v[2] *= res;
+    newVectors->SetVector(ptId, v);
+  }
+  theOutputData->SetVectors(newVectors);
+  newVectors->Delete();
+}
+
+template<typename TypeData> void
+ExecScalars(VISU_FieldTransform::TTransformFun theFunction, int theNbComponent, 
+           TypeData* theInputData, TypeData* theOutputData)
+{
+  vtkScalars *inScalars = theInputData->GetScalars();
+  if ( !inScalars || theNbComponent < 1 ) 
+    return; 
+  vtkScalars *newScalars = vtkScalars::New();
+  newScalars->SetNumberOfScalars(theNbComponent);
+  for (int ptId = 0; ptId < theNbComponent; ptId++) {
+    float s = inScalars->GetScalar(ptId );
+    s = (*theFunction)(s);
+    newScalars->SetScalar(ptId, s);
+  }
+  theOutputData->SetScalars(newScalars);
+  newScalars->Delete();
+}
+
+void VISU_FieldTransform::Execute(){
+  //if(MYDEBUG)  MESSAGE("VISU_FieldTransform::Execute");
+  vtkDataSet *input = this->GetInput(), *output = this->GetOutput();
+  output->CopyStructure(input);
+  output->GetPointData()->CopyAllOff();
+  output->GetCellData()->CopyAllOff();
+
+  ExecScalars(myFunction,input->GetNumberOfPoints(),input->GetPointData(),output->GetPointData());
+  ExecVectors(myFunction,input->GetNumberOfPoints(),input->GetPointData(),output->GetPointData());
+  //output->GetPointData()->PassData(input->GetPointData());
+
+  ExecScalars(myFunction,input->GetNumberOfCells(),input->GetCellData(),output->GetCellData());
+  ExecVectors(myFunction,input->GetNumberOfCells(),input->GetCellData(),output->GetCellData());
+  //output->GetCellData()->PassData(input->GetCellData());
+}
+
+
diff --git a/src/VISU_I/VISU_FieldTransform.hxx b/src/VISU_I/VISU_FieldTransform.hxx
new file mode 100644 (file)
index 0000000..71e9cfc
--- /dev/null
@@ -0,0 +1,33 @@
+// File:       VISU_Extractor.hxx
+// Created:    Fri Jan 10 16:37:54 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_FieldTransform_HeaderFile
+#define VISU_FieldTransform_HeaderFile
+
+#include <vtkObjectFactory.h>
+#include <vtkDataSetToDataSetFilter.h>
+
+class VTK_EXPORT VISU_FieldTransform : public vtkDataSetToDataSetFilter{
+public:
+  vtkTypeMacro(VISU_FieldTransform,vtkDataSetToDataSetFilter);
+  static VISU_FieldTransform *New();
+  typedef double (*TTransformFun)(double);
+  void SetTransformFunction(TTransformFun theFunction);
+protected:
+  VISU_FieldTransform();
+  virtual ~VISU_FieldTransform();
+  VISU_FieldTransform(const VISU_FieldTransform&) {};
+  void operator=(const VISU_FieldTransform&) {};
+  void Execute();
+  
+  TTransformFun myFunction;
+};
+extern "C" {
+  double Identical(double theArg);
+  double Logarithmic10(double theArg);
+}
+
+#endif
diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc
new file mode 100644 (file)
index 0000000..037e0d5
--- /dev/null
@@ -0,0 +1,947 @@
+using namespace std;
+// File :      VISU_Gen_i.cc file 
+// Created :   
+// Author :    Alexey Petrov
+// Project :   SALOME
+// Copyright : OPEN CASCADE
+// $Header: 
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Convertor.hxx"
+#include "VISU_PrsObject_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Table_i.hh"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_Study.h"
+#include "SALOMEDS_Tool.hxx"
+
+#include <strstream>   
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
+#include <vtkUnstructuredGridReader.h>
+#include <vtkUnstructuredGridWriter.h>
+
+#include <omnithread.h>        
+#include CORBA_SERVER_HEADER(SALOME_Session)
+
+#include <qstring.h>
+#include <qfileinfo.h>
+static QFileInfo aFileInfo;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+#include <utilities.h>
+
+//static int IS_LOADED = (cout<<"\n----------------- VisuEngine_factory is loaded -----------------\n", 1);
+extern "C" {
+  PortableServer::ObjectId * 
+    VisuEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
+                      const char *instanceName, const char *interfaceName) 
+      {
+       if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
+       VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
+       return pVISU_Gen->getId() ;
+      }
+  Engines::Component_ptr  
+    GetVisuGen(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, 
+              SALOME_NamingService* theNamingService, QMutex* theMutex)
+      {
+       if(MYDEBUG) MESSAGE("extern \"C\" GetVisuGen");
+       VISU::VISU_Gen_i *aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theNamingService,theMutex);
+       return Engines::Component::_narrow( VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()));
+       //return aVISU_Gen->_this();
+      }
+}
+
+namespace VISU{
+  //===========================================================================
+  QMutex* Base_i::myMutex = NULL;
+  CORBA::ORB_var Base_i::myOrb;
+  PortableServer::POA_var Base_i::myPOA;
+  SALOME_NamingService* Base_i::myNamingService;
+  SALOME_LifeCycleCORBA* Base_i::myEnginesLifeCycle;
+  VISU_Gen_i* Base_i::myVisuGenImpl;
+  VISU_Gen_var Base_i::GetVisuGenInter() { return myVisuGenImpl->_this();}
+  Base_i::~Base_i() {}
+  char* Base_i::GetID(){ 
+    //CORBA::Object_var anObject = _this();
+    //return CORBA::string_dup(myOrb->object_to_string(anObject));
+    return CORBA::string_dup(myOrb->object_to_string(_this()));
+  }
+  //===========================================================================
+  static int mySCnt = 0;
+  static int myQCnt = 0;
+  Mutex::Mutex(QMutex* theMutex, QApplication* theQApp) :
+    myQApp(theQApp), isQAppLocked(theQApp->locked()), 
+    myMutex(theMutex), isSessionLocked(theMutex->locked())
+  {
+    if(MYDEBUG) MESSAGE("Mutex::Mutex : "<<!isQAppLocked<<" "<<!isSessionLocked);
+    if(!isSessionLocked) { myMutex->lock(); mySCnt++; }
+    if(!isQAppLocked) { myQApp->lock(); myQCnt++; }
+    //myQApp->syncX();
+    //if(MYDEBUG) MESSAGE("Mutex::Mutex - "<<myQCnt<<" "<<mySCnt);
+  }
+  Mutex::~Mutex(){
+    if(MYDEBUG) MESSAGE("Mutex::~Mutex : "<<!isQAppLocked<<" "<<!isSessionLocked);
+    //myQApp->syncX();
+    if(!isQAppLocked) { myQApp->unlock(); myQCnt--; }
+    if(!isSessionLocked) { myMutex->unlock(); mySCnt--; }
+    //if(MYDEBUG) MESSAGE("Mutex::~Mutex - "<<myQCnt<<" "<<mySCnt);
+    // myQApp->processEvents(); myQApp->processEvents(); myQApp->processEvents();
+  }
+  //===========================================================================
+  static Storable::TCallbackMap VisuStoreMap;
+  string Storable::ToString(){
+    ostrstream strOut;
+    Storable::DataToStream( strOut, "myComment", GetComment() );
+    ToStream(strOut);
+    strOut<<ends;
+    if(MYDEBUG) MESSAGE("Storable::ToString - "<<strOut.str());
+    auto_ptr<char> aRet(strOut.str());
+    return aRet.get(); 
+  }
+
+  void Storable::Registry(const char* theComment, TStorableEngine theEngine)
+    throw(std::logic_error&)
+      {
+       if(!VisuStoreMap.insert(TCallbackMap::value_type(theComment,theEngine)).second){
+         if(MYDEBUG) MESSAGE("Storable::Registry >> dupliacte registring !!!");
+         throw std::logic_error("Storable::Registry >> dupliacte registring !!!");
+       }
+      }
+
+  void RegistryStorable() throw(std::logic_error&) {
+    //Storable::Registry(View3D_i::myComment.c_str(),&View3DRestore);
+    Storable::Registry(Result_i::myComment.c_str(),&ResultRestore);
+    Storable::Registry(Mesh_i::myComment.c_str(),&MeshRestore);
+    Storable::Registry(ScalarMap_i::myComment.c_str(),&ScalarMapRestore);
+    Storable::Registry(DeformedShape_i::myComment.c_str(),&DeformedShapeRestore);
+    Storable::Registry(CutPlanes_i::myComment.c_str(),&CutPlanesRestore);
+    Storable::Registry(IsoSurfaces_i::myComment.c_str(),&IsoSurfacesRestore);
+    Storable::Registry(StreamLines_i::myComment.c_str(),&StreamLinesRestore);
+    Storable::Registry(Vectors_i::myComment.c_str(),&VectorsRestore);
+    Storable::Registry(Table_i::myComment.c_str(),&TableRestore);
+    Storable::Registry(Curve_i::myComment.c_str(),&CurveRestore);
+    Storable::Registry(Container_i::myComment.c_str(),&ContainerRestore);
+  }
+
+  void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){
+    if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<<theStr);
+    QStringList strList = QStringList::split( ";", theStr, false );
+    for ( int i = 0; i < strList.count(); i++ ) {
+      QString next = strList[ i ];
+      int pos = next.find("=");
+      QString aName, aValue;
+      if ( pos < 0 ) {
+       aName = next.stripWhiteSpace();
+       aValue = "";
+      }
+      else {
+       aName = next.left( pos ).stripWhiteSpace();
+       aValue = next.mid( pos+1 );
+       if ( aValue.isNull() )
+         aValue = "";
+      }
+      if ( !aName.isEmpty() )
+       theMap.insert( TRestoringMap::value_type( aName.latin1(), aValue ) );   
+    }
+  }
+  void Storable::DataToStream(ostrstream& theStr, const QString& theName, const QString& theVal) {
+    QString output = ( !theName.isNull() ? theName : QString("") ) 
+                   + QString( "=" ) 
+                  + ( !theVal.isNull()  ? theVal  : QString("") );
+    theStr<<output.latin1()<<";";
+  }
+  void Storable::DataToStream(ostrstream& theStr, const QString& theName, const int theVal) {
+    QString output = ( !theName.isNull() ? theName : QString("") ) 
+                   + QString( "=" ) 
+                  + QString::number( theVal );
+    theStr<<output.latin1()<<";";
+  }
+  void Storable::DataToStream(ostrstream& theStr, const QString& theName, const double theVal) {
+    QString output = ( !theName.isNull() ? theName : QString("") ) 
+                   + QString( "=" ) 
+                  + QString::number( theVal );
+    theStr<<output.latin1()<<";";
+  }
+  Storable* Storable::Create(SALOMEDS::SObject_ptr theSObject,
+                            const string& thePrefix, const string& theLocalPersistentID) 
+    throw (std::runtime_error&)
+      {
+       try{
+         QString strIn( theLocalPersistentID.c_str() );
+         TRestoringMap aMap;
+         StrToMap(strIn,aMap);
+         //CORBA::String_var aResultID(GetResultSO(theSObject)->GetID());
+         //aMap.insert(TRestoringMap::value_type("ResultID", strdup(aResultID)));
+         bool isExist;
+         QString aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist);
+         if ( isExist ) {
+           TCallbackMap::const_iterator i = VisuStoreMap.find(aComment.latin1());
+           if(MYDEBUG) MESSAGE("Storable::Create - "<<aComment.latin1()<<" "<<(i != VisuStoreMap.end()));
+           if(i == VisuStoreMap.end()) return NULL;
+           return (i->second)(theSObject,thePrefix,aMap);
+         }
+       }catch(std::logic_error& exc){
+         MESSAGE("Follow exception was accured :\n"<<exc.what());
+       }catch(...){
+         MESSAGE("Unknown exception was accured!");
+       }
+       return NULL;
+      }
+  const QString& Storable::FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind)
+    throw(std::logic_error&)
+      {
+       TRestoringMap::const_iterator i = theMap.find(theArg);
+       if(i == theMap.end()) {
+         if(MYDEBUG) MESSAGE("Storable::Init >> there is no value for "<<theArg);
+         if(isFind != NULL) *isFind = false;
+         //throw std::logic_error(string("Storable::Init >> there is no value for ") + theArg);
+         static QString BAD_VALUE("NULL");
+         return BAD_VALUE;
+       }
+       if(isFind != NULL) *isFind = true;
+       return i->second;
+      }
+
+  //===========================================================================
+  PortableServer::Servant GetServant(CORBA::Object_ptr theObject){
+    PortableServer::POA_ptr aPOA = Base_i::GetPOA();
+    if(CORBA::is_nil(theObject)) 
+      if(MYDEBUG) MESSAGE("GetServant - CORBA::is_nil(theObject)");
+    return aPOA->reference_to_servant(theObject);
+  }
+  //===========================================================================
+  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject){
+    SALOMEDS::GenericAttribute_var anAttr;
+    CORBA::Object_var anObj;
+    try{
+      if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
+       SALOMEDS::AttributeIOR_var anIOR  = SALOMEDS::AttributeIOR::_narrow(anAttr);
+       CORBA::String_var aValue = anIOR->Value();
+       CORBA::ORB_ptr anORB = Base_i::GetORB();
+       if(strcmp(aValue,"") != 0)
+         anObj = anORB->string_to_object(aValue);
+      }
+    }catch(...){
+      MESSAGE("SObjectToObject - Unknown exception was accured!");
+    }
+    return anObj;
+  }
+  //===========================================================================
+  SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument){
+    SALOMEDS::SComponent_var aSComponent = theStudyDocument->FindComponent("VISU");
+    if (aSComponent->_is_nil()) {
+      SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
+      aStudyBuilder->NewCommand();
+      int aLocked = theStudyDocument->GetProperties()->IsLocked();
+      if (aLocked) theStudyDocument->GetProperties()->SetLocked(false);
+      aSComponent = aStudyBuilder->NewComponent("VISU"); 
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
+      SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      aName->SetValue("Visu");
+
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap");
+      SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
+      aPixmap->SetPixMap( "ICON_OBJBROWSER_Visu" );
+      
+      VISU_Gen_var aVisuGen = Base_i::GetVisuGenInter();
+      aStudyBuilder->DefineComponentInstance(aSComponent,aVisuGen);
+      if (aLocked) theStudyDocument->GetProperties()->SetLocked(true);
+      aStudyBuilder->CommitCommand();
+    }
+    return aSComponent;
+  }
+  //===========================================================================
+  string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
+                                  const char* theComment, int IsAllLevels)
+    {
+      if(0 && MYDEBUG) MESSAGE("FindEntryWithComment - '"<<theComment<<"'");
+      SALOMEDS::ChildIterator_var anIter = 
+       theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry));
+      anIter->InitEx(IsAllLevels);
+      SALOMEDS::SObject_var aFieldSO;
+      for(;anIter->More();anIter->Next()) {
+       SALOMEDS::GenericAttribute_var anAttr;
+       if (anIter->Value()->FindAttribute(anAttr,"AttributeComment")) {
+         SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+         CORBA::String_var aString = aCmnt->Value();
+         string aValue(aString);
+         if (aValue == theComment) {
+           aFieldSO = anIter->Value();
+           aString = aFieldSO->GetID();
+           aValue = aString;
+           return aValue;
+         }
+       }
+      }
+      return "";
+    }
+  //===========================================================================
+  string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, 
+                              const char* theFatherEntry, const char* theRefFatherEntry,
+                              const char* theIOR, const char* theName, 
+                              const char* thePersistentRef, const char* theComment,
+                              CORBA::Boolean theCreateNew)
+    {
+      if(0 && MYDEBUG) 
+       MESSAGE("CreateAttributes - theName = "<<theName<<"; theComment = '"<<theComment<<
+               "'; theFatherEntry = "<<theFatherEntry);
+      SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
+      SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry);
+      SALOMEDS::SObject_var newObj;
+      if (theCreateNew) newObj = aStudyBuilder->NewObject(aFather);
+      else newObj = aFather;
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+      SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+      anIOR->SetValue(theIOR); 
+      anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+      SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      aName->SetValue(theName); 
+      anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef");
+      SALOMEDS::AttributePersistentRef_var aPRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr);
+      aPRef->SetValue(thePersistentRef); 
+      anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
+      SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+      aCmnt->SetValue(theComment);
+      if(strcmp(theRefFatherEntry,"") != 0){
+       SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
+       SALOMEDS::SObject_var anObj = aStudyBuilder->NewObject(aRefFather);
+       aStudyBuilder->Addreference(anObj,newObj);
+      }
+      CORBA::String_var anEntry = newObj->GetID();
+      string aRet(anEntry);
+      if(0 && MYDEBUG) MESSAGE("CreateAttributes - anEntry = "<<aRet<<"; IOR = "<<theIOR);
+      return aRet;
+    }
+  //===========================================================================
+  static SALOMEDS::SComponent_var VisuSComponent;
+  static string VisuTmpDir;
+  static CORBA::Boolean myIsMultiFile;
+  const CORBA::Boolean IsMultifile() { 
+    return myIsMultiFile;
+  }
+  //===========================================================================
+  VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb,
+                        PortableServer::POA_ptr poa,
+                        PortableServer::ObjectId * contId, 
+                        const char *instanceName, 
+                        const char *interfaceName) :
+    Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+  {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<<myMutex);
+    _thisObj = this ;
+    _id = _poa->activate_object(_thisObj);
+    SALOME_NamingService aNamingService(orb);
+    CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
+    SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
+    //aSession->GetInterface(); 
+    myVisuGen = VISU::VISU_Gen::_narrow( aSession->GetVisuComponent() );
+  }
+
+  VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, 
+                        SALOME_NamingService* theNamingService, QMutex* theMutex) :
+    Engines_Component_i()
+  {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<<theMutex);
+    Mutex mt(theMutex,qApp);
+    Base_i::myMutex = theMutex;
+    Base_i::myOrb = CORBA::ORB::_duplicate(theORB);
+    Base_i::myPOA = PortableServer::POA::_duplicate(thePOA);
+    Base_i::myNamingService = theNamingService;
+    static SALOME_LifeCycleCORBA aEnginesLifeCycle(theNamingService);
+    Base_i::myEnginesLifeCycle = &aEnginesLifeCycle;
+    Base_i::myVisuGenImpl = this;
+    RegistryStorable();
+    if(!QAD_Application::getDesktop()->getActiveStudy())
+      QAD_Application::getDesktop()->createStudy();
+    myStudyDocument = 
+      QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+    Base_i::myPOA->activate_object(this);
+  }
+
+  VISU_Gen_i::~VISU_Gen_i(){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
+  }
+  //===========================================================================
+  bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
+                     const SALOMEDS::TMPFile & theStream,
+                     const char* theURL,
+                     bool isMultiFile)
+  {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::Load - myMutex = "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      SALOMEDS::Study_var aStudy = theComponent->GetStudy(); 
+      SALOMEDS::StudyBuilder_var  aStudyBuilder = aStudy->NewBuilder(); 
+      TCollection_AsciiString aTmpDir =
+       isMultiFile?TCollection_AsciiString((char*)theURL):SALOMEDS_Tool::GetTmpDir();
+      VisuSComponent = SALOMEDS::SComponent::_duplicate(theComponent);
+      VisuTmpDir = aTmpDir.ToCString();
+      SALOMEDS::ListOfFileNames_var aSeq =
+       SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.ToCString(),isMultiFile);
+      myIsMultiFile = isMultiFile;
+      return true;
+    }
+    return myVisuGen->Load(theComponent,theStream,theURL,isMultiFile);
+  }
+
+  char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
+                                          const char* aLocalPersistentID,
+                                          CORBA::Boolean isMultiFile) {
+    if(myMutex){
+      CORBA::String_var aString("");
+      if(strcmp(aLocalPersistentID,"") != 0) {
+       Mutex mt(myMutex,qApp);
+       Storable* aStorable =
+         Storable::Create(theSObject,VisuTmpDir.c_str(),aLocalPersistentID);
+       if(aStorable != NULL) aString = aStorable->GetID();
+      }
+      return aString._retn();
+    }
+    return myVisuGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile);
+  }
+  //===========================================================================
+  SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
+                                   const char* theURL,
+                                   bool isMultiFile)
+  {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - myMutex = "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      CORBA::String_var aString = SALOMEDS_Tool::GetTmpDir();
+      TCollection_AsciiString aTmpDir = isMultiFile? (const Standard_CString)theURL: (const Standard_CString)aString.in();
+      if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
+      int aCounter = 0;
+      TColStd_SequenceOfAsciiString aFileNames;
+      SALOMEDS::Study_var aStudy = theComponent->GetStudy(); 
+      SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
+      for (; itBig->More(); itBig->Next()) {
+       SALOMEDS::SObject_var gotBranch = itBig->Value();
+       CORBA::Object_var anObj = SObjectToObject(gotBranch);
+       if(CORBA::is_nil(anObj)) continue;
+       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
+       if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){
+         const QFileInfo& aFileInfo = pResult->GetFileInfo();
+         QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+         QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
+         static QString aCommand;
+         aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
+         if(system(aCommand) == -1){
+           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+           continue;
+         }else
+           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
+         TCollection_AsciiString aString(strdup(aFileName.latin1()));
+         aFileNames.Append(aString);
+       }
+      }
+      SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
+      if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.Length() - "<<aFileNames.Length());
+      if(aFileNames.Length() > 0){
+       SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+       aSeq->length(aFileNames.Length());
+       for(aCounter = aFileNames.Length(); aCounter > 0; aCounter--)
+         aSeq[aCounter-1] = CORBA::string_dup(aFileNames.Value(aCounter).ToCString());
+       aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.ToCString(), aSeq.in(), isMultiFile);
+       if(!isMultiFile)
+         SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true);
+      }
+      return aStreamFile._retn();
+    }
+    return myVisuGen->Save(theComponent,theURL,isMultiFile);
+  }
+
+  char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
+                                          const char* IORString,
+                                          CORBA::Boolean isMultiFile) {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::IORToLocalPersistentID - myMutex = "<<myMutex);
+    if(myMutex){
+      CORBA::String_var aString(IORString);
+      if(strcmp(IORString,"") != 0){ 
+       CORBA::ORB_ptr anORB = GetORB();
+       CORBA::Object_var anObj = anORB->string_to_object(aString);
+       if(!CORBA::is_nil(anObj)){
+         Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj));
+         if(pStorable != NULL){
+           Mutex mt(myMutex,qApp);
+           aString = pStorable->ToString().c_str();
+           return aString._retn();
+         }
+       }
+      }
+      return aString._retn();
+    }
+    return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile);
+  }
+
+  void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){
+    //if(MYDEBUG) MESSAGE("VISU_Gen_i::SetCurrentStudy : "<<(!theStudy->_is_nil()));
+    if(myMutex)
+      myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+    else
+      myVisuGen->SetCurrentStudy(theStudy);
+  }
+  SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::GetCurrentStudy : "<<myMutex);
+    if(myMutex)
+      return SALOMEDS::Study::_duplicate(myStudyDocument);
+    return myVisuGen->GetCurrentStudy();
+  }
+  ViewManager_ptr VISU_Gen_i::GetViewManager(){
+    //omni_mutex aMutex;
+    //omni_mutex_lock aMutexLock(aMutex);
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::GetViewManager : "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      ViewManager_i * aViewManager = new ViewManager_i(myStudyDocument);
+      return ViewManager::_duplicate(aViewManager->_this());
+    }
+    return myVisuGen->GetViewManager();
+  }
+
+  SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return SALOMEDS::SObject::_nil();
+      Mutex mt(myMutex,qApp);
+      SALOMEDS::SObject_var aRes = VISU::ImportTables(theFileName,myStudyDocument);
+      return aRes._retn();
+    }
+    return myVisuGen->ImportTables(theFileName);
+  }
+
+  Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
+      Mutex mt(myMutex,qApp);
+      aFileInfo.setFile(theFileName);
+      Result_i* pResult = new Result_i(myStudyDocument);
+      if(pResult->Create(theFileName) != NULL) 
+       return Result::_duplicate(pResult->_this());
+      return Result::_nil();
+    }
+    return myVisuGen->ImportFile(theFileName);
+  }
+
+  Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ImportMed : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = new Result_i(myStudyDocument);
+      if(pResult->Create(theMedSObject) != NULL) 
+       return Result::_duplicate(pResult->_this());
+      return Result::_nil();
+    }
+    return myVisuGen->ImportMed(theMedSObject);
+  }
+
+  Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::MeshOnEntity : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Mesh_i* aPresent = new Mesh_i(pResult);
+      if(aPresent->Create(theMeshName,theEntity) != NULL) 
+        return Mesh::_duplicate(aPresent->_this());
+      return Mesh::_nil();
+    }
+    return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
+  }
+
+  Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, 
+                                         VISU::Entity theEntity, 
+                                         const char* theFamilyName){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::FamilyMeshOnEntity : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Mesh_i* aPresent = new Mesh_i(pResult);
+      if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL) 
+        return Mesh::_duplicate(aPresent->_this());
+      return Mesh::_nil();
+    }
+    return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
+  }
+
+  Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult, const char* theMeshName, 
+                                const char* theGroupName){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::GroupMesh : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Mesh_i* aPresent = new Mesh_i(pResult);
+      if(aPresent->Create(theMeshName,theGroupName) != NULL) 
+        return Mesh::_duplicate(aPresent->_this());
+      return Mesh::_nil();
+    }
+    return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
+  }
+
+  ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                            const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return ScalarMap::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(ScalarMap_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       ScalarMap_i* aPresent = new ScalarMap_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return ScalarMap::_duplicate(aPresent->_this());
+      }
+      return ScalarMap::_nil();
+    }
+    return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                    const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return DeformedShape::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(DeformedShape_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       DeformedShape_i* aPresent = new DeformedShape_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return DeformedShape::_duplicate(aPresent->_this());
+      }
+      return DeformedShape::_nil();
+    }
+    return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                    const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Vectors::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(Vectors_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       Vectors_i* aPresent = new Vectors_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return Vectors::_duplicate(aPresent->_this());
+      }
+      return Vectors::_nil();
+    }
+    return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                    const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return IsoSurfaces::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(IsoSurfaces_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       IsoSurfaces_i* aPresent = new IsoSurfaces_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return IsoSurfaces::_duplicate(aPresent->_this());
+      }
+      return IsoSurfaces::_nil();
+    }
+    return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                    const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return StreamLines::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(StreamLines_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       StreamLines_i* aPresent = new StreamLines_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return StreamLines::_duplicate(aPresent->_this());
+      }
+      return StreamLines::_nil();
+    }
+    return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                    const char* theFieldName, CORBA::Double theIteration){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::ScalarMapOnField : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return CutPlanes::_nil();
+      Mutex mt(myMutex,qApp);
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      if(CutPlanes_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,theIteration)){
+       CutPlanes_i* aPresent = new CutPlanes_i(pResult);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,theIteration) != NULL) 
+         return CutPlanes::_duplicate(aPresent->_this());
+      }
+      return CutPlanes::_nil();
+    }
+    return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+  Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::CreateTable : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Table::_nil();
+      Mutex mt(myMutex,qApp);
+      Table_i* aPresent = new Table_i(myStudyDocument,theTableEntry);
+      if(aPresent->Create() != NULL) 
+       return Table::_duplicate(aPresent->_this());
+      return Table::_nil();
+    }
+    return myVisuGen->CreateTable(theTableEntry);
+  }
+
+  Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::CreateCurve : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Curve::_nil();
+      Mutex mt(myMutex,qApp);
+      PortableServer::POA_ptr aPOA = GetPOA();
+      Table_i* pTable = dynamic_cast<Table_i*>(aPOA->reference_to_servant(theTable));
+      Curve_i* aPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
+      if(aPresent->Create() != NULL) { 
+       return Curve::_duplicate(aPresent->_this());
+      }
+      return Curve::_nil();
+    }
+    return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
+  }
+  Container_ptr VISU_Gen_i::CreateContainer(){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::CreateContainer : "<<myMutex);
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Container::_nil();
+      Mutex mt(myMutex,qApp);
+      Container_i* aPresent = new Container_i(myStudyDocument);
+      if(aPresent->Create() != NULL) {
+       return Container::_duplicate(aPresent->_this());
+      }
+      return Container::_nil();
+    }
+    return myVisuGen->CreateContainer();
+  }
+
+  void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      SALOMEDS::Study_var aStudy = theComponent->GetStudy(); 
+      if(!aStudy->_is_nil()){
+       SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
+       for (int i = 0; itBig->More(); itBig->Next(),i++) {
+         SALOMEDS::SObject_var gotBranch = itBig->Value();
+         if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : itBig->Next() = "<<i);
+         CORBA::Object_var anObj = SObjectToObject(gotBranch);
+         if(CORBA::is_nil(anObj)) continue;
+         Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
+         if(pResult->GetSourceId() == Result_i::eRestoredFile){ //Try remove its file and directory
+           const QFileInfo& aFileInfo = pResult->GetFileInfo();
+           static QString aCommand;
+           aCommand.sprintf("rm %s",aFileInfo.filePath().latin1());
+           if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+           aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",aFileInfo.dirPath().latin1());
+           if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+         }
+       }
+      }
+      return;
+    }
+    myVisuGen->Close(theComponent);
+  }
+
+  char* VISU_Gen_i::ComponentDataType(){
+    return CORBA::string_dup("VISU");
+  }
+
+  bool VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) {
+    Result_var aResultObj = Result::_narrow(theIOR);
+    return !(aResultObj->_is_nil());
+  }
+
+  SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
+                                                  SALOMEDS::SObject_ptr theSObject,
+                                                  CORBA::Object_ptr theObject,
+                                                  const char* theName) 
+  throw (SALOME::SALOME_Exception) 
+  {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::PublishInStudy : "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      SALOMEDS::SObject_var aResultSO;
+      Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject));
+      if (!aResultObj) return aResultSO._retn();
+      const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
+      CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID();
+      aResultSO = theStudy->FindObjectID(anEntry);
+      return aResultSO._retn();
+    }
+    return myVisuGen->PublishInStudy(theStudy, theSObject, theObject, theName);
+  }
+    
+  CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
+    if(0 && MYDEBUG) MESSAGE("VISU_Gen_i::CanCopy : "<<myMutex);
+    if(myMutex){
+      //Mutex mt(myMutex,qApp);
+      SALOMEDS::GenericAttribute_var anAttr;
+      if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return false;
+      try {
+       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+       CORBA::String_var aValue = anIOR->Value();
+       if(strcmp(aValue,"") != 0){
+         CORBA::Object_ptr anObj = GetORB()->string_to_object(aValue);
+         if (!CORBA::is_nil(anObj)){
+           Result_var aResultObj = Result::_narrow(anObj);
+           if(!aResultObj->_is_nil()){
+             Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj));
+             if(pResult != NULL){
+               if(abs(pResult->GetSourceId()) > Result_i::eFile) 
+                 if((pResult->GetFileInfo()).filePath() == "Med") return false;
+               return true;
+             }
+           }
+         }
+       }
+      } catch (...) {
+       MESSAGE("Unknown exception was accured!");
+      }
+      return false;
+    }
+    return myVisuGen->CanCopy(theObject);
+  }
+
+  SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::CopyFrom : "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+
+      theObjectID = 0;
+      SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
+      SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+
+      PortableServer::POA_ptr aPOA = GetPOA();
+      
+      SALOMEDS::GenericAttribute_var anAttr;
+      if (!theObject->FindAttribute(anAttr,"AttributeIOR")) return NULL;
+      SALOMEDS::AttributeIOR_var anIORAttr = SALOMEDS::AttributeIOR::_narrow(anAttr);
+      CORBA::Object_var aCorbaObj;
+      try {
+       aCorbaObj = GetORB()->string_to_object(anIORAttr->Value());
+      } catch(...) {
+       aStreamFile->length(1);
+       aStreamFile[0] = strdup("E")[0];
+       return aStreamFile._retn();
+      }
+      if (CORBA::is_nil(aCorbaObj)) {
+       return NULL;
+      }
+
+      Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj));
+      if (!pStorable) {
+       return NULL;
+      }
+      CORBA::String_var aTmpDir = SALOMEDS_Tool::GetTmpDir();
+
+      string aStr = pStorable->ToString().c_str();
+      ofstream stmOut2((string(aTmpDir) + string("copy_persistent")).c_str(),ios::out);
+      stmOut2<<aStr<<endl;
+      stmOut2.close();
+
+      Result_i* aResultObj = dynamic_cast<Result_i*>(aPOA->reference_to_servant(aCorbaObj));
+      if (aResultObj) {
+       string aFileName = string(SALOMEDS_Tool::GetNameFromPath(theObject->GetStudy()->URL())) + "_";
+       const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
+       aFileName += aFileInfo.fileName().latin1();
+       static QString aCommand;
+       aCommand.sprintf("cp %s %s",
+                        aFileInfo.filePath().latin1(),
+                        (string(aTmpDir) + aFileName).c_str());
+       if(system(aCommand) == -1) {
+         if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<<aCommand);
+         return NULL;
+       }
+
+       aSeq->length(2);
+       aSeq[0] = "copy_persistent";
+       aSeq[1] = aFileName.c_str();
+      } else {
+       aSeq->length(1);
+       aSeq[0] = "copy_persistent";
+      }
+      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aSeq.in(), false);
+      SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aSeq.in(), true);
+
+      // Assign an ID = 1 the the type VISU::Result
+      theObjectID = 1;
+      return aStreamFile._retn();
+    }
+    return myVisuGen->CopyFrom(theObject, theObjectID);
+  }
+
+  CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
+    // The VISU component can paste only objects copied by VISU component
+    // and with the object type = 1
+    if(0 && MYDEBUG) MESSAGE("VISU_Gen_i::CanPaste : "<<myMutex);
+    if (strcmp(theComponentName, ComponentDataType()) != 0 || theObjectID != 1) return false;
+    return true;
+  }
+
+  SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
+                                             CORBA::Long theObjectID,
+                                             SALOMEDS::SObject_ptr theObject) {
+    if(MYDEBUG) MESSAGE("VISU_Gen_i::PasteInto : "<<myMutex);
+    if(myMutex){
+      Mutex mt(myMutex,qApp);
+      SALOMEDS::SObject_var aResultSO;
+      if (theObjectID != 1) return aResultSO._retn();
+      
+      CORBA::String_var aTmpDir = (const char*)SALOMEDS_Tool::GetTmpDir();
+      SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
+
+      ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str());
+//        ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str(),ios::in);
+      stmIn.seekg(0, ios::end);
+      int aLength = stmIn.tellg();
+      stmIn.seekg(0, ios::beg);
+      char* aString = new char[aLength+1];
+      stmIn.read(aString, aLength);
+      aString[aLength] = 0;
+      myIsMultiFile = true;
+      
+      string aFileName(aTmpDir.in());
+      if(aSeq->length() > 1) aFileName += aSeq[1].in();
+      Storable* aStorable = Storable::Create(theObject,aFileName,aString);
+
+      SALOMEDS::ListOfFileNames_var aSeqToRm = new SALOMEDS::ListOfFileNames;
+      aSeqToRm->length(1);
+      aSeqToRm[0] = "copy_persistent";
+      SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aSeqToRm.in(), true);
+
+      SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent();
+      SALOMEDS::Study_var aStudy = theObject->GetStudy();
+      SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+      CORBA::String_var aComponentID(aComponent->GetID()), aSObjID(theObject->GetID());
+      if (strcmp(aComponentID, aSObjID) == 0) //create the new result SObject
+       aResultSO = aStudyBuilder->NewObject(aComponent);
+      else 
+       aResultSO = SALOMEDS::SObject::_duplicate(theObject);
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR");
+      SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+      CORBA::String_var anIORValue(aStorable->GetID());
+      anIOR->SetValue(anIORValue);
+      return aResultSO._retn();
+    }
+    return myVisuGen->PasteInto(theStream,theObjectID,theObject);
+  }
+
+};
diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh
new file mode 100644 (file)
index 0000000..3b5e238
--- /dev/null
@@ -0,0 +1,105 @@
+// File :      VISU_GEN_i.h file
+// Created :   
+// Author :    Alexey Petrov
+// Project :   SALOME
+// Copyright : OPEN CASCADE
+// $Header: 
+
+
+#ifndef __VISU_GEN_I_H__
+#define __VISU_GEN_I_H__
+
+#include "VISUConfig.hh"
+
+#include "SALOME_Component_i.hxx"
+#include "SALOME_NamingService.hxx"
+
+namespace VISU{
+  class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
+                    public virtual ::Engines_Component_i,
+                    public virtual Base_i
+  {
+    VISU_Gen_var myVisuGen;
+    SALOMEDS::Study_var myStudyDocument;
+    VISU_Gen_i();
+    VISU_Gen_i(const VISU::VISU_Gen_i &);
+  public:
+    VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, 
+              SALOME_NamingService* theNamingService, QMutex* theMutex);
+    VISU_Gen_i(CORBA::ORB_ptr orb,
+              PortableServer::POA_ptr poa,
+              PortableServer::ObjectId * contId, 
+              const char *instanceName, 
+              const char *interfaceName);
+    virtual ~VISU_Gen_i();
+    virtual VISU::VISUType GetType() { return VISU::TVISUGEN;};
+
+    virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
+    virtual SALOMEDS::Study_ptr GetCurrentStudy();
+    virtual ViewManager_ptr GetViewManager();
+
+    virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
+
+    //Create Result
+    virtual Result_ptr ImportFile(const char* theFileName);
+    virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
+
+    //Create Presentation Of Submeshes
+    virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity);
+    virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, 
+                                       VISU::Entity theEntity, const char* theFamilyName);
+    virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
+
+    //Create 3D collored Presentation Of Different Types
+    virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                          const char* theFieldName, CORBA::Double theIteration);
+    virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                                  const char* theFieldName, CORBA::Double theIteration);
+    virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                      const char* theFieldName, CORBA::Double theIteration);
+    virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                              const char* theFieldName, CORBA::Double theIteration);
+    virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                          const char* theFieldName, CORBA::Double theIteration);
+    virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                              const char* theFieldName, CORBA::Double theIteration);
+    //Create Digital Presentation
+    virtual Table_ptr CreateTable(const char* theTableEntry);
+    virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
+    virtual Container_ptr CreateContainer();
+    
+    // inherited methods from SALOMEDS::Driver
+    virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
+                                   const char* theURL,
+                                   bool isMultiFile);
+    virtual bool Load(SALOMEDS::SComponent_ptr,
+                     const SALOMEDS::TMPFile &,
+                     const char* theURL,
+                     bool isMultiFile);
+
+    virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); 
+
+    virtual char* ComponentDataType();
+
+    virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
+                                        const char* IORString,
+                                        CORBA::Boolean isMultiFile);
+    virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
+                                        const char* aLocalPersistentID,
+                                        CORBA::Boolean isMultiFile);
+    
+    virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
+    virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
+                                                SALOMEDS::SObject_ptr theSObject,
+                                                CORBA::Object_ptr theObject,
+                                                const char* theName) throw (SALOME::SALOME_Exception);
+
+    CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
+    SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
+    CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
+    SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
+                                   CORBA::Long theObjectID,
+                                   SALOMEDS::SObject_ptr theObject);
+  };
+}
+#endif 
diff --git a/src/VISU_I/VISU_LookupTable.cxx b/src/VISU_I/VISU_LookupTable.cxx
new file mode 100644 (file)
index 0000000..af54375
--- /dev/null
@@ -0,0 +1,79 @@
+using namespace std;
+//  File      : VISU_LookupTable.cxx
+//  Created   : UI team, 18.02.03
+//  Descr     : Scaling values of vtkLookupTable
+//  Author    : Vitaliy Smetannikov
+//  Project   : SALOME
+//  Module    : OBJECT
+//  Copyright : Open CASCADE 2003
+
+
+#include "VISU_LookupTable.hxx"
+#include "vtkObjectFactory.h"
+
+
+VISU_LookupTable *VISU_LookupTable::New() {
+  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_LookupTable");
+  if(ret) {
+    return (VISU_LookupTable*)ret;
+  }
+  // If the factory was unable to create the object, then create it here.
+  return new VISU_LookupTable;
+}
+
+VISU_LookupTable::VISU_LookupTable(int sze, int ext)
+  : vtkLogLookupTable(sze, ext), myScale(1.), myIsLog(0) 
+{}
+
+int VISU_LookupTable::ComputeLogRange(float inRange[2], float outRange[2]){
+  if(inRange[0] >= inRange[1]){
+    //vtkErrorMacro (<<"Minimum value must be less than maximum value");
+    return -1;
+  }
+  if(0.0 <= inRange[0] && 0.0 < inRange[1]){
+    if (inRange[0] == 0.0) inRange[0] = 1.0e-06 * (inRange[1] - inRange[0]);
+    outRange[0] = log10((double)inRange[0]);
+    outRange[1] = log10((double)inRange[1]);
+    return 0;
+  }else if(inRange[0] < 0.0 && inRange[1] <= 0.0){
+    outRange[0] = log10((double)-inRange[0]);
+    outRange[1] = log10((double)-inRange[1]);
+    return 1;
+  }else{
+    //vtkErrorMacro(<<"Can't use logarithmic table on mixed negative/positive values");
+    return -1;
+  }
+}
+
+void VISU_LookupTable::SetTableRange(float min, float max){
+  this->TableRange[0] = min;
+  this->TableRange[1] = max;
+  this->UseAbsoluteValue = ComputeLogRange(this->TableRange,this->myLogRange);
+  if(this->UseAbsoluteValue < 0) return;
+  this->LogMinRange = this->myLogRange[0];
+  this->LogMaxRange = this->myLogRange[1];
+}
+
+unsigned char* VISU_LookupTable::MapValue(float v) {
+  v = this->TableRange[0] + (v - this->TableRange[0])*myScale;
+  if(myIsLog) {
+    v = pow((float)10.0,v)*myScale;
+    //v = pow(10.0, (this->LogMinRange + (v - this->LogMinRange)))*myScale;
+    return vtkLogLookupTable::MapValue(v);
+  }else{
+    //v *= myScale;
+    return vtkLookupTable::MapValue(v);
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VISU_I/VISU_LookupTable.hxx b/src/VISU_I/VISU_LookupTable.hxx
new file mode 100644 (file)
index 0000000..a690fb6
--- /dev/null
@@ -0,0 +1,41 @@
+//  File      : VISU_LookupTable.h
+//  Created   : UI team, 18.02.03
+//  Descr     : Scaling values of vtkLookupTable
+//  Author    : Vitaliy Smetannikov
+//  Project   : SALOME
+//  Module    : OBJECT
+//  Copyright : Open CASCADE 2003
+
+
+#ifndef VISU_LookupTable_H
+#define VISU_LookupTable_H
+
+//#include <vtkLookupTable.h>
+#include <vtkLogLookupTable.h>
+
+class VISU_LookupTable: public vtkLogLookupTable {
+ public:
+   vtkTypeMacro(VISU_LookupTable,vtkLogLookupTable);
+
+   static VISU_LookupTable *New();
+   
+   void SetTableRange(float min, float max);
+   static int ComputeLogRange(float inRange[2], float outRange[2]);
+   float* GetLogRange() { return myLogRange;}
+   unsigned char *MapValue(float v);
+
+   float GetMapScale() { return myScale; }
+   void SetMapScale(float theScale) { myScale = theScale; Modified(); }
+
+   int IsLog() { return myIsLog; }
+   void SetLog(int theLog) { myIsLog = theLog; Modified(); }
+   
+ protected:
+  VISU_LookupTable(int sze=256, int ext=256);
+  ~VISU_LookupTable() {};
+   
+  float myScale;
+  int myIsLog;
+  float myLogRange[2];
+};
+#endif // VISU_LookupTable_H
diff --git a/src/VISU_I/VISU_MedConvertor.cxx b/src/VISU_I/VISU_MedConvertor.cxx
new file mode 100644 (file)
index 0000000..2ae5ff2
--- /dev/null
@@ -0,0 +1,625 @@
+using namespace std;
+
+// File:       VISU_MedConvertor.cxx
+// Created:    Fri Jan 10 12:04:54 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_MedConvertor.hxx"
+#include <valarray>    
+#include <vtkCellType.h>
+#define USER_INTERLACE MED_FULL_INTERLACE
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 1;
+#endif
+static med_err ret = 0;
+
+typedef map<VISU::TEntity,med_entite_maillage> TVisu2MedEntity;
+static TVisu2MedEntity aVisu2MedEntity;
+static int INIT = (
+                  aVisu2MedEntity[VISU::NODE_ENTITY] = MED_NOEUD,
+                  aVisu2MedEntity[VISU::EDGE_ENTITY] = MED_ARETE,
+                  aVisu2MedEntity[VISU::FACE_ENTITY] = MED_FACE,
+                  aVisu2MedEntity[VISU::CELL_ENTITY] = MED_MAILLE,
+                  1);
+
+static med_geometrie_element NODEGEOM[1] = {MED_POINT1};
+static med_geometrie_element EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
+  MED_SEG2, MED_SEG3
+  };
+static med_geometrie_element FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
+  MED_TRIA3, MED_QUAD4, MED_TRIA6, MED_QUAD8
+  };
+static med_geometrie_element  CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
+  MED_POINT1, MED_SEG2, MED_SEG3, MED_TRIA3,
+  MED_QUAD4, MED_TRIA6, MED_QUAD8, MED_TETRA4,
+  MED_PYRA5, MED_PENTA6, MED_HEXA8, MED_TETRA10, 
+  MED_PYRA13, MED_PENTA15, MED_HEXA20
+  };
+void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd) 
+     throw (std::runtime_error&)
+{
+  switch(theEntity){
+  case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
+  case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
+  case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
+  case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
+  default:
+    throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect");
+  }
+}
+
+extern "C"
+VISU_Convertor* CreateMedConvertor(const string& theFileName) throw(std::runtime_error&){
+  return new VISU_MedConvertor(theFileName);
+}
+
+int med2vtkCellType(int medType){
+  for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+    if(med2vtk[i].medType == medType) return med2vtk[i].vtkType;
+  return -1;
+}
+
+int vtk2medCellType(int vtkType){
+  for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+    if(med2vtk[i].vtkType == vtkType) return med2vtk[i].medType;
+  return -1;
+}
+
+class MedFile{
+  char* myFileName;
+  med_idt myFid;
+  MedFile();
+  MedFile(const MedFile&);
+public:
+  MedFile(const char* theFileName) throw(std::runtime_error&) :
+    myFileName(strdup(theFileName))
+  {
+    myFid = MEDouvrir(myFileName,MED_LECT);
+    if(myFid < 0){
+      free(myFileName);
+      throw std::runtime_error(string("MedFile::MedFile >> MEDouvrir(...) - ") + theFileName);
+    }
+  }
+  ~MedFile(){
+    free(myFileName);
+    if(myFid >= 0) 
+      MEDfermer(myFid);
+  }
+  const med_idt& GetFid() const { return myFid;};
+};
+
+VISU_MedConvertor::VISU_MedConvertor(const string& theFileName) throw (std::runtime_error&) {
+  myFileInfo.setFile(QString(theFileName.c_str()));
+  myName = myFileInfo.baseName();
+}
+
+VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
+  MedFile aMedFile(myFileInfo.absFilePath());
+  med_idt fid = aMedFile.GetFid();
+  med_int iMeshEnd = MEDnMaa(fid);  //Get number of meshes
+  if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "<<iMeshEnd<<"; myFileInfo = "<<myFileInfo.filePath());
+  for(int iMesh = 1; iMesh <= iMeshEnd; iMesh++){
+    med_int aMeshDim;
+    char aMeshName[MED_TAILLE_NOM+1] = "";
+    MEDmaaInfo(fid,iMesh,aMeshName,&aMeshDim);
+    if(MYDEBUG) MESSAGE("ImportInfo - aMeshName = '"<<aMeshName<<"'; aMeshDim = "<<aMeshDim);
+    VISU::TMesh &aMesh = myMeshMap[aMeshName];
+    aMesh.myDim = aMeshDim;
+    aMesh.myName = aMeshName;
+    typedef map<int,VISU::TEntity> TFamily2EntityMap;
+    TFamily2EntityMap aFamily2EntityMap;
+    TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
+    for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++) {
+      VISU::TEntity anEntity = aVisu2MedEntityIter->first;
+      int iGeomElemEnd;
+      med_geometrie_element* aGeomElemVector;
+      GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+      med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
+      for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+       int medId = getIdMedType(aGeomElemVector[iGeomElem]);
+       int aVtkType = med2vtk[medId].vtkType;
+       med_geometrie_element aMedType = med2vtk[medId].medType;
+       if(aMedEntity == MED_NOEUD){
+         med_geometrie_element typgeo = (med_geometrie_element)0;
+         med_connectivite typco = (med_connectivite)0;
+         med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
+         if(iNumElemEnd > 0){
+           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+           aMeshOnEntity.myEntity = anEntity;
+           aMeshOnEntity.myMeshName = aMeshName;
+           if(MYDEBUG) 
+             MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<"; iNumElemEnd = "<<iNumElemEnd<<
+                     "; medName = "<<med2vtk[medId].medName<<"; medId = "<<medId);
+           med_booleen iname_elem, inum_elem;
+           valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
+           valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
+           med_repere rep;
+           valarray<char> name_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
+           valarray<char> unit_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
+           valarray<med_float> coord(aMesh.myDim*iNumElemEnd);
+           ret = MEDnoeudsLire(fid,aMeshName,aMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
+                               &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
+                               &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
+           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDnoeudsLire(...)");
+           for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+             if(num_fam_elem[iNumElem] != 0) 
+               aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
+         }
+       }
+       //Get number of connectivities
+       med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD); 
+       if (iNumElemEnd > 0) {
+         VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+         aMeshOnEntity.myEntity = anEntity;
+         aMeshOnEntity.myMeshName = aMeshName;
+         med_booleen iname_elem, inum_elem;
+         valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
+         valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
+         med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
+         if(MYDEBUG) 
+           MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<"; iNumElemEnd = "<<iNumElemEnd<<
+                   "; medName = "<<med2vtk[medId].medName<<"; aNbConnForElem = "<<aNbConnForElem);
+         valarray<med_int> conn(0,aNbConnForElem*iNumElemEnd);
+         ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
+                               &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
+                               &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
+         if (ret < 0) throw std::runtime_error("ImportInfo >> MEDelementsLire(...)");
+         for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+           if(num_fam_elem[iNumElem] != 0) 
+             aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
+       }
+      }
+    }
+    med_int aNbFamily = MEDnFam(fid,aMeshName,0,MED_FAMILLE);
+    if(MYDEBUG) MESSAGE("ImportInfo - aNbFamily = "<<aNbFamily);
+    for(int aFamInd = 1; aFamInd <= aNbFamily; aFamInd++){
+      med_int aNbAttrib = MEDnFam(fid,aMeshName,aFamInd,MED_ATTR);
+      valarray<med_int> anAttId(aNbAttrib), anAttVal(aNbAttrib);
+      valarray<char> anAttDesc('\0',aNbAttrib*MED_TAILLE_DESC+1);
+      med_int aNbGroup = MEDnFam(fid,aMeshName,aFamInd,MED_GROUPE);
+      if(0 && MYDEBUG) 
+       MESSAGE("ImportInfo - aFamInd = "<<aFamInd<<"; aNbAttrib = "<<aNbAttrib<<"; aNbGroup = "<<aNbGroup);
+      valarray<char> aGroupNames('\0',aNbGroup*MED_TAILLE_LNOM+1);
+      char aFamilyName[MED_TAILLE_NOM+1] = "";
+      med_int aFamilyNum;
+      ret = MEDfamInfo(fid,aMeshName,aFamInd,aFamilyName,&aFamilyNum,
+                      &anAttId[0],&anAttVal[0],&anAttDesc[0],&aNbAttrib,
+                      &aGroupNames[0],&aNbGroup);
+      if(ret < 0) throw std::runtime_error("ImportInfo >> MEDfamInfo");
+      if(0 && MYDEBUG) 
+       MESSAGE("ImportInfo - aFamilyNum = "<<aFamilyNum<<"; aNbGroup = "<<aNbGroup);
+      if(aFamily2EntityMap.find(aFamilyNum) == aFamily2EntityMap.end()) continue;
+      VISU::TEntity anEntity = aFamily2EntityMap[aFamilyNum];
+      VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+      VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName];
+      aFamily.myName = aFamilyName;
+      aFamily.myEntity = anEntity;
+      aFamily.myId = aFamilyNum;
+      if(MYDEBUG) 
+       MESSAGE("ImportInfo - aFamily.myEntity = "<<anEntity<<
+               "; myName = '"<<aFamilyName<<"'; myId = "<<aFamilyNum);
+      VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+      for(int iGroup = 0, iPos = 0; iGroup < aNbGroup; iGroup++, iPos += MED_TAILLE_LNOM){
+       char aGroupName[MED_TAILLE_LNOM+1];
+       strncpy(aGroupName,&aGroupNames[iPos],MED_TAILLE_LNOM);
+       aGroupName[MED_TAILLE_LNOM] = '\0';
+       if(MYDEBUG) MESSAGE("ImportInfo - aGroupName["<<iGroup<<"] = '"<<aGroupName<<"'");
+       aBindGroups.insert(aGroupName);
+      }
+    }
+    //Calculation of TMesh.TGroupMap
+    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+    if(aMeshOnEntityMap.empty()) continue;
+    VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+      const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+      if(aFamilyMap.empty()) continue;
+      VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+      for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+       const VISU::TFamily& aFamily = aFamilyMapIter->second;
+       const VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+       if(aBindGroups.empty()) continue;
+       VISU::TBindGroups::const_iterator aBindGroupsIter = aBindGroups.begin();
+       for(; aBindGroupsIter != aBindGroups.end(); aBindGroupsIter++){
+         const string& aGroupName = *aBindGroupsIter;
+         VISU::TGroup& aGroup = aGroupMap[aGroupName];
+         aGroup.myName = aGroupName;
+         aGroup.myMeshName = aMesh.myName;
+         VISU::TFamilyAndEntity aFamilyAndEntity(aFamily.myName,aFamily.myEntity);
+         aGroup.myFamilyAndEntitySet.insert(aFamilyAndEntity);
+       }
+      }
+    }
+    //Displaing information for the TMesh.TGroupMap
+    VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+    if(MYDEBUG) MESSAGE("ImportInfo - aGroupMap.size() = "<<aGroupMap.size());
+    for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+      const string& aGroupName = aGroupMapIter->first;
+      if(MYDEBUG) MESSAGE("ImportInfo - aGroupName = '"<<aGroupName<<"' : ");
+      const VISU::TGroup& aGroup = aGroupMapIter->second;
+      const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+      VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
+      for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+       const string& aFamilyName = aFamilyAndEntitySetIter->first;
+       if(MYDEBUG) MESSAGE("ImportInfo - \t aFamilyName = '"<<aFamilyName<<"'");
+      }
+    }
+  }
+  //Reading information about fields
+  med_int iFieldEnd = MEDnChamp(fid,0);
+  if (iFieldEnd < 0) throw std::runtime_error("ImportChamps >> MEDnChamp(fid,0)");
+  if(MYDEBUG) MESSAGE("ImportInfo - iFieldEnd = "<<iFieldEnd);
+  for(med_int iField = 1; iField <= iFieldEnd; iField++){
+    med_int ncomp = MEDnChamp(fid,iField);
+    if(ncomp < 0) throw std::runtime_error("ImportChamps >> MEDnChamp(fid,i)");
+    valarray<char> comp('\0',ncomp*MED_TAILLE_PNOM + 1);
+    valarray<char> unit('\0',ncomp*MED_TAILLE_PNOM + 1);
+    char name_field[MED_TAILLE_NOM + 1] = "";
+    med_type_champ type_field;
+    if(MEDchampInfo(fid,iField,name_field,&type_field,&comp[0],&unit[0],ncomp) < 0)
+      throw std::runtime_error(string("ImportInfo >> MEDchampInfo(...)"));
+    //if(type_field != MED_REEL64) continue; //There is some problem in reading INTXX values
+    TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
+    for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++) {
+      VISU::TEntity anEntity = aVisu2MedEntityIter->first;
+      int iGeomElemEnd;
+      med_geometrie_element* aGeomElemVector;
+      GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+      med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
+      for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+       med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
+       med_int iTimeStampEnd = MEDnPasdetemps(fid,name_field,aMedEntity,aGeom);
+       if(iTimeStampEnd < 0) throw std::runtime_error("ImportInfo >> MEDnPasdetemps(...)");
+       if(iTimeStampEnd > 0) {
+         for(med_int iTimeStamp = 1; iTimeStamp <= iTimeStampEnd; iTimeStamp++) {
+           char aMeshName[MED_TAILLE_NOM+1] = "";
+           med_int ngauss = 0, numdt = 0, numo = 0;
+           char dt_unit[MED_TAILLE_PNOM+1] = "";
+           med_float dt = 0;
+           ret = MEDpasdetempsInfo(fid,name_field,aMedEntity,aGeom,iTimeStamp,
+                                   aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
+           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDpasdetempsInfo(...) < 0");
+           if(myMeshMap.find(aMeshName) == myMeshMap.end())
+             throw std::runtime_error("ImportInfo >> MEDpasdetempsInfo(...)");
+           VISU::TMesh &aMesh = myMeshMap[aMeshName];
+           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+           VISU::TFieldMap::iterator aFieldMapIter = aMeshOnEntity.myFieldMap.find(name_field);
+           //if(MYDEBUG && aFieldMapIter == aMeshOnEntity.myFieldMap.end()){
+           VISU::TField& aField = aMeshOnEntity.myFieldMap[name_field];
+           if(iTimeStamp == 1){
+             if(MYDEBUG){
+               MESSAGE("ImportInfo - aField.myName = '"<<name_field<<"'; myNbComp = "<<ncomp);
+               MESSAGE("ImportInfo -\t myMeshName = '"<<aMeshName<<"'; myEntity = "<<anEntity);
+             }
+             aField.myId = iField;
+             aField.myName = name_field;
+             aField.myEntity = anEntity;
+             aField.myMeshName = aMeshName;
+             aField.myNbComp = ncomp;
+           }
+           VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
+           aValForTime.myId = iTimeStamp;
+           aValForTime.myTime = VISU::TField::TTime(dt,dt_unit);
+           if(MYDEBUG && iGeomElem == 0) 
+             MESSAGE("ImportInfo -\t aField.myTime = "<<dt<<", "<<dt_unit);
+         }
+       }
+      }
+    }
+  }
+  return this; 
+}
+
+int VISU_MedConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                                       const string& theFamilyName)
+  throw (std::runtime_error&)
+{
+  //Open the med file (it will be closed by call of destructor)
+  MedFile aMedFile(myFileInfo.absFilePath());
+  med_idt fid = aMedFile.GetFid();
+  //Main part of code
+  const string& aMeshName = theMeshOnEntity.myMeshName;
+  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
+  VISU::TMesh& aMesh = myMeshMap[aMeshName];
+  int isPointsUpdated;
+  if(anEntity == VISU::NODE_ENTITY) 
+    isPointsUpdated = LoadPoints(fid,aMesh,theFamilyName);
+  else 
+    isPointsUpdated = LoadPoints(fid,aMesh);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(fid,theMeshOnEntity,theFamilyName);
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+int VISU_MedConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+     throw (std::runtime_error&)
+{
+  //Open the med file (it will be closed by call of destructor)
+  MedFile aMedFile(myFileInfo.absFilePath());
+  med_idt fid = aMedFile.GetFid();
+  //Main part of code
+  int isPointsUpdated = 0;
+  int isCellsOnEntityUpdated = 0;
+  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
+  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+    const string& aFamilyName = aFamilyAndEntitySetIter->first;
+    const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
+    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
+    if(anEntity == VISU::NODE_ENTITY){
+      isPointsUpdated += LoadPoints(fid,theMesh,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(fid,aMeshOnEntity);
+    }else{
+      isPointsUpdated += LoadPoints(fid,theMesh);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(fid,aMeshOnEntity,aFamilyName);
+    }
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+int VISU_MedConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                                      VISU::TMeshOnEntity& theMeshOnEntity, 
+                                      VISU::TField& theField, 
+                                      VISU::TField::TValForTime& theValForTime)
+  throw (std::runtime_error&)
+{
+  //Open the med file (it will be closed by call of destructor)
+  MedFile aMedFile(myFileInfo.absFilePath());
+  med_idt fid = aMedFile.GetFid();
+  //Main part of code
+  int isPointsUpdated = LoadPoints(fid,theMesh);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(fid,theMeshOnEntity);
+  int isFieldUpdated = LoadField(fid,theMeshOnEntity,theField,theValForTime);
+  
+  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
+}
+
+int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, const string& theFamilyName) 
+  throw (std::runtime_error&)
+{
+  //Check on existing family
+  VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
+  aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
+  aMeshOnEntity.myMeshName = theMesh.myName;
+  VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
+  bool isFamilyPresent = (pFamily != NULL);
+  VISU::TFamily& aFamily = *pFamily;
+  //Check on loading already done
+  bool isPointsLoaded = !theMesh.myPointsCoord.empty();
+  if(isPointsLoaded) 
+    if(!isFamilyPresent) return 0;
+    else if(!aFamily.mySubMesh.empty()) return 0;
+  if(MYDEBUG) 
+    MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
+  //Main part of code
+  char aMeshName[MED_TAILLE_NOM+1] = "";
+  strcpy(aMeshName,theMesh.myName.c_str());
+  med_geometrie_element typgeo = (med_geometrie_element)0; //MED_POINT1
+  med_connectivite typco = (med_connectivite)0; //MED_NOD
+  med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
+  if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> MEDnEntMaa(...)");
+  if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
+  med_repere rep;
+  med_booleen iname_elem, inum_elem;
+  valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
+  valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
+  valarray<char> name_coord('\0',theMesh.myDim*MED_TAILLE_PNOM+1);
+  valarray<char> unit_coord('\0',theMesh.myDim*MED_TAILLE_PNOM+1);
+  valarray<med_float> coord(theMesh.myDim*iNumElemEnd);
+  ret = MEDnoeudsLire(fid,aMeshName,theMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
+                     &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
+                     &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
+  if(ret < 0) throw std::runtime_error("LoadPoints >> MEDnoeudsLire(...)");
+  if(!isPointsLoaded){
+    VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
+    aPointsCoord.resize(iNumElemEnd*theMesh.myDim);
+    if(MYDEBUG) MESSAGE("LoadPoints - Filling coordinates of the mesh - inum_elem = "<<inum_elem);
+    inum_elem = MED_FAUX; // It is workaround
+    if(inum_elem == MED_FAUX)
+      for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+       for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
+         aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
+    else
+      for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+       for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
+         aPointsCoord[num_elem[iNumElem2Dim]] = coord[iNumElem2Dim];
+    if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+    VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
+    aConnForCellType.resize(iNumElemEnd);
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+      aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
+  }
+  if(isFamilyPresent && iNumElemEnd > 0){
+    if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
+    VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
+    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+      if(num_fam_elem[iNumElem] == aFamily.myId)
+       aSubMeshOnCellType.insert(iNumElem);
+  }
+  return 1;
+}
+
+int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity& theMeshOnEntity,
+                                        const string& theFamilyName)
+  throw (std::runtime_error&)
+{
+  //Check on existing family
+  VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
+  bool isFamilyPresent = (pFamily != NULL);
+  VISU::TFamily& aFamily = *pFamily;
+  //Check on loading already done
+  bool isCellsLoaded = !theMeshOnEntity.myCellsConn.empty();
+  if(isCellsLoaded) 
+    if(!isFamilyPresent) return 0;
+    else if(!aFamily.mySubMesh.empty()) return 0;
+  if(MYDEBUG) {
+    MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
+    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
+  }
+  //Main part of code
+  int iGeomElemEnd;
+  med_geometrie_element* aGeomElemVector;
+  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
+  GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+  const med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
+  char aMeshName[MED_TAILLE_NOM+1] = "";
+  strcpy(aMeshName,theMeshOnEntity.myMeshName.c_str());
+  if(MYDEBUG) 
+    MESSAGE("LoadCellsOnEntity - theMeshOnEntity.myEntity = "<<theMeshOnEntity.myEntity<<
+           "; iGeomElemEnd = "<<iGeomElemEnd<<"; theFamilyName = '"<<theFamilyName<<"'");
+  VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
+  int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+  for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+    int medId = getIdMedType(aGeomElemVector[iGeomElem]);
+    int nbMedNodes = med2vtk[medId].medNbNodes;
+    int nbVtkNodes = med2vtk[medId].vtkNbNodes;
+    int aVtkType = med2vtk[medId].vtkType;
+    med_geometrie_element aMedType = med2vtk[medId].medType;
+    med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD);
+    if (iNumElemEnd > 0) {
+      med_booleen iname_elem, inum_elem;
+      valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
+      valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
+      med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
+      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<med2vtk[medId].medName<<
+                         "; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
+      valarray<med_int> conn(aNbConnForElem*iNumElemEnd);
+      ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
+                           &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
+                           &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
+      if (ret < 0) throw std::runtime_error("LoadCellsOnEntity >> MEDelementsLire(...)");
+      if(!isCellsLoaded){
+       VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
+       aConnForCellType.resize(iNumElemEnd);
+       valarray<med_int> aConnect(nbMedNodes);
+       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+         VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
+         anArray.resize(nbVtkNodes);
+         for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
+           aConnect[k] = conn[kj+k] - 1;
+         }
+         switch(aMedType){
+         case MED_TETRA4 :
+         case MED_TETRA10 :
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[1];
+           anArray[2] = aConnect[3];  
+           anArray[3] = aConnect[2];  
+           break;
+         case MED_PYRA5 :
+         case MED_PYRA13 :
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[3];  
+           anArray[2] = aConnect[2];
+           anArray[3] = aConnect[1];  
+           anArray[4] = aConnect[4];
+           break;
+         default:
+           for (int k = 0; k < nbVtkNodes; k++) 
+             anArray[k] = aConnect[k];
+         }
+         for (int k = 0; k < nbVtkNodes; k++) 
+           if(anArray[k] < 0 || aNbPoints <= anArray[k]){
+             static QString aString;
+             aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d](%d) < 0",aNbPoints,iNumElem,k,anArray[k]);
+             throw std::runtime_error(aString.latin1());
+           }
+       }
+      }
+      //Filling aFamily SubMesh
+      if(isFamilyPresent){
+       VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVtkType];
+       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+         if(num_fam_elem[iNumElem] == aFamily.myId)
+           aSubMeshOnCellType.insert(iNumElem);
+      }
+    }
+  }
+  return 1;
+}
+
+int VISU_MedConvertor::LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
+                                const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+     throw (std::runtime_error&)
+{
+  //Check on loading already done
+  if(!theValForTime.myValForCells.empty()) return 0;
+  //Main part of code
+  med_int ncomp = MEDnChamp(fid,theField.myId);
+  if(ncomp < 0) throw std::runtime_error("LoadField >> MEDnChamp(fid,i)");
+  valarray<char> comp('\0',ncomp*MED_TAILLE_PNOM + 1);
+  valarray<char> unit('\0',ncomp*MED_TAILLE_PNOM + 1);
+  char aFieldName[MED_TAILLE_NOM + 1] = "";
+  med_type_champ type_field;
+  if(MEDchampInfo(fid,theField.myId,aFieldName,&type_field,&comp[0],&unit[0],ncomp) < 0)
+    throw std::runtime_error(string("LoadField >> MEDchampInfo(...)"));
+  int iGeomElemEnd;
+  med_geometrie_element* aGeomElemVector;
+  const VISU::TEntity& anEntity = theField.myEntity;
+  GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
+  med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
+  if(MYDEBUG) {
+    MESSAGE("LoadField - aFieldName = '"<<aFieldName<<"'; anEntity = "<<anEntity<<"; iGeomElemEnd = "<<iGeomElemEnd);
+    MESSAGE("LoadField - ncomp = "<<ncomp<<"; type_field = "<<type_field<<"; myId = "<<theValForTime.myId);
+  }
+  for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
+    med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
+    med_int iTimeStampEnd = MEDnPasdetemps(fid,aFieldName,aMedEntity,aGeom);
+    if(iTimeStampEnd > 0) {
+      char aMeshName[MED_TAILLE_NOM+1] = "";
+      med_int ngauss = 0, numdt = 0, numo = 0;
+      char dt_unit[MED_TAILLE_PNOM+1] = "";
+      med_float dt = 0;
+      ret = MEDpasdetempsInfo(fid,aFieldName,aMedEntity,aGeom,theValForTime.myId,
+                             aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
+      if(ret < 0) throw std::runtime_error("LoadField >> MEDpasdetempsInfo(...)");
+      med_int nval = MEDnVal(fid,aFieldName,aMedEntity,aGeom,numdt,numo);
+      if (nval <= 0) throw std::runtime_error("LoadField >> MEDnVal(...) - nval <= 0");
+      else{
+       //Checking for accordance between the mesh and the field on number of geomterical elements 
+       int aVtkType = med2vtkCellType(aGeom);
+       const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
+       VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
+       if(aCellsConnIter == aCellsConn.end()) throw std::runtime_error("LoadField - There is no the geom. elem. on the mesh !!!");
+       const VISU::TMeshOnEntity::TConnForCellType aConnForCellType = aCellsConnIter->second;
+       if(aConnForCellType.size() != nval) throw std::runtime_error("LoadField - Size of values and size of mesh not equal !!!");
+       if(MYDEBUG) MESSAGE("LoadField - aGeom = "<<aGeom<<"; nval = "<<nval<<"; iTimeStampEnd = "<<iTimeStampEnd);
+       VISU::TField::TValForCellsWithType &anArray = theValForTime.myValForCells[aVtkType];
+       int jEnd = theField.myNbComp*nval;
+       anArray.resize(jEnd);
+       char pflname[MED_TAILLE_NOM + 1] = "";
+       switch(type_field){
+       case MED_REEL64 : {
+         valarray<med_float> valr(jEnd);
+         ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
+                            pflname,aMedEntity,aGeom,numdt,numo);
+         for (med_int j = 0; j < jEnd; j++) anArray[j] = valr[j];
+         break;
+       }
+       //case MED_INT64 : //valarray<long long> valr(jEnd);
+       case MED_INT32 : //valarray<long int> valr(jEnd);
+       case MED_INT : {
+         valarray<med_int> valr(jEnd);
+         ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
+                            pflname,aMedEntity,aGeom,numdt,numo);
+         for (med_int j = 0; j < jEnd; j++) anArray[j] = valr[j];
+         break;
+       }
+         default :
+           throw std::runtime_error("LoadField >> Value of med_type_champ for the field is wrong !!!");
+       }
+       if(ret < 0) throw std::runtime_error("ChampLire >> MEDchampLire(...)");
+      }
+    }
+  }
+  return 1; 
+}
diff --git a/src/VISU_I/VISU_MedConvertor.hxx b/src/VISU_I/VISU_MedConvertor.hxx
new file mode 100644 (file)
index 0000000..94ddd8f
--- /dev/null
@@ -0,0 +1,48 @@
+// File:       VISU_MedConvertor.hxx
+// Created:    Fri Jan 10 12:02:49 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_MedConvertor_HeaderFile
+#define VISU_MedConvertor_HeaderFile
+
+#include "VISU_Convertor_impl.hxx"
+
+extern "C"{
+#include <med.h>
+}  
+
+class VISU_MedConvertor: public VISU_Convertor_impl{
+  VISU_MedConvertor();
+  VISU_MedConvertor(const VISU_MedConvertor&);
+public:
+  VISU_MedConvertor(const string& theFileName) throw (std::runtime_error&);
+  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+protected:
+  QFileInfo myFileInfo;
+
+  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+                              const string& theFamilyName = "")
+    throw (std::runtime_error&);
+  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+    throw (std::runtime_error&);
+  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
+                             VISU::TMeshOnEntity& theMeshOnEntity, 
+                             VISU::TField& theField, 
+                             VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&);
+
+  int LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, 
+                const string& theFamilyName = "") 
+    throw (std::runtime_error&);
+  int LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity& theMeshOnEntity,
+                       const string& theFamilyName = "")
+    throw (std::runtime_error&);
+  int LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
+               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&);
+};
+
+#endif
diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc
new file mode 100644 (file)
index 0000000..5faaa07
--- /dev/null
@@ -0,0 +1,1684 @@
+using namespace std;
+// File:       VISU_PrsObject_i.cxx
+// Created:    Fri Jan 17 09:27:59 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_PrsObject_i.hh"
+#include "VISU_Extractor.hxx"
+#include "VISU_FieldTransform.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_Actor.h"
+using namespace VISU;
+
+//#include "QAD_Study.h"
+#include "QAD_Config.h"
+
+#include <vtkUnstructuredGridReader.h>
+#include <vtkUnstructuredGridWriter.h>
+
+#include <vtkDataSet.h>
+#include <vtkDataSetMapper.h>
+#include <vtkProperty.h>
+
+#include <vtkWarpVector.h>
+#include <vtkContourFilter.h>
+#include <vtkAppendPolyData.h>
+#include <vtkCutter.h>
+#include <vtkPlane.h>
+#include <vtkCellDataToPointData.h>
+
+#include <vtkGlyph3D.h>
+#include <vtkHedgeHog.h>
+#include <vtkPolyDataSource.h>
+#include <vtkGlyphSource2D.h>
+#include <vtkTransformPolyDataFilter.h>
+#include <vtkCellCenters.h>
+#include <vtkConeSource.h>
+#include <vtkStreamLine.h>
+#include <vtkTriangleFilter.h>
+#include <vtkGeometryFilter.h>
+#include <vtkFeatureEdges.h>
+
+
+//#define CHECKTIME
+#ifdef CHECKTIME
+#include <OSD_Timer.hxx>
+#endif
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+static float EPS = 1.0E-3;
+const float PI2 = 2.0*PI;
+
+//==============================================================================
+void SetIOR(SALOMEDS::SObject_var& theSObject, const char* theIOR){
+  SALOMEDS::GenericAttribute_var anAttr;
+  theSObject->FindAttribute(anAttr, "AttributeIOR");
+  SALOMEDS::AttributeIOR_var anIOR  = SALOMEDS::AttributeIOR::_narrow(anAttr);
+  CORBA::String_var aValue(theIOR);
+  anIOR->SetValue(aValue);
+}
+
+float CalcScaleFactor(float theBound[6], int theNbElem){
+  float aVolume = 1, vol, idim = 0;
+  for(int i = 0; i < 6; i += 2){
+    vol = fabs(theBound[i+1] - theBound[i]);
+    if(vol > 0) {
+      idim++; 
+      aVolume *= vol;
+    }
+  }
+  aVolume /= theNbElem;
+  float aFactor = pow(aVolume,(float)1./idim);
+  return aFactor;
+}
+
+VISU::Result_i* GetResult(SALOMEDS::SObject_ptr theSObject){
+  VISU::Result_var aResult = FindResult(theSObject);
+  if(!aResult->_is_nil())
+    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));
+  return NULL;
+}
+
+
+//==============================================================================
+QString VISU::PrsObject_i::GetEntry() { 
+  CORBA::String_var anIOR = GetID();
+  SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR);
+  CORBA::String_var anEntry = aSObject->GetID();
+  return anEntry.in();
+}
+
+
+//----------------------------------------------------------------
+//                      Prs3d Object
+//----------------------------------------------------------------
+VISU::Prs3d_i::Prs3d_i(Result_i* theResult) : 
+       PrsObject_i(theResult->GetStudyDocument()), 
+       myResult(theResult) 
+{
+  myMapper = MapperType::New();
+  myColor.R = myColorRGB[0] = 0.5;
+  myColor.G = myColorRGB[1] = 0.5;
+  myColor.B = myColorRGB[2] = 0.5;
+  myAddToStudy = true;
+}
+
+void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
+{
+  SetColor(theOrigin->GetColor());
+  myMapper = MapperType::New();
+  myMapper->ShallowCopy(theOrigin->GetMapper());
+}
+
+VISU::Prs3d_i::~Prs3d_i() {
+  myMapper->Delete();
+}
+
+
+/**
+ * Create Actor referred on existing IO
+ */
+VISU_Actor* VISU::Prs3d_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO){
+  Update();
+  float bounds[6];
+  static float eps = VTK_LARGE_FLOAT * 0.1 ;
+  myMapper->GetBounds(bounds);
+  for (int i = 0; i < 6; ++i) {
+    if (fabs (bounds[i] - myBounds[i]) > eps ) { 
+      MESSAGE("Prs3d_i::CreateActor >> Boundaries of actor do not coincide with boundaries of initial shape !!!");
+      return NULL;
+    }
+  }
+  VISU_Actor* aActor = VISU_Actor::New();
+  if(myMapper->GetInput()->GetNumberOfCells() < 10)
+    aActor->IsShrinkable = false;  //Bug SAL2011 Crash on shrink view 
+  else
+    aActor->IsShrinkable = true;
+  aActor->SetMapper(myMapper);
+  if (myAddToStudy) {
+    if (theIO.IsNull()){
+      //Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry(),"VISU",GetName()); 
+      //There is a bug in gcc compiler - const Standard_CString is mapping as char * const not as const char *
+      //(where Standard_CString is defined as typedef char* Standard_CString)
+      Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",
+                                                                          (const Standard_CString)GetName());
+      aActor->setIO(anIO); 
+    }else
+      aActor->setIO(theIO); 
+  }
+  aActor->DataSource = myMapper->GetInput();
+  aActor->Presentation = this;
+  vtkProperty* aProperty = aActor->GetProperty();
+  aProperty->SetColor(myColorRGB);
+  return aActor;
+}
+
+VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  if(MYDEBUG) MESSAGE(GetComment());
+  myName = VISU::Storable::FindValue(theMap,"myName");
+  myColorRGB[0] = myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
+  myColorRGB[1] = myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
+  myColorRGB[2] = myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
+  return this;
+}
+
+void VISU::Prs3d_i::ToStream(ostrstream& theStr){
+  Storable::DataToStream( theStr, "myName",   myName.c_str() );
+  Storable::DataToStream( theStr, "myColor.R",   myColor.R );
+  Storable::DataToStream( theStr, "myColor.G",   myColor.G );
+  Storable::DataToStream( theStr, "myColor.B",   myColor.B );
+}
+
+void VISU::Prs3d_i::Update()
+{ 
+  myMapper->Update(); 
+}
+
+
+//----------------------------------------------------------------
+//                      Mesh Object
+//----------------------------------------------------------------
+int VISU::Mesh_i::myNbPresent = 0;
+
+QString VISU::Mesh_i::GenerateName() { return VISU::GenerateName("Mesh",myNbPresent++);}
+
+const string VISU::Mesh_i::myComment = "MESH";
+
+const char* VISU::Mesh_i::GetComment() const { return myComment.c_str();}
+
+
+VISU::Mesh_i::Mesh_i(Result_i* theResult) : 
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult) 
+{
+  myInput = NULL;
+  SALOMEDS::Color aColor = {0,1,1};
+  SetCellColor(aColor);
+  SetNodeColor(aColor);
+  SALOMEDS::Color aLinkColor = {83/255.,83/255.,83/255.};
+  SetLinkColor(aLinkColor);
+}
+
+void VISU::Mesh_i::SameAs(const Mesh_i* theOrigin)
+{
+  VISU::Prs3d_i::SameAs(theOrigin);
+  Mesh_i* aMesh = (Mesh_i*) theOrigin;
+  SetCellColor(aMesh->GetCellColor());
+  SetNodeColor(aMesh->GetNodeColor());
+  SetLinkColor(aMesh->GetLinkColor());
+  SetPresentationType(aMesh->GetPresentationType());
+  //myName = string("Copy of ") + theOrigin->GetName();
+  Build(false);
+}
+
+VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, int theEntity){
+  myMeshName = theMeshName;
+  myEntity = theEntity;
+  mySubMeshName = "";
+  return Build(false);
+}
+
+VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, int theEntity, const char* theFamilyName){
+  myMeshName = theMeshName;
+  myEntity = theEntity;
+  mySubMeshName = theFamilyName;
+  return Build(false);
+}
+VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGroupName){
+  myMeshName = theMeshName;
+  myEntity = -1;
+  mySubMeshName = theGroupName;
+  return Build(false);
+}
+
+VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  Prs3d_i::Restore(theMap,false);
+
+  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
+  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();
+  mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
+
+  myCellColor.R = VISU::Storable::FindValue(theMap,"myCellColor.R").toDouble();
+  myCellColor.G = VISU::Storable::FindValue(theMap,"myCellColor.G").toDouble();
+  myCellColor.B = VISU::Storable::FindValue(theMap,"myCellColor.B").toDouble();
+
+  myNodeColor.R = VISU::Storable::FindValue(theMap,"myNodeColor.R").toDouble();
+  myNodeColor.G = VISU::Storable::FindValue(theMap,"myNodeColor.G").toDouble();
+  myNodeColor.B = VISU::Storable::FindValue(theMap,"myNodeColor.B").toDouble();
+
+  myLinkColor.R = VISU::Storable::FindValue(theMap,"myLinkColor.R").toDouble();
+  myLinkColor.G = VISU::Storable::FindValue(theMap,"myLinkColor.G").toDouble();
+  myLinkColor.B = VISU::Storable::FindValue(theMap,"myLinkColor.B").toDouble();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::Mesh_i::ToStream(ostrstream& theStr){
+  Prs3d_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() );
+  Storable::DataToStream( theStr, "myEntity", myEntity );
+  Storable::DataToStream( theStr, "mySubMeshName", mySubMeshName.c_str() );
+
+  Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R );
+  Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G );
+  Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B );
+
+  Storable::DataToStream( theStr, "myNodeColor.R", myNodeColor.R );
+  Storable::DataToStream( theStr, "myNodeColor.G", myNodeColor.G );
+  Storable::DataToStream( theStr, "myNodeColor.B", myNodeColor.B );
+
+  Storable::DataToStream( theStr, "myLinkColor.R", myLinkColor.R );
+  Storable::DataToStream( theStr, "myLinkColor.G", myLinkColor.G );
+  Storable::DataToStream( theStr, "myLinkColor.B", myLinkColor.B );
+}
+
+VISU::Storable* VISU::MeshRestore(SALOMEDS::SObject_ptr theSObject, 
+                                 const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::Mesh_i* pResent = new VISU::Mesh_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::Mesh_i::~Mesh_i(){
+  if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
+}
+
+
+VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
+  try{
+#ifdef CHECKTIME
+    OSD_Timer timer;
+    timer.Start();
+#endif
+    if(myResult->GetInput() == NULL) 
+      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
+    if(!theRestoring) myName = GenerateName();
+    if(myEntity >= 0) 
+      if(mySubMeshName == "") 
+       myType = VISU::TENTITY; 
+      else 
+       myType = VISU::TFAMILY;
+    else 
+      myType = VISU::TGROUP;
+    if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
+    //Building Input and comment for searching according label
+    QString aComment;
+    switch(myType){
+    case VISU::TENTITY : 
+      myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity); 
+      aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
+                      VISU::TENTITY,myMeshName.c_str(),myEntity);
+      break;
+    case VISU::TFAMILY : 
+      myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName);
+      aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                      VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str());
+      break;
+    case VISU::TGROUP : 
+      myInput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
+      aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+                      VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str());
+      break;
+    }
+    if(myInput == NULL) throw std::runtime_error("Mesh_i::Build - myInput == NULL !!!");
+    //Binding pipeline
+    vtkUnstructuredGrid *aDataSet = myInput->GetOutput();
+    //Avoid selection points that don't belong any of cells
+    vtkGeometryFilter *aGeomFilter = vtkGeometryFilter::New();
+    aGeomFilter->SetInput(aDataSet);
+    vtkTriangleFilter *aTriangleFilter = vtkTriangleFilter::New();
+    aTriangleFilter->SetInput(aGeomFilter->GetOutput());
+    myMapper->SetInput(aTriangleFilter->GetOutput());
+    //  myMapper->SetInput(aDataSet);
+    myMapper->ScalarVisibilityOff();
+    //Setting IOR on the label
+    if(!theRestoring) {
+      string aResultEntry = myResult->GetEntry();
+      string anEntry = FindEntryWithComment(myStudy,aResultEntry.c_str(),aComment.latin1());
+      if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
+      SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(anEntry.c_str());
+      SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObj,"AttributeIOR");
+      SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+      CORBA::String_var aString = GetID();
+      anIOR->SetValue(aString); 
+    }
+#ifdef CHECKTIME
+    timer.Stop();
+    timer.Show();
+#endif
+    aDataSet->GetBounds(myBounds);
+    return this;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return NULL;
+}
+
+
+VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::Prs3d_i::CreateActor(theIO);
+  if ( !aActor ) return NULL;
+  aActor->VisuActorType = VisuActorType_Mesh;
+  
+  vtkProperty* aProperty = aActor->GetProperty();
+  //aProperty->SetRepresentation(TypeRepresentation);
+  aProperty->BackfaceCullingOff();
+  aProperty->EdgeVisibilityOn();
+
+  vtkGeometryFilter *gf = vtkGeometryFilter::New();
+  gf->SetInput(aActor->DataSource);
+  vtkFeatureEdges *edges = vtkFeatureEdges::New();
+  edges->SetInput(gf->GetOutput());
+  edges->BoundaryEdgesOn();
+  edges->ManifoldEdgesOn();
+
+  vtkPolyDataMapper *edgeMapper = vtkPolyDataMapper::New();
+  edgeMapper->SetInput(edges->GetOutput());
+  edgeMapper->ScalarVisibilityOff();
+  
+  aActor->GetMapper()->SetResolveCoincidentTopologyToShiftZBuffer();
+  aActor->GetMapper()->SetResolveCoincidentTopologyZShift(0.02);
+
+  aActor->EdgeDevice = VISU_Actor::New();
+  aActor->EdgeDevice->PickableOff();
+
+  aActor->EdgeDevice->SetMapper(edgeMapper);
+  edgeMapper->Update();
+
+  aActor->EdgeDevice->GetProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B);
+
+  aActor->EdgeDevice->VisibilityOn();
+  
+  return aActor;
+}
+
+
+//==============================================================================
+int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                 const char* theFieldName, double theIteration){
+  try{
+    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    const VISU::TField::TValField& aValField = aField.myValField;
+    return aValField.find((int)theIteration) != aValField.end();
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return 0;
+}
+
+int VISU::ScalarMap_i::myNbPresent = 0;
+QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap",myNbPresent++);}
+
+const string VISU::ScalarMap_i::myComment = "SCALARMAP";
+const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
+
+VISU::ScalarMap_i::ScalarMap_i(Result_i* theResult, bool theAddToStudy) : 
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult) 
+{
+  myAddToStudy = theAddToStudy;
+  myInput = VISU_Extractor::New();
+  myFieldTransform = VISU_FieldTransform::New();
+}
+
+void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin)
+{
+  ScalarMap_i* aScalarMap = (ScalarMap_i*) theOrigin;
+  VISU::Prs3d_i::SameAs(aScalarMap);
+  myField = aScalarMap->GetField();
+  myMeshName = myField->myMeshName;
+  myEntity = myField->myEntity;
+  myIteration = aScalarMap->GetIteration();
+  myFieldName = aScalarMap->GetFieldName();
+
+  SetScalarMode(aScalarMap->GetScalarMode());
+  Build(false);
+  SetScaling(aScalarMap->GetScaling());
+  SetOrientation(aScalarMap->GetOrientation());
+  SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY());
+  SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight());
+  SetNbColors(aScalarMap->GetNbColors());
+  SetLabels(aScalarMap->GetLabels());
+  SetTitle(aScalarMap->GetTitle());
+  //if (aScalarMap->isRangeFixed())
+  SetRange(aScalarMap->GetMin(), aScalarMap->GetMax());
+    //else
+    //CalculateRange();
+  //myScalarMode = aScalarMap->GetScalarMode();
+  //myName = string("Copy of ") + theOrigin->GetName();
+}
+
+
+/**
+ * Creates Scalar Map and initialises it from resources
+ */
+VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                         const char* theFieldName, CORBA::Double theIteration){
+  myIsFixedRange = false;
+
+  // Orientation
+  QString aOrient = QAD_CONFIG->getSetting("Visu:SBOrientation");
+  if ( !aOrient.isEmpty() ) 
+    myOrientation = (VISU::ScalarMap::Orientation) aOrient.toInt();
+  else
+    myOrientation = VISU::ScalarMap::VERTICAL;
+
+  // Scalar Bar origin
+  QString aXorigin = QAD_CONFIG->getSetting("Visu:SBXorigin");
+  if ( !aXorigin.isEmpty() )
+    myPosition[0] = aXorigin.toFloat();
+  else {
+    if(myOrientation == VISU::ScalarMap::VERTICAL) {
+      myPosition[0] = 0.03;
+    } else {
+      myPosition[0] = 0.2;
+    }
+  }
+  
+  QString aYorigin = QAD_CONFIG->getSetting("Visu:SBYorigin");
+  if ( !aYorigin.isEmpty() )
+    myPosition[1] = aYorigin.toFloat();
+  else {
+    if(myOrientation == VISU::ScalarMap::VERTICAL) {
+      myPosition[1] = 0.1;
+    } else {
+      myPosition[1] = 0.012;
+    }
+  }
+
+  // Scalar Bar size
+  QString aWidth = QAD_CONFIG->getSetting("Visu:SBWidth");
+  if ( !aWidth.isEmpty() )
+    myWidth = aWidth.toFloat();
+  else {
+    myWidth =(myOrientation == VISU::ScalarMap::VERTICAL)? 0.17:0.6;
+  }
+  QString aHeight = QAD_CONFIG->getSetting("Visu:SBHeight");
+  if ( !aHeight.isEmpty() )
+    myHeight = aHeight.toFloat();
+  else {
+    myHeight =(myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
+  }
+
+  // Nb of Colors
+  QString aColors = QAD_CONFIG->getSetting("Visu:SBNumberOfColors");
+  myNumberOfColors = (aColors.isEmpty())? 64 : aColors.toInt();
+  if (myNumberOfColors > 64) 
+    myNumberOfColors = 64;
+
+  // Nb of Labels
+  QString aLabels = QAD_CONFIG->getSetting("Visu:SBNumberOfLabels");
+  myNumberOfLabels = (aLabels.isEmpty())? 5 : aLabels.toInt();
+  if (myNumberOfLabels > 65) 
+    myNumberOfLabels = 65;
+  
+  // Scalar Range
+  QString aFixRange = QAD_CONFIG->getSetting("Visu:SBImposeRange");
+  myIsFixedRange = (aFixRange.compare("true") == 0);
+  
+  QString aRangeMin = QAD_CONFIG->getSetting("Visu:SBMinimumValue");
+  myScalarRange[0] = (aRangeMin.isEmpty())? 0 : aRangeMin.toFloat();
+  
+  QString aRangeMax = QAD_CONFIG->getSetting("Visu:SBMaximumValue");
+  myScalarRange[1] = (aRangeMax.isEmpty())? 0 : aRangeMax.toFloat();
+
+  QString aScaling = QAD_CONFIG->getSetting("Visu:SBScaling");
+  if(aScaling.compare("LOGARITHMIC") == 0) 
+    myScaling = VISU::LOGARITHMIC;
+  else 
+    myScaling = VISU::LINEAR;
+
+//    myName = GenerateName();
+  myMeshName = theMeshName;
+  myEntity = theEntity;
+  myFieldName =theFieldName;
+  myScalarMode = 0;
+  myIteration = theIteration;
+  return Build(false);
+}
+
+
+
+VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  Prs3d_i::Restore(theMap,false);
+
+  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName");
+  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();
+  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName");
+  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
+
+  myScalarMode = VISU::Storable::FindValue(theMap,"myScalarMode").toInt();
+  myScalarRange[0] = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
+  myScalarRange[1] = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
+  myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt();
+  myScaling = (VISU::Scaling)VISU::Storable::FindValue(theMap,"myScaling").toInt();
+
+  myTitle = VISU::Storable::FindValue(theMap,"myTitle");
+  myOrientation = (VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt();
+  myNumberOfColors = VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt();
+  myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
+  myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
+  myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
+  myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
+  myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::ScalarMap_i::ToStream(ostrstream& theStr){
+  Prs3d_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myMeshName",       myMeshName.c_str() );
+  Storable::DataToStream( theStr, "myEntity",         myEntity );
+  Storable::DataToStream( theStr, "myFieldName",      myFieldName.c_str() );
+  Storable::DataToStream( theStr, "myIteration",      myIteration );
+
+  Storable::DataToStream( theStr, "myScalarMode",     myScalarMode );
+  Storable::DataToStream( theStr, "myScalarRange[0]", myScalarRange[0] );
+  Storable::DataToStream( theStr, "myScalarRange[1]", myScalarRange[1] );
+  Storable::DataToStream( theStr, "myIsFixedRange",   myIsFixedRange );
+  Storable::DataToStream( theStr, "myScaling",        myScaling );
+
+  Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
+  Storable::DataToStream( theStr, "myOrientation",    myOrientation );
+  Storable::DataToStream( theStr, "myNumberOfColors", myNumberOfColors );
+  Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+  Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
+  Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
+  Storable::DataToStream( theStr, "myWidth",          myWidth );
+  Storable::DataToStream( theStr, "myHeight",         myHeight );
+}
+
+void VISU::ScalarMap_i::SetScaling(VISU::Scaling theScaling){
+  VISU_FieldTransform::TTransformFun aFun;
+  if(MYDEBUG)  MESSAGE("ScalarMap_i::SetScaling - theScaling = "<<theScaling);
+  switch(theScaling){
+  case VISU::LOGARITHMIC : 
+    aFun = &Logarithmic10;  
+    break;
+  default:  
+    aFun = &Identical;
+  }
+  myScaling = theScaling;
+  myFieldTransform->SetTransformFunction(aFun);
+  if(MYDEBUGWITHFILES)
+    WriteToFile(myFieldTransform->GetUnstructuredGridOutput(),(string("/tmp/")+getenv("USER")+"-PrsScaling").c_str());
+}
+
+VISU::Scaling VISU::ScalarMap_i::GetScaling(){
+  return myScaling;
+}
+
+
+void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax) { 
+  myScalarRange[0] = theMin; 
+  myScalarRange[1] = theMax; 
+  myIsFixedRange = true;
+  if(MYDEBUG) 
+    MESSAGE("ScalarMap_i::SetRange - myScalarRange[0] = "<<myScalarRange[0]<<
+           "; myScalarRange[1] = "<<myScalarRange[1]);
+}
+   
+void VISU::ScalarMap_i::CalculateRange() {
+  //myIsFixedRange = false;
+  myInput->GetUnstructuredGridOutput()->GetScalarRange(myScalarRange);
+  if(MYDEBUG) 
+    MESSAGE("ScalarMap_i::CalculateRange - myScalarRange[0] = "<<myScalarRange[0]<<
+           "; myScalarRange[1] = "<<myScalarRange[1]);
+}
+
+void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode){
+  myScalarMode = theScalarMode;
+  vtkUnstructuredGridReader* aReader = 
+    myResult->GetInput()->GetFieldOnMesh(myMeshName,(VISU::TEntity)myEntity,myFieldName,myIteration);
+  if(aReader != NULL) {
+    string aFieldName = VISU_Convertor::GenerateName(myFieldName,(int)myIteration);
+    myInput->Extract(aReader,aFieldName,myScalarMode,myField->myNbComp,myField->myEntity);
+  }
+}
+
+VISU::Storable* VISU::ScalarMapRestore(SALOMEDS::SObject_ptr theSObject, 
+                                      const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::ScalarMap_i* pResent = new VISU::ScalarMap_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::ScalarMap_i::~ScalarMap_i(){
+  if(MYDEBUG) MESSAGE("ScalarMap_i::~ScalarMap_i()");
+  myInput->Delete();
+  myFieldTransform->Delete();
+}
+
+
+void VISU::ScalarMap_i::Update() {
+  VISU::Prs3d_i::Update();
+  if (!myIsFixedRange) CalculateRange();
+}
+
+
+VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
+  if(MYDEBUG) 
+    MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
+  try{
+#ifdef CHECKTIME
+    OSD_Timer timer;
+    timer.Start();
+#endif
+    if(myResult->GetInput() == NULL) 
+      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
+    myField = &(myResult->GetInput()->GetField(myMeshName,(VISU::TEntity)myEntity,myFieldName));
+    if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
+    SetScalarMode(myScalarMode);
+    if(myInput->GetInput() == NULL) throw std::runtime_error("Can't build build vtk representation !!!");
+    vtkUnstructuredGrid *aDataSet = myInput->GetUnstructuredGridOutput();
+    myFieldTransform->SetInput(aDataSet);
+    SetScaling(myScaling);
+    aDataSet->GetBounds(myBounds);
+    if(!theRestoring){
+      if (!myIsFixedRange) aDataSet->GetScalarRange(myScalarRange);
+      myName = "NoName";
+      CORBA::String_var anIOR = GetID();
+      const VISU::TField::TValField& aValField = myField->myValField;
+      const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
+      const VISU::TField::TTime& aTime = aValForTime.myTime;
+      QString aComment;
+      aComment.sprintf("%s, %g",myFieldName.c_str(),aTime.first);
+      myTitle = aComment.simplifyWhiteSpace();
+      if (myAddToStudy) {
+       myName = GenerateName();
+       aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                        VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp);
+       string aResultEntry = myResult->GetEntry();
+       string aRefFatherEntry = myResult->GetRefFatherEntry();
+       string anEntry = FindEntryWithComment(myStudy,aResultEntry.c_str(),aComment.latin1());
+       if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
+       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d;myComponentId=%d",
+                        GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),(int)myIteration,myField->myNbComp,myScalarMode);
+       CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),
+                        anIOR,myName.c_str(),"",aComment.latin1(),true);
+      }
+    }
+    if(MYDEBUG) 
+      MESSAGE("ScalarMap_i::Build - myFieldName = "<<myFieldName<<"; myName = "<<myName<<
+             "; myScalarRange[0] = "<<myScalarRange[0]<<"; myScalarRange[1] = "<<myScalarRange[1]<<
+             "; myNumberOfColors = "<<myNumberOfColors);
+    
+    myMapper->SetInput(DoHook(theRestoring));
+    myMapper->ScalarVisibilityOn();
+#ifdef CHECKTIME
+    timer.Stop();
+    timer.Show();
+#endif
+    return this;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return NULL;
+}
+
+
+VISU::ScalarMap_i::DataType* VISU::ScalarMap_i::DoHook(int theRestoring){
+  myMapper->ScalarVisibilityOn();
+  return myFieldTransform->GetUnstructuredGridOutput();
+}
+
+
+
+VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  //Update();
+  VISU_Actor* aActor = VISU::Prs3d_i::CreateActor(theIO);
+  if ( !aActor ) return NULL;
+
+  VISU_LookupTable* aActorLookupTbl = VISU_LookupTable::New();
+  if(GetScaling() == VISU::LOGARITHMIC) 
+    aActorLookupTbl->SetLog(true);
+  aActorLookupTbl->SetHueRange(0.667,0.0);
+  aActorLookupTbl->SetNumberOfColors(myNumberOfColors);
+  aActorLookupTbl->SetRange(myScalarRange);
+  aActorLookupTbl->SetMapScale(1.);
+  aActorLookupTbl->Build();
+  myMapper->SetLookupTable(aActorLookupTbl);   
+//  if(GetScaling() == VISU::ScalarMap::LOGARITHMIC){
+//    float* aLogScalarRange = aActorLookupTbl->GetLogRange();
+//    myMapper->SetScalarRange(aLogScalarRange);
+//  }else
+    myMapper->SetScalarRange(myScalarRange);
+  aActorLookupTbl->Delete();
+
+
+  VISU_ScalarBarActor* aBar = VISU_ScalarBarActor::New();
+  VISU_LookupTable* aBarLookupTbl = VISU_LookupTable::New();
+  if(GetScaling() == VISU::LOGARITHMIC) 
+    aBarLookupTbl->SetLog(true);
+  aBarLookupTbl->SetHueRange(0.667,0.0);
+  aBarLookupTbl->SetNumberOfColors(myNumberOfColors);
+  aBarLookupTbl->SetRange(myScalarRange);
+  aBarLookupTbl->Build();
+  aBar->SetLookupTable(aBarLookupTbl);
+  aBarLookupTbl->Delete();
+
+  aBar->SetTitle(myTitle.c_str());
+  aBar->SetOrientation(myOrientation);
+  aBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+  aBar->GetPositionCoordinate()->SetValue(myPosition[0],
+                                         myPosition[1]);
+  aBar->SetWidth(myWidth);
+  aBar->SetHeight(myHeight);
+  aBar->SetNumberOfLabels(myNumberOfLabels);
+  aActor->setScalarBar(aBar);
+
+  aActor->VisuActorType = VisuActorType_ScalarMap;
+  strncpy(aActor->FieldName, myFieldName.c_str(), 40);
+  aActor->FieldName[39] = '\0';
+
+  vtkProperty* aProperty = aActor->GetProperty();
+//  aProperty->SetSpecularColor( 1, 1, 1);
+//  aProperty->SetSpecular( 0.3 );
+//  aProperty->SetSpecularPower( 20 );
+//  aProperty->SetAmbient( 0.2);
+//  aProperty->SetDiffuse( 0.8 );
+  aProperty->EdgeVisibilityOn();     
+  return aActor;
+}
+
+//==============================================================================
+int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                     const char* theFieldName, double theIteration){
+  try{
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
+    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    return aField.myNbComp > 1;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return 0;
+}
+
+int VISU::DeformedShape_i::myNbPresent = 0;
+QString VISU::DeformedShape_i::GenerateName() { return VISU::GenerateName("Def.Shape",myNbPresent++);}
+
+const string VISU::DeformedShape_i::myComment = "DEFORMEDSHAPE";
+const char* VISU::DeformedShape_i::GetComment() const { return myComment.c_str();}
+
+VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy) : 
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult),       
+       ScalarMap_i(theResult, theAddToStudy)
+{
+  if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
+  myWarpVector = vtkWarpVector::New();
+}
+
+
+void VISU::DeformedShape_i::SameAs(const DeformedShape_i* theOrigin)
+{
+  DeformedShape_i* aDefShape = (DeformedShape_i*) theOrigin;
+  setColored(aDefShape->isColored());
+  VISU::ScalarMap_i::SameAs(theOrigin);
+  SetScale(aDefShape->GetScale());
+}
+
+
+VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                             const char* theFieldName, double theIteration){
+  myIsColored = false;
+  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  ScalarMap_i::Restore(theMap,false);
+
+  myFactor = VISU::Storable::FindValue(theMap,"myFactor").toDouble();
+  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::DeformedShape_i::ToStream(ostrstream& theStr){
+  ScalarMap_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myFactor", myFactor );
+  Storable::DataToStream( theStr, "myIsColored", myIsColored );
+}
+
+VISU::Storable* VISU::DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject, 
+                                          const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::DeformedShape_i* pResent = new VISU::DeformedShape_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::DeformedShape_i::~DeformedShape_i(){
+  if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()");
+  myWarpVector->Delete();
+}
+
+
+VISU::ScalarMap_i::DataType* VISU::DeformedShape_i::DoHook(int theRestoring){
+  if(!theRestoring)
+    myFactor = ScaleFactor();
+  if(MYDEBUG) 
+    MESSAGE("DeformedShape_i::DoHook() - myFactor = "<<myFactor);
+  if(myField->myNbComp > 1){
+    if(myField->myEntity == VISU::CELL_ENTITY){
+      vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
+      aFilter->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+      aFilter->PassCellDataOn();
+      myWarpVector->SetInput(aFilter->GetUnstructuredGridOutput());
+      aFilter->Delete();
+    }else
+      myWarpVector->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+
+    if(GetScaling() == VISU::LOGARITHMIC) 
+      myWarpVector->SetScaleFactor(log10(myFactor));
+    else
+      myWarpVector->SetScaleFactor(myFactor);
+    if(myIsColored)
+      myMapper->ScalarVisibilityOn();
+  }
+  return myWarpVector->GetOutput();
+}
+
+
+float VISU::DeformedShape_i::ScaleFactor() { 
+  vtkUnstructuredGrid *aDataSet = myInput->GetUnstructuredGridOutput();
+  int nbCells = aDataSet->GetNumberOfCells(), nbPoints = aDataSet->GetNumberOfPoints();
+  return ::CalcScaleFactor(myBounds, nbCells? nbCells: nbPoints);
+}
+
+void VISU::DeformedShape_i::Update(){
+  myWarpVector->SetScaleFactor(myFactor);
+  myMapper->Update();
+}
+
+VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::ScalarMap_i::CreateActor(theIO);
+  if ( ! aActor ) return NULL;
+  if (myIsColored) {
+    myMapper->ScalarVisibilityOn();
+  } else {
+    myMapper->ScalarVisibilityOff();
+    aActor->setScalarBar(NULL);
+  }
+  aActor->VisuActorType = VisuActorType_DeformedShape;
+  aActor->GetProperty()->SetRepresentation(1);
+  return aActor;
+}
+
+
+//==============================================================================
+int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                 const char* theFieldName, double theIteration){
+  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+}
+
+int VISU::CutPlanes_i::myNbPresent = 0;
+QString VISU::CutPlanes_i::GenerateName() { return VISU::GenerateName("CutPlanes",myNbPresent++);}
+
+const string VISU::CutPlanes_i::myComment = "CUTPLANES";
+const char* VISU::CutPlanes_i::GetComment() const { return myComment.c_str();}
+
+VISU::CutPlanes_i::CutPlanes_i(Result_i* theResult, bool theAddToStudy) :
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult),       
+       ScalarMap_i(theResult, theAddToStudy)
+{
+  if(MYDEBUG) MESSAGE("CutPlanes_i::CutPlanes_i");
+  myAppendPolyData = vtkAppendPolyData::New();
+}
+
+void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin)
+{
+  CutPlanes_i* aCutPlanes = (CutPlanes_i*) theOrigin;
+  SetNbPlanes(aCutPlanes->GetNbPlanes());
+  SetOrientationType(aCutPlanes->GetOrientationType());
+  SetRotateX(aCutPlanes->GetRotateX());
+  SetRotateY(aCutPlanes->GetRotateY());
+  Update();
+  VISU::ScalarMap_i::SameAs(theOrigin);
+}
+
+VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                         const char* theFieldName, double theIteration){
+  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  ScalarMap_i::Restore(theMap,false);
+
+  myNbPlanes = VISU::Storable::FindValue(theMap,"myNbPlanes").toInt();
+  myBasePlane = (VISU::CutPlanes::Orientation)VISU::Storable::FindValue(theMap,"myBasePlane").toInt();
+  SetOrientationType(myBasePlane);
+  float aRot[2];
+  aRot[0] = VISU::Storable::FindValue(theMap,"aRot[0]").toDouble();
+  SetRotateX(aRot[0]);
+  aRot[1] = VISU::Storable::FindValue(theMap,"aRot[1]").toDouble();
+  SetRotateY(aRot[1]);
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::CutPlanes_i::ToStream(ostrstream& theStr){
+  ScalarMap_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myNbPlanes",  myNbPlanes );
+  Storable::DataToStream( theStr, "myBasePlane", myBasePlane );
+  Storable::DataToStream( theStr, "aRot[0]",     GetRotateX() );
+  Storable::DataToStream( theStr, "aRot[1]",     GetRotateY() );
+}
+
+VISU::Storable* VISU::CutPlanesRestore(SALOMEDS::SObject_ptr theSObject, 
+                                      const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::CutPlanes_i* pResent = new VISU::CutPlanes_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::CutPlanes_i::~CutPlanes_i(){
+  if(MYDEBUG) MESSAGE("CutPlanes_i::~CutPlanes_i()");
+  myAppendPolyData->Delete();
+}
+
+VISU_Actor* VISU::CutPlanes_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::ScalarMap_i::CreateActor(theIO);
+  if (! aActor ) return NULL;
+  aActor->VisuActorType = VisuActorType_CutPlanes;
+  return aActor;
+}
+
+
+
+float* GetIdent(float theR[3][3]){
+  for(int i = 0; i < 3; i++)
+    for(int j = 0; j < 3; j++)
+      theR[i][j] = (i==j? 1.0: 0.0);
+  return theR[0];
+}
+
+
+float* GetRx(float theRx[3][3], float thaAng){
+  theRx[0][0] = 1.0;            theRx[0][1] = 0.0;            theRx[0][2] = 0.0;
+  theRx[1][0] = 0.0;            theRx[1][1] = cos(thaAng);    theRx[1][2] = -sin(thaAng);
+  theRx[2][0] = 0.0;            theRx[2][1] = sin(thaAng);    theRx[2][2] = cos(thaAng);
+  return theRx[0];
+}
+
+
+float* GetRy(float theRy[3][3], float thaAng){
+  theRy[0][0] = cos(thaAng);    theRy[0][1] = 0.0;            theRy[0][2] = sin(thaAng);
+  theRy[1][0] = 0.0;            theRy[1][1] = 1.0;            theRy[1][2] = 0.0;   
+  theRy[2][0] = -sin(thaAng);   theRy[2][1] = 0.0;            theRy[2][2] = cos(thaAng);   
+  return theRy[0];
+}
+
+
+float* GetRz(float theRz[3][3], float thaAng){
+  theRz[0][0] = cos(thaAng);    theRz[0][1] = -sin(thaAng);   theRz[0][2] = 0.0;
+  theRz[1][0] = sin(thaAng);    theRz[1][1] = cos(thaAng);    theRz[1][2] = 0.0;   
+  theRz[2][0] = 0.0;            theRz[2][1] = 0.0;            theRz[2][2] = 1.0;   
+  return theRz[0];
+}
+
+
+void MulMatrix(float C[3][3], const float A[3][3], const float B[3][3]){ // C = A*B;
+  for(int i = 0; i < 3; i++)
+    for(int j = 0; j < 3; j++){
+      C[i][j] = 0.0;
+      for(int k = 0; k < 3; k++)
+       C[i][j] += A[i][k]*B[k][j];
+    }
+}
+
+
+float DotMul(const float A[3], const float B[3]){ // A*B;
+  float C = 0.0;
+  for(int i = 0; i < 3; i++)  C += A[i]*B[i];
+  return C;
+}
+
+
+void Mul(float C[3], const float A[3], float B){ // A*B;
+  for(int i = 0; i < 3; i++)  C[i] = A[i]*B;
+}
+
+
+void GetBoundProject(float BoundPrj[3], const float BoundBox[6], const float Dir[3]){
+  float BoundPoints[8][3] = { {BoundBox[0],BoundBox[2],BoundBox[4]},
+                             {BoundBox[1],BoundBox[2],BoundBox[4]},
+                             {BoundBox[0],BoundBox[3],BoundBox[4]},
+                             {BoundBox[1],BoundBox[3],BoundBox[4]},
+                             {BoundBox[0],BoundBox[2],BoundBox[5]},
+                             {BoundBox[1],BoundBox[2],BoundBox[5]}, 
+                             {BoundBox[0],BoundBox[3],BoundBox[5]}, 
+                             {BoundBox[1],BoundBox[3],BoundBox[5]}};
+  BoundPrj[0] = DotMul(Dir,BoundPoints[0]), BoundPrj[1] = BoundPrj[0];
+  float tmp;
+  for(int i = 1; i < 8; i++){
+    tmp = DotMul(Dir,BoundPoints[i]);
+    if(BoundPrj[1] < tmp) BoundPrj[1] = tmp;
+    if(BoundPrj[0] > tmp) BoundPrj[0] = tmp;
+  }
+  BoundPrj[2] = BoundPrj[1] - BoundPrj[0];
+  BoundPrj[1] = BoundPrj[0] + (1.0 - EPS)*BoundPrj[2];
+  BoundPrj[0] = BoundPrj[0] + EPS*BoundPrj[2];
+  BoundPrj[2] = BoundPrj[1] - BoundPrj[0];
+}
+
+void VISU::CutPlanes_i::SetRotateX(CORBA::Double theAng){
+  if(myBasePlane == VISU::CutPlanes::XY)
+    myAng[0] = theAng;   
+  else if(myBasePlane == VISU::CutPlanes::YZ)
+    myAng[1] = theAng; 
+  else if(myBasePlane == VISU::CutPlanes::ZX)
+    myAng[2] = theAng;
+}
+
+CORBA::Double VISU::CutPlanes_i::GetRotateX(){
+  if(myBasePlane == VISU::CutPlanes::XY)
+    return myAng[0];   
+  else if(myBasePlane == VISU::CutPlanes::YZ)
+    return myAng[1]; 
+  else if(myBasePlane == VISU::CutPlanes::ZX)
+    return myAng[2];
+}
+
+void VISU::CutPlanes_i::SetRotateY(CORBA::Double theAng){
+  if(myBasePlane == VISU::CutPlanes::XY)
+    myAng[1] = theAng;   
+  else if(myBasePlane == VISU::CutPlanes::YZ)
+    myAng[2] = theAng; 
+  else if(myBasePlane == VISU::CutPlanes::ZX)
+    myAng[0] = theAng;
+}
+
+CORBA::Double VISU::CutPlanes_i::GetRotateY(){
+  if(myBasePlane == VISU::CutPlanes::XY)
+    return myAng[1];   
+  else if(myBasePlane == VISU::CutPlanes::YZ)
+    return myAng[2]; 
+  else if(myBasePlane == VISU::CutPlanes::ZX)
+    return myAng[0];
+}
+
+VISU::ScalarMap_i::DataType* VISU::CutPlanes_i::DoHook(int theRestoring){
+  if(!theRestoring){
+    myAng[0] = myAng[1] = myAng[2] = 0.0;
+    myNbPlanes = 10;
+    myBasePlane = VISU::CutPlanes::XY;
+  }
+  if(MYDEBUG) 
+    MESSAGE("CutPlanes_i::DoHook() - myNbPlanes = "<<myNbPlanes<<"; myBasePlane = "<<myBasePlane<<
+           "; myAng[0] = "<<myAng[0]<<"; myAng[1] = "<<myAng[1]<<"; myAng[2] = "<<myAng[2]);
+  Update();
+  myMapper->ScalarVisibilityOn();
+  return myAppendPolyData->GetOutput();
+}
+
+
+void VISU::CutPlanes_i::SetPlane(int theId){
+  vtkCutter *aCutPlane = vtkCutter::New();
+  aCutPlane->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+  vtkPlane *aPlane = vtkPlane::New();
+  float aOrig[3];
+  Mul(aOrig,myDir,myBoundPrj[0] + theId*myDBPrj);
+  if(0 && MYDEBUG) MESSAGE("aOrig["<<theId<<"]: "<<aOrig[0]<<"; "<<aOrig[1]<<"; "<<aOrig[2]);
+  aPlane->SetOrigin(aOrig);
+  if(theId == 0) aPlane->SetNormal(myInvDir);
+  else  aPlane->SetNormal(myDir);
+  aCutPlane->SetCutFunction(aPlane);
+  aPlane->Delete();
+  myAppendPolyData->AddInput(aCutPlane->GetOutput());
+  aCutPlane->Delete();
+}
+
+
+void VISU::CutPlanes_i::Update(){
+  int iEnd = myAppendPolyData->GetNumberOfInputs();
+  if(MYDEBUG) MESSAGE("CutPlanes_i::Update - iEnd = "<<iEnd);
+  for(int i = iEnd-1; i >= 0; i--)
+    myAppendPolyData->RemoveInput(myAppendPolyData->GetInput(i));
+  float aRx[3][3], aRy[3][3], aRz[3][3];
+  int iPlane = 0;
+  if(myBasePlane == VISU::CutPlanes::XY){ // X-Y
+    if(fabs(myAng[0]) > EPS) ::GetRx(aRx,myAng[0]); else ::GetIdent(aRx);
+    if(fabs(myAng[1]) > EPS) ::GetRy(aRy,myAng[1]); else ::GetIdent(aRy);
+    ::MulMatrix(myRotation,aRx,aRy);
+    iPlane = 2;
+  }else if(myBasePlane == VISU::CutPlanes::YZ){ // Y-Z
+    if(fabs(myAng[1]) > EPS) ::GetRy(aRy,myAng[1]); else ::GetIdent(aRy);
+    if(fabs(myAng[2]) > EPS) ::GetRz(aRz,myAng[2]); else ::GetIdent(aRz);
+    ::MulMatrix(myRotation,aRy,aRz);
+     iPlane = 0;
+  }else if(myBasePlane == VISU::CutPlanes::ZX){ // Z-X
+    if(fabs(myAng[2]) > EPS) ::GetRz(aRz,myAng[2]); else ::GetIdent(aRz);
+    if(fabs(myAng[0]) > EPS) ::GetRx(aRx,myAng[0]); else ::GetIdent(aRx);
+    ::MulMatrix(myRotation,aRz,aRx);
+    iPlane = 1;
+  }
+  for(int i = 0; i < 3; i++)  myDir[i] = myRotation[i][iPlane];
+  ::Mul(myInvDir,myDir,-1.0);
+  ::GetBoundProject(myBoundPrj, myBounds, myDir);
+  if(MYDEBUG) MESSAGE("myDir "<<myDir[0]<<"; "<<myDir[1]<<"; "<<myDir[2]);
+  int aNbPlanes = GetNbPlanes();
+  SCRUTE(aNbPlanes);
+  if (aNbPlanes > 1 ) {
+    myDBPrj = myBoundPrj[2]/(aNbPlanes - 1);
+    for (int i = 0; i < aNbPlanes; i++){
+      SetPlane(i);
+    }
+  }
+   else { 
+     myDBPrj = 0.5*myBoundPrj[2];
+     SetPlane(1);
+   }
+}
+
+
+//==============================================================================
+int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                   const char* theFieldName, double theIteration){
+  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+}
+
+int VISU::IsoSurfaces_i::myNbPresent = 0;
+QString VISU::IsoSurfaces_i::GenerateName() { return VISU::GenerateName("IsoSurfaces",myNbPresent++);}
+
+const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES";
+const char* VISU::IsoSurfaces_i::GetComment() const { return myComment.c_str();}
+
+VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy) :
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult),       
+       ScalarMap_i(theResult, theAddToStudy)
+{
+  if(MYDEBUG) MESSAGE("IsoSurfaces_i::IsoSurfaces_i");
+  myContourFilter = vtkContourFilter::New();
+}
+
+void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) {
+  IsoSurfaces_i* aIsoSurfaces = (IsoSurfaces_i*) theOrigin;
+  SetNbSurfaces(aIsoSurfaces->GetNbSurfaces());
+  SetRange(aIsoSurfaces->GetRangeMin(), aIsoSurfaces->GetRangeMax());
+  VISU::ScalarMap_i::SameAs(theOrigin);
+}
+
+VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                           const char* theFieldName, double theIteration){
+  myNbSurface = 10;
+  myRange[0] = 0;
+  myRange[1] = 0;
+  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  ScalarMap_i::Restore(theMap,false);
+
+  myNbSurface = VISU::Storable::FindValue(theMap,"myNbSurface").toInt();
+  myRange[0] = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
+  myRange[1] = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::IsoSurfaces_i::ToStream(ostrstream& theStr){
+  ScalarMap_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myNbSurface", myNbSurface );
+  Storable::DataToStream( theStr, "myRange[0]", myRange[0] );
+  Storable::DataToStream( theStr, "myRange[1]", myRange[1] );
+}
+
+VISU::Storable* VISU::IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject, 
+                                        const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::IsoSurfaces_i* pResent = new VISU::IsoSurfaces_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::IsoSurfaces_i::~IsoSurfaces_i(){
+  if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()");
+  myContourFilter->Delete();
+}
+
+
+VISU::ScalarMap_i::DataType* VISU::IsoSurfaces_i::DoHook(int theRestoring){
+  if(MYDEBUG) 
+    MESSAGE("IsoSurfaces_i::DoHook() - myNbSurface = "<<myNbSurface);
+  if(myField->myEntity == VISU::CELL_ENTITY){
+    vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
+    aFilter->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+    aFilter->PassCellDataOn();
+    myContourFilter->SetInput(aFilter->GetOutput());
+    aFilter->Delete();
+  } else
+    myContourFilter->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+
+  if ((myRange[0]==0) && (myRange[1]==0)) {
+    myRange[0] = myScalarRange[0];
+    myRange[1] = myScalarRange[1];
+  }
+  if(GetScaling() == VISU::LOGARITHMIC){ 
+    float aLogRange[2];
+    VISU_LookupTable::ComputeLogRange(myRange,aLogRange);
+    if(MYDEBUG) 
+      MESSAGE("IsoSurfaces_i::DoHook() - aLogRange = {"<<aLogRange[0]<<", "<<aLogRange[1]<<"}");
+    myContourFilter->GenerateValues(myNbSurface, aLogRange);
+  }else
+    myContourFilter->GenerateValues(myNbSurface, myRange);
+  myMapper->ScalarVisibilityOn();
+  return myContourFilter->GetOutput();
+}
+
+
+void VISU::IsoSurfaces_i::Update(){
+  if ((myRange[0]==0) && (myRange[1]==0)) {
+    myRange[0] = myScalarRange[0];
+    myRange[1] = myScalarRange[1];
+  }
+  if(GetScaling() == VISU::LOGARITHMIC){ 
+    float aLogRange[2];
+    VISU_LookupTable::ComputeLogRange(myRange,aLogRange);
+    if(MYDEBUG) 
+      MESSAGE("IsoSurfaces_i::Update() - aLogRange = {"<<aLogRange[0]<<", "<<aLogRange[1]<<"}");
+    myContourFilter->GenerateValues(myNbSurface, aLogRange);
+  }else
+    myContourFilter->GenerateValues(myNbSurface, myRange);
+  myMapper->Update();
+}
+
+
+VISU_Actor* VISU::IsoSurfaces_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::ScalarMap_i::CreateActor(theIO);
+  if ( ! aActor ) return NULL;
+  aActor->VisuActorType = VisuActorType_IsoSurfaces;
+  return aActor;
+}
+
+//==============================================================================
+int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                   const char* theFieldName, double theIteration){
+  return DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+}
+
+int VISU::StreamLines_i::myNbPresent = 0;
+QString VISU::StreamLines_i::GenerateName() { return VISU::GenerateName("StreamLines",myNbPresent++);}
+
+const string VISU::StreamLines_i::myComment = "STREAMLINES";
+const char* VISU::StreamLines_i::GetComment() const { return myComment.c_str();}
+
+VISU::StreamLines_i::StreamLines_i(Result_i* theResult, bool theAddToStudy) :
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult),       
+       ScalarMap_i(theResult, theAddToStudy),
+       DeformedShape_i(theResult, theAddToStudy)
+{
+  if(MYDEBUG) MESSAGE("StreamLines_i::StreamLines_i");
+  myStream = vtkStreamLine::New();
+}
+
+VISU::Storable* VISU::StreamLines_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                           const char* theFieldName, double theIteration){
+  myDirection = VISU::StreamLines::FORWARD;
+  myStepLength = 0.1;
+  myIntegrationStep = 0.1;
+  myPropagationTime = 100;
+  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+void VISU::StreamLines_i::SameAs(const StreamLines_i* theOrigin) {
+  StreamLines_i* aIsoLines = (StreamLines_i*) theOrigin;
+  SetDirection(aIsoLines->GetDirection());
+  SetStepLength(aIsoLines->GetStepLength());
+  SetIntegrationStep(aIsoLines->GetIntegrationStep());
+  SetPropagationTime(aIsoLines->GetPropagationTime());
+  VISU::DeformedShape_i::SameAs(theOrigin);
+}
+
+VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  DeformedShape_i::Restore(theMap,false);
+
+  myStepLength = VISU::Storable::FindValue(theMap,"myStepLength").toDouble();
+  myIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
+  myPropagationTime = VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble();
+  myDirection = (VISU::StreamLines::Direction) VISU::Storable::FindValue(theMap,"myDirection").toInt();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::StreamLines_i::ToStream(ostrstream& theStr){
+  DeformedShape_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myStepLength", myStepLength );
+  Storable::DataToStream( theStr, "myIntegrationStep", myIntegrationStep );
+  Storable::DataToStream( theStr, "myPropagationTime", myPropagationTime );
+  Storable::DataToStream( theStr, "myDirection", (int)myDirection );
+
+}
+
+VISU::Storable* VISU::StreamLinesRestore(SALOMEDS::SObject_ptr theSObject, 
+                                        const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::StreamLines_i* pResent = new VISU::StreamLines_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::StreamLines_i::~StreamLines_i(){
+  if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()");
+  myStream->Delete();
+}
+
+
+VISU::ScalarMap_i::DataType* VISU::StreamLines_i::DoHook(int theRestoring){
+  return myStream->GetOutput();
+}
+
+
+void VISU::StreamLines_i::Update(){
+  if(myField->myNbComp > 1){
+    if(myField->myEntity == VISU::CELL_ENTITY){
+      //myStream->DebugOn();
+      vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
+      aFilter->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+      aFilter->PassCellDataOn();
+      myStream->SetInput(aFilter->GetOutput());
+      aFilter->Delete();
+
+      vtkCellCenters *centers = vtkCellCenters::New(); // for vectors on cells
+      centers->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+      centers->VertexCellsOn();
+      myStream->SetSource(centers->GetOutput());
+      centers->Delete();
+    }else{
+      myStream->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+      myStream->SetSource(myFieldTransform->GetUnstructuredGridOutput());
+    }
+    myStream->SetStepLength(myStepLength);
+    myStream->SetIntegrationStepLength(myIntegrationStep);
+    myStream->SetMaximumPropagationTime(myPropagationTime);
+    switch (myDirection) {
+    case VISU::StreamLines::FORWARD:
+      myStream->SetIntegrationDirectionToForward();
+      break;
+    case VISU::StreamLines::BACKWARD:
+      myStream->SetIntegrationDirectionToBackward();
+      break;
+    case VISU::StreamLines::BOTH:
+      myStream->SetIntegrationDirectionToIntegrateBothDirections();
+    }
+    myStream->Update();
+    myMapper->Update();
+  }
+}
+
+
+VISU_Actor* VISU::StreamLines_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::DeformedShape_i::CreateActor(theIO);
+  if ( ! aActor ) return NULL;
+  aActor->VisuActorType = VisuActorType_StreamLines;
+  return aActor;
+}
+
+//==============================================================================
+int VISU::Vectors_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                               const char* theFieldName, double theIteration){
+  return DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+}
+
+int VISU::Vectors_i::myNbPresent = 0;
+QString VISU::Vectors_i::GenerateName() { return VISU::GenerateName("Vectors",myNbPresent++);}
+
+const string VISU::Vectors_i::myComment = "VECTORS";
+const char* VISU::Vectors_i::GetComment() const { return myComment.c_str();}
+
+VISU::Vectors_i::Vectors_i(Result_i* theResult, bool theAddToStudy) :
+       PrsObject_i(theResult->GetStudyDocument()), 
+       Prs3d_i(theResult),       
+       ScalarMap_i(theResult, theAddToStudy),
+       DeformedShape_i(theResult, theAddToStudy)
+{
+  if(MYDEBUG) MESSAGE("Vectors_i::Vectors_i");
+  myGlyph = vtkGlyph3D::New();
+  myHog = vtkHedgeHog::New();
+}
+
+void VISU::Vectors_i::SameAs(const VISU::Vectors_i* theOrigin) {
+  Vectors_i* aVectors = (Vectors_i*) theOrigin;
+  SetLineWidth(aVectors->GetLineWidth());
+  SetGlyphType(aVectors->GetGlyphType());
+  SetGlyphPos(aVectors->GetGlyphPos());
+  VISU::DeformedShape_i::SameAs(theOrigin);
+}
+
+VISU::Storable* VISU::Vectors_i::Create(const char* theMeshName, VISU::Entity theEntity, 
+                                       const char* theFieldName, double theIteration){
+  myLineWidth = 1.0;
+  myTypeGlyph = VISU::Vectors::ARROW;
+  myPosGlyph = VISU::Vectors::CENTER;
+  return DeformedShape_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+}
+
+VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap, int theBuilding)
+     throw(std::logic_error&)
+{
+  DeformedShape_i::Restore(theMap,false);
+
+  myTypeGlyph = (VISU::Vectors::GlyphType)VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt();
+  myLineWidth = VISU::Storable::FindValue(theMap,"myLineWidth").toDouble();
+  myPosGlyph = (VISU::Vectors::GlyphPos)VISU::Storable::FindValue(theMap,"myPosGlyph").toInt();
+
+  if(theBuilding)
+    return Build(true);
+  return NULL;
+}
+
+void VISU::Vectors_i::ToStream(ostrstream& theStr){
+  DeformedShape_i::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myTypeGlyph", myTypeGlyph );
+  Storable::DataToStream( theStr, "myLineWidth", myLineWidth );
+  Storable::DataToStream( theStr, "myPosGlyph",  myPosGlyph );
+}
+
+VISU::Storable* VISU::VectorsRestore(SALOMEDS::SObject_ptr theSObject, 
+                                    const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  VISU::Result_i* pResult = GetResult(theSObject);
+  if(pResult != NULL){
+    VISU::Vectors_i* pResent = new VISU::Vectors_i(pResult);
+    return pResent->Restore(theMap);
+  }
+  return NULL;
+}
+
+
+VISU::ScalarMap_i::DataType* VISU::Vectors_i::DoHook(int theRestoring){
+  if(!theRestoring){
+    myFactor = ScaleFactor();
+  }
+  if(MYDEBUG) 
+    MESSAGE("Vectors_i::DoHook() - myFactor = "<<myFactor<<"; myTypeGlyph = "<<myTypeGlyph<<
+           "; myLineWidth = "<<myLineWidth<<"; myPosGlyph = "<<myPosGlyph);
+  if (myTypeGlyph == VISU::Vectors::NONE) return myHog->GetOutput();
+  return myGlyph->GetOutput();
+}
+
+VISU::Vectors_i::~Vectors_i(){
+  if(MYDEBUG) MESSAGE("Vectors_i::~Vectors_i()");
+  myGlyph->Delete();
+  myHog->Delete();
+}
+
+VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) {
+  VISU_Actor* aActor = VISU::DeformedShape_i::CreateActor(theIO);
+  if ( ! aActor ) return NULL;
+  aActor->VisuActorType = VisuActorType_Vectors;
+  aActor->IsShrinkable = false;
+  vtkProperty* aProperty = aActor->GetProperty();
+  aProperty->SetRepresentation(2);
+  aProperty->SetLineWidth(myLineWidth);
+  return aActor;
+}
+
+void VISU::Vectors_i::Update() {
+  switch (myTypeGlyph) {
+  case VISU::Vectors::ARROW:
+    {
+      vtkGlyphSource2D *aGlyphSource = vtkGlyphSource2D::New();
+      aGlyphSource->SetGlyphTypeToArrow();
+      aGlyphSource->SetFilled(0);
+      if(myPosGlyph == VISU::Vectors::TAIL)
+       aGlyphSource->SetCenter(0.5, 0.0, 0.0);
+      else if(myPosGlyph == VISU::Vectors::HEAD)
+       aGlyphSource->SetCenter(-0.5, 0.0, 0.0);
+      myGlyph->SetSource(aGlyphSource->GetOutput());
+      aGlyphSource->Delete();
+    }
+    break;
+
+  case VISU::Vectors::CONE2:
+  case VISU::Vectors::CONE6:
+    {
+      vtkConeSource *aGlyphSource = vtkConeSource::New(); //by default
+      if (myTypeGlyph == VISU::Vectors::CONE6)
+       aGlyphSource->SetResolution(7);
+      else
+       aGlyphSource->SetResolution(3);
+      aGlyphSource->SetHeight(.7);
+      aGlyphSource->SetRadius(.1);
+      vtkTransform *aTransform = vtkTransform::New();
+      if(myPosGlyph == VISU::Vectors::TAIL)
+       aTransform->Translate(0.5*aGlyphSource->GetHeight(),0.0,0.0);
+      else if(myPosGlyph == VISU::Vectors::HEAD)
+       aTransform->Translate(-0.5*aGlyphSource->GetHeight(),0.0,0.0);
+      
+      vtkTransformPolyDataFilter *aFilter = vtkTransformPolyDataFilter::New();
+      aFilter->SetInput(aGlyphSource->GetOutput());
+      aGlyphSource->Delete();
+      aFilter->SetTransform(aTransform);
+      aTransform->Delete();
+      myGlyph->SetSource(aGlyphSource->GetOutput());
+      aFilter->Delete();
+    }
+    break;
+  case VISU::Vectors::NONE:
+    {
+      if(myField->myEntity == VISU::CELL_ENTITY){
+       vtkCellCenters *centers = vtkCellCenters::New(); // for vectors on cells
+       centers->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+       centers->VertexCellsOn();
+       myHog->SetInput(centers->GetOutput());
+       centers->Delete();
+      }else
+       myHog->SetInput(myFieldTransform->GetInput());
+      
+      myHog->SetScaleFactor(myFactor);
+      myHog->Update();
+      myMapper->SetInput(myHog->GetOutput());
+      myMapper->Update();
+      return;
+    }
+  }
+  if(myField->myNbComp > 1){
+    if(myField->myEntity == VISU::CELL_ENTITY){
+      vtkCellCenters *centers = vtkCellCenters::New(); // for vectors on cells
+      centers->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+      centers->VertexCellsOn();
+      myGlyph->SetInput(centers->GetOutput());
+      centers->Delete();
+    }else
+      myGlyph->SetInput(myFieldTransform->GetUnstructuredGridOutput());
+    myGlyph->SetVectorModeToUseVector();
+    myGlyph->SetScaleFactor(2*myFactor);
+  }
+  myGlyph->Update();
+  myMapper->SetInput(myGlyph->GetOutput());
+  myMapper->Update();  
+}
+//==============================================================================
+
diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh
new file mode 100644 (file)
index 0000000..842ec89
--- /dev/null
@@ -0,0 +1,535 @@
+// File:       VISU_PrsObject_i.hxx
+// Created:    Fri Jan 17 09:26:33 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_PrsObject_i_HeaderFile
+#define VISU_PrsObject_i_HeaderFile
+
+#include "VISU_Result_i.hh"
+//#include "VISU_Convertor.hxx"
+#include "Handle_SALOME_InteractiveObject.hxx"
+
+class VISU_Extractor;
+class VISU_FieldTransform;
+class VISU_Actor;
+
+class vtkDataSetMapper;
+class vtkDataSet;
+class vtkProperty;
+
+class vtkWarpVector;
+class vtkContourFilter;
+class vtkAppendPolyData;
+
+class vtkGlyph3D;
+class vtkHedgeHog;
+class vtkPolyDataSource;
+class vtkStreamLine;
+
+
+namespace VISU{
+  struct TField;
+  //==============================================================================
+  class PrsObject_i : public virtual POA_VISU::PrsObject,
+                      public virtual Storable
+  {
+    PrsObject_i(const PrsObject_i&);
+
+  public:
+    PrsObject_i(SALOMEDS::Study_ptr theStudy) : 
+      myStudy(SALOMEDS::Study::_duplicate(theStudy)) {};
+    virtual ~PrsObject_i() {}
+
+  protected:
+    string myName;
+    SALOMEDS::Study_var myStudy;
+
+  public:
+    virtual const char* GetName() const { return myName.c_str();}
+    const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;}
+    QString GetEntry();
+  };
+
+
+  //==============================================================================
+  class Prs3d_i : public virtual PrsObject_i
+  {
+    Prs3d_i();
+    Prs3d_i(const Prs3d_i&);
+  public:
+    Prs3d_i(Result_i* theResult);
+    virtual void SameAs(const Prs3d_i* theOrigin);
+    virtual ~Prs3d_i();
+
+    typedef vtkDataSetMapper MapperType;
+    typedef vtkDataSet DataType;
+    
+    virtual const float* GetColor() const { return myColorRGB;}
+    virtual void SetColor(const float* theRGB){
+      myColor.R = myColorRGB[0] = theRGB[0]; 
+      myColor.G = myColorRGB[1] = theRGB[1]; 
+      myColor.B = myColorRGB[2] = theRGB[2];
+    }
+
+
+  protected:
+    Result_i* myResult;
+    MapperType *myMapper;
+    float myBounds[6];
+    float myColorRGB[3];
+    struct SALOMEDS::Color myColor;
+
+    bool myAddToStudy;
+
+  public:
+    virtual void Update();
+    virtual const char* GetComment() const = 0;
+    virtual QString GenerateName() = 0;
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    virtual void ToStream(ostrstream& theStr);
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    MapperType* GetMapper() const { return myMapper;}
+    Result_i* GetResult() const { return myResult; }
+  };
+
+
+  //==============================================================================
+  class Mesh_i : public virtual POA_VISU::Mesh,
+                 public virtual Prs3d_i
+  {
+    static int myNbPresent;
+    Mesh_i();
+    Mesh_i(const Mesh_i&);
+  public:
+    Mesh_i(Result_i* theResult);
+    virtual void SameAs(const Mesh_i* theOrigin);
+    virtual ~Mesh_i();
+    virtual VISU::VISUType GetType() { return VISU::TMESH;};
+
+    virtual void SetCellColor(const SALOMEDS::Color& theColor) { myCellColor = theColor;}
+    virtual SALOMEDS::Color GetCellColor() { return myCellColor;}
+
+    virtual void SetNodeColor(const SALOMEDS::Color& theColor) { myNodeColor = theColor;}
+    virtual SALOMEDS::Color GetNodeColor() { return myNodeColor;}
+
+    virtual void SetLinkColor(const SALOMEDS::Color& theColor) { myLinkColor = theColor;}
+    virtual SALOMEDS::Color GetLinkColor() { return myLinkColor;}
+
+    virtual void SetPresentationType(VISU::PresentationType theType) { myPresentType = theType;}
+    virtual PresentationType GetPresentationType() { return myPresentType;}
+
+    typedef VISU::Mesh InterfaceType;
+    typedef vtkUnstructuredGridReader InputType;
+
+  protected:
+    Storable* Build(int theRestoring);
+
+    InputType *myInput;
+    VISU::VISUType myType;
+    string myMeshName;
+    int myEntity;
+    string mySubMeshName;
+    struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor;
+    VISU::PresentationType myPresentType;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, int theEntity);
+    virtual Storable* Create(const char* theMeshName, int theEntity, const char* theFamilyName);
+    virtual Storable* Create(const char* theMeshName, const char* theGroupName);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    virtual void ToStream(ostrstream& theStr);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    virtual InputType* GetInput() const { return myInput;}
+  };
+  Storable* MeshRestore(SALOMEDS::SObject_ptr theSObject, 
+                       const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+  //==============================================================================
+  class ScalarMap_i : public virtual POA_VISU::ScalarMap,
+                     public virtual Prs3d_i
+  {
+    static int myNbPresent;
+    ScalarMap_i();
+    ScalarMap_i(const ScalarMap_i&);
+
+  public:
+    ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const ScalarMap_i* theOrigin);
+    virtual ~ScalarMap_i();
+
+    virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
+
+    virtual void SetScalarMode(CORBA::Long theScalarMode);
+    virtual CORBA::Long GetScalarMode() { return myScalarMode;}
+
+    virtual void SetScaling(VISU::Scaling theScaling);
+    virtual VISU::Scaling GetScaling();
+
+    virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
+    virtual CORBA::Double GetMin() { return myScalarRange[0];}  
+    virtual CORBA::Double GetMax() { return myScalarRange[1];}
+
+    virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation) { 
+      myOrientation = theOrientation;
+    }
+    virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
+
+    virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
+    virtual CORBA::Double GetPosX() { return myPosition[0];} 
+    virtual CORBA::Double GetPosY() { return myPosition[1];}
+      
+    virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) { 
+      myWidth = theWidth; myHeight = theHeight;
+    }
+    virtual CORBA::Double GetWidth() { return myWidth;}  
+    virtual CORBA::Double GetHeight() { return myHeight;}
+
+    virtual void SetNbColors(CORBA::Long theNbColors) { myNumberOfColors = theNbColors;}
+    virtual CORBA::Long GetNbColors() { return myNumberOfColors;}
+
+    virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
+    virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
+    
+    virtual void SetTitle(const char* theName) { myTitle = theName;}
+    virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
+
+    virtual void CalculateRange();
+    virtual bool isRangeFixed() { return myIsFixedRange; }
+    
+    virtual double GetIteration() { return myIteration; }
+
+    typedef VISU::ScalarMap InterfaceType;
+    typedef VISU_Extractor InputType;
+
+  protected:
+    Storable* Build(int theRestoring);
+    virtual DataType* DoHook(int theRestoring);
+
+    InputType *myInput;
+    
+    string myMeshName;
+    int myEntity;
+    string myFieldName;
+    int myScalarMode;
+    double myIteration;
+    VISU_FieldTransform *myFieldTransform;
+    const TField* myField;
+    
+    float myScalarRange[2];
+    bool myIsFixedRange;
+    VISU::Scaling myScaling;
+
+    string myTitle;
+    VISU::ScalarMap::Orientation myOrientation;
+    int myNumberOfColors, myNumberOfLabels;
+    float myPosition[2], myWidth, myHeight;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    InputType* GetInput() { return myInput;}
+
+    virtual void Update();
+    const VISU::TField*  GetField() const { return myField;}
+    const string&  GetFieldName() const { return myFieldName;}
+    int GetScalarMode() const { return myScalarMode;}
+
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject, 
+                            const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+  //==============================================================================
+  class DeformedShape_i : public virtual POA_VISU::DeformedShape,
+                         public virtual ScalarMap_i
+  {
+    static int myNbPresent;
+    DeformedShape_i();
+    DeformedShape_i(const DeformedShape_i&);
+  public:
+    DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const DeformedShape_i* theOrigin);
+    virtual ~DeformedShape_i();
+
+    virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
+
+    virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
+    virtual CORBA::Double GetScale() { return myFactor;}
+
+    typedef VISU::DeformedShape InterfaceType;
+
+    virtual bool isColored() { return myIsColored; }
+    virtual void setColored(bool theColor) 
+    { myIsColored = theColor; }
+
+  protected:
+    virtual DataType* DoHook(int theRestoring);
+    float myFactor;
+    bool myIsColored;
+    vtkWarpVector *myWarpVector;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void Update();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    float ScaleFactor();
+
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject, 
+                                const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+
+
+  //==============================================================================
+  class CutPlanes_i : public virtual POA_VISU::CutPlanes,
+                     public virtual ScalarMap_i
+  {
+    static int myNbPresent;
+    CutPlanes_i();
+    CutPlanes_i(const CutPlanes_i&);
+  public:
+    CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const CutPlanes_i* theOrigin);
+    virtual ~CutPlanes_i();
+    virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
+
+    virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) { 
+      myBasePlane = theOrient;
+    }
+    virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
+
+    virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
+    virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
+    
+    virtual void SetRotateX(CORBA::Double theAngle);
+    virtual CORBA::Double GetRotateX();
+    virtual void SetRotateY(CORBA::Double theAngle);
+    virtual CORBA::Double GetRotateY();
+    
+    typedef VISU::CutPlanes InterfaceType;
+
+  protected:
+    virtual DataType* DoHook(int theRestoring);
+
+    float myRotation[3][3];
+    float myAng[3], myDir[3], myInvDir[3], myBoundPrj[3], myDBPrj;
+    vtkAppendPolyData *myAppendPolyData;
+    VISU::CutPlanes::Orientation myBasePlane;
+    int myNbPlanes;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void Update();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    void SetPlane(int theId);
+
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject, 
+                            const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+
+  //==============================================================================
+  class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
+                       public virtual ScalarMap_i
+  {
+    static int myNbPresent;
+    IsoSurfaces_i();
+    IsoSurfaces_i(const IsoSurfaces_i&);
+  public:
+    IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const IsoSurfaces_i* theOrigin);
+    virtual ~IsoSurfaces_i();
+    virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
+
+    virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
+    virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
+
+    virtual void SetRange(float theMin, float theMax)
+    { myRange[0] = theMin;  myRange[1] = theMax; }
+
+    virtual float GetRangeMin() { return myRange[0]; }
+    virtual float GetRangeMax() { return myRange[1]; }
+
+    typedef VISU::IsoSurfaces InterfaceType;
+
+  protected:
+    virtual DataType* DoHook(int theRestoring);
+
+    vtkContourFilter *myContourFilter;
+    int myNbSurface;
+    float myRange[2];
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void Update();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    vtkContourFilter* GetFilter() { return myContourFilter;}
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject, 
+                              const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+
+  //==============================================================================
+  class StreamLines_i : public virtual POA_VISU::StreamLines,
+                       public virtual DeformedShape_i
+  {
+    static int myNbPresent;
+    StreamLines_i();
+    StreamLines_i(const StreamLines_i&);
+  public:
+    StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const StreamLines_i* theOriginal);
+    virtual ~StreamLines_i();
+
+    virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
+
+    typedef VISU::StreamLines InterfaceType;
+
+    virtual void SetDirection(VISU::StreamLines::Direction theDirection) 
+    { myDirection = theDirection; }
+    virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
+
+    virtual void SetStepLength(float theStep) { myStepLength = theStep; }
+    virtual float GetStepLength() { return myStepLength; }
+
+    virtual void SetPropagationTime(float theTime) { myPropagationTime = theTime; }
+    virtual float GetPropagationTime() { return myPropagationTime; }
+
+    virtual void SetIntegrationStep(float theStep) { myIntegrationStep = theStep; }
+    virtual float GetIntegrationStep() { return myIntegrationStep; }
+
+  protected:
+    virtual DataType* DoHook(int theRestoring);
+    vtkStreamLine* myStream;
+
+    VISU::StreamLines::Direction myDirection;
+    float myStepLength;
+    float myIntegrationStep;
+    float myPropagationTime;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void Update();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject, 
+                              const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+
+
+  //==============================================================================
+  class Vectors_i : public virtual POA_VISU::Vectors,
+                   public virtual DeformedShape_i
+  {
+    static int myNbPresent;
+    Vectors_i();
+    Vectors_i(const Vectors_i&);
+  public:
+    Vectors_i(Result_i* theResult, bool theAddToStudy = true);
+    virtual void SameAs(const Vectors_i* theOrigin);
+    virtual ~Vectors_i();
+    virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
+
+    virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
+    virtual CORBA::Double GetLineWidth() { return myLineWidth;}
+
+    virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
+    virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
+    
+    virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
+    virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
+
+    typedef VISU::Vectors InterfaceType;
+
+  protected:
+    virtual DataType* DoHook(int theRestoring);
+
+    float myLineWidth;
+    VISU::Vectors::GlyphType myTypeGlyph;
+    VISU::Vectors::GlyphPos myPosGlyph;
+    vtkGlyph3D *myGlyph;
+    vtkHedgeHog *myHog;
+
+  public:
+    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
+                            const char* theFieldName, double theIteration);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
+      throw(std::logic_error&);
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual QString GenerateName();
+    virtual void Update();
+    virtual void ToStream(ostrstream& theStr);
+    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
+                         const char* theFieldName, double theIteration);
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+  };
+  Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject, 
+                          const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+  //==============================================================================
+}
+#endif
+
+
diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc
new file mode 100644 (file)
index 0000000..dc9f250
--- /dev/null
@@ -0,0 +1,375 @@
+using namespace std;
+// File:       VISU_Result_i.cc
+// Created:    Fri Jan 10 13:56:05 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+#include "VISU_Result_i.hh"
+#include "VISU_Convertor_impl.hxx"
+#include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_Extractor.hxx"
+using namespace VISU;
+
+#include "SALOMEDS_Tool.hxx"
+
+#include <qstring.h>
+#include <qfileinfo.h>
+
+#include <fstream>     
+
+#include <vtkUnstructuredGridReader.h>
+#include <vtkUnstructuredGridWriter.h>
+
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
+VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){
+  SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
+  SALOMEDS::SObject_var aFather = theSObject->GetFather();
+  CORBA::String_var aComponentID(aSComponent->GetID());
+  CORBA::String_var aFatherID(aFather->GetID());
+  VISU::Result_var aResult;
+  while(strcmp(aComponentID,aFatherID) != 0){
+    CORBA::Object_var anObject = VISU::SObjectToObject(aFather);
+    if(!CORBA::is_nil(anObject)){
+      aResult = VISU::Result::_narrow(anObject);
+      if(!aResult->_is_nil()) return aResult;
+    }
+    aFather = aFather->GetFather();
+  }
+  return aResult;
+}
+
+QString VISU::GenerateName(const string& theFmt, int theId){
+  static QString aName;
+  if(theId > 0)
+    aName.sprintf("%s:%d",theFmt.c_str(),theId);
+  else
+    aName.sprintf("%s",theFmt.c_str());
+  return aName;
+}
+
+void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
+  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+  aWriter->SetFileName(theFileName.c_str());
+  aWriter->SetInput(theDataSet);
+  aWriter->Write();
+  aWriter->Delete();
+}
+
+QString GenerateName(const char* theName){
+  typedef map<string,int> TNameMap;
+  static TNameMap aMap;
+  TNameMap::const_iterator i = aMap.find(theName);
+  QString tmp;
+  if(i == aMap.end()) {
+    aMap[theName] = 0;
+    tmp = theName;
+  }else{
+    tmp = VISU::GenerateName(theName,++aMap[theName]);
+  }
+  if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
+  return tmp;
+}
+
+void CreateReference(SALOMEDS::Study_ptr theStudyDocument, 
+                    const string& theFatherEntry, const string& theRefEntry)
+{
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
+  SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
+  SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
+  SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
+  aStudyBuilder->Addreference(newObj,aRefSObj);
+}
+
+string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){
+  SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
+  CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
+  return aDataType.in();
+}
+
+//==============================================================================
+
+const string VISU::Result_i::myComment = "RESULT";
+const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
+
+VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
+  myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+  myInput = NULL;
+}
+
+VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) 
+     throw (std::runtime_error&)
+{
+  if(MYDEBUG) MESSAGE("Result_i::Build");
+  mySComponent = FindOrCreateVisuComponent(myStudyDocument);
+  CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
+  string aRefFatherEntry = GetRefFatherEntry();
+  QString aComment;
+  aComment.sprintf("myComment=%s;myType=%d;myFileName=%s",
+                  GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1());
+  string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
+                                        anIOR,myName.c_str(),"",aComment.latin1(),true);
+  mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
+  if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
+  if(theSObject != NULL){
+    CORBA::String_var aString = theSObject->GetID();
+    CreateReference(myStudyDocument,aResultEntry,aString.in());
+  }
+  const TMeshMap& aMeshMap = myInput->GetMeshMap();
+  if(!aMeshMap.empty()) {//apo
+    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      const string& aMeshName = aMeshMapIter->first;
+      const VISU::TMesh& aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+                      aMeshName.c_str(),aMesh.myDim);
+      string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
+                                          "",aMeshName.c_str(),"",aComment.latin1(),true);
+      if(aMeshOnEntityMap.empty()) continue;
+      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
+      string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "","Families","",aComment.latin1(),true);
+      //Import entities and according families
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      typedef map<VISU::TEntity,string> TEntity2Entry;
+      TEntity2Entry aEntity2Entry;
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
+                        VISU::TENTITY,aMeshName.c_str(),anEntity);
+       string anEntityName;
+       switch(anEntity){
+       case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
+       case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
+       case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
+       case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
+       default:
+         throw std::runtime_error("Build >> Value of entity is incorrect!");
+       }
+       aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
+                                                  "",anEntityName.c_str(),"",aComment.latin1(),true);
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+         const string& aFamilyName = aFamilyMapIter->first;
+         aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                          VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
+         CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
+                          "",aFamilyName.c_str(),"",aComment.latin1(),true);
+       }
+      }
+      //Importing groups
+      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      if(aGroupMap.size() > 0){
+       aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
+       string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                              "","Groups","",aComment.latin1(),true);
+       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+         const string& aGroupName = aGroupMapIter->first;
+         aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+                          VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
+         string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "",aGroupName.c_str(),"",aComment.latin1(),true);
+         const VISU::TGroup& aGroup = aGroupMapIter->second;
+         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+         VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
+         for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+           const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+           const string& aFamilyName = aFamilyAndEntity.first;
+           const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+           aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                            VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
+           string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
+           CreateReference(myStudyDocument,aGroupEntry,anEntry);
+         }
+       }
+      }
+      //Import fields
+      string aFieldsEntry;
+      bool isFieldEntryCreated = 0;
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+         if(!isFieldEntryCreated){
+           aComment.sprintf("myComment=FIELDS;myMeshName=%s",aMeshName.c_str());
+           aFieldsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                           "","Fields","",aComment.latin1(),true);
+           isFieldEntryCreated = true;
+         }
+         const string& aFieldName = aFieldMapIter->first;
+         const VISU::TField& aField = aFieldMapIter->second;
+         const VISU::TField::TValField& aValField = aField.myValField;
+         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
+         string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "",aFieldName.c_str(),"",aComment.latin1(),true);
+         CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
+         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         for(; aValFieldIter != aValField.end(); aValFieldIter++){
+           int aTimeStamp = aValFieldIter->first;
+           const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
+           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
+           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
+           CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
+                            "",aTimeStampId.c_str(),"",aComment.latin1(),true);
+         }
+       }
+      }
+    }
+  }
+  return this;
+}
+
+VISU::Storable* VISU::Result_i::Create(const char* theFileName){
+  try{
+    mySourceId = eFile;
+    myInput = CreateConvertor(theFileName);
+    if(myInput == NULL) return NULL;
+    myFileInfo.setFile(theFileName);
+    myName = ::GenerateName(myFileInfo.fileName().latin1());
+    return Build();
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return NULL;
+}
+
+VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
+  if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from theMedSObject");
+  try{
+    mySourceId = eComponent;
+    myInput = CreateMEDConvertor(theMedSObject);
+    if(myInput == NULL) return NULL;
+    string aCompDataType = GetComponentDataType(theMedSObject);
+    myFileInfo.setFile(aCompDataType.c_str());
+    myName = ::GenerateName("aResult");
+    return Build(theMedSObject);
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return NULL;
+}
+
+VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, 
+                                       const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  if(MYDEBUG)  MESSAGE("Result_i::Restore - "<<thePrefix);
+  try{
+    mySObject = SALOMEDS::SObject::_duplicate(theSObject);
+    myStudyDocument = mySObject->GetStudy();
+    mySComponent = mySObject->GetFatherComponent();
+    myName = VISU::Storable::FindValue(theMap,"myName");
+    SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
+    if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
+      mySourceId = eRestoredComponent;
+      if(MYDEBUG)  MESSAGE("Result_i::GetInput - There is some reference.");
+      SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
+      CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
+      myFileInfo.setFile(aDataType.in());
+      if(MYDEBUG)  MESSAGE("Result_i::GetInput - aDataType = "<<aDataType);
+      Engines::Component_var aEngComp = Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
+      if (CORBA::is_nil(aEngComp)) 
+       throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
+      SALOMEDS::StudyBuilder_var  aStudyBuilder = myStudyDocument->NewBuilder();
+      SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
+      aStudyBuilder->LoadWith(aCompRefSObj,aDriver);
+      if(strcmp(aDataType,"Med") == 0){
+       myInput = CreateMEDConvertor(aTargetRefSObj);
+      }else
+       throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
+    }else{
+      mySourceId = eRestoredFile;
+      myFileInfo.setFile(thePrefix.c_str());
+      string aStudyPrefix(SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
+      string aTmpDir(SALOMEDS_Tool::GetDirFromPath(myStudyDocument->URL()));
+      if(!myFileInfo.isFile()){
+       string aFileName = thePrefix + aStudyPrefix + "_" + myName;  
+       myFileInfo.setFile(aFileName.c_str());
+      }
+      if(MYDEBUG)  
+       MESSAGE("Result_i::Restore - aFileName = "<<myFileInfo.filePath()<<"; "<<myFileInfo.isFile());
+      myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
+      QString aComment;
+      aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
+                      GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
+      SALOMEDS::GenericAttribute_var anAttr;
+      if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
+       throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
+      SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+      aCmnt->SetValue(aComment.latin1());
+      // remove temporary file, if it's not multifile mode
+      if (false || !IsMultifile()) {
+       SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+       aSeq->length(1);
+       aSeq[0]=(aStudyPrefix + myName).c_str();
+       SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+      }
+    }
+    return this;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return NULL;
+}
+
+VISU::Result_i::InputType* VISU::Result_i::GetInput() { 
+  return myInput;
+}
+
+void VISU::Result_i::ToStream(ostrstream& theStr){
+  if(MYDEBUG) MESSAGE(GetComment());
+  Storable::DataToStream(theStr,"myName",myName.c_str());
+}
+
+VISU::Storable* VISU::ResultRestore(SALOMEDS::SObject_ptr theSObject, 
+                                   const string& thePrefix, const Storable::TRestoringMap& theMap)
+     throw(std::logic_error&)
+{
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISU::Result_i* pResult = new VISU::Result_i(aStudy);
+  if(pResult == NULL) return NULL;
+  return pResult->Restore(theSObject,thePrefix,theMap);
+}
+     
+string VISU::Result_i::GetRefFatherEntry() { 
+  //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry();
+  return "";
+}
+
+string VISU::Result_i::GetEntry(){ 
+  CORBA::String_var anEntry = mySObject->GetID();
+  return string(anEntry);
+}
+
+const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
+const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
+const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
+
+VISU::Result_i::~Result_i() {
+  if(MYDEBUG) MESSAGE("Result_i::~Result_i()");
+  if(myInput) delete myInput;
+}
diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh
new file mode 100644 (file)
index 0000000..441e826
--- /dev/null
@@ -0,0 +1,71 @@
+// File:       VISU_Result_i.hh
+// Created:    Fri Jan 10 12:36:38 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+#ifndef __VISU_RESULT_I_H__
+#define __VISU_RESULT_I_H__
+
+#include "VISUConfig.hh"
+
+class vtkUnstructuredGridReader;
+class vtkUnstructuredGrid;
+class VISU_Convertor;
+class FieldInfo;
+class QAD_Study;
+
+namespace VISU{
+  class Result_i : public virtual POA_VISU::Result,
+                   public virtual Storable
+  {
+    Result_i();
+    Result_i(const Result_i &);
+  public:
+    Result_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~Result_i();
+
+    virtual VISU::VISUType GetType() { return VISU::TRESULT;};
+
+    typedef VISU_Convertor InputType;
+    typedef vtkUnstructuredGridReader OutputType;
+    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+  private:
+    TSourceId mySourceId;
+    InputType *myInput;
+    string myName;
+    QFileInfo myFileInfo;
+  protected:
+    virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = NULL) 
+      throw (std::runtime_error&);
+  public:
+    virtual Storable* Create(const char* theFileName);
+    virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
+    virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
+                             const string& thePrefix, const Storable::TRestoringMap& theMap)
+      throw(std::logic_error&);
+    virtual void ToStream(ostrstream& theStr);
+    virtual const char* GetComment() const;
+    static const string myComment;
+    InputType* GetInput();
+    const string& GetName() const { return myName;}
+    const QFileInfo& GetFileInfo() const { return myFileInfo;}
+    Result_i::TSourceId GetSourceId() const { return mySourceId;}
+  private:
+    SALOMEDS::SObject_var mySObject;
+    SALOMEDS::Study_var myStudyDocument;
+    SALOMEDS::SComponent_var mySComponent;
+  public:
+    string GetRefFatherEntry();
+    string GetEntry();
+    const SALOMEDS::SObject_var& GetSObject() const;
+    const SALOMEDS::Study_var& GetStudyDocument() const;
+    const SALOMEDS::SComponent_var& GetSComponent() const;
+  };
+  Storable* ResultRestore(SALOMEDS::SObject_ptr theSObject, 
+                          const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&);
+  Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
+  QString GenerateName(const string& theFmt, int theId);
+  void WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName);
+}
+#endif
diff --git a/src/VISU_I/VISU_ScalarBarActor.cxx b/src/VISU_I/VISU_ScalarBarActor.cxx
new file mode 100644 (file)
index 0000000..754779c
--- /dev/null
@@ -0,0 +1,600 @@
+using namespace std;
+// File:       VISU_ScalarBarActor.cxx
+// Created:    Wed Feb 26 10:34:56 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_LookupTable.hxx"
+#include <vtkObjectFactory.h>
+
+//------------------------------------------------------------------------------
+VISU_ScalarBarActor* VISU_ScalarBarActor::New(){
+  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_ScalarBarActor");
+  if(ret)
+    return (VISU_ScalarBarActor*)ret;
+  return new VISU_ScalarBarActor;
+}
+
+VISU_ScalarBarActor::VISU_ScalarBarActor()
+{
+  this->myLookupTable = NULL;
+  this->Position2Coordinate->SetValue(0.17, 0.8);
+  
+  this->PositionCoordinate->SetCoordinateSystemToNormalizedViewport();
+  this->PositionCoordinate->SetValue(0.82,0.1);
+  
+  this->MaximumNumberOfColors = 64;
+  this->NumberOfLabels = 5;
+  this->NumberOfLabelsBuilt = 0;
+  this->Orientation = VTK_ORIENT_VERTICAL;
+  this->Title = NULL;
+
+  this->Bold = 1;
+  this->Italic = 1;
+  this->Shadow = 1;
+  this->FontFamily = VTK_ARIAL;
+  this->LabelFormat = new char[8]; 
+  sprintf(this->LabelFormat,"%s","%-#6.3g");
+
+  this->TitleMapper = vtkTextMapper::New();
+  this->TitleMapper->SetJustificationToCentered();
+  this->TitleActor = vtkActor2D::New();
+  this->TitleActor->SetMapper(this->TitleMapper);
+  this->TitleActor->GetPositionCoordinate()->
+    SetReferenceCoordinate(this->PositionCoordinate);
+  
+  this->TextMappers = NULL;
+  this->TextActors = NULL;
+
+  this->ScalarBar = vtkPolyData::New();
+  this->ScalarBarMapper = vtkPolyDataMapper2D::New();
+  this->ScalarBarMapper->SetInput(this->ScalarBar);
+  this->ScalarBarActor = vtkActor2D::New();
+  this->ScalarBarActor->SetMapper(this->ScalarBarMapper);
+  this->ScalarBarActor->GetPositionCoordinate()->
+    SetReferenceCoordinate(this->PositionCoordinate);
+  this->LastOrigin[0] = 0;
+  this->LastOrigin[1] = 0;
+  this->LastSize[0] = 0;
+  this->LastSize[1] = 0;
+}
+
+void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win)
+{
+  this->TitleActor->ReleaseGraphicsResources(win);
+  if (this->TextMappers != NULL )
+    {
+    for (int i=0; i < this->NumberOfLabelsBuilt; i++)
+      {
+      this->TextActors[i]->ReleaseGraphicsResources(win);
+      }
+    }
+  this->ScalarBarActor->ReleaseGraphicsResources(win);
+}
+
+VISU_ScalarBarActor::~VISU_ScalarBarActor()
+{
+  if (this->LabelFormat) 
+    {
+    delete [] this->LabelFormat;
+    this->LabelFormat = NULL;
+    }
+
+  this->TitleMapper->Delete();
+  this->TitleActor->Delete();
+
+  if (this->TextMappers != NULL )
+    {
+    for (int i=0; i < this->NumberOfLabelsBuilt; i++)
+      {
+      this->TextMappers[i]->Delete();
+      this->TextActors[i]->Delete();
+      }
+    delete [] this->TextMappers;
+    delete [] this->TextActors;
+    }
+
+  this->ScalarBar->Delete();
+  this->ScalarBarMapper->Delete();
+  this->ScalarBarActor->Delete();
+
+  if (this->Title)
+    {
+    delete [] this->Title;
+    this->Title = NULL;
+    }
+  
+  this->SetLookupTable(NULL);
+}
+
+void VISU_ScalarBarActor::SetLookupTable(vtkScalarsToColors* theLookupTable){
+  //this->myLookupTable = dynamic_cast<VISU_LookupTable*>(theLookupTable);
+  if(this->myLookupTable != NULL) this->myLookupTable->UnRegister(this);
+  this->myLookupTable = VISU_LookupTable::SafeDownCast(theLookupTable);
+  this->myLookupTable->Register(this);
+}
+
+vtkScalarsToColors* VISU_ScalarBarActor::GetLookupTable(){
+  cout<<"VISU_ScalarBarActor::GetLookupTable = "<<this->myLookupTable;
+  return this->myLookupTable;
+}
+
+int VISU_ScalarBarActor::RenderOverlay(vtkViewport *viewport)
+{
+  int renderedSomething = 0;
+  int i;
+  
+  // Everything is built, just have to render
+  if (this->Title != NULL)
+    {
+    renderedSomething += this->TitleActor->RenderOverlay(viewport);
+    }
+  this->ScalarBarActor->RenderOverlay(viewport);
+  if( this->TextActors == NULL)
+    {
+     vtkWarningMacro(<<"Need a mapper to render a scalar bar");
+     return renderedSomething;
+    }
+  
+  for (i=0; i<this->NumberOfLabels; i++)
+    {
+    renderedSomething += this->TextActors[i]->RenderOverlay(viewport);
+    }
+
+  renderedSomething = (renderedSomething > 0)?(1):(0);
+
+  return renderedSomething;
+}
+
+int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  int renderedSomething = 0;
+  int i;
+  int size[2];
+  
+  if ( ! this->myLookupTable )
+    {
+    vtkWarningMacro(<<"Need a mapper to render a scalar bar");
+    return 0;
+    }
+
+  // Check to see whether we have to rebuild everything
+  if ( viewport->GetMTime() > this->BuildTime || 
+       ( viewport->GetVTKWindow() && 
+        viewport->GetVTKWindow()->GetMTime() > this->BuildTime ) )
+    {
+    // if the viewport has changed we may - or may not need
+    // to rebuild, it depends on if the projected coords chage
+    int *barOrigin;
+    barOrigin = this->PositionCoordinate->GetComputedViewportValue(viewport);
+    size[0] = 
+      this->Position2Coordinate->GetComputedViewportValue(viewport)[0] -
+      barOrigin[0];
+    size[1] = 
+      this->Position2Coordinate->GetComputedViewportValue(viewport)[1] -
+      barOrigin[1];
+    if (this->LastSize[0] != size[0] || this->LastSize[1] != size[1] ||
+       this->LastOrigin[0] != barOrigin[0] || 
+       this->LastOrigin[1] != barOrigin[1])
+      {
+      this->Modified();
+      }
+    }
+  
+  // Check to see whether we have to rebuild everything
+  if ( this->GetMTime() > this->BuildTime || 
+       this->myLookupTable->GetMTime() > this->BuildTime )
+    {
+    vtkDebugMacro(<<"Rebuilding subobjects");
+
+    // Delete previously constructed objects
+    //
+    if (this->TextMappers != NULL )
+      {
+      for (i=0; i < this->NumberOfLabelsBuilt; i++)
+       {
+       this->TextMappers[i]->Delete();
+       this->TextActors[i]->Delete();
+       }
+      delete [] this->TextMappers;
+      delete [] this->TextActors;
+      }
+
+    // Build scalar bar object
+    //
+    VISU_LookupTable *lut = this->myLookupTable;  //VISU specific
+    // we hard code how many steps to display
+    int numColors = this->MaximumNumberOfColors;
+    float *range = lut->GetRange();
+
+    int numPts = 2*(numColors + 1);
+    vtkPoints *pts = vtkPoints::New();
+    pts->SetNumberOfPoints(numPts);
+    vtkCellArray *polys = vtkCellArray::New();
+    polys->Allocate(polys->EstimateSize(numColors,4));
+    vtkScalars *colors = vtkScalars::New(VTK_UNSIGNED_CHAR,3);
+    colors->SetNumberOfScalars(numColors);
+    vtkUnsignedCharArray *colorData = (vtkUnsignedCharArray *)colors->GetData();
+
+    this->ScalarBarActor->SetProperty(this->GetProperty());
+    this->ScalarBar->Initialize();
+    this->ScalarBar->SetPoints(pts);
+    this->ScalarBar->SetPolys(polys);
+    this->ScalarBar->GetCellData()->SetScalars(colors);
+    pts->Delete(); polys->Delete(); colors->Delete();
+
+    // get the viewport size in display coordinates
+    int *barOrigin, barWidth, barHeight;
+    barOrigin = this->PositionCoordinate->GetComputedViewportValue(viewport);
+    size[0] = 
+      this->Position2Coordinate->GetComputedViewportValue(viewport)[0] -
+      barOrigin[0];
+    size[1] = 
+      this->Position2Coordinate->GetComputedViewportValue(viewport)[1] -
+      barOrigin[1];
+    this->LastOrigin[0] = barOrigin[0];
+    this->LastOrigin[1] = barOrigin[1];
+    this->LastSize[0] = size[0];
+    this->LastSize[1] = size[1];
+    
+    // Update all the composing objects
+    //
+    if (this->Title == NULL )
+      {
+      this->TitleActor->VisibilityOff();
+      }
+    this->TitleActor->VisibilityOn();
+    this->TitleActor->SetProperty(this->GetProperty());
+    this->TitleMapper->SetInput(this->Title);
+    this->TitleMapper->SetBold(this->Bold);
+    this->TitleMapper->SetItalic(this->Italic);
+    this->TitleMapper->SetShadow(this->Shadow);
+    this->TitleMapper->SetFontFamily(this->FontFamily);
+
+    
+    // find the best size for the title font
+    int titleSize[2];
+    this->SizeTitle(titleSize, size, viewport);
+    
+    // find the best size for the ticks
+    int labelSize[2];
+    this->AllocateAndSizeLabels(labelSize, size, viewport,range);
+    this->NumberOfLabelsBuilt = this->NumberOfLabels;
+    
+    // generate points
+    float x[3]; x[2] = 0.0;
+    float delta;
+    if ( this->Orientation == VTK_ORIENT_VERTICAL )
+      {
+      barWidth = size[0] - 4 - labelSize[0];
+      barHeight = (int)(0.86*size[1]);
+      delta=(float)barHeight/numColors;
+      for (i=0; i<numPts/2; i++)
+       {
+       x[0] = 0;
+       x[1] = i*delta;
+        pts->SetPoint(2*i,x);
+       x[0] = barWidth;
+        pts->SetPoint(2*i+1,x);
+       }
+      }
+    else
+      {
+      barWidth = size[0];
+      barHeight = (int)(0.4*size[1]);
+      delta=(float)barWidth/numColors;
+      for (i=0; i<numPts/2; i++)
+       {
+       x[0] = i*delta;
+       x[1] = barHeight;
+        pts->SetPoint(2*i,x);
+       x[1] = 0;
+        pts->SetPoint(2*i+1,x);
+       }
+      }
+
+    //polygons & cell colors
+    unsigned char *rgba, *rgb;
+    int ptIds[4];
+    float val, *aLogRange = this->myLookupTable->GetLogRange();
+    for (i=0; i<numColors; i++)
+      {
+      ptIds[0] = 2*i;
+      ptIds[1] = ptIds[0] + 1;
+      ptIds[2] = ptIds[1] + 2;
+      ptIds[3] = ptIds[0] + 2;
+      polys->InsertNextCell(4,ptIds);
+      rgba = lut->MapValue(range[0] + (range[1] - range[0])*((float)i /(numColors-1.0)));
+      if(this->myLookupTable->IsLog()){ // SALOME specific
+       val = aLogRange[0] + (float)i/(numColors-1.0) * (aLogRange[1]-aLogRange[0]);
+       rgba = lut->MapValue(val);
+      }
+      rgb = colorData->GetPointer(3*i); //write into array directly
+      rgb[0] = rgba[0];
+      rgb[1] = rgba[1];
+      rgb[2] = rgba[2];
+      }
+
+    // Now position everything properly
+    //
+    if (this->Orientation == VTK_ORIENT_VERTICAL)
+      {
+      int sizeTextData[2];
+      
+      // center the title
+      this->TitleActor->SetPosition(size[0]/2, 0.9*size[1]);
+      
+      for (i=0; i < this->NumberOfLabels; i++)
+       {
+       val = (float)i/(this->NumberOfLabels-1) *barHeight;
+       this->TextMappers[i]->SetJustificationToLeft();
+        this->TextMappers[i]->GetSize(viewport,sizeTextData);
+        this->TextActors[i]->SetPosition(barWidth+3,
+                                         val - sizeTextData[1]/2);
+       }
+      }
+    else
+      {
+      this->TitleActor->SetPosition(size[0]/2, 
+                                    barHeight + labelSize[1] + 0.1*size[1]);
+      for (i=0; i < this->NumberOfLabels; i++)
+       {
+       val = (float)i/(this->NumberOfLabels-1) * barWidth;
+       this->TextMappers[i]->SetJustificationToCentered();
+       this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]);
+       }
+      }
+
+    this->BuildTime.Modified();
+    }
+
+  // Everything is built, just have to render
+  if (this->Title != NULL)
+    {
+    renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
+    }
+  this->ScalarBarActor->RenderOpaqueGeometry(viewport);
+  for (i=0; i<this->NumberOfLabels; i++)
+    {
+    renderedSomething += this->TextActors[i]->RenderOpaqueGeometry(viewport);
+    }
+
+  renderedSomething = (renderedSomething > 0)?(1):(0);
+
+  return renderedSomething;
+}
+
+void VISU_ScalarBarActor::PrintSelf(ostream& os, vtkIndent indent)
+{
+  vtkActor2D::PrintSelf(os,indent);
+
+  if ( this->myLookupTable )
+    {
+    os << indent << "Lookup Table:\n";
+    this->myLookupTable->PrintSelf(os,indent.GetNextIndent());
+    }
+  else
+    {
+    os << indent << "Lookup Table: (none)\n";
+    }
+
+  os << indent << "Title: " << (this->Title ? this->Title : "(none)") << "\n";
+  os << indent << "Maximum Number Of Colors: " 
+     << this->MaximumNumberOfColors << "\n";
+  os << indent << "Number Of Labels: " << this->NumberOfLabels << "\n";
+  os << indent << "Number Of Labels Built: " << this->NumberOfLabelsBuilt << "\n";
+
+  os << indent << "Orientation: ";
+  if ( this->Orientation == VTK_ORIENT_HORIZONTAL )
+    {
+    os << "Horizontal\n";
+    }
+  else
+    {
+    os << "Vertical\n";
+    }
+
+  os << indent << "Font Family: ";
+  if ( this->FontFamily == VTK_ARIAL )
+    {
+    os << "Arial\n";
+    }
+  else if ( this->FontFamily == VTK_COURIER )
+    {
+    os << "Courier\n";
+    }
+  else
+    {
+    os << "Times\n";
+    }
+
+  os << indent << "Bold: " << (this->Bold ? "On\n" : "Off\n");
+  os << indent << "Italic: " << (this->Italic ? "On\n" : "Off\n");
+  os << indent << "Shadow: " << (this->Shadow ? "On\n" : "Off\n");
+  os << indent << "Label Format: " << this->LabelFormat << "\n";
+}
+
+void VISU_ScalarBarActor::ShallowCopy(vtkProp *prop)
+{
+  VISU_ScalarBarActor *a = VISU_ScalarBarActor::SafeDownCast(prop);
+  if ( a != NULL )
+    {
+    this->SetPosition2(a->GetPosition2());
+    this->SetLookupTable(a->GetLookupTable());
+    this->SetMaximumNumberOfColors(a->GetMaximumNumberOfColors());
+    this->SetOrientation(a->GetOrientation());
+    this->SetBold(a->GetBold());
+    this->SetItalic(a->GetItalic());
+    this->SetShadow(a->GetShadow());
+    this->SetFontFamily(a->GetFontFamily());
+    this->SetLabelFormat(a->GetLabelFormat());
+    this->SetTitle(a->GetTitle());
+
+    this->GetPositionCoordinate()->SetCoordinateSystem(
+      a->GetPositionCoordinate()->GetCoordinateSystem());    
+    this->GetPositionCoordinate()->SetValue(
+      a->GetPositionCoordinate()->GetValue());
+    this->GetPosition2Coordinate()->SetCoordinateSystem(
+      a->GetPosition2Coordinate()->GetCoordinateSystem());    
+    this->GetPosition2Coordinate()->SetValue(
+      a->GetPosition2Coordinate()->GetValue());
+    }
+
+  // Now do superclass
+  this->vtkActor2D::ShallowCopy(prop);
+}
+
+void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size,
+                                              vtkViewport *viewport,
+                                              float *range)
+{
+  labelSize[0] = 0;
+  labelSize[1] = 0;
+  int fontSize;
+  int tempi[2];
+  
+  this->TextMappers = new vtkTextMapper * [this->NumberOfLabels];
+  this->TextActors = new vtkActor2D * [this->NumberOfLabels];
+  char string[512];
+  float val, *aLogRange = this->myLookupTable->GetLogRange();
+  int targetWidth, targetHeight;
+  int i;
+  
+  for (i=0; i < this->NumberOfLabels; i++)
+    {
+    this->TextMappers[i] = vtkTextMapper::New();
+    val = range[0] + (float)i/(this->NumberOfLabels-1) * (range[1]-range[0]);
+    if(0 < i && i < this->NumberOfLabels - 1)  // SALOME specific
+       if(this->myLookupTable->IsLog()){
+        val = aLogRange[0] + (float)i/(this->NumberOfLabels-1) * (aLogRange[1]-aLogRange[0]);
+        val = pow((float)10.0,val);
+       }
+    sprintf(string, this->LabelFormat, val);
+    this->TextMappers[i]->SetInput(string);
+    this->TextMappers[i]->SetBold(this->Bold);
+    this->TextMappers[i]->SetItalic(this->Italic);
+    this->TextMappers[i]->SetShadow(this->Shadow);
+    this->TextMappers[i]->SetFontFamily(this->FontFamily);
+    this->TextActors[i] = vtkActor2D::New();
+    this->TextActors[i]->SetMapper(this->TextMappers[i]);
+    this->TextActors[i]->SetProperty(this->GetProperty());
+    this->TextActors[i]->GetPositionCoordinate()->
+      SetReferenceCoordinate(this->PositionCoordinate);
+    }
+  if (this->NumberOfLabels)
+    {
+    if ( this->Orientation == VTK_ORIENT_VERTICAL )
+      {
+      targetWidth = (int)(0.6*size[0]);
+      targetHeight = (int)(0.86*size[1]/this->NumberOfLabels);
+      }
+    else
+      {
+      targetWidth = (int)(size[0]*0.8/this->NumberOfLabels);
+      targetHeight = (int)(0.25*size[1]);
+      }
+    fontSize = targetWidth;
+    for (i=0; i < this->NumberOfLabels; i++)
+      {
+      this->TextMappers[i]->SetFontSize(fontSize);
+      this->TextMappers[i]->GetSize(viewport,tempi);
+      if (labelSize[0] < tempi[0])
+        {
+        labelSize[0] = tempi[0];
+        }
+      if (labelSize[1] < tempi[1])
+        {
+        labelSize[1] = tempi[1];
+        }
+      }
+    
+    while (labelSize[0] < targetWidth && labelSize[1] < targetHeight && 
+           fontSize < 100 ) 
+      {
+      fontSize++;
+      labelSize[0] = 0;
+      labelSize[1] = 0;
+      for (i=0; i < this->NumberOfLabels; i++)
+        {
+        this->TextMappers[i]->SetFontSize(fontSize);
+        this->TextMappers[i]->GetSize(viewport,tempi);
+        if (labelSize[0] < tempi[0])
+          {
+          labelSize[0] = tempi[0];
+          }
+        if (labelSize[1] < tempi[1])
+          {
+          labelSize[1] = tempi[1];
+          }
+        }
+      }
+    
+    while ((labelSize[0] > targetWidth || 
+            labelSize[1] > targetHeight) && fontSize > 0 )
+      {
+      fontSize--;
+      labelSize[0] = 0;
+      labelSize[1] = 0;
+      for (i=0; i < this->NumberOfLabels; i++)
+        {
+        this->TextMappers[i]->SetFontSize(fontSize);
+        this->TextMappers[i]->GetSize(viewport,tempi);
+        if (labelSize[0] < tempi[0])
+          {
+          labelSize[0] = tempi[0];
+          }
+        if (labelSize[1] < tempi[1])
+          {
+          labelSize[1] = tempi[1];
+          }
+        }
+      }
+    }
+}
+
+void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size, 
+                                  vtkViewport *viewport)
+{
+  int targetWidth, targetHeight;
+  titleSize[0] = 0;    
+  titleSize[1] = 0;
+  int fontSize;
+  int tempi[2];
+  
+  if (this->Title != NULL && (strlen(this->Title) != 0))
+    {
+    if ( this->Orientation == VTK_ORIENT_VERTICAL )
+      {
+      targetWidth = size[0];
+      targetHeight = (int)(0.1*size[1]);
+      }
+    else
+      {
+      targetWidth = size[0];
+      targetHeight = (int)(0.25*size[1]);
+      }
+    fontSize = targetWidth;
+    this->TitleMapper->SetFontSize(fontSize);
+    this->TitleMapper->GetSize(viewport,tempi);
+    
+    while (tempi[1] < targetHeight && tempi[0] < targetWidth 
+           && fontSize < 100 ) 
+      {
+      fontSize++;
+      this->TitleMapper->SetFontSize(fontSize);
+      this->TitleMapper->GetSize(viewport,tempi);
+      }
+    
+    while ((tempi[1] > targetHeight || tempi[0] > targetWidth )
+           && fontSize > 0 )
+      {
+      fontSize--;
+      this->TitleMapper->SetFontSize(fontSize);
+      this->TitleMapper->GetSize(viewport,tempi);
+      }
+    titleSize[0] = tempi[0];
+    titleSize[1] = tempi[1];
+    }
+}
diff --git a/src/VISU_I/VISU_ScalarBarActor.hxx b/src/VISU_I/VISU_ScalarBarActor.hxx
new file mode 100644 (file)
index 0000000..9e4ed8b
--- /dev/null
@@ -0,0 +1,116 @@
+// File:       VISU_ScalarBarActor.hxx
+// Created:    Wed Feb 26 10:13:15 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_ScalarBarActor_HeaderFile
+#define VISU_ScalarBarActor_HeaderFile
+
+#include <vtkScalarBarActor.h>
+#include <vtkActor2D.h>
+#include <vtkScalarsToColors.h>
+#include <vtkPolyDataMapper2D.h>
+#include <vtkTextMapper.h>
+
+class VISU_LookupTable;
+
+#define VTK_ORIENT_HORIZONTAL 0
+#define VTK_ORIENT_VERTICAL 1
+
+class VTK_EXPORT VISU_ScalarBarActor : public vtkActor2D
+{
+public:
+  vtkTypeMacro(VISU_ScalarBarActor,vtkActor2D);
+  void PrintSelf(ostream& os, vtkIndent indent);
+
+  static VISU_ScalarBarActor *New();
+
+  int RenderOpaqueGeometry(vtkViewport* viewport);
+  int RenderTranslucentGeometry(vtkViewport*) { return 0; };
+  int RenderOverlay(vtkViewport* viewport);
+
+  virtual void ReleaseGraphicsResources(vtkWindow *);
+
+  void SetLookupTable(vtkScalarsToColors*);
+  vtkScalarsToColors* GetLookupTable();
+
+  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
+  vtkGetMacro(MaximumNumberOfColors, int);
+
+  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
+  vtkGetMacro(NumberOfLabels, int);
+  
+  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
+  vtkGetMacro(Orientation, int);
+  void SetOrientationToHorizontal()
+       {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
+  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
+
+  vtkSetMacro(Bold, int);
+  vtkGetMacro(Bold, int);
+  vtkBooleanMacro(Bold, int);
+
+  vtkSetMacro(Italic, int);
+  vtkGetMacro(Italic, int);
+  vtkBooleanMacro(Italic, int);
+
+  vtkSetMacro(Shadow, int);
+  vtkGetMacro(Shadow, int);
+  vtkBooleanMacro(Shadow, int);
+
+  vtkSetMacro(FontFamily, int);
+  vtkGetMacro(FontFamily, int);
+  void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
+  void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
+  void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
+
+  vtkSetStringMacro(LabelFormat);
+  vtkGetStringMacro(LabelFormat);
+
+  vtkSetStringMacro(Title);
+  vtkGetStringMacro(Title);
+
+  void ShallowCopy(vtkProp *prop);
+
+protected:
+  VISU_ScalarBarActor();
+  ~VISU_ScalarBarActor();
+  VISU_ScalarBarActor(const VISU_ScalarBarActor&);
+  void operator=(const VISU_ScalarBarActor&);
+
+  VISU_LookupTable* myLookupTable;
+private:
+  int   MaximumNumberOfColors;
+  int   NumberOfLabels;
+  int   NumberOfLabelsBuilt;
+  int   Orientation;
+  char  *Title;
+
+  int  Bold;
+  int   Italic;
+  int   Shadow;
+  int   FontFamily;
+  char  *LabelFormat;
+
+private:
+  vtkTextMapper *TitleMapper;
+  vtkActor2D    *TitleActor;
+
+  vtkTextMapper **TextMappers;
+  vtkActor2D    **TextActors;
+
+  vtkPolyData         *ScalarBar;
+  vtkPolyDataMapper2D *ScalarBarMapper;
+  vtkActor2D          *ScalarBarActor;
+
+  vtkTimeStamp  BuildTime;
+  int LastSize[2];
+  int LastOrigin[2];
+
+  void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
+  void AllocateAndSizeLabels(int *labelSize, int *size,
+                             vtkViewport *viewport, float *range);
+};
+
+#endif
diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc
new file mode 100644 (file)
index 0000000..ba5dda3
--- /dev/null
@@ -0,0 +1,1053 @@
+using namespace std;
+// File:       VISU_Table_i.cc
+// Created:    Thu Feb 13 17:57:39 2003
+// Author:     Vadim SANDLER
+//             <vsr@rolex.nnov.matra-dtv.fr>
+
+#include "VISU_Table_i.hh"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_Study.h"
+#include <fstream>     
+#include <strstream>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+#include <memory>      
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------
+//                      Table Object
+//----------------------------------------------------------------
+int VISU::Table_i::myNbPresent = 0;
+const string VISU::Table_i::myComment  = "TABLE";
+/*! 
+  Generate unique name
+*/
+const char* VISU::Table_i::GenerateName() 
+{ 
+  return VISU::GenerateName( "Table", ++myNbPresent ); 
+}
+/*!
+  Gets comment string
+*/
+const char* VISU::Table_i::GetComment() const 
+{ 
+  return myComment.c_str(); 
+}
+/*!
+  Constructor
+*/
+VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
+     : PrsObject_i(theStudy)
+{
+  myObjectEntry = theObjectEntry; 
+  myOrientation = VISU::Table::HORIZONTAL;
+}
+/*!
+  Destructor
+*/
+VISU::Table_i::~Table_i()
+{
+}
+/*!
+  Gets number of rows in table
+*/
+CORBA::Long VISU::Table_i::GetNbRows()
+{
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  if ( !SO->_is_nil() ) {
+    SALOMEDS::GenericAttribute_var        anAttr;
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      SALOMEDS::AttributeTableOfInteger_var anInt =  SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      return anInt->GetNbRows();
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      SALOMEDS::AttributeTableOfReal_var aReal =  SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      return aReal->GetNbRows();
+    }
+  }
+  return 0;
+}
+/*!
+  Gets number of columns in table
+*/
+CORBA::Long VISU::Table_i::GetNbColumns()
+{
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  if ( !SO->_is_nil() ) {
+    SALOMEDS::GenericAttribute_var        anAttr;
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      SALOMEDS::AttributeTableOfInteger_var anInt =  SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      return anInt->GetNbColumns();
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      SALOMEDS::AttributeTableOfReal_var aReal =  SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      return aReal->GetNbColumns();
+    }
+  }
+  return 0;
+}
+/*!
+  Creates table object
+*/
+VISU::Storable* VISU::Table_i::Create()
+{
+  // generate name ... 
+  myName = GenerateName();
+  // ... and build the object
+  return Build( false );
+}
+/*!
+  Builds presentation of table
+*/
+VISU::Storable* VISU::Table_i::Build( int theRestoring ) 
+{
+  // look for reference SObject with table attribute
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  if ( !SO->_is_nil() ) {
+    SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+    SALOMEDS::GenericAttribute_var anAttr;
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) || 
+        Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      // look for component
+      if ( !theRestoring ) {
+       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+       // create SObject and set attributes
+       QString aComment;
+       aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TTABLE);
+       string anEntry = CreateAttributes( myStudy, 
+                                          SComponent->GetID(),
+                                          "",
+                                          GetID(),
+                                          GetName(),
+                                          "",
+                                          aComment.latin1(), 
+                                          true );
+       // create SObject referenced to real table object
+       SALOMEDS::SObject_var newSO = myStudy->FindObjectID( anEntry.c_str() );
+       SALOMEDS::SObject_var refSO = Builder->NewObject( newSO );
+       Builder->Addreference( refSO, SO );
+      }
+      return this;
+    }
+  }
+  return NULL;
+}
+/*!
+  Restores table object from stream
+*/
+VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap )
+     throw( std::logic_error& )
+{
+  if(MYDEBUG) MESSAGE(GetComment());
+  myName = VISU::Storable::FindValue(theMap,"myName");
+  myObjectEntry = VISU::Storable::FindValue(theMap,"myObjectEntry");
+  myTitle = VISU::Storable::FindValue(theMap,"myTitle");
+  myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
+  return Build( true );
+}
+/*!
+  Flushes table data into stream
+*/
+void VISU::Table_i::ToStream( ostrstream& theStr )
+{
+  Storable::DataToStream( theStr, "myName",        myName.c_str() );
+  Storable::DataToStream( theStr, "myObjectEntry", myObjectEntry.c_str() );
+  Storable::DataToStream( theStr, "myTitle",       myTitle.c_str() );
+  Storable::DataToStream( theStr, "myOrientation", myOrientation );
+
+//  theStr<<"\n myName ="<<myName;
+//  theStr<<" myObjectEntry "<<myObjectEntry;
+//  theStr<<" myTitle "<<myTitle;
+//  theStr<<" myOrientation "<<myOrientation;
+}
+/*!
+  Called from engine to restore table from the file
+*/
+VISU::Storable* VISU::TableRestore(SALOMEDS::SObject_ptr theSObject, 
+                                  const string& thePrefix, const Storable::TRestoringMap& theMap)
+{
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISU::Table_i* pResent = new VISU::Table_i( aStudy, "" );
+  return pResent->Restore( theMap );
+}
+
+//----------------------------------------------------------------
+//                      Curve Object
+//----------------------------------------------------------------
+/*!
+  Restores table object from the stream [ static ]
+*/
+static VISU::Table_i* GetTable( SALOMEDS::Study_var& theStudy, const VISU::Storable::TRestoringMap& theMap ) {
+  string anEntry = VISU::Storable::FindValue( theMap, "TableID" ).latin1();
+  SALOMEDS::SObject_var aSObject = theStudy->FindObjectID( anEntry.c_str() );
+  CORBA::Object_var anObject = VISU::SObjectToObject( aSObject );
+  if( !CORBA::is_nil( anObject ) ) {
+    CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
+    if( !CORBA::is_nil( aTable ) )
+      return dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+  }
+  return NULL;
+}
+
+int VISU::Curve_i::myNbPresent = 0;
+const string VISU::Curve_i::myComment  = "CURVE";
+/*! 
+  Generate unique name
+*/
+const char* VISU::Curve_i::GenerateName() 
+{ 
+  return VISU::GenerateName( "Curve", ++myNbPresent ); 
+}
+/*!
+  Gets comment string
+*/
+const char* VISU::Curve_i::GetComment() const 
+{ 
+  return myComment.c_str(); 
+}
+/*!
+  Constructor
+  NB : theHRow, theVRow are the indexes of rows in the Table object and numbered from the 1 to GetNbRows()
+*/
+VISU::Curve_i::Curve_i(SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow )
+     : PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ), myVRow( theVRow )
+{
+  myAuto = true;
+  myLine = VISU::Curve::SOLIDLINE;
+  myLineWidth = 0;
+  myMarker = VISU::Curve::CIRCLE;
+  myColor.R = 0.0; myColor.G = 0.0; myColor.B = 0.0;
+}
+/*!
+  Destructor
+*/
+VISU::Curve_i::~Curve_i()
+{
+}
+/*!
+  Creates curve object
+*/
+VISU::Storable* VISU::Curve_i::Create()
+{
+  // generate name ... 
+  myName = GenerateName();
+  // ... and build the object
+  return Build( false );
+}
+/*!
+  Builds presentation of curve
+*/
+VISU::Storable* VISU::Curve_i::Build( int theRestoring ) 
+{
+  if ( myTable != NULL ) {
+    // getting table SObject by it's entry
+    SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetEntry() );
+    int nbRows = myTable->GetNbRows();
+    if ( !SO->_is_nil() && myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
+      if ( !theRestoring ) {
+       // look for component
+       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+       // create SObject and set attributes
+       QString aComment;
+       aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
+       string anEntry = CreateAttributes( myStudy, 
+                                          myTable->GetEntry(),
+                                          "",
+                                          GetID(),
+                                          GetName(),
+                                          "",
+                                          aComment.latin1(),
+                                          true );
+      }
+      return this;
+    }
+  }
+  return NULL;
+}
+
+/*!
+  Returns CORBA::True if curve refers to valid table data
+*/
+CORBA::Boolean VISU::Curve_i::IsValid()
+{
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil() ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      if ( myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) {
+       return true;
+      }
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      if ( myHRow > 0 && myHRow <= aReal->GetNbRows() && myVRow > 0 && myVRow <= aReal->GetNbRows() ) {
+       return true;
+      }
+    }
+  }
+  return false;
+}
+/*!
+  Returns hor.axis title
+*/
+string VISU::Curve_i::GetHorTitle()
+{
+  string title;
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil() ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles();
+      if ( rowTitles->length() > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() ) {
+       title = strdup( rowTitles[ myHRow-1 ] );
+      }
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowTitles = aReal->GetRowTitles();
+      if ( rowTitles->length() > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() ) {
+       title = strdup( rowTitles[ myHRow-1 ] );
+      }
+    }
+  }
+  return title;
+}
+/*!
+  Returns ver.axis title
+*/
+string VISU::Curve_i::GetVerTitle()
+{
+  string title;
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil() ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles();
+      if ( rowTitles->length() > 0 && myVRow > 0 && myVRow <= anInt->GetNbRows() )
+       title = strdup( rowTitles[ myVRow-1 ] );
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowTitles = aReal->GetRowTitles();
+      if ( rowTitles->length() > 0 && myVRow > 0 && myVRow <= aReal->GetNbRows() )
+       title = strdup( rowTitles[ myVRow-1 ] );
+    }
+  }
+  return title;
+}
+/*!
+  Returns hor.axis units
+*/
+string VISU::Curve_i::GetHorUnits()
+{
+  string units;
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil()  ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowUnits = anInt->GetRowUnits();
+      if ( rowUnits->length() > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() )
+       units = strdup( rowUnits[ myHRow-1 ] );
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowUnits = aReal->GetRowUnits();
+      if ( rowUnits->length() > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() )
+       units = strdup( rowUnits[ myHRow-1 ] );
+    }
+  }
+  return units;
+}
+/*!
+  Returns ver.axis units
+*/
+string VISU::Curve_i::GetVerUnits()
+{
+  string units;
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil() ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowUnits = anInt->GetRowUnits();
+      if ( rowUnits->length() > 0 && myVRow > 0 && myVRow <= anInt->GetNbRows() )
+       units = strdup( rowUnits[ myVRow-1] );
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      SALOMEDS::StringSeq_var rowUnits = aReal->GetRowUnits();
+      if ( rowUnits->length() > 0 && myVRow > 0 && myVRow <= aReal->GetNbRows() )
+       units = strdup( rowUnits[ myVRow-1 ] );
+    }
+  }
+  return units;
+}
+/*!
+  Gets curve data
+*/
+int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
+{
+  theHorList = 0; theVerList = 0;
+  // getting table SObject by it's entry
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  if ( !SO->_is_nil() ) { 
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      int nbCols = anInt->GetNbColumns() ; 
+      if ( nbCols > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) {
+       int nbPoints = 0;
+       for ( int j = 1; j <= nbCols; j++ ) {
+         if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) )
+           nbPoints++;
+       }
+       if ( nbPoints > 0 ) {
+         theHorList = new double[ nbPoints ];
+         theVerList = new double[ nbPoints ];
+         for ( int j = 1; j <= nbCols; j++ ) {
+           if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) ) {
+             theHorList[j-1] = anInt->GetValue( myHRow, j );
+             theVerList[j-1] = anInt->GetValue( myVRow, j );
+           }
+         }
+       }
+       return nbPoints;
+      }
+    }
+    else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      int nbCols = aReal->GetNbColumns() ; 
+      if ( nbCols > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() && myVRow > 0 && myVRow <= aReal->GetNbRows() ) {
+       int nbPoints = 0;
+       for ( int j = 1; j <= nbCols; j++ ) {
+         if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) )
+           nbPoints++;
+       }
+       if ( nbPoints > 0 ) {
+         theHorList = new double[ nbPoints ];
+         theVerList = new double[ nbPoints ];
+         for ( int j = 1; j <= nbCols; j++ ) {
+           if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) ) {
+             theHorList[j-1] = aReal->GetValue( myHRow, j );
+             theVerList[j-1] = aReal->GetValue( myVRow, j );
+           }
+         }
+       }
+       return nbPoints;
+      }
+    }
+  }
+  return 0;
+}
+/*!
+  Creates curve Plot2d presentation object
+*/
+Plot2d_Curve* VISU::Curve_i::CreatePresentation()
+{
+  Plot2d_Curve* crv = new Plot2d_Curve();
+  crv->setHorTitle( strdup( GetHorTitle().c_str() ) );
+  //crv->setVerTitle( strdup( GetVerTitle().c_str() ) );
+  crv->setVerTitle( strdup( GetName() ) );
+  crv->setHorUnits( strdup( GetHorUnits().c_str() ) );
+  crv->setVerUnits( strdup( GetVerUnits().c_str() ) );
+  double* xList = 0;
+  double* yList = 0;
+  int     nbPoints = GetData( xList, yList );
+  if ( nbPoints > 0 && xList && yList ) {
+    crv->setData( xList, yList, nbPoints );
+  }
+  crv->setLine( (Plot2d_Curve::LineType)GetLine(), GetLineWidth() );
+  crv->setMarker( (Plot2d_Curve::MarkerType)GetMarker() ); 
+  SALOMEDS::Color color = GetColor();
+  crv->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+  crv->setAutoAssign( IsAuto() );
+  crv->setIO(new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",strdup(GetName()))); 
+  return crv;
+}
+/*!
+  Restores curve object from stream
+*/
+VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap )
+     throw( std::logic_error& )
+{
+  if(MYDEBUG) MESSAGE(GetComment());
+  myName = VISU::Storable::FindValue(theMap,"myName");
+  myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt();
+  myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt();
+  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
+  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
+  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
+  myMarker = ( VISU::Curve::MarkerType )( VISU::Storable::FindValue(theMap,"myMarker").toInt() );
+  myLine = ( VISU::Curve::LineType )( VISU::Storable::FindValue(theMap,"myLine").toInt() );
+  return Build( true );
+}
+/*!
+  Flushes curve data into stream
+*/
+void VISU::Curve_i::ToStream( ostrstream& theStr )
+{
+  Storable::DataToStream( theStr, "TableID",   GetTableID() );
+  Storable::DataToStream( theStr, "myName",    myName.c_str() );
+  Storable::DataToStream( theStr, "myHRow",    myHRow );
+  Storable::DataToStream( theStr, "myVRow",    myVRow );
+  Storable::DataToStream( theStr, "myColor.R", myColor.R );
+  Storable::DataToStream( theStr, "myColor.G", myColor.G );
+  Storable::DataToStream( theStr, "myColor.B", myColor.B );
+  Storable::DataToStream( theStr, "myMarker",  myMarker );
+  Storable::DataToStream( theStr, "myLine",    myLine );
+}
+/*!
+  Gets reference table's entry
+*/
+const char* VISU::Curve_i::GetTableID() { 
+  return myTable->GetEntry();
+}
+/*!
+  Called from engine to restore curve from the file
+*/
+VISU::Storable* VISU::CurveRestore(SALOMEDS::SObject_ptr theSObject, 
+                                  const string& thePrefix, const Storable::TRestoringMap& theMap)
+{
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISU::Table_i* pTable = GetTable( aStudy, theMap );
+  if( pTable != NULL ) {
+    VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0 );
+    return pResent->Restore( theMap );
+  }
+  return NULL;
+}
+
+//----------------------------------------------------------------
+//                      Container Object
+//----------------------------------------------------------------
+int VISU::Container_i::myNbPresent = 0;
+const string VISU::Container_i::myComment  = "CONTAINER";
+/*! 
+  Generate unique name
+*/
+const char* VISU::Container_i::GenerateName() 
+{ 
+  return VISU::GenerateName( "Container", ++myNbPresent ); 
+}
+/*!
+  Gets comment string
+*/
+const char* VISU::Container_i::GetComment() const 
+{ 
+  return myComment.c_str(); 
+}
+/*!
+  Constructor
+*/
+VISU::Container_i::Container_i( SALOMEDS::Study_ptr theStudy )
+     : PrsObject_i( theStudy )
+{
+}
+/*!
+  Destructor
+*/
+VISU::Container_i::~Container_i()
+{
+  myCurves.clear();
+}
+/*!
+  Inserts curve into the container
+*/
+void VISU::Container_i::AddCurve( Curve_ptr theCurve )
+{
+  if ( myStudy->_is_nil() )
+    return;
+  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  if ( mySO->_is_nil() )
+    return;
+  PortableServer::POA_var aPOA = GetPOA();
+  Curve_i* pCurve = dynamic_cast<Curve_i*>( aPOA->reference_to_servant( theCurve ) );
+  if( pCurve ) {
+    QString entry = pCurve->GetEntry();
+    SALOMEDS::SObject_var SO = myStudy->FindObjectID( entry.latin1() );
+    if ( !SO->_is_nil() && myCurves.find( entry ) == myCurves.end() ) {
+      myCurves.append( entry );
+      SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+      SALOMEDS::SObject_var newSO = Builder->NewObject( mySO );
+      Builder->Addreference( newSO, SO );
+    }
+  }
+}
+/*!
+  Removes curve from the container
+*/
+void VISU::Container_i::RemoveCurve( Curve_ptr theCurve )
+{
+  if ( myStudy->_is_nil() )
+    return;
+  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  if ( mySO->_is_nil() )
+    return;
+  PortableServer::POA_var aPOA = GetPOA();
+  Curve_i* pCurve = dynamic_cast<Curve_i*>( aPOA->reference_to_servant( theCurve ) );
+  if( pCurve ) {
+    QString entry = pCurve->GetEntry();
+    if ( myCurves.find( entry ) != myCurves.end() ) {
+      // found !!!
+      myCurves.remove( entry );
+      SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+      SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+      for ( ; CI->More(); CI->Next() ) {
+       SALOMEDS::SObject_var childSO = CI->Value();
+       SALOMEDS::SObject_var refSO;
+       if ( childSO->ReferencedObject( refSO ) && !refSO->_is_nil() && entry == QString( refSO->GetID() ) ) {
+         Builder->RemoveObject( childSO );
+       }
+      }
+    }
+  }
+}
+/*!
+  Gets number of curves in the container
+*/
+CORBA::Long VISU::Container_i::GetNbCurves()
+{
+  return myCurves.count();
+}
+/*!
+  Clears container
+*/
+void VISU::Container_i::Clear()
+{
+  if ( myStudy->_is_nil() )
+    return;
+  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  if ( mySO->_is_nil() )
+    return;
+  QStringList toDelete;
+  SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+  for ( ; CI->More(); CI->Next() ) {
+    toDelete.append( CI->Value()->GetID() );
+  }
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  for ( int i = 0; i < toDelete.count(); i++ ) {
+    SALOMEDS::SObject_var SO = myStudy->FindObjectID( toDelete[i].latin1() );
+    Builder->RemoveObject( SO );
+  }
+  myCurves.clear();
+}
+/*!
+  Creates container object
+*/
+VISU::Storable* VISU::Container_i::Create()
+{
+  // generate name ... 
+  myName = GenerateName();
+  // ... and build the object
+  return Build( false );
+}
+/*!
+  Builds presentation of container
+*/
+VISU::Storable* VISU::Container_i::Build( int theRestoring ) 
+{
+  if ( !theRestoring ) {
+    // looking for component
+    SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+    // create SObject and set attributes
+    QString aComment;
+    aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER);
+    string anEntry = CreateAttributes( myStudy, 
+                                      SComponent->GetID(),
+                                      "",
+                                      GetID(),
+                                      GetName(),
+                                      "",
+                                      aComment.latin1(),
+                                      true );
+  }
+  return this;
+}
+/*!
+  Updates presentation of container
+*/
+void VISU::Container_i::Update()
+{
+  if ( myStudy->_is_nil() )
+    return;
+  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  SALOMEDS::GenericAttribute_var anAttr;
+  if ( !mySO->_is_nil() ) {
+    QStringList toDelete;
+    int i;
+    for ( i = 0; i < myCurves.count(); i++ ) {
+      SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[i].latin1() );
+      if ( !SO->_is_nil() && Builder->FindAttribute( SO, anAttr, "AttributeIOR" ) ) {
+       // if real Curve Object still exists 
+       SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+       bool bFound = false;
+       for ( ; CI->More(); CI->Next() ) {
+         SALOMEDS::SObject_var childSO = CI->Value();
+         SALOMEDS::SObject_var refSO;
+         if ( childSO->ReferencedObject( refSO ) && !refSO->_is_nil() && myCurves[i] == QString( refSO->GetID() ) ) {
+           bFound = true; break;
+         }
+       }
+       if (! bFound ) {
+         // create SObject referenced to real curve object if is not yet added
+         SALOMEDS::SObject_var newSO = Builder->NewObject( mySO );
+         Builder->Addreference( newSO, SO );
+       }
+      }
+      else {
+       // real Curve Object doesn't exist (might be removed)
+       toDelete.append( myCurves[i] );
+      }
+    }
+    for ( i = 0; i < toDelete.count(); i++ ) { 
+      myCurves.remove( toDelete[i] );
+    }
+    toDelete.clear();
+    SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+    for ( ; CI->More(); CI->Next() ) {
+      SALOMEDS::SObject_var childSO = CI->Value();
+      SALOMEDS::SObject_var refSO;
+      if ( childSO->ReferencedObject( refSO ) && ( refSO->_is_nil() || !Builder->FindAttribute( refSO, anAttr, "AttributeIOR" ) ||
+                                                  myCurves.find( refSO->GetID() ) == myCurves.end() ) ) {
+       toDelete.append( childSO->GetID() );
+      }
+    }
+    for ( i = 0; i < toDelete.count(); i++ ) { 
+      SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+      for ( ; CI->More(); CI->Next() ) {
+       SALOMEDS::SObject_var childSO = CI->Value();
+       if ( toDelete[i] == CI->Value()->GetID() ) {
+         Builder->RemoveObject( childSO );
+       }
+      }
+    }
+  }
+}
+/*!
+  Gets curve from container by index
+  NB : curves are numbered from 1
+*/
+VISU::Curve_i* VISU::Container_i::GetCurve( CORBA::Long theIndex )
+{
+  if ( theIndex > 0 && theIndex <= myCurves.count()  ) {
+    SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+    SALOMEDS::GenericAttribute_var anAttr;
+    SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[  theIndex-1 ].latin1() );
+    CORBA::Object_var anObject = VISU::SObjectToObject( SO );
+    if( !CORBA::is_nil( anObject ) ) {
+      // if real Curve Object exists 
+      CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
+      if( !CORBA::is_nil( aCurve ) )
+      return dynamic_cast<VISU::Curve_i*>(VISU::GetServant( aCurve ) );
+    }
+  }
+  return NULL;
+}
+/*!
+  Restores container data from the stream
+*/
+VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMap )
+     throw( std::logic_error& )
+{
+  if(MYDEBUG) MESSAGE(GetComment());
+  myName = VISU::Storable::FindValue( theMap, "myName" ); 
+  QString val = VISU::Storable::FindValue( theMap, "myCurves" );
+  myCurves = QStringList::split( QString( "*" ), val, false );
+  return Build( true );
+}
+/*!
+  Flushes container data into the stream
+*/
+void VISU::Container_i::ToStream( ostrstream& theStr )
+{
+  Storable::DataToStream( theStr, "myName",   myName.c_str() );
+  Storable::DataToStream( theStr, "myCurves", myCurves.join( QString( "*" ) ) );
+//  theStr<<" myName "<<myName;
+//  theStr<<" myCurves "<<myCurves.join( QString( "*" ) ).latin1()<<"* ";
+}
+/*!
+  Called from engine to restore container from the file
+*/
+VISU::Storable* VISU::ContainerRestore(SALOMEDS::SObject_ptr theSObject, 
+                                      const string& thePrefix, const Storable::TRestoringMap& theMap)
+{
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  VISU::Container_i* pResent = new VISU::Container_i( aStudy );
+  return pResent->Restore( theMap );
+}
+
+//-------------------------------------------------------------
+//             Implementation of reading from file
+//-------------------------------------------------------------
+typedef vector<float> TValues;
+
+struct TRow{
+  string myTitle;
+  string myUnit;
+  TValues myValues;
+};
+
+typedef vector<TRow> TRows;
+
+struct TTable2D{
+  string myTitle;
+  vector<string> myColumnUnits;
+  vector<string> myColumnTitles;
+  TRows myRows;
+  int Check(){
+    if(myRows.empty()) return 0;
+    int iEnd = myRows[0].myValues.size();
+    if(iEnd == 0) return 0;
+    if(myColumnTitles.size() != iEnd) myColumnTitles.resize(iEnd);
+    if(myColumnUnits.size() != iEnd) myColumnUnits.resize(iEnd);
+    int jEnd = myRows.size();
+    for(int j = 0; j < jEnd; j++)
+      if(myRows[j].myValues.size() != iEnd) return 0;
+    return 1;
+  }
+  void getColumns(TTable2D& theTable2D) const {
+    TRows& aRows = theTable2D.myRows;
+    aRows.clear();
+    if(myRows.empty()) return;
+    int jEnd = myRows.size();
+    //Define Titles & Units
+    theTable2D.myColumnTitles.resize(jEnd);
+    theTable2D.myColumnUnits.resize(jEnd);
+    for(int j = 0; j < jEnd; j++){
+      theTable2D.myColumnTitles[j] = myRows[j].myTitle;
+      theTable2D.myColumnUnits[j] = myRows[j].myUnit;
+    }
+    //Define Rows
+    int iEnd = myRows[0].myValues.size();
+    for(int i = 0; i < iEnd; i++){
+      TRow aNewRow;
+      aNewRow.myTitle = myColumnTitles[i];
+      aNewRow.myUnit = myColumnUnits[i];
+      aNewRow.myValues.resize(jEnd);
+      for(int j = 0; j < jEnd; j++){
+       aNewRow.myValues[j] = myRows[j].myValues[i];
+      }
+      aRows.push_back(aNewRow);
+    }
+  }
+};
+
+typedef vector<TTable2D> TTableCont;
+
+int getLine(ifstream& theStmIn, QString& theString){
+  char tmp;
+  ostrstream aStrOut;
+  while(theStmIn.get(tmp)){
+    aStrOut<<tmp;
+    if(tmp == '\n') break;
+  }
+  aStrOut<<ends;
+  auto_ptr<char> aRet(aStrOut.str());
+  theString = aRet.get();
+  return !theStmIn.eof();
+}
+
+void ImportTables(const char* theFileName, TTableCont& theTableCont){
+  ifstream aStmIn;
+  QFileInfo aFileInfo(theFileName);
+  if(!aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size()) return;
+  aStmIn.open(theFileName);
+  QString aTmp;
+  do{
+    //Find beginning of Table
+    while(getLine(aStmIn,aTmp) && aTmp == "\n");
+    cout<<"\n There is new Table2D with Title = ";
+    TTable2D aTable2D;
+    while(!aStmIn.eof() && aTmp != "\n"){
+      if(aTmp.find("#TITLE:") == 0){
+       int aLen = aTmp.find(":") + 1;
+       aTmp.remove(0,aLen);
+       QString aTitle = aTmp.stripWhiteSpace();
+       aTable2D.myTitle = aTitle;
+       cout<<aTitle<<endl;
+      }else if(aTmp.find("#COLUMN_TITLES:") == 0){
+       int aLen = aTmp.find(":") + 1;
+       aTmp.remove(0,aLen);
+       QStringList aStrList = QStringList::split("|",aTmp);
+       cout<<"Its Column Titles : ";
+       for(int i = 0; i < aStrList.count(); i++){
+         aTmp = aStrList[i].stripWhiteSpace();
+         aTable2D.myColumnTitles.push_back(aTmp.latin1());
+         cout<<"\t"<<aTmp;
+       }
+       cout<<endl;
+      }else if(aTmp.find("#COLUMN_UNITS:") == 0){
+       int aLen = aTmp.find(":") + 1;
+       aTmp.remove(0,aLen);
+       QStringList aStrList = QStringList::split(" ",aTmp);
+       cout<<"Its Column Units : ";
+       for(int i = 0; i < aStrList.count(); i++){
+         aTmp = aStrList[i].stripWhiteSpace();
+         aTable2D.myColumnUnits.push_back(aTmp.latin1());
+         cout<<"\t"<<aTmp;
+       }
+       cout<<endl;
+      }else if(aTmp.find("#") == 0){
+       //It is a comment
+      }else if(aTmp.find("#TITLE:") > 0){
+       QStringList aStrList = QStringList::split("#TITLE:",aTmp);
+       QString aTitle = aStrList[1].stripWhiteSpace();
+       TRow aRow; 
+       aRow.myTitle = aTitle;
+       cout<<aTitle<<" : ";
+       QStringList aValList = QStringList::split(" ",aStrList[0]);
+       for(int i = 0; i < aValList.count(); i++){
+         float aVal = aValList[i].toFloat();
+         aRow.myValues.push_back(aVal);
+         cout<<"\t"<<aVal;
+       }
+       aTable2D.myRows.push_back(aRow);
+       cout<<endl;
+      }else{
+       QStringList aValList = QStringList::split(" ",aTmp);
+       TRow aRow; 
+       for(int i = 0; i < aValList.count(); i++){
+         float aVal = aValList[i].toFloat();
+         aRow.myValues.push_back(aVal);
+         cout<<"\t"<<aVal;
+       }
+       aTable2D.myRows.push_back(aRow);
+       cout<<endl;
+      }
+      getLine(aStmIn,aTmp);
+    }
+    if(aTable2D.Check()){
+      cout<<"aTable2D checked "<<aTable2D.myTitle<<endl;
+      theTableCont.push_back(aTable2D);
+    }
+  }while(!aStmIn.eof());
+  aStmIn.close();
+  cout<<"After close"<<endl;
+}
+
+SALOMEDS::SObject_var VISU::ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy){
+  TTableCont aTableCont;
+  ImportTables(theFileName,aTableCont);
+  if(aTableCont.empty()) return SALOMEDS::SObject::_nil();
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::SComponent_var theSComponent = VISU::FindOrCreateVisuComponent(theStudy);
+  SALOMEDS::SObject_var aFileObject = aStudyBuilder->NewObject(theSComponent);
+  SALOMEDS::GenericAttribute_var anAttr = 
+    aStudyBuilder->FindOrCreateAttribute(aFileObject, "AttributeName");
+  SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+  QFileInfo aFileInfo(theFileName);
+  aName->SetValue(aFileInfo.fileName().latin1());
+  int iEnd = aTableCont.size();
+  /*
+  for(int i = 0, iEnd = aTableCont.size(); i < iEnd; i++){
+    const TTable2D& aTable2D = aTableCont[i];
+    SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeName");
+    aName = SALOMEDS::AttributeName::_narrow(anAttr);
+    cout<<"aTable2D.myTitle = "<<aTable2D.myTitle<<endl;
+    if(aTable2D.myTitle != "")
+      aName->SetValue(aTable2D.myTitle.c_str());
+    else{
+      QString aNewName;
+      aNewName.sprintf("Table:%d",i);
+      aName->SetValue(aNewName.latin1());
+    }
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeTableOfReal");
+    SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+    aTableOfReal->SetTitle(aTable2D.myTitle.c_str());
+    const TRows& aRows = aTable2D.myRows;
+    //aTable2D.getColumns(aRows);
+    int kEnd = aRows[0].myValues.size();
+    aTableOfReal->SetNbColumns(kEnd);
+    for(int j = 0, jEnd = aRows.size(); j < jEnd; j++){
+      cout<<"j = "<<j<<endl;
+      const TRow& aRow = aRows[j];
+      SALOMEDS::DoubleSeq_var aDoubleSeq = new SALOMEDS::DoubleSeq();
+      int kEnd = aRow.myValues.size();
+      aDoubleSeq->length(kEnd);
+      cout<<"kEnd = "<<kEnd<<endl;
+      for(int k = 0; k < kEnd; k++) aDoubleSeq[k] = aRow.myValues[k];
+      aTableOfReal->AddRow(aDoubleSeq.in());
+      aTableOfReal->SetRowTitle(j+1,aRow.myTitle.c_str());
+      aTableOfReal->SetRowUnit(j+1,aRow.myUnit.c_str());
+    }
+    for(int k = 0; k < kEnd; k++){
+      aTableOfReal->SetColumnTitle(k+1,aTable2D.myColumnTitles[k].c_str());
+      //aTableOfReal->SetColumnUnit(k+1,aTable2D.myColumnUnits[k].c_str());
+    }
+  }
+  */
+  for(int i = 0, iEnd = aTableCont.size(); i < iEnd; i++){
+    const TTable2D& aTable2D = aTableCont[i];
+    SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeName");
+    aName = SALOMEDS::AttributeName::_narrow(anAttr);
+    cout<<"aTable2D.myTitle = "<<aTable2D.myTitle<<endl;
+    if(aTable2D.myTitle != "")
+      aName->SetValue(aTable2D.myTitle.c_str());
+    else{
+      QString aNewName;
+      aNewName.sprintf("Table:%d",i);
+      aName->SetValue(aNewName.latin1());
+    }
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeTableOfReal");
+    SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+    aTableOfReal->SetTitle(aTable2D.myTitle.c_str());
+    TTable2D aNewTable2D;
+    aTable2D.getColumns(aNewTable2D);
+    int kEnd = aNewTable2D.myRows[0].myValues.size();
+    aTableOfReal->SetNbColumns(kEnd);
+    for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++){
+      cout<<"j = "<<j<<endl;
+      SALOMEDS::DoubleSeq_var aDoubleSeq = new SALOMEDS::DoubleSeq();
+      aDoubleSeq->length(kEnd);
+      cout<<"kEnd = "<<kEnd<<endl;
+      for(int k = 0; k < kEnd; k++) aDoubleSeq[k] = aNewTable2D.myRows[j].myValues[k];
+      aTableOfReal->AddRow(aDoubleSeq.in());
+      aTableOfReal->SetRowTitle(j+1,aNewTable2D.myRows[j].myTitle.c_str());
+      aTableOfReal->SetRowUnit(j+1,aNewTable2D.myRows[j].myUnit.c_str());
+    }
+    for(int k = 0; k < kEnd; k++){
+      aTableOfReal->SetColumnTitle(k+1,aNewTable2D.myColumnTitles[k].c_str());
+      //aTableOfReal->SetColumnUnit(k+1,aTable2D.myColumnUnits[k].c_str());
+    }
+  }
+  return aFileObject;
+}
diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh
new file mode 100644 (file)
index 0000000..d92547a
--- /dev/null
@@ -0,0 +1,163 @@
+// File:       VISU_Table_i.hh
+// Created:    Thu Feb 13 17:24:49 2003
+// Author:     Vadim SANDLER
+//             <vsr@rolex.nnov.matra-dtv.fr>
+
+#ifndef VISU_Table_i_HeaderFile
+#define VISU_Table_i_HeaderFile
+
+#include "VISU_PrsObject_i.hh"
+#include <qstringlist.h>
+#include "Plot2d_Curve.h"
+
+namespace VISU{
+  //==============================================================================
+  class Table_i : public virtual POA_VISU::Table,
+                  public virtual PrsObject_i
+  {
+    static int myNbPresent;
+    Table_i();
+    Table_i( const Table_i& );
+  public:
+    Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
+    virtual ~Table_i();
+    virtual VISU::VISUType GetType() { return VISU::TTABLE;};
+
+    virtual void SetTitle( const char* theName ) { myTitle = theName; }
+    virtual char* GetTitle() { return CORBA::string_dup( myTitle.c_str() ); }
+
+    virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; }
+    virtual VISU::Table::Orientation GetOrientation() { return myOrientation; }
+
+    virtual CORBA::Long GetNbRows();
+    virtual CORBA::Long GetNbColumns();
+
+  protected:
+    Storable* Build(int theRestoring);
+
+  protected:
+    VISU::Table::Orientation myOrientation;
+    string myTitle;
+    string myObjectEntry;
+
+  public:
+    virtual Storable* Create();
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+      throw(std::logic_error&);
+    virtual void ToStream( ostrstream& theStr );
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual const char* GenerateName();
+
+    virtual char* GetObjectEntry() { return CORBA::string_dup( myObjectEntry.c_str() ); }
+  };
+  Storable* TableRestore(SALOMEDS::SObject_ptr theSObject, 
+                        const string& thePrefix, const Storable::TRestoringMap& theMap);
+  SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
+
+  //==============================================================================
+  class Curve_i : public virtual POA_VISU::Curve,
+                  public virtual PrsObject_i
+  {
+    static int myNbPresent;
+    Curve_i();
+    Curve_i( const Curve_i& );
+  public:
+    Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow );
+    virtual ~Curve_i();
+    virtual VISU::VISUType GetType() { return VISU::TCURVE;};
+
+    virtual void SetTitle( const char* theName ) { myTitle = theName; myAuto = false; }
+    virtual char* GetTitle() { return CORBA::string_dup( myTitle.c_str() ); }
+
+    virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
+    virtual SALOMEDS::Color GetColor() { return myColor; }
+    
+    virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
+    virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
+
+    virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) 
+                                                { myLine = theType; myLineWidth = theWidth; myAuto = false; }
+    virtual VISU::Curve::LineType GetLine() { return myLine; }
+    virtual CORBA::Long GetLineWidth() { return myLineWidth; }
+
+  protected:
+    Storable* Build(int theRestoring);
+
+  protected:
+    Table_i*                myTable;
+    int                     myHRow;
+    int                     myVRow;
+    struct SALOMEDS::Color  myColor;
+    VISU::Curve::MarkerType myMarker;
+    VISU::Curve::LineType   myLine;
+    int                     myLineWidth;
+    string                  myTitle;
+    bool                    myAuto;
+
+  public:
+    virtual Storable* Create();
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+      throw(std::logic_error&);
+    virtual void ToStream( ostrstream& theStr );
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual const char* GenerateName();
+    virtual const char* GetTableID();
+
+    virtual CORBA::Boolean IsAuto() { return myAuto; }
+    virtual CORBA::Boolean IsValid();
+    virtual string GetHorTitle();
+    virtual string GetVerTitle();
+    virtual string GetHorUnits();
+    virtual string GetVerUnits();
+    virtual int    GetData( double*& theHorList, double*& theVerList );
+
+    virtual Plot2d_Curve* CreatePresentation();
+  };
+  Storable* CurveRestore(SALOMEDS::SObject_ptr theSObject, 
+                        const string& thePrefix, const Storable::TRestoringMap& theMap);
+
+  //==============================================================================
+  class Container_i : public virtual POA_VISU::Container,
+                      public virtual PrsObject_i
+  {
+    static int myNbPresent;
+    Container_i();
+    Container_i( const Container_i& );
+  public:
+    Container_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~Container_i();
+    virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
+
+    virtual void AddCurve( Curve_ptr theCurve );
+    virtual void RemoveCurve( Curve_ptr theCurve );
+
+    virtual CORBA::Long GetNbCurves();
+    virtual void Clear();
+
+  protected:
+    Storable* Build(int theRestoring);
+    
+  protected:
+    QStringList myCurves;
+    
+  public:
+    virtual Storable* Create();
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+      throw(std::logic_error&);
+    virtual void ToStream( ostrstream& theStr );
+    static const string myComment;
+    virtual const char* GetComment() const;
+    virtual const char* GenerateName();
+
+    void Update();
+    VISU::Curve_i* GetCurve( CORBA::Long theIndex );
+
+  };
+  Storable* ContainerRestore(SALOMEDS::SObject_ptr theSObject, 
+                            const string& thePrefix, const Storable::TRestoringMap& theMap);
+}
+#endif // (#ifndef VISU_Table_i_HeaderFile)
+
+
diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx
new file mode 100644 (file)
index 0000000..f475f1a
--- /dev/null
@@ -0,0 +1,460 @@
+//  File      : VISU_TimeAnimation.cxx
+//  Created   : 10 / 04 / 2003
+//  Author    : Vitaly SMETANNIKOV
+//  Project   : SALOME 
+//  Module    : VISU_I
+//  Copyright : Open CASCADE 
+
+
+#include "VISU_TimeAnimation.h"
+#include "VISU_ScalarBarActor.hxx"
+
+
+//************************************************************************
+VISU_TimeAnimation::VISU_TimeAnimation(SALOMEDS::Study_var theStudy) {
+  myStudy = theStudy;
+  myIsActive = false;
+  myFrame = 0;
+  mySpeed = 1;
+  myProportional = false;
+  myView = 0;
+  myMaxVal = 0;
+  myMinVal = 0;
+}
+
+
+//************************************************************************
+VISU_TimeAnimation::~VISU_TimeAnimation() {
+  for (int i = 0; i < getNbFields(); i++) 
+    clearData(myFieldsLst[i]);
+}
+
+
+//************************************************************************
+void VISU_TimeAnimation::addField(SALOMEDS::SObject_var theField) {
+  FieldData aNewData;
+  aNewData.myField = theField;
+  aNewData.myNbTimes = 0;
+  aNewData.myPrs = 0;
+  aNewData.myActors = 0;
+  aNewData.myTiming = 0;
+  aNewData.myPrsType = VISU::TSCALARMAP;
+  myFieldsLst.append(aNewData);
+}
+
+
+//************************************************************************
+void VISU_TimeAnimation::clearData(FieldData& theData) {
+  if (theData.myTiming) {
+    free(theData.myTiming);
+    theData.myTiming = 0;
+  }
+  vtkRenderer* aRen = myView->getRenderer();
+  if (theData.myActors) {
+    for (int i = 0; i < theData.myNbTimes; i++) {
+      if (theData.myActors[i]->HasScalarBar() && (i==0)) 
+       aRen->RemoveActor2D(theData.myActors[i]->getScalarBar());
+      aRen->RemoveActor(theData.myActors[i]);
+      theData.myActors[i]->Delete();
+    }
+    free(theData.myActors);
+    theData.myActors = 0;
+  }
+  if (theData.myPrs) {
+    for (int i = 0; i < theData.myNbTimes; i++) 
+      theData.myPrs[i]->_remove_ref();
+    free(theData.myPrs);
+    theData.myPrs = 0;
+  }  
+  theData.myNbTimes = 0;
+}
+
+
+//************************************************************************
+void VISU_TimeAnimation::generatePresentations(int theFieldNum) {
+  FieldData& aData = myFieldsLst[theFieldNum];
+
+  // Delete previous presentations
+  clearData(aData);
+
+  VISU::Result_i* pResult = createPresent(aData.myField); 
+  VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
+  aData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
+
+  aData.myPrs = (VISU::ScalarMap_i**) malloc(aData.myNbTimes * sizeof(VISU::ScalarMap_i*));
+  aData.myTiming = (double*) malloc(aData.myNbTimes * sizeof(double));
+
+  SALOMEDS::ChildIterator_var anIter = myStudy->NewChildIterator(aData.myField);
+  SALOMEDS::SObject_var aTimeStamp;
+  anIter->Next(); // First is reference on support
+  long i = 0;
+  double aMin = 0, aMax = 0;
+  for(;anIter->More();anIter->Next()) {
+    if (i == aData.myNbTimes) {
+      MESSAGE("Found extra timestamps in field");
+      return;
+    }
+    aTimeStamp = anIter->Value();
+    if (aTimeStamp->_is_nil()) continue;
+
+    aData.myTiming[i] = getTimeValue(aTimeStamp);
+    if (isRangeDefined()) {
+      if (aData.myTiming[i] < myMinVal) continue;
+      if (aData.myTiming[i] > myMaxVal) break;
+    }
+
+    VISU::Storable::TRestoringMap aTimeMap = getMapOfValue(aTimeStamp);
+    QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName"); 
+    VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt(); 
+    QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName"); 
+    double aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toDouble(); 
+    
+    switch (aData.myPrsType) {
+    case VISU::TSCALARMAP: // ScalarMap
+      {
+       VISU::ScalarMap_i* aPresent = new VISU::ScalarMap_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::ScalarMap_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+      
+    case VISU::TISOSURFACE: // Iso Surfaces
+      {
+       VISU::IsoSurfaces_i* aPresent = new VISU::IsoSurfaces_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::IsoSurfaces_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+    
+    case VISU::TCUTPLANES: // Cut Planes
+      {
+       VISU::CutPlanes_i* aPresent = new VISU::CutPlanes_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::CutPlanes_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+      
+    case VISU::TDEFORMEDSHAPE: // Deformed Shape
+      {
+       VISU::DeformedShape_i* aPresent = new VISU::DeformedShape_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::DeformedShape_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+      
+    case VISU::TVECTORS: // Vectors
+      {
+       VISU::Vectors_i* aPresent = new VISU::Vectors_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::Vectors_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+      
+    case VISU::TSTREAMLINES: // Stream Lines
+      {
+       VISU::StreamLines_i* aPresent = new VISU::StreamLines_i(pResult, false);
+       aPresent->Create(aMeshName.latin1(), anEntity, 
+                        aFieldName.latin1(), aTimeStampId);
+       //VISU::StreamLines_var aTmp = aPresent->_this();
+       //aPresent->_remove_ref();
+       aData.myPrs[i] = aPresent;
+      }
+      break;
+    }
+    if (aData.myPrs[i]->GetMin() < aMin) aMin = aData.myPrs[i]->GetMin();
+    if (aData.myPrs[i]->GetMax() > aMax) aMax = aData.myPrs[i]->GetMax();
+    i++;
+  }
+  aData.myNbTimes = i;
+  for (i = 0; i < aData.myNbTimes; i++) 
+    aData.myPrs[i]->SetRange(aMin, aMax);
+}
+
+
+//************************************************************************
+bool VISU_TimeAnimation::generateFrames() {
+  if (!myView) {
+    MESSAGE("Viewer is nod defined for animation");
+    return false;
+  }
+  clearView();
+  vtkRenderer* aRen = myView->getRenderer();
+  for (int i = 0; i < getNbFields(); i++) {
+    FieldData& aData = myFieldsLst[i];
+    aData.myActors = (VISU_Actor**) malloc(aData.myNbTimes * sizeof(VISU_Actor*));
+    for (long j = 0; j < aData.myNbTimes; j++) {
+      VISU_Actor* aActor = aData.myPrs[j]->CreateActor();
+      if (aActor == NULL) {
+       for (int k = 0; k < j; k++) {
+         aData.myActors[k]->Delete();
+       }
+       free(aData.myActors);
+       aData.myActors = 0;
+       return false;
+      }
+     aRen->AddActor(aActor);
+      if (j == 0) {
+       aActor->VisibilityOn();
+       if (aActor->HasScalarBar()) {
+         aRen->AddActor2D(aActor->getScalarBar());
+       }
+      } else
+       aActor->VisibilityOff();
+      aData.myActors[j] = aActor;
+    }
+  }
+  myFrame = 0;
+  emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+  myView->Repaint();
+  return true;
+}
+
+//************************************************************************
+void VISU_TimeAnimation::clearView() {
+  if (!myView) {
+    MESSAGE("Viewer is nod defined for animation");
+    return;
+  }
+  vtkRenderer* aRen = myView->getRenderer();
+  for (int i = 0; i < getNbFields(); i++) {
+    FieldData& aData = myFieldsLst[i];
+    if (aData.myActors) {
+      for (int i = 0; i < aData.myNbTimes; i++) {
+       if (aData.myActors[i]->HasScalarBar() && (i==0)) 
+         aRen->RemoveActor2D(aData.myActors[i]->getScalarBar());
+       aRen->RemoveActor(aData.myActors[i]);
+       aData.myActors[i]->Delete();
+      }
+      free(aData.myActors);
+      aData.myActors = 0;
+    }
+  }
+}
+
+//************************************************************************
+void VISU_TimeAnimation::stopAnimation() {
+  myIsActive = false;
+}
+
+//************************************************************************
+void VISU_TimeAnimation::startAnimation() {
+  if (!myIsActive) {
+    myIsActive = true;
+    QThread::start();
+  }
+}
+
+//************************************************************************
+void VISU_TimeAnimation::nextFrame() {
+  stopAnimation();
+  if (myFrame < (myFieldsLst[0].myNbTimes-1)) {
+    int i;
+    for (i = 0; i < getNbFields(); i++) 
+      myFieldsLst[i].myActors[myFrame]->VisibilityOff();
+    myFrame++;
+    for (i = 0; i < getNbFields(); i++) 
+      myFieldsLst[i].myActors[myFrame]->VisibilityOn(); 
+
+    emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+    myView->Repaint();
+  }
+}
+
+//************************************************************************
+void VISU_TimeAnimation::prevFrame() {
+  stopAnimation();
+  if (myFrame > 0) {
+    int i;
+    for (i = 0; i < getNbFields(); i++) 
+      myFieldsLst[i].myActors[myFrame]->VisibilityOff();
+    myFrame--;
+    for (i = 0; i < getNbFields(); i++) 
+      myFieldsLst[i].myActors[myFrame]->VisibilityOn();    
+
+    emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+    myView->Repaint();
+  }
+}
+
+//************************************************************************
+void VISU_TimeAnimation::firstFrame() {
+  stopAnimation();
+  int i;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOff();
+  myFrame = 0;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOn();    
+
+  emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+  myView->Repaint();
+}
+
+//************************************************************************
+void VISU_TimeAnimation::lastFrame() {
+  stopAnimation();
+  int i;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOff();
+  myFrame = myFieldsLst[0].myNbTimes-1;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+    
+  emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+  myView->Repaint();
+}
+
+
+//************************************************************************
+void VISU_TimeAnimation::gotoFrame(long theFrame) {
+  if ((theFrame < 0) || (theFrame > (getNbFrames()-1))) 
+    return;
+  stopAnimation();
+  int i;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOff();
+  myFrame = theFrame;
+  for (i = 0; i < getNbFields(); i++) 
+    myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+  emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+  myView->Repaint();
+}
+
+
+//************************************************************************
+VISU::ScalarMap_i* VISU_TimeAnimation::getPresentation(int theField, long theFrame) {
+  if ((theField > getNbFields()) || (theField < 0))
+    return NULL;
+  if ((theFrame < 0) || (theFrame > (myFieldsLst[theField].myNbTimes - 1)))
+    return NULL;
+  return myFieldsLst[theField].myPrs[theFrame];
+}
+
+
+//************************************************************************
+long VISU_TimeAnimation::getNbFrames() { 
+  return (getNbFields() > 0)? myFieldsLst[0].myNbTimes : 0;
+}
+
+
+//************************************************************************
+void VISU_TimeAnimation::run() {
+  if (!myView) {
+    MESSAGE("Viewer is nod defined for animation");
+    return;
+  }
+
+  double k=1;
+  double aOneVal;
+  bool isDumping = !myDumpPath.isEmpty();
+  aOneVal = (myFieldsLst[0].myNbTimes > 2) ?
+    myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0] : 1;
+
+  while (true) {
+    qApp->lock();      
+    emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+    for (int i = 0; i < getNbFields(); i++) {
+      FieldData& aData = myFieldsLst[i];
+      if (myFrame > 0) aData.myActors[myFrame-1]->VisibilityOff();
+      else aData.myActors[aData.myNbTimes-1]->VisibilityOff();
+      
+      aData.myActors[myFrame]->VisibilityOn();
+    }
+    myView->Repaint();
+    if (isDumping) {
+      QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
+      QString aFile(myDumpPath);
+      QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]);
+      int aPos = -1;
+      while ((aPos = aName.find(".")) > -1 )
+       aName.replace(aPos, 1, "_");
+      aFile += aName;
+      aFile += ".jpeg";
+      px.save(aFile, "JPEG");
+    }
+    qApp->unlock();
+    
+    if (!isDumping) {
+      if (myProportional) {
+       switch (myFrame) {
+       case 0:
+         k=1;
+         break;        
+       case 1:
+         if (myFieldsLst[0].myNbTimes > 2)
+           k = (myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal;
+         else
+           k = 1;
+         break;        
+       default:
+         k = (myFrame < (myFieldsLst[0].myNbTimes-1))? 
+           (myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal : 1;
+       }
+      } else
+       k = 1;
+      
+      msleep((int) 1000.*k/mySpeed);
+    }
+    if (!myIsActive) QThread::exit();
+    
+    myFrame++;
+    if (myFrame == myFieldsLst[0].myNbTimes) 
+      myFrame = 0;
+  }
+}
+
+//************************************************************************
+VISU::Result_i* VISU_TimeAnimation::createPresent(SALOMEDS::SObject_var theField) {
+  SALOMEDS::SObject_var aSObj = theField->GetFather();
+  aSObj = aSObj->GetFather();
+  aSObj = aSObj->GetFather();
+  CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
+  if(CORBA::is_nil(anObject)) return NULL;
+  return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
+}
+
+
+//************************************************************************
+VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue(SALOMEDS::SObject_var theSObject) {
+  VISU::Storable::TRestoringMap aMap;
+  if(!theSObject->_is_nil()){
+    SALOMEDS::GenericAttribute_var anAttr;
+    if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
+      SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+      CORBA::String_var aString = aComment->Value();
+      QString strIn(aString.in());
+      VISU::Storable::StrToMap(strIn,aMap);
+    }
+  }
+  return aMap;
+}
+
+//************************************************************************
+double VISU_TimeAnimation::getTimeValue(SALOMEDS::SObject_var theTimeStamp) {
+  SALOMEDS::GenericAttribute_var anAttr;
+  if(theTimeStamp->FindAttribute(anAttr, "AttributeName")) {
+    SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+    QString aNameString(aName->Value());
+    return aNameString.toDouble();
+  }
+}
+  
+//************************************************************************
+void VISU_TimeAnimation::setSpeed(int theSpeed) { 
+  mySpeed = (theSpeed<1)? 1 : theSpeed; 
+}
diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h
new file mode 100644 (file)
index 0000000..87f08e6
--- /dev/null
@@ -0,0 +1,106 @@
+//  File      : VISU_TimeAnimation.h
+//  Created   : 10 / 04 / 2003
+//  Author    : Vitaly SMETANNIKOV
+//  Project   : SALOME 
+//  Module    : VISU_I
+//  Copyright : Open CASCADE 
+
+#ifndef VISU_TIMEANIMATION_H
+#define VISU_TIMEANIMATION_H
+
+#include <qobject.h>
+#include <qvaluelist.h>
+#include <qthread.h>
+#include "VISU_Actor.h"
+#include "VISU_PrsObject_i.hh"
+#include "VTKViewer_ViewFrame.h"
+
+
+struct FieldData
+{
+  VISU::VISUType myPrsType;  
+  SALOMEDS::SObject_var myField; // field label
+  long myNbTimes;                // number of Timestamps
+  VISU::ScalarMap_i** myPrs;         // Presentations
+  VISU_Actor** myActors;         // Actors
+  double* myTiming;              // time values
+};
+
+
+class VISU_TimeAnimation: public QObject, public QThread
+{
+    Q_OBJECT
+ public:
+  static VISU::Result_i* createPresent(SALOMEDS::SObject_var theField);
+  static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
+  static double getTimeValue(SALOMEDS::SObject_var theTimestamp);
+  
+  VISU_TimeAnimation(SALOMEDS::Study_var theStudy);
+  ~VISU_TimeAnimation();
+
+  void addField(SALOMEDS::SObject_var theField);
+  FieldData& getFieldData(int theNum) { return myFieldsLst[theNum]; }
+
+  bool generateFrames();
+  void generatePresentations(int theFieldNum);
+  void setViewer(VTKViewer_ViewFrame* theView) { myView = theView; }
+  VTKViewer_ViewFrame* getViewer() { return myView; }
+  void clearView();
+  void clearData(FieldData& theData);
+
+  void stopAnimation();
+  void startAnimation();
+  void nextFrame();
+  void prevFrame();
+  void firstFrame();
+  void lastFrame();
+  void gotoFrame(long theFrame);
+
+  int getNbFields() { return myFieldsLst.size(); }
+  long getNbFrames();
+  bool isRunning() { return myIsActive; }
+  long getCurrentFrame() { return myFrame; }
+
+  VISU::ScalarMap_i* getPresentation(int theField, long theFrame);
+
+  void setPresentationType(int theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; }
+  VISU::VISUType getPresentationType(int theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; }
+
+  void setSpeed(int theSpeed);
+  int getSpeed() { return mySpeed; }
+
+  bool isProportional() { return myProportional; }
+
+  void setAnimationRange(double theMin, double theMax)
+    { myMaxVal = theMax; myMinVal = theMin; }
+
+  double getMinRange() { return myMinVal; }
+  double getMaxRange() { return myMaxVal; } 
+  bool isRangeDefined() { return ((myMaxVal!=0) && (myMinVal != 0)); }
+
+  void dumpTo(QString thePath) { myDumpPath = thePath; }
+
+ public slots:
+  void setProportional(bool theProp) { myProportional = theProp; }
+
+ signals:
+  void frameChanged(long theNewFrame, double theTime);
+
+ protected:
+  void run();
+
+ private:
+
+  QValueList<FieldData> myFieldsLst;
+  bool myIsActive;
+  long myFrame;
+  int mySpeed;
+  bool myProportional;
+  SALOMEDS::Study_var myStudy;
+
+  double myMaxVal, myMinVal;
+  QString myDumpPath;
+  VTKViewer_ViewFrame* myView;
+};
+
+#endif  //VISU_TIMEANIMATION_H
diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc
new file mode 100644 (file)
index 0000000..f7d2de2
--- /dev/null
@@ -0,0 +1,1147 @@
+using namespace std;
+// File:       VISU_ViewManager_i.cxx
+// Created:    Wed Jan 22 17:53:23 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+#include "VISU_ViewManager_i.hh"
+#include "VISU_PrsObject_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_Actor.h"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_Tools.h"
+#include "QAD_Study.h"
+#include "QAD_RightFrame.h"
+#include "QAD_StudyFrame.h"
+
+#include "VTKViewer_ViewFrame.h"
+#include "SALOMEGUI_TableDlg.h"
+#include "Plot2d_CurveContainer.h"
+#include "Plot2d_ViewFrame.h"
+//#include "SALOMEGUI_SetupCurveDlg.h"
+//#include "SALOMEGUI_SetupPlot2dDlg.h"
+
+#include <vtkTransformPolyDataFilter.h>
+#include <vtkDataSetMapper.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+#include <memory>
+#include <qstring.h>
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU{
+  //===========================================================================
+  VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame){
+    return dynamic_cast<VTKViewer_ViewFrame*>(theStudyFrame->getRightFrame()->getViewFrame());
+  }
+  vtkRenderer* GetRenderer(QAD_StudyFrame* theStudyFrame){
+    return GetViewFrame(theStudyFrame)->getRenderer();
+  }
+  vtkCamera* GetCamera(QAD_StudyFrame* theStudyFrame){
+    return GetRenderer(theStudyFrame)->GetActiveCamera();
+  }
+  void RepaintView(QAD_StudyFrame* theStudyFrame){
+    GetRenderer(theStudyFrame)->ResetCameraClippingRange();
+    GetViewFrame(theStudyFrame)->Repaint();
+  }
+  VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs){
+    VTKViewer_ViewFrame* vf = GetViewFrame(theStudyFrame);
+    if (!vf) return NULL;
+    if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
+    vtkRenderer *aRen = vf->getRenderer();
+    vtkActorCollection *anActColl = aRen->GetActors();
+    vtkActor *anActor;
+    VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
+    void *aSrcAddr = thePrs != NULL? (void*)thePrs->GetMapper(): NULL;
+    if(MYDEBUG) MESSAGE("UpdateViewer - aSrcAddr = "<<aSrcAddr);
+    for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
+      if(anActor->IsA("VISU_Actor")){ 
+       anVISUActor = VISU_Actor::SafeDownCast(anActor);
+       void* aCurrAddr = (void*)anVISUActor->GetMapper();      
+       if(MYDEBUG) MESSAGE("UpdateViewer - aCurrAddr = "<<aCurrAddr);
+       if (aSrcAddr == aCurrAddr) {
+         if(MYDEBUG) MESSAGE("UpdateViewer - aSrcAddr == aCurrAddr");
+         aResActor = anVISUActor;
+         if(theDisplaing < eErase){
+           aResActor->VisibilityOn();
+           if (aResActor->HasScalarBar()) aResActor->getScalarBar()->VisibilityOn();
+         }else{
+           aResActor->VisibilityOff();
+           if (aResActor->HasScalarBar()) aResActor->getScalarBar()->VisibilityOff();
+         }
+       } else {
+         if(theDisplaing > eDisplay){
+           anVISUActor->VisibilityOff();
+           if (anVISUActor->HasScalarBar()) anVISUActor->getScalarBar()->VisibilityOff();
+         }else{
+           anVISUActor->VisibilityOn();
+           if (anVISUActor->HasScalarBar()) anVISUActor->getScalarBar()->VisibilityOn();
+         }
+       } 
+      }
+    }
+    if (aResActor) {
+      RepaintView(theStudyFrame);
+      return aResActor;
+    }
+    if(thePrs != NULL && theDisplaing < eErase){
+      anVISUActor = thePrs->CreateActor();
+      if (anVISUActor ) {
+       if(MYDEBUG) MESSAGE("UpdateViewer - thePrs->CreateActor() = "<<anVISUActor->GetMapper());
+       vf->AddActor(anVISUActor);
+       if(anVISUActor->HasScalarBar()){
+         if(MYDEBUG) MESSAGE("UpdateViewer - anVISUActor->getScalarBar()");
+         aRen->AddActor2D(anVISUActor->getScalarBar());
+       }
+      } else {
+       MESSAGE ("Null actor is created");
+       return NULL;
+      }
+    }
+    RepaintView(theStudyFrame);
+    return anVISUActor;
+  }
+  void UpdatePlot2d(Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve) {
+    if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = "<<theDisplaying);
+    if ( !theView )
+      return;
+    QList<Plot2d_Curve> clist;
+    theView->getCurves( clist );
+    if ( theDisplaying == eEraseAll ) {
+      for ( int i = 0; i < clist.count(); i++ ) {
+       if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - "<<clist.at( i ));
+       theView->eraseCurve( clist.at( i ) );
+      }
+    }
+    else if ( theDisplaying == eErase ) {
+      for ( int i = 0; i < clist.count(); i++ ) {
+       if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+         if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - "<<clist.at( i ) );
+         theView->eraseCurve( clist.at( i ) );
+       }
+      }
+    }
+    else if ( theDisplaying == eDisplay ) {
+      bool bFound = false;
+      for ( int i = 0; i < clist.count(); i++ ) {
+       if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+         if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - "<<clist.at( i ) );
+         clist.at( i )->setHorTitle( strdup( theCurve->GetHorTitle().c_str() ) );
+         clist.at( i )->setVerTitle( strdup( theCurve->GetVerTitle().c_str() ) );
+         clist.at( i )->setHorUnits( strdup( theCurve->GetHorUnits().c_str() ) );
+         clist.at( i )->setVerUnits( strdup( theCurve->GetVerUnits().c_str() ) );
+         /* - DATA NOT UPDATED */
+         if ( !clist.at( i )->isAutoAssign() ) {
+           clist.at( i )->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
+           clist.at( i )->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); 
+           SALOMEDS::Color color = theCurve->GetColor();
+           clist.at( i )->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+           clist.at( i )->setAutoAssign( theCurve->IsAuto() );
+         }
+         theView->displayCurve( clist.at( i ) );
+         bFound = true;
+       }
+      }
+      if ( !bFound ) {
+       Plot2d_Curve* crv = theCurve->CreatePresentation();
+       if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
+       if ( crv )
+         theView->displayCurve( crv );
+      }
+    }
+    else if ( theDisplaying == eDisplayOnly ) {
+      bool bFound = false;
+      for ( int i = 0; i < clist.count(); i++ ) {
+       if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+         if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - "<<clist.at( i ) );
+         clist.at( i )->setHorTitle( strdup( theCurve->GetHorTitle().c_str() ) );
+         clist.at( i )->setVerTitle( strdup( theCurve->GetVerTitle().c_str() ) );
+         clist.at( i )->setHorUnits( strdup( theCurve->GetHorUnits().c_str() ) );
+         clist.at( i )->setVerUnits( strdup( theCurve->GetVerUnits().c_str() ) );
+         /* - DATA NOT UPDATED */
+         if ( !clist.at( i )->isAutoAssign() ) {
+           clist.at( i )->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
+           clist.at( i )->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); 
+           SALOMEDS::Color color = theCurve->GetColor();
+           clist.at( i )->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+           clist.at( i )->setAutoAssign( theCurve->IsAuto() );
+         }
+         theView->displayCurve( clist.at( i ) );
+         bFound = true;
+       }
+       else {
+         theView->eraseCurve( clist.at( i ) );
+       }
+      }
+      if ( !bFound ) {
+       Plot2d_Curve* crv = theCurve->CreatePresentation();
+       if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - "<<crv );
+       if ( crv )
+         theView->displayCurve( crv );
+      }
+    }
+  }
+  //===========================================================================
+  ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy) {
+    if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i");
+    Mutex mt(myMutex,qApp);
+    myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+    /*
+    CORBA::String_var aName = myStudyDocument->Name();
+    if(QAD_Application::getDesktop()->getActiveApp()->isStudyOpened(aName.in()))
+      QAD_Application::getDesktop()->getActiveApp()->loadStudy(aName.in());
+      */
+  }
+  VISU::View3D_ptr ViewManager_i::Create3DView(){
+    if(MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
+    VISU::View3D_i* pView = new View3D_i(myStudyDocument);
+    if(pView->Create(1) != NULL) 
+      return VISU::View3D::_duplicate(pView->_this());
+    return VISU::View3D::_nil();
+  }
+  VISU::View_ptr ViewManager_i::GetCurrentView(){
+    if(MYDEBUG) MESSAGE("ViewManager_i::GetCurrent3DView");
+    QAD_Study* Study = QAD_Application::getDesktop()->findStudy( myStudyDocument );
+    QAD_StudyFrame* StudyFrame;
+    if ( Study && ( StudyFrame = Study->getActiveStudyFrame() ) ) {
+      if ( StudyFrame->getTypeView() == VIEW_VTK ) {
+       VISU::View3D_i* pView = new View3D_i(myStudyDocument);
+       if(pView->Create(0) != NULL) 
+         return VISU::View3D::_duplicate(pView->_this());
+      }
+      else if ( StudyFrame->getTypeView() == VIEW_PLOT2D ) {
+       VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
+       if(pView->Create(0) != NULL) 
+         return VISU::XYPlot::_duplicate(pView->_this());
+      }
+    }
+    return VISU::View::_nil();
+  }
+  VISU::XYPlot_ptr ViewManager_i::CreateXYPlot(){
+    if(MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
+    VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
+    if(pView->Create(1) != NULL) 
+      return VISU::XYPlot::_duplicate(pView->_this());
+    return VISU::XYPlot::_nil();
+  }
+  VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
+    if(MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
+    VISU::TableView_i* pView = new TableView_i(myStudyDocument);
+    if(pView->Create(VISU::Table::_duplicate(theTable)) != NULL) 
+      return VISU::TableView::_duplicate(pView->_this());
+    return VISU::TableView::_nil();
+  }
+  void ViewManager_i::Destroy(View_ptr theView){
+    if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - "<<theView->_is_nil());
+    if(theView->_is_nil()) return;
+    CORBA::Object_var aView = VISU::View::_narrow(theView);
+    if(!CORBA::is_nil(aView)){
+      if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - VISU::View"<<(!CORBA::is_nil(aView)));
+      VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(aView));
+      if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - dynamic_cast"<<pView);
+      if(pView) {
+       pView->Close();
+       pView->_remove_ref();
+      }
+      //if(pView) delete pView;
+      return;
+    }
+  }
+  //===========================================================================
+  View_i::View_i(SALOMEDS::Study_ptr theStudy) {
+    if(MYDEBUG) MESSAGE("View_i::View_i");
+    Mutex mt(myMutex,qApp);
+    CORBA::String_var aName = theStudy->Name();
+    myStudy = QAD_Application::getDesktop()->findStudy( theStudy );
+    if(MYDEBUG) MESSAGE("View_i::View_i - isStudyOpened = "<<myStudy);
+    if ( !myStudy ) 
+      myStudy = myStudy = QAD_Application::getDesktop()->getActiveApp()->loadStudy(aName.in());
+  }
+  View_i::~View_i(){
+    if(MYDEBUG) MESSAGE("View_i::~View_i");
+  }
+
+  void View_i::SetBackground(const SALOMEDS::Color& theColor) {}
+  SALOMEDS::Color View_i::GetBackground() { return SALOMEDS::Color();}
+  void View_i::Minimize() {}
+  void View_i::Restore() {}
+  void View_i::Maximize() {}
+  void View_i::EraseAll() {}
+  void View_i::DisplayAll() {}
+  void View_i::Erase(PrsObject_ptr thePrsObj) {}
+  void View_i::Display(PrsObject_ptr thePrsObj) {}
+  void View_i::DisplayOnly(PrsObject_ptr thePrsObj) {}
+  void View_i::Update() {}
+
+  CORBA::Boolean View_i::SavePicture(const char* theFileName) { return false; }
+
+  const char* View_i::GetComment() const { return "";}
+  void View_i::ToStream(ostrstream& theStr) {}
+
+  const char* View_i::GetEntry(){ 
+    SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectIOR(GetID());
+    CORBA::String_var anEntry = aSObject->GetID();
+    string aString(anEntry);
+    if(MYDEBUG) MESSAGE("Result_i::GetEntry - "<<aString);
+    return aString.c_str();
+  }
+  //===========================================================================
+  XYPlot_i::XYPlot_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {
+    if(MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
+  }
+  Storable* XYPlot_i::Create(int theNew){
+    if(MYDEBUG) MESSAGE("XYPlot_i::Create");
+    Mutex mt(myMutex,qApp);
+    if(theNew)
+      myStudyFrame = myStudy->newWindow3d("",VIEW_PLOT2D);
+    else
+      myStudyFrame = myStudy->getActiveStudyFrame();
+    myView = dynamic_cast<Plot2d_ViewFrame*>(myStudyFrame->getRightFrame()->getViewFrame());
+    Update();
+    return this;
+  } 
+  void XYPlot_i::Update() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::Update");
+    Mutex mt(myMutex,qApp);
+    myName = myStudyFrame->title();
+    myView->Repaint();
+  }
+  void XYPlot_i::Close(){
+    if(MYDEBUG) MESSAGE("XYPlot_i::Close");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->close();
+  }
+  XYPlot_i::~XYPlot_i() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->close();
+  }
+  void XYPlot_i::SetTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = theTitle;
+    myStudyFrame->setCaption(myName.c_str());
+  }
+  char* XYPlot_i::GetTitle() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = myStudyFrame->title();
+    return CORBA::string_dup(myName.c_str());
+  }
+
+  void XYPlot_i::SetSubTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetSubTitle");
+    Mutex mt(myMutex,qApp);
+    myView->setTitle(theTitle);
+  }
+  char* XYPlot_i::GetSubTitle() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetSubTitle");
+    Mutex mt(myMutex,qApp);
+    return CORBA::string_dup(myView->getTitle());
+  }
+
+  void XYPlot_i::SetCurveType(VISU::XYPlot::CurveType theType){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetCurveType");
+    Mutex mt(myMutex,qApp);
+    myView->setCurveType(theType);
+  }
+  VISU::XYPlot::CurveType XYPlot_i::GetCurveType(){
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetCurveType");
+    Mutex mt(myMutex,qApp);
+    return (VISU::XYPlot::CurveType)myView->getCurveType();
+  }
+
+  void XYPlot_i::SetMarkerSize(CORBA::Long theSize){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetMarkerSize");
+    Mutex mt(myMutex,qApp);
+    myView->setMarkerSize(theSize);
+  }
+  CORBA::Long XYPlot_i::GetMarkerSize(){
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetMarkerSize");
+    Mutex mt(myMutex,qApp);
+    return myView->getMarkerSize();
+  }
+
+  void XYPlot_i::EnableXGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor, 
+                            CORBA::Boolean theMinor, CORBA::Long theNumMinor){
+    if(MYDEBUG) MESSAGE("XYPlot_i::EnableXGrid");
+    Mutex mt(myMutex,qApp);
+    myView->setXGrid(theMajor,theNumMajor,theMinor,theNumMinor);
+  }
+  void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor, 
+                            CORBA::Boolean theMinor, CORBA::Long theNumMinor){
+    if(MYDEBUG) MESSAGE("XYPlot_i::EnableYGrid");
+    Mutex mt(myMutex,qApp);
+    myView->setYGrid(theMajor,theNumMajor,theMinor,theNumMinor);
+  }
+
+  void XYPlot_i::SetHorScaling(VISU::Scaling theScaling){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetHorScaling");
+    Mutex mt(myMutex,qApp);
+    if(theScaling == VISU::LOGARITHMIC)
+      myView->setHorScaleMode(1);
+    else
+      myView->setHorScaleMode(0);
+  }
+  VISU::Scaling XYPlot_i::GetHorScaling(){
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetHorScaling");
+    Mutex mt(myMutex,qApp);
+    return (VISU::Scaling)myView->getHorScaleMode();
+  }
+
+  void XYPlot_i::SetVerScaling(VISU::Scaling theScaling){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetVerScaling");
+    Mutex mt(myMutex,qApp);
+    if(theScaling == VISU::LOGARITHMIC)
+      myView->setVerScaleMode(1);
+    else
+      myView->setVerScaleMode(0);
+  }
+  VISU::Scaling XYPlot_i::GetVerScaling(){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetVerScaling");
+    Mutex mt(myMutex,qApp);
+    return (VISU::Scaling)myView->getVerScaleMode();
+  }
+
+  void XYPlot_i::SetXTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetXTitle");
+    Mutex mt(myMutex,qApp);
+    myView->setXTitle(true,theTitle);
+  }
+  char* XYPlot_i::GetXTitle() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetXTitle");
+    Mutex mt(myMutex,qApp);
+    return CORBA::string_dup(myView->getXTitle());
+  }
+
+  void XYPlot_i::SetYTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetYTitle");
+    Mutex mt(myMutex,qApp);
+    myView->setYTitle(true,theTitle);
+  }
+  char* XYPlot_i::GetYTitle() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetYTitle");
+    Mutex mt(myMutex,qApp);
+    return CORBA::string_dup(myView->getYTitle());
+  }
+
+  void XYPlot_i::ShowLegend(CORBA::Boolean theShowing){
+    if(MYDEBUG) MESSAGE("XYPlot_i::ShowLegend");
+    Mutex mt(myMutex,qApp);
+    myView->showLegend(theShowing);
+  }
+
+  void XYPlot_i::SetBackground(const SALOMEDS::Color& theColor){
+    if(MYDEBUG) MESSAGE("XYPlot_i::SetBackground");
+    Mutex mt(myMutex,qApp);
+    QColor aColor(255.0*theColor.R,255.0*theColor.G,255.0*theColor.B);
+    myView->setBackgroundColor(aColor);
+  }
+  SALOMEDS::Color XYPlot_i::GetBackground() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::GetBackground");
+    Mutex mt(myMutex,qApp);
+    SALOMEDS::Color aColor;
+    aColor.R = myView->backgroundColor().red()/255.0;
+    aColor.G = myView->backgroundColor().green()/255.0;
+    aColor.B = myView->backgroundColor().blue()/255.0;
+    return aColor;
+  }
+  void XYPlot_i::Minimize() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::Minimize");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showMinimized();
+  }
+  void XYPlot_i::Restore() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::Restore");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showNormal();
+  }
+  void XYPlot_i::Maximize() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::Maximize");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showMaximized();
+  }
+  void XYPlot_i::Display(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::Display"); 
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    // is it Curve ?
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+      UpdatePlot2d(myView,eDisplay,aCurve);
+    }
+    // is it Container ?
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+      int nbCurves = aContainer->GetNbCurves();
+      for ( int i = 1; i <= nbCurves; i++ ) {
+       VISU::Curve_i* aCurve = aContainer->GetCurve( i );
+       if ( aCurve && aCurve->IsValid() ) {
+         UpdatePlot2d(myView,eDisplay,aCurve);
+       }
+      }
+      myView->Repaint();
+    }
+    // is it Table ?
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+      SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
+      if ( !TableSO->_is_nil() ) {
+       SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
+         for ( ; Iter->More(); Iter->Next() ) {
+         CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
+         if( !CORBA::is_nil( childObject ) ) {
+           CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
+           if( !CORBA::is_nil( aCurve ) )
+             UpdatePlot2d(myView,eDisplay,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+         }
+       }
+       myView->Repaint();
+      }
+    }
+  }
+  void XYPlot_i::Erase(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::Display"); 
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    // is it Curve ?
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+      UpdatePlot2d(myView,eErase,aCurve);
+    }
+    // is it Container ?
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+      int nbCurves = aContainer->GetNbCurves();
+      for ( int i = 1; i <= nbCurves; i++ ) {
+       VISU::Curve_i* aCurve = aContainer->GetCurve( i );
+       if ( aCurve && aCurve->IsValid() ) {
+         UpdatePlot2d(myView,eErase,aCurve);
+       }
+      }
+      myView->Repaint();
+    }
+    // is it Table ?
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+      SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
+      if ( !TableSO->_is_nil() ) {
+       SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
+         for ( ; Iter->More(); Iter->Next() ) {
+         CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
+         if( !CORBA::is_nil( childObject ) ) {
+           CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
+           if( !CORBA::is_nil( aCurve ) )
+             UpdatePlot2d(myView,eErase,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+         }
+       }
+       myView->Repaint();
+      }
+    }
+  }
+  void XYPlot_i::EraseAll() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::EraseAll");
+    Mutex mt(myMutex,qApp);
+    myView->EraseAll();
+  }
+  void XYPlot_i::DisplayOnly(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::Display"); 
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    // is it Curve ?
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+      UpdatePlot2d(myView,eDisplayOnly,aCurve);
+    }
+    // is it Container ?
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+      int nbCurves = aContainer->GetNbCurves();
+      for ( int i = 1; i <= nbCurves; i++ ) {
+       VISU::Curve_i* aCurve = aContainer->GetCurve( i );
+       if ( aCurve && aCurve->IsValid() ) {
+         UpdatePlot2d(myView,eDisplayOnly,aCurve);
+       }
+      }
+      myView->Repaint();
+    }
+    // is it Table ?
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+      SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
+      if ( !TableSO->_is_nil() ) {
+       SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
+         for ( ; Iter->More(); Iter->Next() ) {
+         CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
+         if( !CORBA::is_nil( childObject ) ) {
+           CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
+           if( !CORBA::is_nil( aCurve ) )
+             UpdatePlot2d(myView,eDisplayOnly,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+         }
+       }
+       myView->Repaint();
+      }
+    }
+  }
+  void XYPlot_i::FitAll() {
+    if(MYDEBUG) MESSAGE("XYPlot_i::FitAll");
+    Mutex mt(myMutex,qApp);
+    myView->fitAll();
+  }
+  CORBA::Boolean XYPlot_i::SavePicture(const char* theFileName) {
+    if(MYDEBUG) MESSAGE("XYPlot_i::SavePicture");
+    Mutex mt(myMutex,qApp);
+    if (!myView->getViewWidget())
+      return false;
+
+    QApplication::setOverrideCursor( Qt::waitCursor );
+    QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
+    QApplication::restoreOverrideCursor();
+    
+    if (!QString(theFileName).isNull()) {
+      QApplication::setOverrideCursor( Qt::waitCursor );
+      QString fmt = QAD_Tools::getFileExtensionFromPath(theFileName).upper();
+      if (fmt.isEmpty())
+       fmt = QString("BMP"); // default format
+      if (fmt == "JPG")
+       fmt = "JPEG";
+      bool bOk = px.save(theFileName, fmt.latin1());
+      QApplication::restoreOverrideCursor();
+      return bOk;
+    }
+    return false;
+  }
+
+  //===========================================================================
+  TableView_i::TableView_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {}
+  Storable* TableView_i::Create(VISU::Table_var theTable){
+    if(MYDEBUG) MESSAGE("TableView_i::Create - "<<(!theTable->_is_nil()));
+    Mutex mt(myMutex,qApp);
+    if(!theTable->_is_nil()){
+      VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable.in()));
+      if(MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = "<<table);
+      if(table != NULL) {
+       SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectID(table->GetObjectEntry());
+       if(!aSObject->_is_nil()) {
+         myView = new SALOMEGUI_TableDlg(QAD_Application::getDesktop(),aSObject);
+         myView->show();
+         myName = (myView->caption()).latin1();
+         return this;
+       }
+      }
+    }
+    return NULL;
+  }
+  void TableView_i::SetTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("TableView_i::SetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = theTitle;
+    myView->setCaption(myName.c_str());
+  }
+  char* TableView_i::GetTitle() {
+    if(MYDEBUG) MESSAGE("TableView_i::GetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = (myView->caption()).latin1();
+    return CORBA::string_dup(myName.c_str());
+  }
+  void TableView_i::Close(){
+    if(MYDEBUG) MESSAGE("TableView_i::Close");
+    Mutex mt(myMutex,qApp);
+    myView->close();
+  }
+  TableView_i::~TableView_i() {
+    if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
+    Mutex mt(myMutex,qApp);
+    Close();
+    delete myView;
+  }
+  //===========================================================================
+  int View3D_i::myNbViewParams = 0;
+  const string View3D_i::myComment = "VIEW3D";
+  const char* View3D_i::GetComment() const { return myComment.c_str();}
+  const char* View3D_i::GenerateViewParamsName() { 
+    return VISU::GenerateName( "ViewParams", ++myNbViewParams ); 
+  }
+
+  View3D_i::View3D_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {
+    if(MYDEBUG) MESSAGE("View3D_i::View3D_i");
+  }
+
+  Storable* View3D_i::Create(int theNew){
+    if(MYDEBUG) MESSAGE("View3D_i::Create");
+    Mutex mt(myMutex,qApp);
+    if(theNew)
+      myStudyFrame = myStudy->newWindow3d("",VIEW_VTK);
+    else
+      myStudyFrame = myStudy->getActiveStudyFrame();
+
+    VTKViewer_NonIsometricTransform *NITr = GetViewFrame(myStudyFrame)->getNonIsometricTransform();
+    myScaleFactor[0] = NITr->GetCoeff(AxisFunction::XAxis);
+    myScaleFactor[1] = NITr->GetCoeff(AxisFunction::YAxis);
+    myScaleFactor[2] = NITr->GetCoeff(AxisFunction::ZAxis);
+
+    return Build(false);
+  }
+
+  Storable* View3D_i::Build(int theRestoring){
+    if(MYDEBUG) MESSAGE("View3D_i::Build");
+    if(theRestoring){
+      myStudyFrame->setTitle(myName.c_str());
+      SetBackground(myColor);
+      SetPointOfView(myPosition);
+      SetViewUp(myViewUp);
+      SetFocalPoint(myFocalPnt);
+      SetParallelScale(myParallelScale);
+      ScaleView(VISU::View3D::XAxis,myScaleFactor[0]);
+      ScaleView(VISU::View3D::YAxis,myScaleFactor[1]);
+      ScaleView(VISU::View3D::ZAxis,myScaleFactor[2]);
+      RepaintView(myStudyFrame);
+    }else{
+      Update();
+      /*
+      SALOMEDS::SComponent_var aSComponent = FindOrCreateVisuComponent(myStudyDocument);
+      CORBA::String_var aSComponentEntry = aSComponent->GetID(), anIOR(GetID());
+      string anEntry = CreateAttributes(myStudyDocument,aSComponentEntry,"",anIOR,myName.c_str(),"",GetComment());
+      */
+    }
+    return this;
+  }
+
+  void View3D_i::Update(){
+    if(MYDEBUG) MESSAGE("View3D_i::Update");
+    Mutex mt(myMutex,qApp);
+    myName = myStudyFrame->title();
+    myColor = GetBackground();
+    GetCamera(myStudyFrame)->GetPosition(myPosition);
+    GetCamera(myStudyFrame)->GetViewUp(myViewUp);
+    GetCamera(myStudyFrame)->GetFocalPoint(myFocalPnt);
+    myParallelScale = GetCamera(myStudyFrame)->GetParallelScale();
+    RepaintView(myStudyFrame);
+
+    VTKViewer_NonIsometricTransform *NITr = GetViewFrame(myStudyFrame)->getNonIsometricTransform();
+    myScaleFactor[0] = NITr->GetCoeff(AxisFunction::XAxis);
+    myScaleFactor[1] = NITr->GetCoeff(AxisFunction::YAxis);
+    myScaleFactor[2] = NITr->GetCoeff(AxisFunction::ZAxis);
+  }
+
+  CORBA::Boolean View3D_i::SavePicture(const char* theFileName) {
+    if(MYDEBUG) MESSAGE("View3D_i::SavePicture");
+    Mutex mt(myMutex,qApp);
+    if (!myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget())
+      return false;
+
+    QApplication::setOverrideCursor( Qt::waitCursor );
+    QPixmap px = QPixmap::grabWindow(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget()->winId());
+    QApplication::restoreOverrideCursor();
+    
+    if (!QString(theFileName).isNull()) {
+      QApplication::setOverrideCursor( Qt::waitCursor );
+      QString fmt = QAD_Tools::getFileExtensionFromPath(theFileName).upper();
+      if (fmt.isEmpty())
+       fmt = QString("BMP"); // default format
+      if (fmt == "JPG")
+       fmt = "JPEG";
+      bool bOk = px.save(theFileName, fmt.latin1());
+      QApplication::restoreOverrideCursor();
+      return bOk;
+    }
+    return false;
+  }
+
+  CORBA::Boolean View3D_i::SaveViewParams(const char* theName){
+    if(MYDEBUG)  MESSAGE("View3D_i::SaveViewPoint");
+    Mutex mt(myMutex,qApp);
+    if ( theName ) {
+      SALOMEDS::Study::ListOfSObject_var aList = 
+       myStudy->getStudyDocument()->FindObjectByName(theName,"VISU");
+      SALOMEDS::GenericAttribute_var anAttr;
+      int iEnd = aList->length();
+      for(int i = 0; i < iEnd; i++){
+       SALOMEDS::SObject_var anObj = aList[i];
+       CORBA::String_var aString = anObj->GetID();
+       string anEntry(aString);
+       if(MYDEBUG)  MESSAGE("View3D_i::SaveViewPoint - anEntry = "<<anEntry);
+       if(anObj->FindAttribute(anAttr, "AttributeComment")){
+         SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+         aString = aCmnt->Value();
+         string aComm(aString);
+         if(MYDEBUG)  MESSAGE("View3D_i::SaveViewPoint - aComm = "<<aComm);
+         if(aComm.compare(View3D_i::myComment) >= 0){
+           aCmnt->SetValue(ToString().c_str());
+           return 1;
+         }
+       }
+      }
+    }
+    QString newName;
+    if ( theName )
+      newName = QString( theName );
+    else
+      newName = QString( GenerateViewParamsName() );
+    SALOMEDS::SComponent_var aSComponent = 
+      FindOrCreateVisuComponent(myStudy->getStudyDocument());
+    CORBA::String_var aSComponentEntry = aSComponent->GetID(), anIOR(GetID());
+    string anEntry = CreateAttributes(myStudy->getStudyDocument(),aSComponentEntry,"","",newName.latin1(),"",ToString().c_str());
+    return 1;
+  }
+
+  CORBA::Boolean View3D_i::RestoreViewParams(const char* theName){
+    if(MYDEBUG)  MESSAGE("View3D_i::RestoreViewPoint - "<<theName);
+    Mutex mt(myMutex,qApp);
+    SALOMEDS::Study::ListOfSObject_var aList = 
+      myStudy->getStudyDocument()->FindObjectByName(theName,"VISU");
+    SALOMEDS::GenericAttribute_var anAttr;
+    int iEnd = aList->length();
+    if(MYDEBUG)  MESSAGE("View3D_i::RestoreViewPoint - iEnd = "<<iEnd);
+    for(int i = 0; i < iEnd; i++){
+      SALOMEDS::SObject_var anObj = aList[i];
+      CORBA::String_var aString = anObj->GetID();
+      string anEntry(aString);
+      if(MYDEBUG)  MESSAGE("View3D_i::RestoreViewPoint - anEntry = "<<anEntry);
+      if(anObj->FindAttribute(anAttr, "AttributeComment")){
+       SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
+       aString = aCmnt->Value();
+       QString strIn(aString);
+       Storable::TRestoringMap aMap;
+       Storable::StrToMap(strIn,aMap);
+       if ( Storable::FindValue( aMap,"myComment").compare( View3D_i::myComment.c_str() ) >= 0 ) {
+         if(MYDEBUG)  MESSAGE("View3D_i::RestoreViewPoint - aComm = "<<strIn);
+         return Restore( aMap ) != NULL;
+       }
+      }
+    }
+    return 0;
+  }
+
+#define  RESTORE(MAP,ARG,FMT) ARG = VISU::Storable::FindValue(MAP,#ARG).FMT()
+
+  Storable* View3D_i::Restore(const Storable::TRestoringMap& theMap) throw(std::logic_error&) {
+    if(MYDEBUG)  MESSAGE("View3D_i::Restore");
+    //RESTORE(theMap,myName,latin1);
+    
+    RESTORE(theMap,myColor.R,toDouble);
+    RESTORE(theMap,myColor.G,toDouble);
+    RESTORE(theMap,myColor.B,toDouble);
+    
+    RESTORE(theMap,myPosition[0],toDouble);
+    RESTORE(theMap,myPosition[1],toDouble);
+    RESTORE(theMap,myPosition[2],toDouble);
+    
+    RESTORE(theMap,myFocalPnt[0],toDouble);
+    RESTORE(theMap,myFocalPnt[1],toDouble);
+    RESTORE(theMap,myFocalPnt[2],toDouble);
+    
+    RESTORE(theMap,myViewUp[0],toDouble);
+    RESTORE(theMap,myViewUp[1],toDouble);
+    RESTORE(theMap,myViewUp[2],toDouble);
+    
+    RESTORE(theMap,myParallelScale,toDouble);
+    
+    RESTORE(theMap,myScaleFactor[0],toDouble);
+    RESTORE(theMap,myScaleFactor[1],toDouble);
+    RESTORE(theMap,myScaleFactor[2],toDouble);
+    
+    return Build(true);
+  }
+    
+#undef RESTORE
+
+  void View3D_i::ToStream(ostrstream& theStr) {
+    if(MYDEBUG) MESSAGE(GetComment());
+    Update();
+    Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
+
+    Storable::DataToStream(theStr,"myColor.R",myColor.R);
+    Storable::DataToStream(theStr,"myColor.G",myColor.G);
+    Storable::DataToStream(theStr,"myColor.B",myColor.B);
+
+    Storable::DataToStream(theStr,"myPosition[0]",myPosition[0]);
+    Storable::DataToStream(theStr,"myPosition[1]",myPosition[1]);
+    Storable::DataToStream(theStr,"myPosition[2]",myPosition[2]);
+
+    Storable::DataToStream(theStr,"myFocalPnt[0]",myFocalPnt[0]);
+    Storable::DataToStream(theStr,"myFocalPnt[1]",myFocalPnt[1]);
+    Storable::DataToStream(theStr,"myFocalPnt[2]",myFocalPnt[2]);
+
+    Storable::DataToStream(theStr,"myViewUp[0]",myViewUp[0]);
+    Storable::DataToStream(theStr,"myViewUp[1]",myViewUp[1]);
+    Storable::DataToStream(theStr,"myViewUp[2]",myViewUp[2]);
+
+    Storable::DataToStream(theStr,"myParallelScale",myParallelScale);
+
+    Storable::DataToStream(theStr,"myScaleFactor[0]",myScaleFactor[0]);
+    Storable::DataToStream(theStr,"myScaleFactor[1]",myScaleFactor[1]);
+    Storable::DataToStream(theStr,"myScaleFactor[2]",myScaleFactor[2]);
+  }
+
+  Storable* VISU::View3DRestore(SALOMEDS::SComponent_var& theSComponent, SALOMEDS::Study_var& theStudy,
+                               const char* thePrefix, const Storable::TRestoringMap& theMap)
+    {
+      try{
+       View3D_i* pView3D = new View3D_i(theStudy);
+       return pView3D->Restore(theMap);
+      }catch(std::logic_error& exc){
+       MESSAGE("Follow exception was accured :\n"<<exc.what());
+      }catch(...){
+       MESSAGE("Unknown exception was accured!");
+      }
+      return NULL;
+    }
+  
+  void View3D_i::Close(){
+    if(MYDEBUG) MESSAGE("View3D_i::Close");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->close();
+  }
+
+  View3D_i::~View3D_i() {
+    if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->close();
+  }
+  
+  //-------------------- View interface --------------------
+  void View3D_i::SetTitle(const char* theTitle){
+    if(MYDEBUG) MESSAGE("View3D_i::SetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = theTitle;
+    /*
+    SALOMEDS::SObject_var aSObject = 
+    myStudy->getStudyDocument()->FindObjectID(GetEntry());
+    SALOMEDS::GenericAttribute_var anAttr;
+    if(aSObject->FindAttribute(anAttr,"AttributeName")){
+      SALOMEDS::AttributeName_ptr aName = SALOMEDS::AttributeName::_narrow(anAttr);
+      aName->SetValue(myName.c_str());
+    }
+    */
+    myStudyFrame->setTitle(myName.c_str());
+  }
+  char* View3D_i::GetTitle() {
+    if(MYDEBUG) MESSAGE("View3D_i::GetTitle");
+    Mutex mt(myMutex,qApp);
+    myName = myStudyFrame->title();
+    return CORBA::string_dup(myName.c_str());
+  }
+  void View3D_i::SetBackground(const SALOMEDS::Color& theColor) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetBackground");
+    Mutex mt(myMutex,qApp);
+    myColor.R = theColor.R;
+    myColor.G = theColor.G;
+    myColor.B = theColor.B;
+    QColor aColor(255.0*myColor.R,255.0*myColor.G,255.0*myColor.B);
+    GetViewFrame(myStudyFrame)->setBackgroundColor(aColor);
+  }
+  SALOMEDS::Color View3D_i::GetBackground() { 
+    if(MYDEBUG) MESSAGE("View3D_i::GetBackground");
+    Mutex mt(myMutex,qApp);
+    float backint[3];
+    GetRenderer(myStudyFrame)->GetBackground(backint);
+    myColor.R = backint[0];
+    myColor.G = backint[1];
+    myColor.B = backint[2];
+    return myColor;
+  }
+  void View3D_i::Minimize() {
+    if(MYDEBUG) MESSAGE("View3D_i::Minimize");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showMinimized();
+  }
+  void View3D_i::Restore() {
+    if(MYDEBUG) MESSAGE("View3D_i::Restore");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showNormal();
+  }
+  void View3D_i::Maximize() {
+    if(MYDEBUG) MESSAGE("View3D_i::Maximize");
+    Mutex mt(myMutex,qApp);
+    myStudyFrame->showMaximized();
+  }
+  //===========================================================================
+  void View3D_i::EraseAll() {
+    if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
+    Mutex mt(myMutex,qApp);
+    UpdateViewer(myStudyFrame,eEraseAll);
+  }
+  void View3D_i::DisplayAll() {
+    if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
+    Mutex mt(myMutex,qApp);
+    UpdateViewer(myStudyFrame,eDisplayAll);
+  }
+  void View3D_i::Erase(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::Erase");
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+      UpdateViewer(myStudyFrame,eErase,aPrs);
+  }
+  void View3D_i::Display(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::Display"); 
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+      UpdateViewer(myStudyFrame,eDisplay,aPrs);
+  }
+  void View3D_i::DisplayOnly(PrsObject_ptr thePrsObj) {
+    if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
+    Mutex mt(myMutex,qApp);
+    CORBA::Object_var anObj = thePrsObj;
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+      UpdateViewer(myStudyFrame,eDisplayOnly,aPrs);
+  }
+
+  //-------------------- View3D interface --------------------
+  void View3D_i::FitAll() { 
+    if(MYDEBUG) MESSAGE("View3D_i::FitAll");
+    Mutex mt(myMutex,qApp);
+    GetViewFrame(myStudyFrame)->onViewFitAll();
+    Update();
+  }
+  void View3D_i::SetView(VISU::View3D::ViewType theType) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetView");
+    Mutex mt(myMutex,qApp);
+    switch(theType){
+    case VISU::View3D::FRONT : GetViewFrame(myStudyFrame)->onViewFront(); break;
+    case VISU::View3D::BACK : GetViewFrame(myStudyFrame)->onViewBack(); break;
+    case VISU::View3D::LEFT : GetViewFrame(myStudyFrame)->onViewLeft(); break;
+    case VISU::View3D::RIGHT : GetViewFrame(myStudyFrame)->onViewRight(); break;
+    case VISU::View3D::TOP : GetViewFrame(myStudyFrame)->onViewTop(); break;
+    case VISU::View3D::BOTTOM : GetViewFrame(myStudyFrame)->onViewBottom(); break;
+    }
+    Update();
+  }
+
+  void View3D_i::SetPointOfView(const VISU::View3D::XYZ theCoord) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
+    Mutex mt(myMutex,qApp);
+    VISU::View3D::XYZ_copy(myPosition,theCoord);
+    GetCamera(myStudyFrame)->SetPosition(myPosition);
+  }
+  VISU::View3D::XYZ_slice* View3D_i::GetPointOfView() { 
+    if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
+    Mutex mt(myMutex,qApp);
+    GetCamera(myStudyFrame)->GetPosition(myPosition);
+    return VISU::View3D::XYZ_dup(myPosition);
+  }
+
+  void View3D_i::SetViewUp(const VISU::View3D::XYZ theDir) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
+    Mutex mt(myMutex,qApp);
+    VISU::View3D::XYZ_copy(myViewUp,theDir);
+    GetCamera(myStudyFrame)->SetViewUp(myViewUp);
+  }
+  VISU::View3D::XYZ_slice* View3D_i::GetViewUp() { 
+    if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
+    Mutex mt(myMutex,qApp);
+    GetCamera(myStudyFrame)->GetViewUp(myViewUp);
+    return VISU::View3D::XYZ_dup(myViewUp);
+  }
+
+  void View3D_i::SetFocalPoint(const VISU::View3D::XYZ theCoord) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
+    Mutex mt(myMutex,qApp);
+    VISU::View3D::XYZ_copy(myFocalPnt,theCoord);
+    GetCamera(myStudyFrame)->SetFocalPoint(myFocalPnt);
+  }
+  VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint() { 
+    if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
+    Mutex mt(myMutex,qApp);
+    GetCamera(myStudyFrame)->GetFocalPoint(myFocalPnt);
+    return VISU::View3D::XYZ_dup(myFocalPnt);
+  }
+
+  void View3D_i::SetParallelScale(CORBA::Double theScale) {
+    if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
+    Mutex mt(myMutex,qApp);
+    myParallelScale = theScale;
+    GetCamera(myStudyFrame)->SetParallelScale(myParallelScale);
+  }
+  CORBA::Double View3D_i::GetParallelScale() { 
+    if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
+    Mutex mt(myMutex,qApp);
+    return myParallelScale = GetCamera(myStudyFrame)->GetParallelScale();
+  }
+
+  void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam) {
+    Mutex mt(myMutex,qApp);
+    bool changed = false;
+    VTKViewer_ViewFrame* vf =  GetViewFrame(myStudyFrame);
+    VTKViewer_NonIsometricTransform *aTransform = vf->getNonIsometricTransform();
+    static double EPS =1.0E-3;
+    VTKViewer_NonIsometricTransform::Function 
+      aFunction = (fabs(theParam - 1.0) < EPS? 
+                  VTKViewer_NonIsometricTransform::Identical: 
+                  VTKViewer_NonIsometricTransform::Linear);
+    AxisFunction::Axis anAxis;
+    if(theAxis == VISU::View3D::XAxis){
+      myScaleFactor[0] = theParam;
+      anAxis = AxisFunction::XAxis;
+    }else if(theAxis == VISU::View3D::YAxis){
+      myScaleFactor[1] = theParam;
+      anAxis = AxisFunction::YAxis;
+    }else{
+      myScaleFactor[2] = theParam;
+      anAxis = AxisFunction::ZAxis;
+    }
+    if(MYDEBUG) 
+      MESSAGE("View3D_i::ScaleView - theParam = "<<theParam<<"; aFunction = "<<aFunction);
+    vtkRenderer* Renderer = vf->getRenderer();
+    vtkActorCollection* theActors = Renderer->GetActors();
+    theActors->InitTraversal();
+    vtkActor *actor = theActors->GetNextActor();
+    while(actor){
+      //SALOME_Actor* pSA = dynamic_cast<SALOME_Actor*> (actor);
+      SALOME_Actor* pSA = dynamic_cast<VISU_Actor*> (actor);
+      if(pSA){
+       vtkPolyDataMapper* mapper = NULL;
+       vtkMapper* initialMapper = pSA->GetInitialMapper();
+       if ( initialMapper == NULL )
+         initialMapper =   actor->GetMapper();
+       if ( initialMapper->IsA("vtkDataSetMapper") )
+         mapper = vtkDataSetMapper::SafeDownCast( initialMapper )->GetPolyDataMapper ();
+       else
+         mapper = vtkPolyDataMapper::SafeDownCast( initialMapper );
+       if(mapper){
+         //create transformation
+         if(MYDEBUG) MESSAGE("View3D_i::ScaleView - theActors->GetNextActor()");
+         aTransform->SetFunction(anAxis,aFunction,theParam); 
+         //create Filter
+         vtkTransformPolyDataFilter *aTransformFilter = vtkTransformPolyDataFilter::New();
+         aTransformFilter->SetInput ( mapper->GetInput() );
+         aTransformFilter->SetTransform (aTransform);
+
+         //create new mapper
+         vtkMapper* aIMapper = pSA->GetInitialMapper();
+         if ((aIMapper != NULL) && aIMapper->IsA("vtkDataSetMapper")) {
+           vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+           aMapper->SetInput (aTransformFilter->GetOutput());
+           aMapper->ShallowCopy ( actor->GetMapper());
+           actor->SetMapper (aMapper);
+           aMapper->Delete();
+         } else {
+           vtkPolyDataMapper *aMapper = vtkPolyDataMapper::New();
+           aMapper->SetInput (aTransformFilter->GetOutput());
+           aMapper->ShallowCopy ( actor->GetMapper());
+           actor->SetMapper (aMapper);
+           aMapper->Delete();
+         }
+         aTransformFilter->Delete();
+         changed = true;
+       }
+      }
+      actor = theActors->GetNextActor();
+    }
+    if(MYDEBUG) 
+      MESSAGE("View3D_i::ScaleView - myScaleFactor = "<<
+             myScaleFactor[0]<<"; "<<myScaleFactor[1]<<"; "<<myScaleFactor[2]);
+    if (changed)
+      RepaintView(myStudyFrame);
+  }
+  void View3D_i::RemoveScale() {
+    if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
+    Mutex mt(myMutex,qApp);
+    ScaleView(VISU::View3D::XAxis,1.0);
+    ScaleView(VISU::View3D::YAxis,1.0);
+    ScaleView(VISU::View3D::ZAxis,1.0);
+  }
+  //===========================================================================
+}
diff --git a/src/VISU_I/VISU_ViewManager_i.hh b/src/VISU_I/VISU_ViewManager_i.hh
new file mode 100644 (file)
index 0000000..6c847fa
--- /dev/null
@@ -0,0 +1,229 @@
+// File:       VISU_ViewManager_i.hxx
+// Created:    Wed Jan 22 17:52:40 2003
+// Author:     Alexey PETROV
+//             <apo@ivanox.nnov.matra-dtv.fr>
+
+
+#ifndef VISU_ViewManager_i_HeaderFile
+#define VISU_ViewManager_i_HeaderFile
+
+#include "VISUConfig.hh"
+class QAD_Study;
+class QAD_StudyFrame;
+class VTKViewer_ViewFrame;
+class Plot2d_ViewFrame;
+class SALOMEGUI_TableDlg;
+class VISU_Actor;
+class vtkRenderer;
+class vtkCamera;
+
+namespace VISU{
+  class Prs3d_i;
+  class ViewManager_i : public virtual POA_VISU::ViewManager,
+                        public virtual Base_i
+  {
+  public:
+    ViewManager_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~ViewManager_i() {};
+    virtual VISU::VISUType GetType() { return VISU::TVIEWMANAGER;};
+
+    virtual View3D_ptr Create3DView();
+    virtual View_ptr   GetCurrentView();
+    virtual TableView_ptr CreateTableView(VISU::Table_ptr theTable);
+    virtual XYPlot_ptr CreateXYPlot();
+    virtual void Destroy(View_ptr theView);
+
+  protected:
+    SALOMEDS::Study_var myStudyDocument;
+  };
+
+  //===========================================================================
+  class View_i : public virtual POA_VISU::View,
+                 public virtual Storable
+  {
+  protected:
+    QAD_Study* myStudy;
+    string myName;
+  public:
+    View_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~View_i();
+    virtual void SetBackground(const SALOMEDS::Color& theColor);
+    virtual SALOMEDS::Color GetBackground();
+    virtual void Minimize();
+    virtual void Restore();
+    virtual void Maximize();
+    virtual void EraseAll();
+    virtual void DisplayAll();
+    virtual void Erase(PrsObject_ptr thePrsObj);
+    virtual void Display(PrsObject_ptr thePrsObj);
+    virtual void DisplayOnly(PrsObject_ptr thePrsObj);
+    virtual void Update();
+
+    virtual CORBA::Boolean SavePicture(const char* theFileName);
+
+    virtual void Close() = 0;
+    virtual void ToStream(ostrstream& theStr);
+    virtual const char* GetComment() const;
+  public:
+    virtual const char* View_i::GetEntry();
+  };
+
+  //===========================================================================
+  class XYPlot_i : public virtual POA_VISU::XYPlot,
+                   public virtual View_i
+  {
+  public:
+    XYPlot_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~XYPlot_i();
+    virtual VISU::VISUType GetType() { return VISU::TXYPLOT;};
+
+    virtual void SetTitle(const char* theTitle);
+    virtual char* GetTitle();
+
+    virtual void SetSubTitle(const char* theTitle);
+    virtual char* GetSubTitle();
+
+    virtual void SetCurveType(VISU::XYPlot::CurveType theType);
+    virtual VISU::XYPlot::CurveType GetCurveType();
+
+    virtual void SetMarkerSize(CORBA::Long theSize);
+    virtual CORBA::Long GetMarkerSize();
+
+    virtual void EnableXGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor, 
+                            CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+    virtual void EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor, 
+                            CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+
+    virtual void SetHorScaling(VISU::Scaling theScaling);
+    virtual VISU::Scaling GetHorScaling();
+    virtual void SetVerScaling(VISU::Scaling theScaling);
+    virtual VISU::Scaling GetVerScaling();
+
+    virtual void SetXTitle(const char* theTitle);
+    virtual char* GetXTitle();
+
+    virtual void SetYTitle(const char* theTitle);
+    virtual char* GetYTitle();
+
+    virtual void ShowLegend(CORBA::Boolean theShowing);
+
+    virtual void SetBackground(const SALOMEDS::Color& theColor);
+    virtual SALOMEDS::Color GetBackground();
+    virtual void Minimize();
+    virtual void Restore();
+    virtual void Maximize();
+    virtual void EraseAll();
+    virtual void Erase(PrsObject_ptr thePrsObj);
+    virtual void Display(PrsObject_ptr thePrsObj);
+    virtual void DisplayOnly(PrsObject_ptr thePrsObj);
+    virtual void Update();
+
+    virtual CORBA::Boolean SavePicture(const char* theFileName);
+
+    virtual void FitAll();
+
+    virtual void Close();
+  protected:
+    QAD_StudyFrame*   myStudyFrame;
+    Plot2d_ViewFrame* myView;
+  public:
+    virtual Storable* Create(int theNew);
+  };
+
+  //===========================================================================
+  class TableView_i : public virtual POA_VISU::TableView,
+                      public virtual View_i
+  {
+  public:
+    TableView_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~TableView_i();
+    virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW;};
+
+    virtual void SetTitle(const char* theTitle);
+    virtual char* GetTitle();
+
+    virtual void Close();
+  protected:
+    SALOMEGUI_TableDlg* myView;
+  public:
+    virtual Storable* Create(VISU::Table_var theTable);
+  };
+
+  //===========================================================================
+  class View3D_i : public virtual POA_VISU::View3D,
+                   public virtual View_i
+  {
+  public:
+    View3D_i(SALOMEDS::Study_ptr theStudy);
+    virtual ~View3D_i();
+    virtual VISU::VISUType GetType() { return VISU::TVIEW3D;};
+
+    //View interface
+    virtual void SetTitle(const char* theTitle);
+    virtual char* GetTitle();
+    virtual void SetBackground(const SALOMEDS::Color& theColor);
+    virtual SALOMEDS::Color GetBackground();
+    virtual void Minimize();
+    virtual void Restore();
+    virtual void Maximize();
+    virtual void EraseAll();
+    virtual void DisplayAll();
+    virtual void Erase(PrsObject_ptr thePrsObj);
+    virtual void Display(PrsObject_ptr thePrsObj);
+    virtual void DisplayOnly(PrsObject_ptr thePrsObj);
+    virtual void Update();
+
+    virtual CORBA::Boolean SavePicture(const char* theFileName);
+    
+    //View3D interface
+    virtual void FitAll();
+    virtual void SetView(VISU::View3D::ViewType theType);
+
+    virtual void SetPointOfView(const VISU::View3D::XYZ theCoord);
+    virtual VISU::View3D::XYZ_slice* GetPointOfView();
+
+    virtual void SetViewUp(const VISU::View3D::XYZ theDir);
+    virtual VISU::View3D::XYZ_slice* GetViewUp();
+
+    virtual void SetFocalPoint(const VISU::View3D::XYZ theCoord);
+    virtual VISU::View3D::XYZ_slice* GetFocalPoint();
+
+    virtual void SetParallelScale(CORBA::Double theScale);
+    virtual CORBA::Double GetParallelScale();
+
+    virtual void ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam);
+    virtual void RemoveScale();
+
+    virtual const char*    GenerateViewParamsName();
+    virtual CORBA::Boolean SaveViewParams(const char* theName);
+    virtual CORBA::Boolean RestoreViewParams(const char* theName);
+
+    virtual void Close();
+  protected:
+    QAD_StudyFrame* myStudyFrame;
+    SALOMEDS::Color myColor;
+    CORBA::Double myPosition[3], myFocalPnt[3], myViewUp[3], myParallelScale, myScaleFactor[3];
+
+    Storable* Build(int theRestoring);
+    static int myNbViewParams;
+
+  public:
+    virtual Storable* Create(int theNew);
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap) throw(std::logic_error&);
+    virtual void ToStream(ostrstream& theStr);
+    virtual const char* GetComment() const;
+    static const string myComment;
+  };
+  Storable* View3DRestore(SALOMEDS::SComponent_var& theSComponent, SALOMEDS::Study_var& theStudy,
+                         const char* thePrefix, const Storable::TRestoringMap& theMap);
+
+  VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame);
+  vtkRenderer* GetRenderer(QAD_StudyFrame* theStudyFrame);
+  vtkCamera* GetCamera(QAD_StudyFrame* theStudyFrame);
+  void RepaintView(QAD_StudyFrame* theStudyFrame);
+
+  enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
+  VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs = NULL);
+}
+
+#endif