]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce first version of WP1_2_1 development
authorapo <apo@opencascade.com>
Fri, 4 May 2007 08:19:57 +0000 (08:19 +0000)
committerapo <apo@opencascade.com>
Fri, 4 May 2007 08:19:57 +0000 (08:19 +0000)
211 files changed:
adm_local/unix/make_commence.in
build_configure
configure.in.base
idl/VISU_Gen.idl
resources/SalomeApp.xml
resources/Visu_holo_render.png [new file with mode: 0755]
resources/Visu_slider_avi.png [new file with mode: 0755]
resources/Visu_slider_first.png [new file with mode: 0644]
resources/Visu_slider_last.png [new file with mode: 0644]
resources/Visu_slider_more.png [new file with mode: 0755]
resources/Visu_slider_next.png [new file with mode: 0644]
resources/Visu_slider_pause.png [new file with mode: 0644]
resources/Visu_slider_play.png [new file with mode: 0644]
resources/Visu_slider_previous.png [new file with mode: 0644]
resources/Visu_tree_multipr_full.png [new file with mode: 0755]
resources/Visu_tree_multipr_hide.png [new file with mode: 0755]
resources/Visu_tree_multipr_low.png [new file with mode: 0755]
resources/Visu_tree_multipr_medium.png [new file with mode: 0755]
src/CONVERTOR/Makefile.in
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.cxx
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_ConvertorDef.hxx
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_ConvertorUtils.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_IDMapper.cxx
src/CONVERTOR/VISU_IDMapper.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/MULTIPR/MULTIPR_API.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_API.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_DecimationAccel.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_DecimationAccel.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_DecimationFilter.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_DecimationFilter.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Elements.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Elements.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Exceptions.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Family.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Family.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Field.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Field.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_GaussLoc.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_GaussLoc.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Globals.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Mesh.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Mesh.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_MeshDis.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_MeshDis.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Nodes.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Nodes.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Obj.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Obj.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_PointOfField.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Profil.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Profil.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_ProgressCallback.hxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Utils.cxx [new file with mode: 0755]
src/MULTIPR/MULTIPR_Utils.hxx [new file with mode: 0755]
src/MULTIPR/Makefile.in [new file with mode: 0755]
src/MULTIPR/multipr.cxx [new file with mode: 0755]
src/Makefile.in
src/OBJECT/Makefile.in
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_ActorFactory.h
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h
src/OBJECT/VISU_ScalarMapAct.cxx
src/OBJECT/VISU_ScalarMapAct.h
src/OBJECT/VISU_VectorsAct.cxx
src/OBJECT/VISU_VectorsAct.h
src/PIPELINE/Makefile.in
src/PIPELINE/SALOME_ExtractGeometry.cxx
src/PIPELINE/SALOME_ExtractGeometry.h
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutLinesPL.hxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.hxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_DeformedShapePL.hxx
src/PIPELINE/VISU_Extractor.cxx
src/PIPELINE/VISU_Extractor.hxx
src/PIPELINE/VISU_FieldTransform.cxx
src/PIPELINE/VISU_FieldTransform.hxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_MeshPL.cxx
src/PIPELINE/VISU_MeshPL.hxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_PipeLineUtils.cxx
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_Plot3DPL.hxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_UsedPointsFilter.cxx
src/PIPELINE/VISU_UsedPointsFilter.hxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx
src/VISUGUI/Makefile.in
src/VISUGUI/VISU_images.po
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.h
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.h
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.h
src/VISUGUI/VisuGUI_Displayer.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.h
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.h
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_OffsetDlg.cxx
src/VISUGUI/VisuGUI_Plot3DDlg.cxx
src/VISUGUI/VisuGUI_Plot3DDlg.h
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.h
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.h
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_TimeAnimation.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_TransparencyDlg.cxx
src/VISUGUI/VisuGUI_TransparencyDlg.h
src/VISUGUI/VisuGUI_VectorsDlg.cxx
src/VISUGUI/VisuGUI_VectorsDlg.h
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/Makefile.in
src/VISU_I/VISUConfig.cc
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx
src/VISU_I/VISU_CutLines_i.cc
src/VISU_I/VISU_CutLines_i.hh
src/VISU_I/VISU_CutPlanes_i.cc
src/VISU_I/VISU_CutPlanes_i.hh
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_DeformedShape_i.hh
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_I.cxx
src/VISU_I/VISU_IsoSurfaces_i.cc
src/VISU_I/VISU_IsoSurfaces_i.hh
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Mesh_i.hh
src/VISU_I/VISU_Plot3D_i.cc
src/VISU_I/VISU_Plot3D_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_PrsObject_i.cc
src/VISU_I/VISU_PrsObject_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_StreamLines_i.cc
src/VISU_I/VISU_StreamLines_i.hh
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_Table_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_Vectors_i.cc
src/VISU_I/VISU_Vectors_i.hh
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_I/VISU_ViewManager_i.hh
src/VISU_I/VISU_View_i.cc
src/VISU_I/VISU_View_i.hh
src/VISU_SWIG/Makefile.in
src/VISU_SWIG/VISU_Gen_s.cc
src/VISU_SWIG/visu.py
src/VVTK/VVTK_ViewModel.cxx
src/VVTK/VVTK_ViewModel.h
src/VVTK/VVTK_ViewWindow.cxx

index bba7766f82c95313fa0fa7067530b3fbd0dac6cb..90f080db629cfacef12a3fd2573c37c6a91295c4 100644 (file)
@@ -101,6 +101,12 @@ HDF5_INCLUDES=@HDF5_INCLUDES@
 HDF5_LIBS=@HDF5_LIBS@
 HDF5_MT_LIBS=@HDF5_MT_LIBS@
 
+# MED2
+
+MED2_INCLUDES=@MED2_INCLUDES@
+MED2_LIBS=@MED2_LIBS@
+MED2_MT_LIBS=@MED2_MT_LIBS@
+
 # OpenCasCade
 
 OCC_INCLUDES=@CAS_CPPFLAGS@
@@ -288,3 +294,4 @@ $(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL:%=@KERNEL_ROOT_DIR@/salome_adm/unix/c
        cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
                                                                       -I @GUI_ROOT_DIR@/adm_local/unix/config_files \
                                                                       -I @MED_ROOT_DIR@/adm_local/unix/config_files
+
index 212e7d8b0e292dc8c6a5431bd7bcdc906ee73d48..ad67c184998c15c89afddd985f4db2e08202c1a2 100755 (executable)
@@ -42,6 +42,14 @@ if test ! -d "${MED_ROOT_DIR}"; then
     exit
 fi
 
+########################################################################
+# Test if the MED2HOME is set correctly
+
+if test ! -d "${MED2HOME}"; then
+    echo "failed : MED2HOME variable is not correct !"
+    exit
+fi
+
 ########################################################################
 # find_in - utility function
 #
index b96d47bbc50c814301c62c6fd6b1e1cf51f43fb3..a01f6e78cab6e4d4ae851c33f599332ed4c49244 100644 (file)
@@ -242,6 +242,14 @@ echo
 
 CHECK_HDF5
 
+echo
+echo ---------------------------------------------
+echo testing MED2
+echo ---------------------------------------------
+echo
+
+CHECK_MED2
+
 echo
 echo ---------------------------------------------
 echo BOOST Library
@@ -317,7 +325,7 @@ echo ---------------------------------------------
 echo
 
 echo Configure
-variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok"
+variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok"
 
 for var in $variables
 do
index 2f1d27f9c008597788b7deadc7c690724a4c0ff7..733355e537ce74eae9bb633b02ce670998f105e5 100644 (file)
@@ -94,6 +94,9 @@ module VISU {
     TFIELD, /*!< Field represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept. */
     TTIMESTAMP, /*!<Time stamp represents a subfield: the results of calculations are taken in one definite moment. */
     TANIMATION, /*!< Represents Animation object. */
+    TCOLOREDPRS3DHOLDER, /*!< Colored 3D presentation holder */
+    TCOLOREDPRS3DCACHE, /*!< Colored 3D presentation cache */
+       TPART, /*!< MULTIPR: part of a mesh */
     TALL
   };
 
@@ -307,14 +310,47 @@ module VISU {
   };
 
   //-------------------------------------------------------
+  interface Result;
   /*! \brief 3D presentation interface
    *
    * This is a root class for all 3D presentations, which can be displayed in %VISU module.
    */
-  interface Prs3d : PrsObject, SALOME::GenericObj {
-    //interface Prs3d : PrsObject{
+  interface Prs3d : PrsObject, SALOME::GenericObj 
+  {
+    /*!
+     * Applies a set basic input parameters to the 3D presentation
+     * \return True of the set of input parameters is correct and was succesfully applied,
+     * False otherwise
+     */
+    boolean Apply(in boolean theReInit); 
+
+    //! Sets Result object used by presentation to obtain its input 
+    void SetResultObject(in Result theResult);
+
+    //! Gets Result object used by presentation to obtain its input 
+    Result GetResultObject();
+
+    //! Sets name of the mesh used by presentation to obtain its input 
+    void SetMeshName(in string theMeshName);
+
+    //! Gets name of the mesh used by presentation to obtain its input 
+    string GetMeshName();
+
+    /*!
+     * Move the 3D presentation according to the given offset parameters
+     */
     void SetOffset(in float theDx, in float theDy, in float theDz);
+
+
+    /*!
+     * Gets offset parameters for the 3D presentation
+     */
     void GetOffset(out float theDx, out float theDy, out float theDz);
+
+    /*!
+     * Gets memory size actually used by the presentation (Mb).
+     */
+    float GetMemorySize();
   };
 
   /*!
@@ -392,7 +428,49 @@ module VISU {
    * bar is displayed along with each colored field presentation and serves for
    * consulting the correspondance between colors and data values.
    */
-  interface ColoredPrs3d : Prs3d {
+  interface ColoredPrs3d : Prs3d 
+  {
+    /*! Sets Entity input parameter that defines where the parent mesh to be taken from. 
+     */
+    void SetEntity(in Entity theEntity);
+    /*! Gets Entity input parameter that defines where the parent mesh is taken from. 
+     */
+    Entity GetEntity();
+
+    /*! Sets name of field input parameter that defines what phisical data to be retrived. 
+     */
+    void SetFieldName(in string theName);
+    /*! Gets name of field input parameter that defines what phisical data is retrived. 
+     */
+    string GetFieldName();
+
+    /*! Sets number of timestamp input parameter that defines what time of phisical data to be retrived. 
+     */
+    void SetTimeStampNumber(in long theTimeStampNumber);
+    /*! Gets number of timestamp input parameter that defines what time of phisical data is retrived. 
+     */
+    long GetTimeStampNumber();
+
+    /*! Defines timestamp representation. 
+     */
+    struct TimeStampInfo
+    {
+      string myTime;
+      long myNumber;
+    };
+
+    /*! Defines representation range of timestamps. 
+     */
+    typedef sequence<TimeStampInfo> TimeStampsRange;
+
+    /*! Gets available range of timestamps. 
+     */
+    TimeStampsRange GetTimeStampsRange();
+
+    /*! Defines whether this presentation is bound to timestamp or not.
+     */
+    boolean IsTimeStampFixed();
+
     /*! Sets the method of coloring of the elements composing a 3D presentation.
      */
     void SetScalarMode(in long theScalarMode);
@@ -411,6 +489,21 @@ module VISU {
      */
     double GetMax();
 
+    /*!
+     * Gets the min boundary of the scalar bar from source data.
+     */
+    double GetSourceMin();
+
+    /*!
+     * Gets the max boundary of the scalar bar from source data.
+     */
+    double GetSourceMax();
+
+    /*!
+     * Defines whether the scalar range corresponds to the source data or not.
+     */
+    boolean IsRangeFixed();
+
     /*! \brief Position of the scalar bar.
      *
      * Sets the position of the scalar bar origin on the screen.
@@ -489,6 +582,116 @@ module VISU {
   };
 
 
+  //-------------------------------------------------------
+  interface View3D;
+  interface ColoredPrs3dCache;
+
+  /*! \brief %ColoredPrs3dHolder interface.
+   * Interface of 3d presentation's holder, which represents colored 3d presentations,
+   * created on fields. It is publishing in the object browser in a separate folder
+   * and can be controled by viewer's slider.
+   */
+  interface ColoredPrs3dHolder : PrsObject, SALOME::GenericObj
+  {
+    /*!
+     * Presentation input parameters.
+     */
+    struct BasicInput
+    {
+      Result myResult;
+      string myMeshName;
+      Entity myEntity;
+      string myFieldName;
+      long myTimeStampNumber;
+    };
+
+    /*!
+     * Apply input parameters to last visited presentation in the cache.
+     */
+    boolean Apply(in ColoredPrs3d thePrs3d,
+                 in BasicInput theInput,
+                 in View3D theView3D);
+
+    /*!
+     * Gets the last visited presentation in the cache.
+     */
+    ColoredPrs3d GetDevice();
+
+    /*!
+     * Gets type of the managed presentations.
+     */
+    VISUType GetPrsType();
+
+    /*!
+     * Gets TimeStampsRange information from the last visited presentation.
+     */
+    ColoredPrs3d::TimeStampsRange GetTimeStampsRange();
+
+    /*!
+     * Gets input parameters of the last visited presentation.
+     */
+    BasicInput GetBasicInput();
+
+    /*!
+     * Gets a %ColoredPrs3dCache, to which the holder belongs
+     */
+    ColoredPrs3dCache GetCache();
+
+    /*!
+     * Gets memory size actually used by the holder (Mb).
+     */
+    float GetMemorySize();
+  };
+
+
+  //-------------------------------------------------------
+  /*! \brief %ColoredPrs3dCache interface.
+   * This interface is responsible for memory management of 3d presentations.
+   * One cache corresponds to one study.
+   */
+  interface ColoredPrs3dCache : RemovableObject, SALOME::GenericObj
+  {
+    /*! This enumeration contains the cache memory modes. */
+    enum MemoryMode {
+      MINIMAL, /*!< Minimal memory mode (default behaviour). */
+      LIMITED  /*!< Limited memory mode (fixed memory size for presentations). */
+    };
+
+    /*! This enumeration defines how to enlarge the cache limited memory. */
+    enum EnlargeType {
+      NO_ENLARGE, /*!< No need to enlarge (default behaviour). */
+      ENLARGE,    /*!< Enlarge limited memory. */
+      IMPOSSIBLE  /*!< Impossible to enlarge (not enough free memory). */
+    };
+
+    /*! Sets a memory mode.*/
+    void SetMemoryMode(in MemoryMode theMode);
+
+    /*! Gets a memory mode.*/
+    MemoryMode GetMemoryMode();
+
+    /*! Sets a memory size for limited mode (Mb). */
+    void SetLimitedMemory(in float theMemorySize);
+
+    /*! Gets a memory size for limited mode (Mb). */
+    float GetLimitedMemory();
+
+    /*!
+     * Gets memory size actually used by the cache system (Mb).
+     */
+    float GetMemorySize();
+
+    /*! Creates %ColoredPrs3dHolder.*/
+    ColoredPrs3dHolder CreateHolder(in VISUType theType,
+                                   in ColoredPrs3dHolder::BasicInput theInput);
+
+    /*! Gets a memory which is required to create a holder. */
+    EnlargeType GetRequiredMemory(in VISUType theType,
+                                 in ColoredPrs3dHolder::BasicInput theInput,
+                                 out float theRequiredMemory);
+  };
+
+
   //-------------------------------------------------------
   /*! \brief Interface of the %Scalar Map
    *
@@ -517,6 +720,11 @@ module VISU {
      */
     void SetRange(in double theMin, in double theMax);
 
+    /*!
+     * Sets scalar range that corresponds to the source data.
+     */
+    void SetSourceRange();
+
     /*! %Orientation of the scalar bar (to provide backward compatibility). */
     enum Orientation {
       HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
@@ -590,19 +798,6 @@ module VISU {
    */
   interface ScalarMapOnDeformedShape : ScalarMap {
     
-    /*!
-     * Sets the source ranges of pipeline
-     */
-    void SetSourceRange(in double theMinRange,in double theMaxRange);
-    /*!
-     * Gets the minimum source range of pipeline
-     */
-    double GetSourceRangeMin();
-    /*!
-     * Gets the maximum source range of pipeline
-     */
-    double GetSourceRangeMax();
-    
     /*!
      * Sets the scale of the presentatable object.
      * \param theScale Double value defining the scale of this presentable object.
@@ -1349,7 +1544,6 @@ module VISU {
 
   //-------------------------------------------------------
   interface ViewManager;
-  interface View3D;
 
   /*! \brief %VISU_Gen interface
    *
@@ -1435,6 +1629,12 @@ module VISU {
                            in string theSubMeshName,
                            in string theNewName);
 
+    /*!
+     * Creates a VISU 3D presentation according to the given type
+     * \param theType Type that defines what kind of 3D presentation should be created
+     */
+    Prs3d CreatePrs3d(in VISUType theType, in SALOMEDS::Study theStudy);
+
     /*!
      * Creates a mesh on the basis of the data generated in other sources (MED object or file).
      * \param theResult   Data generated in other sources. (MED object or file)
@@ -1471,7 +1671,7 @@ module VISU {
      */
     ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName,
                               in Entity theEntity, in string theFieldName,
-                              in double theIteration);
+                              in long theIteration);
 
     /*!
      * Creates a Gauss Points presentation.
@@ -1483,7 +1683,7 @@ module VISU {
      */
     GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in double theIteration);
+                                  in long theIteration);
 
     /*!
      * Creates a deformed shape presentation.
@@ -1495,7 +1695,7 @@ module VISU {
      */
     DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName,
                                       in Entity theEntity, in string theFieldName,
-                                      in double theIteration);
+                                      in long theIteration);
 
     /*!
      * Creates a deformed shape presentation.
@@ -1507,7 +1707,7 @@ module VISU {
      */
     ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName,
                                                             in Entity theEntity, in string theFieldName,
-                                                            in double theIteration);
+                                                            in long theIteration);
 
     /*!
      * Creates a vector presentation.
@@ -1519,7 +1719,7 @@ module VISU {
      */
     Vectors VectorsOnField(in Result theResult, in string theMeshName,
                           in Entity theEntity, in string theFieldName,
-                          in double theIteration);
+                          in long theIteration);
 
     /*!
      * Creates an iso surface presentation.
@@ -1531,7 +1731,7 @@ module VISU {
      */
     IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in double theIteration);
+                                  in long theIteration);
 
     /*!
      * Creates an stream lines presentation.
@@ -1543,7 +1743,7 @@ module VISU {
      */
     StreamLines StreamLinesOnField(in Result theResult, in string theMeshName,
                                   in Entity theEntity, in string theFieldName,
-                                  in double theIteration);
+                                  in long theIteration);
 
     /*!
      * Creates a presentation of cut planes.
@@ -1555,7 +1755,7 @@ module VISU {
      */
     CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName,
                               in Entity theEntity, in string theFieldName,
-                              in double theIteration);
+                              in long theIteration);
 
     /*!
      * Creates a presentation of cut lines.
@@ -1567,7 +1767,7 @@ module VISU {
      */
     CutLines CutLinesOnField(in Result theResult, in string theMeshName,
                             in Entity theEntity, in string theFieldName,
-                            in double theIteration);
+                            in long theIteration);
 
     /*!
      * Creates a Plot3D presentation.
@@ -1579,7 +1779,7 @@ module VISU {
      */
     Plot3D Plot3DOnField(in Result theResult, in string theMeshName,
                         in Entity theEntity, in string theFieldName,
-                        in double theIteration);
+                        in long theIteration);
 
     /*!
      * Creates a table presentation.
@@ -1618,6 +1818,11 @@ module VISU {
     void DeleteResult(in Result theResult);
 
     void DeletePrs3d(in Prs3d thePrs3d);
+
+    /*!
+     * Get or create %ColoredPrs3dCache object.
+     */
+    ColoredPrs3dCache GetColoredPrs3dCache(in SALOMEDS::Study theStudy);
   };
 
   /*! \brief %View interface
index 5488527cc80116efb353ae8fe1f2964896c0c2cb..a278866af02ea6456b882849831f1c21eb4bdf7c 100644 (file)
     <parameter name="recorder_fps"         value="17.3" />
     <parameter name="recorder_quality"     value="100"  />
     <parameter name="recorder_progressive" value="true" />
+    <parameter name="cache_memory_mode"    value="1" />
+    <parameter name="cache_memory_limit"   value="512" />
   </section>
   <section name="resources">
     <!-- Module resources -->
diff --git a/resources/Visu_holo_render.png b/resources/Visu_holo_render.png
new file mode 100755 (executable)
index 0000000..e7e2737
Binary files /dev/null and b/resources/Visu_holo_render.png differ
diff --git a/resources/Visu_slider_avi.png b/resources/Visu_slider_avi.png
new file mode 100755 (executable)
index 0000000..ff0edd0
Binary files /dev/null and b/resources/Visu_slider_avi.png differ
diff --git a/resources/Visu_slider_first.png b/resources/Visu_slider_first.png
new file mode 100644 (file)
index 0000000..ba47a29
Binary files /dev/null and b/resources/Visu_slider_first.png differ
diff --git a/resources/Visu_slider_last.png b/resources/Visu_slider_last.png
new file mode 100644 (file)
index 0000000..a5a63b7
Binary files /dev/null and b/resources/Visu_slider_last.png differ
diff --git a/resources/Visu_slider_more.png b/resources/Visu_slider_more.png
new file mode 100755 (executable)
index 0000000..86d572b
Binary files /dev/null and b/resources/Visu_slider_more.png differ
diff --git a/resources/Visu_slider_next.png b/resources/Visu_slider_next.png
new file mode 100644 (file)
index 0000000..1cca9a8
Binary files /dev/null and b/resources/Visu_slider_next.png differ
diff --git a/resources/Visu_slider_pause.png b/resources/Visu_slider_pause.png
new file mode 100644 (file)
index 0000000..fea48a1
Binary files /dev/null and b/resources/Visu_slider_pause.png differ
diff --git a/resources/Visu_slider_play.png b/resources/Visu_slider_play.png
new file mode 100644 (file)
index 0000000..7bd655f
Binary files /dev/null and b/resources/Visu_slider_play.png differ
diff --git a/resources/Visu_slider_previous.png b/resources/Visu_slider_previous.png
new file mode 100644 (file)
index 0000000..95fd158
Binary files /dev/null and b/resources/Visu_slider_previous.png differ
diff --git a/resources/Visu_tree_multipr_full.png b/resources/Visu_tree_multipr_full.png
new file mode 100755 (executable)
index 0000000..7bcc515
Binary files /dev/null and b/resources/Visu_tree_multipr_full.png differ
diff --git a/resources/Visu_tree_multipr_hide.png b/resources/Visu_tree_multipr_hide.png
new file mode 100755 (executable)
index 0000000..06893fc
Binary files /dev/null and b/resources/Visu_tree_multipr_hide.png differ
diff --git a/resources/Visu_tree_multipr_low.png b/resources/Visu_tree_multipr_low.png
new file mode 100755 (executable)
index 0000000..cdbb4d8
Binary files /dev/null and b/resources/Visu_tree_multipr_low.png differ
diff --git a/resources/Visu_tree_multipr_medium.png b/resources/Visu_tree_multipr_medium.png
new file mode 100755 (executable)
index 0000000..2ddfcaf
Binary files /dev/null and b/resources/Visu_tree_multipr_medium.png differ
index 4f10fe78dcc3a334862da3e55e991ba2a41dfc5d..ba11b72f5128c0e339288c66f438410c4bbcfb1a 100644 (file)
@@ -33,12 +33,19 @@ BOOST_LIBSUFFIX=@BOOST_LIBSUFFIX@
 @COMMENCE@
 
 EXPORT_HEADERS = \
+       VISU_TypeList.hxx \
        VISU_IDMapper.hxx \
-       VISU_Convertor.hxx  \
-       VISU_ConvertorDef.hxx  \
-       VISU_Convertor_impl.hxx  \
-       VISU_ConvertorUtils.hxx  \
+       VISU_ConvertorDef.hxx \
+       VISU_Structures.hxx \
+       VISU_Convertor.hxx \
+       VISU_ConvertorDef_impl.hxx \
+       VISU_Structures_impl.hxx \
+       VISU_MeshValue.hxx \
+       VISU_PointCoords.hxx \
+       VISU_Convertor_impl.hxx \
+       VISU_ConvertorUtils.hxx \
        VISU_MergeFilter.hxx \
+       VISU_AppendPolyData.hxx \
        VISU_ExtractUnstructuredGrid.hxx
 
 # Libraries targets
@@ -46,12 +53,17 @@ EXPORT_HEADERS = \
 LIB = libVisuConvertor.la
 LIB_SRC = \
        VISU_IDMapper.cxx \
+       VISU_Structures.cxx \
        VISU_Convertor.cxx \
+       VISU_Structures_impl.cxx \
+       VISU_MeshValue.cxx \
+       VISU_PointCoords.cxx \
        VISU_Convertor_impl.cxx \
+       VISU_MedConvertor.cxx \
        VISU_ConvertorUtils.cxx \
        VISU_ExtractUnstructuredGrid.cxx \
-       VISU_MergeFilter.cxx \
-       VISU_MedConvertor.cxx
+       VISU_AppendPolyData.cxx \
+       VISU_MergeFilter.cxx
 
 # Executables targets
 BIN = VISUConvertor
index 60ce65673b63b74dd5c88197e35d95aeeca090b7..c9517fdabe08b28a2bf26ff5f7aa952f07d8f075 100644 (file)
@@ -46,7 +46,8 @@ static int MYDEBUG = 1;
 static int MYDEBUG = 0;
 #endif
 
-//#define _DEXCEPT_
+//#define _DEBUG_ID_MAPPING_
+#define _DEXCEPT_
 
 typedef vtkUnstructuredGrid TOutput;
 
@@ -91,26 +92,32 @@ void parseFile(const char* theFileName)
            if(anEntity != VISU::NODE_ENTITY){
              VISU::PGaussPtsIDMapper aGaussMesh = 
                aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
-             VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput();
-             /*
+#ifdef _DEBUG_ID_MAPPING_
+             vtkDataSet* aDataSet = aGaussMesh->GetOutput();
+             aDataSet->Update();
              int aNbCells = aDataSet->GetNumberOfCells();
+             cout<<"aNbCells = "<<aNbCells<<endl;
              for(int anCellId = 0; anCellId < aNbCells; anCellId++){
                VISU::TGaussPointID anObjID = aGaussMesh->GetObjID(anCellId);
-               cout<<anObjID.first<<"; "<<anObjID.second<<endl;
+               cout<<anObjID.first<<"; "<<anObjID.second<<"; "<<aGaussMesh->GetNodeVTKID(anObjID.first)<<endl;
+               vtkFloatingPointType* aCoord = aGaussMesh->GetNodeCoord(anCellId);
+               cout<<aCoord[0]<<"; "<<aCoord[1]<<"; "<<aCoord[2]<<endl;
              }
-             */
+#endif
            }else{
+             continue;
              VISU::PIDMapper anIDMapper = 
                aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-             VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
-             /*
+#ifdef _DEBUG_ID_MAPPING_
+             vtkDataSet* aDataSet = anIDMapper->GetOutput();
+             aDataSet->Update();
              int aNbCells = aDataSet->GetNumberOfCells();
              for(int anCellId = 0; anCellId < aNbCells; anCellId++){
                int anObjID = anIDMapper->GetElemObjID(anCellId);
                int aVTKID  = anIDMapper->GetElemVTKID(anObjID);
                cout<<anObjID<<"; "<<aVTKID<<endl;
              }
-             */
+#endif
            }
            //goto OK;
          }
@@ -132,18 +139,16 @@ void parseFile(const char* theFileName)
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
        VISU::PIDMapper anIDMapper = aCon->GetMeshOnEntity(aMeshName,anEntity);
-       VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
-       {
-         /*
-         int aNbCells, anCellId, anObjID, aVTKID;
-         aNbCells = aDataSet->GetNumberOfCells();
-         for(anCellId = 0; anCellId < aNbCells; anCellId++){
-           anObjID = anIDMapper->GetElemObjID(anCellId);
-           aVTKID  = anIDMapper->GetElemVTKID(anObjID);
-           cout<<anObjID<<"; "<<aVTKID<<endl;
-         }
-         */
+#ifdef _DEBUG_ID_MAPPING_
+       vtkDataSet* aDataSet = anIDMapper->GetOutput();
+       int aNbCells, anCellId, anObjID, aVTKID;
+       aNbCells = aDataSet->GetNumberOfCells();
+       for(anCellId = 0; anCellId < aNbCells; anCellId++){
+         anObjID = anIDMapper->GetElemObjID(anCellId);
+         aVTKID  = anIDMapper->GetElemVTKID(anObjID);
+         cout<<anObjID<<"; "<<aVTKID<<endl;
        }
+#endif
       }
 
       //Import families
index c18100d3a648ea95f273dd1f31e4645ac1ffbb59..e630d14ef0d69a3adae221b194fc9f9a76d4e7b7 100644 (file)
 
 #include <qstring.h>
 
-using namespace std;
-
-namespace VISU{
-
-  inline
-  int
-  GetNbOfPoints(int theVTKCellType)
-  {
-    switch(theVTKCellType){
-    case VTK_VERTEX : return 1;
-    case VTK_LINE : return 2;
-    case VTK_TRIANGLE : return 3;
-    case VTK_QUAD : return 4;
-    case VTK_TETRA : return 4;
-    case VTK_HEXAHEDRON : return 8;
-    case VTK_WEDGE : return 6;
-    case VTK_PYRAMID : return 5;
-    default: return -1;
-    }
-  }
-}
+#include <utility>
 
 
+//---------------------------------------------------------------
 const VISU::TMeshMap& 
 VISU_Convertor
 ::GetMeshMap() 
@@ -60,23 +41,26 @@ VISU_Convertor
 }
 
 
-string
+//---------------------------------------------------------------
+std::string
 VISU_Convertor
 ::GenerateName(const VISU::TTime& aTime)
 {
   static QString aName;
-  const string aUnits = aTime.second, tmp(aUnits.size(),' ');
+  const std::string aUnits = aTime.second, tmp(aUnits.size(), ' ');
   if(aUnits == "" || aUnits == tmp)
-    aName.sprintf("%g, -",aTime.first);
+    aName.sprintf("%g, -", aTime.first);
   else
-    aName.sprintf("%g, %s",aTime.first,aTime.second.c_str());
+    aName.sprintf("%g, %s", aTime.first, aTime.second.c_str());
   aName = aName.simplifyWhiteSpace();
   return aName.latin1();
 }
 
-string
+
+//---------------------------------------------------------------
+std::string
 VISU_Convertor
-::GenerateName(const string& theName, 
+::GenerateName(const std::string& theName, 
               unsigned int theTimeId) 
 {
   static QString aName;
@@ -86,11 +70,14 @@ VISU_Convertor
   if(iEnd > VtkHighLevelLength) iEnd = VtkHighLevelLength;
   char aNewName[iEnd+1];
   aNewName[iEnd] = '\0';
-  strncpy(aNewName,aName,iEnd);
-  replace(aNewName,aNewName+iEnd,' ','_');
+  strncpy(aNewName, aName, iEnd);
+  std::replace(aNewName, aNewName + iEnd, ' ', '_');
   if(true || theTimeId == 0)
     aName = aNewName;
   else
-    aName.sprintf("%s_%d",aNewName,theTimeId);
+    aName.sprintf("%s_%d", aNewName, theTimeId);
   return aName.latin1();
 }
+
+
+//---------------------------------------------------------------
index f6564a32e3566248101f39867c8adf01dd4f6d66..1d1cd451959f155a82c357a44732ead69bb41dfa 100644 (file)
 
 /*! 
   \file VISU_Convertor.hxx
-  \brief The file contains definitions for basic classes of the VISU CONVERTER package
+  \brief The file represents definition of basic interface of the VISU CONVERTER package
 */
 
-#include "VISU_IDMapper.hxx"
-#include "VISU_ConvertorDef.hxx"
-
-#include "MED_Vector.hxx"
-
-#include <map>
-#include <set>
-#include <utility>
-#include <string>
-#include <stdexcept>
-
-namespace VISU
-{
-  using MED::TVector;
-
-  //---------------------------------------------------------------
-  typedef std::string TName;
-
-  typedef TVector<TName> TNames;
-
-  //---------------------------------------------------------------
-  //! Define a basic class for all MED entites which can be identified by its number
-  struct TIntId: virtual TBaseStructure
-  {
-    vtkIdType myId;
-
-    TIntId(): myId(0)
-    {}
-  };
-
-
-  //---------------------------------------------------------------
-  typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
-  typedef std::map<TName,PGroup> TGroupMap;
-
-  //! Define a basic class which corresponds to MED MESH entity
-  /*!
-    This class in its turn contains map of TMeshOnEntity and TGroup substructures,
-    also it keeps name and dimention of corresponding MED MESH entity.
-  */
-  struct TMesh: virtual TBaseStructure
-  {
-    TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
-    TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
-    TName myName; //! Name of the corresponding MED MESH
-    int myDim; //! Dimension of the corresponding MED MESH
-
-    std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
-    std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
-
-    TMesh(): myDim(0)
-    {}
-  };
-  typedef std::map<std::string,PMesh> TMeshMap;
-
-
-  //---------------------------------------------------------------
-  //! Define a basic class which corresponds to MED PROFILE entity
-  struct TSubProfile: virtual TBaseStructure
-  {};
-
-
-  //---------------------------------------------------------------
-  //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
-  struct TProfile: virtual TNamedIDMapper
-  {};
-
-
-  //---------------------------------------------------------------
-  bool
-  operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
-
-  typedef std::set<PSubProfile> TProfileKey;
-  typedef std::map<TProfileKey,PProfile> TProfileMap;
-
-
-  //---------------------------------------------------------------
-  //! Define a basic class for MED GAUSS entity
-  struct TGauss: virtual TBaseStructure
-  {};
-
-
-  //---------------------------------------------------------------
-  //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
-  struct TGaussSubMesh: virtual TBaseStructure
-  {
-    PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
-  };
-
-  
-  //---------------------------------------------------------------
-  //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
-  struct TGaussMesh: virtual TGaussPtsIDMapper
-  {};
-
-
-  //---------------------------------------------------------------
-  bool
-  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
-
-  typedef std::set<PGaussSubMesh> TGaussKey;
-  typedef std::map<TGaussKey,PGaussMesh> TGaussMeshMap;
-
-
-  //---------------------------------------------------------------
-
-  typedef std::map<TName,PFamily> TFamilyMap;
-  typedef std::map<TName,PField> TFieldMap;
-
-  //! Define a basic class which corresponds to MED ENTITY
-  /*!
-    This class in its turn contains map of TGaussMesh and TProfile substructures,
-    also it keeps corresponding map of MED FAMILIES and FIELDS.
-  */
-  struct TMeshOnEntity: virtual TNamedIDMapper
-  {
-    TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
-    TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
-
-    TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
-    TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
-
-    TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
-    TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
-  };
-
-
-  //---------------------------------------------------------------
-  //! Define a basic class for MED FAMILY entity
-  struct TFamily: virtual TIntId,
-                 virtual TIDMapper
-  {
-    TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
-    TName myName; //!< Contains name of the corresponding MED FAMILY
-  };
-
-
-  //---------------------------------------------------------------
-  typedef std::set<PFamily> TFamilySet;
-
-  //! Define a basic class for MED GROUP entity
-  struct TGroup: virtual TIDMapper
-  {
-    TFamilySet myFamilySet;
-  };
-
-
-  //---------------------------------------------------------------
-  typedef std::map<vtkIdType,PValForTime> TValField;
-  typedef std::pair<vtkFloatingPointType,vtkFloatingPointType> TMinMax;
-
-  //! Define a basic class for MED FIELD entity
-  struct TField: virtual TIntId
-  {
-    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
-    TName myName; //!< Contains name of the corresponding MED FIELD
-    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
-    TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
-    TNames myCompNames; //!< Contains names of components of the MED FIELD
-    TNames myUnitNames; //!< Contains names of units of the MED FIELD
-    vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
-
-    //! Calculate min/max values for each of the MED FIELD components among all its timestamps
-    /*!
-      Numeration of the components starts from 1.
-      Zero component contains min/max value for modulus of corresponding vector
-    */
-    virtual
-    TMinMax 
-    GetMinMax(vtkIdType theCompID) = 0;
-    
-    bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
-
-    TField(): 
-      myNbComp(0),
-      myIsMinMaxInitilized(false)
-    {}
-  };
-
-  //---------------------------------------------------------------
-  typedef std::pair<double,std::string> TTime;
-
-  //! Define a basic class for MED TIMESTAMP entity
-  struct TValForTime: virtual TIntId
-  {
-    TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
-    TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
-    TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
-    TTime myTime;
-
-    PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
-    PGaussMesh myGaussMesh;
-  };
-
-
-  //---------------------------------------------------------------
-  //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
-  void 
-  WriteToFile(vtkUnstructuredGrid* theDataSet, 
-             const std::string& theFileName);
-};
+#include "VISU_Structures.hxx"
 
 
 //---------------------------------------------------------------
@@ -249,15 +48,9 @@ namespace VISU
   1. Perfrom parsing of MED file to get known what MED entities are pressent in it
   2. Get VTK representation for any existing MED entity
   Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation
-  
 */
 class VISU_Convertor
 {
-protected:
-  std::string myName;
-  VISU::TMeshMap myMeshMap;
-  int myIsDone;
-
 public:
   virtual 
   ~VISU_Convertor()
@@ -273,9 +66,6 @@ public:
   int
   IsDone() const { return myIsDone; }
 
-  //! Defines what subtype of vtkDataSet is used for MED to VTK mapping
-  typedef VISU::TVTKOutput TOutput;
-
   //! This method perform first parsing of MED file to get known what MED entities are pressent in it
   virtual
   VISU_Convertor* 
@@ -308,7 +98,7 @@ public:
 
   //! Get amount of memory to build VTK representations for all existing MED entities
   virtual
-  vtkFloatingPointType
+  size_t
   GetSize() = 0;
 
   //! Get mesh for corresponding MED ENTITY
@@ -319,43 +109,43 @@ public:
   
   //! Get amount of memory to build mesh for corresponding MED ENTITY
   virtual
-  vtkFloatingPointType
+  size_t
   GetMeshOnEntitySize(const std::string& theMeshName, 
                      const VISU::TEntity& theEntity) = 0;
   
   //! Get mesh for corresponding MED FAMILY
   virtual 
-  VISU::PIDMapper 
+  VISU::PUnstructuredGridIDMapper 
   GetFamilyOnEntity(const std::string& theMeshName, 
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName) = 0;
 
   //! Get amount of memory to build mesh for corresponding MED FAMILY
   virtual 
-  vtkFloatingPointType 
+  size_t 
   GetFamilyOnEntitySize(const std::string& theMeshName, 
                        const VISU::TEntity& theEntity,
                        const std::string& theFamilyName) = 0;
 
   //! Get mesh for corresponding MED GROUP
   virtual
-  VISU::PIDMapper
+  VISU::PUnstructuredGridIDMapper
   GetMeshOnGroup(const std::string& theMeshName, 
                 const std::string& theGroupName) = 0;
   
   //! Get amount of memory to build mesh for corresponding MED GROUP
   virtual
-  vtkFloatingPointType
+  size_t
   GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName) = 0;
   
   //! Get mesh with attached values for corresponding MED TIMESTAMP
   virtual
-  VISU::PIDMapper 
+  VISU::PUnstructuredGridIDMapper 
   GetTimeStampOnMesh(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName,
-                    int theStampsNum) = 0;
+                    int theTimeStampNumber) = 0;
 
   //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP
   virtual
@@ -363,19 +153,29 @@ public:
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum) = 0;
+                        int theTimeStampNumber) = 0;
    
-  //! Get amount of memory to build mesh for corresponding MED TIMESTAMP
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
-  vtkFloatingPointType
-  GetTimeStampSize(const std::string& theMeshName, 
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFieldName,
-                  int theStampsNum) = 0;
+  size_t
+  GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theTimeStampNumber,
+                        bool& theIsEstimated) = 0;
+    
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
+  virtual 
+  size_t
+  GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theTimeStampNumber,
+                            bool& theIsEstimated) = 0;
     
   //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD
   virtual 
-  vtkFloatingPointType
+  size_t
   GetFieldOnMeshSize(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName) = 0;
@@ -393,7 +193,7 @@ public:
   GetTimeStamp(const std::string& theMeshName, 
               const VISU::TEntity& theEntity,
               const std::string& theFieldName,
-              int theStampsNum) = 0;
+              int theTimeStampNumber) = 0;
     
   //! Allow to generate pretty name for MED TIMESTAMP
   static 
@@ -403,6 +203,11 @@ public:
   static 
   std::string 
   GenerateName(const std::string& theName, unsigned int theTimeId);
+
+protected:
+  std::string myName;
+  VISU::TMeshMap myMeshMap;
+  int myIsDone;
 };
 
 extern "C"
index 1e54cdb63f8ccda3efebd753b4cbe3b47dfe3247..1be0aafc4ac148578b940311d69ba689cd61ed0c 100644 (file)
 
 namespace VISU
 {
-  using MED::SharedPtr;
-
   //---------------------------------------------------------------
   enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
 
+
+  //---------------------------------------------------------------
+  //! Defines VISU enumeration of geometrical types
+  enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
+                 eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
+                 ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310, 
+                 ePYRA13=313, ePENTA15=315, eHEXA20=320, 
+                 ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
+
+
+  //---------------------------------------------------------------
   struct TMesh;
-  typedef SharedPtr<TMesh> PMesh;
+  typedef MED::SharedPtr<TMesh> PMesh;
 
+
+  //---------------------------------------------------------------
   struct TGaussSubMesh;
-  typedef SharedPtr<TGaussSubMesh> PGaussSubMesh;
+  typedef MED::SharedPtr<TGaussSubMesh> PGaussSubMesh;
 
+
+  //---------------------------------------------------------------
   struct TGaussMesh;
-  typedef SharedPtr<TGaussMesh> PGaussMesh;
+  typedef MED::SharedPtr<TGaussMesh> PGaussMesh;
 
+
+  //---------------------------------------------------------------
   struct TSubProfile;
-  typedef SharedPtr<TSubProfile> PSubProfile;
+  typedef MED::SharedPtr<TSubProfile> PSubProfile;
 
+
+  //---------------------------------------------------------------
   struct TProfile;
-  typedef SharedPtr<TProfile> PProfile;
+  typedef MED::SharedPtr<TProfile> PProfile;
 
+
+  //---------------------------------------------------------------
   struct TMeshOnEntity;
-  typedef SharedPtr<TMeshOnEntity> PMeshOnEntity;
+  typedef MED::SharedPtr<TMeshOnEntity> PMeshOnEntity;
 
+
+  //---------------------------------------------------------------
   struct TFamily;
-  typedef SharedPtr<TFamily> PFamily;
+  typedef MED::SharedPtr<TFamily> PFamily;
 
+
+  //---------------------------------------------------------------
   struct TGroup;
-  typedef SharedPtr<TGroup> PGroup;
+  typedef MED::SharedPtr<TGroup> PGroup;
 
+
+  //---------------------------------------------------------------
   struct TField;
-  typedef SharedPtr<TField> PField;
+  typedef MED::SharedPtr<TField> PField;
 
+
+  //---------------------------------------------------------------
   struct TGauss;
-  typedef SharedPtr<TGauss> PGauss;
+  typedef MED::SharedPtr<TGauss> PGauss;
 
+
+  //---------------------------------------------------------------
   struct TValForTime;
-  typedef SharedPtr<TValForTime> PValForTime;
+  typedef MED::SharedPtr<TValForTime> PValForTime;
   
+
+  //---------------------------------------------------------------
   struct TGrille;
-  typedef SharedPtr<TGrille> PGrille;
+  typedef MED::SharedPtr<TGrille> PGrille;
+
+
+  //---------------------------------------------------------------
 }
 
 #endif
index f406e5578ea86dca11bd867e90f3102b05d4742c..4bf738c59c4e4e5f6f355f55f097128087aa5d5e 100644 (file)
@@ -26,7 +26,9 @@
 
 #include "VISU_ConvertorUtils.hxx"
 
+#include <vtkCellType.h>
 #include <vtkUnstructuredGridWriter.h>
+#include <vtkPolyDataWriter.h>
 #include <vtkTimerLog.h>
 
 #ifdef _DEBUG_
@@ -37,9 +39,142 @@ static int MYDEBUG = 0;
 
 namespace VISU
 {
+  //---------------------------------------------------------------
+  vtkIdType
+  VISUGeom2NbNodes(EGeometry theGeom)
+  { 
+    switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return 2;
+    case VISU::eTRIA6: 
+      return 3;
+    case VISU::eQUAD8: 
+      return 4;
+    case VISU::eTETRA10: 
+      return 4;
+    case VISU::eHEXA20: 
+      return 8;
+    case VISU::ePENTA15: 
+      return 6;
+    case VISU::ePYRA13: 
+      return 5;
+#endif
+    case VISU::ePOLYGONE: 
+    case VISU::ePOLYEDRE: 
+      return -1;
+    default:
+      return theGeom % 100;
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  VISUGeom2VTK(EGeometry theGeom)
+  { 
+    switch(theGeom){
+    case VISU::ePOINT1: 
+      return VTK_VERTEX;
+    case VISU::eSEG2: 
+      return VTK_LINE;
+    case VISU::eTRIA3: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD4: 
+      return VTK_QUAD;
+    case VISU::eTETRA4: 
+      return VTK_TETRA;
+    case VISU::eHEXA8: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA6: 
+      return VTK_WEDGE;
+    case VISU::ePYRA5: 
+      return VTK_PYRAMID;
+
+    case VISU::ePOLYGONE: 
+      return VTK_POLYGON;
+    case VISU::ePOLYEDRE: 
+      return VTK_CONVEX_POINT_SET;
+
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return VTK_LINE;
+    case VISU::eTRIA6: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD8: 
+      return VTK_QUAD;
+    case VISU::eTETRA10: 
+      return VTK_TETRA;
+    case VISU::eHEXA20: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA15: 
+      return VTK_WEDGE;
+    case VISU::ePYRA13: 
+      return VTK_PYRAMID;
+
+#else
+
+    case VISU::eSEG3: 
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_EDGE;
+#else
+      return VTK_POLY_LINE;
+#endif
+
+    case VISU::eTRIA6: 
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_TRIANGLE;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eQUAD8: 
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_QUAD;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eTETRA10: 
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_TETRA;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::eHEXA20: 
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_HEXAHEDRON;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePENTA15: 
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_WEDGE;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePYRA13: 
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_PYRAMID;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+    default:
+      return -1;
+    }
+  }
+
 
+  //---------------------------------------------------------------
   void 
-  WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
+  WriteToFile(vtkUnstructuredGrid* theDataSet, 
+             const std::string& theFileName)
   {
     vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
     //aWriter->SetFileType(VTK_BINARY);
@@ -50,6 +185,21 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------
+  void 
+  WriteToFile(vtkPolyData* theDataSet, 
+             const std::string& theFileName)
+  {
+    vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
+    //aWriter->SetFileType(VTK_BINARY);
+    aWriter->SetFileName(theFileName.c_str());
+    aWriter->SetInput(theDataSet);
+    aWriter->Write();
+    aWriter->Delete();
+  }
+
+
+  //---------------------------------------------------------------
   TTimerLog
   ::TTimerLog(int theIsDebug,
              const std::string& theName):
@@ -62,6 +212,7 @@ namespace VISU
     BEGMSG(myIsDebug > 1,"{\n");
   }
 
+  //---------------------------------------------------------------
   TTimerLog
   ::~TTimerLog()
   {
@@ -77,4 +228,6 @@ namespace VISU
     myTimerLog = NULL;
   }
 
+
+  //---------------------------------------------------------------
 }
index c44d5c4393a9d4cc247458377ffe9063540c4a58..348572688078dc9817c4db53b8775b8da5a89b20 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
-//  File   : VISU_Convertor_impl.hxx
+//  File   : VISU_ConvertorUtils.hxx
 //  Author : Alexey PETROV
 //  Module : VISU
 
 #ifndef VISU_ConvertorUtils_HeaderFile
 #define VISU_ConvertorUtils_HeaderFile
 
-#include <string>
+#include "VISU_ConvertorDef.hxx"
+#include "MED_Utilities.hxx"
 
-#include <vtkCellType.h>
+#include <vtkSystemIncludes.h>
 
-#include "MED_Utilities.hxx"
+#include <string>
 
 class vtkUnstructuredGrid;
+class vtkPolyData;
 class vtkTimerLog;
 
+#ifndef VISU_ENABLE_QUADRATIC
+  #define VISU_ENABLE_QUADRATIC
+  #define VISU_USE_VTK_QUADRATIC
+#endif
+
 namespace MED
 {
   class PrefixPrinter;
 }
 
-namespace VISU{
+namespace VISU
+{
+  //---------------------------------------------------------------
+  //! Get number of nodes for defined geometrical type
+  vtkIdType
+  VISUGeom2NbNodes(EGeometry theGeom);
+
+  //! Maps VISU geometrical type to VTK one
+  vtkIdType
+  VISUGeom2VTK(EGeometry theGeom);
 
+  //---------------------------------------------------------------
+  //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
   void 
-  WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+  WriteToFile(vtkUnstructuredGrid* theDataSet, 
+             const std::string& theFileName);
 
+  //---------------------------------------------------------------
+  //! The utility function allows to write vtkPolyData to a file with defined name
+  void 
+  WriteToFile(vtkPolyData* theDataSet, 
+             const std::string& theFileName);
+
+  //---------------------------------------------------------------
+  //! The utility class that allows to perform perfomance mesurement
   class TTimerLog
   {
     int myIsDebug;
@@ -54,6 +81,7 @@ namespace VISU{
     vtkTimerLog* myTimerLog;
     MED::PrefixPrinter myPrefixPrinter;
   public:
+
     TTimerLog(int theIsDebug,
              const std::string& theName);
     ~TTimerLog();
index c39f28fecda312d79f99b1df6114e6eeaf3003a1..225d409e34d688b4058043436142c6fbbbcb268d 100644 (file)
 //  Module : VISU
 
 #include "VISU_Convertor_impl.hxx"
-#include "VISU_ConvertorUtils.hxx"
-#include "VTKViewer_AppendFilter.h"
-#include "VISU_MergeFilter.hxx"
-#include "VTKViewer_CellLocationsArray.h"
-
-#include <vtkPoints.h>
-#include <vtkUnstructuredGrid.h>
-
-#include <vtkIdList.h>
-#include <vtkCellType.h>
-#include <vtkCellArray.h>
-#include <vtkFloatArray.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkCellLinks.h>
-
-
-#include <qstring.h>
-#include <qfileinfo.h>
-
-#include <valarray>    
-#include <memory>
-
-using namespace std;
-using namespace VISU;
-
-static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
-
-static int MYVTKDEBUG = 0;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-//#define _DEXCEPT_
-#else
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#endif
-
-namespace VISU
-{
-  //---------------------------------------------------------------
-  TIsVTKDone::TIsVTKDone(): 
-    myIsVTKDone(false),
-    myIsDone(false)
-  {}
-
-
-  //---------------------------------------------------------------
-  TSizeCounter::TSizeCounter():
-    myNbCells(0),
-    myCellsSize(0)
-  {}
-
-
-  //---------------------------------------------------------------
-  TSource::TSource()
-  {}
-
-  const TVTKSource& 
-  TSource
-  ::GetSource() const
-  {
-    if(!mySource.GetPointer()){
-      mySource = vtkUnstructuredGrid::New();
-      mySource->Delete();
-    }
-    return mySource;
-  }
-
-  TVTKOutput* 
-  TSource
-  ::GetVTKOutput()
-  {
-    return GetSource().GetPointer();
-  }
-
-
-  //---------------------------------------------------------------
-  TAppendFilter::TAppendFilter()
-  {}
-
-  const TVTKAppendFilter& 
-  TAppendFilter
-  ::GetFilter() const
-  {
-    if(!myFilter.GetPointer()){
-      myFilter = VTKViewer_AppendFilter::New();
-      myFilter->Delete();
-      myFilter->SetDoMappingFlag(true);
-    }
-    return myFilter;
-  }
-
-  TVTKOutput* 
-  TAppendFilter
-  ::GetVTKOutput()
-  {
-    GetFilter()->Update();
-    return GetFilter()->GetOutput();
-  }
-
-
-  //---------------------------------------------------------------
-  TMergeFilter::TMergeFilter()
-  {}
-
-  const TVTKMergeFilter& 
-  TMergeFilter
-  ::GetFilter() const
-  {
-    if(!myFilter.GetPointer()){
-      myFilter = VISU_MergeFilter::New();
-      myFilter->Delete();
-    }
-    return myFilter;
-  }
-
-  TVTKOutput* 
-  TMergeFilter
-  ::GetVTKOutput()
-  {
-    GetFilter()->Update();
-    return GetFilter()->GetUnstructuredGridOutput();
-  }
-
-
-  //---------------------------------------------------------------
-  TPointCoords
-  ::TPointCoords():
-    myPoints(vtkPoints::New())
-  {
-    myPoints->Delete();
-  }
-
-  void
-  TPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim)
-  {
-    myDim = theDim;
-    myNbPoints = theNbPoints;
-    myCoord.resize(theNbPoints*theDim);
-    myPoints->SetNumberOfPoints(theNbPoints);
-  }
-
-  TCCoordSlice 
-  TPointCoords
-  ::GetCoordSlice(vtkIdType theNodeId) const
-  {
-    return TCCoordSlice(myCoord,std::slice(theNodeId*myDim,myDim,1));
-  }
-  
-  TCoordSlice 
-  TPointCoords
-  ::GetCoordSlice(vtkIdType theNodeId)
-  {
-    return TCoordSlice(myCoord,std::slice(theNodeId*myDim,myDim,1));
-  }
-
-
-  //---------------------------------------------------------------
-  void
-  TNamedPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const TVectorID& theVectorID)
-  {
-    TPointCoords::Init(theNbPoints,theDim);
-    myPointsDim.resize(theDim);
-    myVectorID = theVectorID;
-
-    for(vtkIdType anID = 0, anEnd = theVectorID.size(); anID < anEnd; anID++)
-      myObj2VTKID[theVectorID[anID]] = anID;
-  }
-
-  std::string&
-  TNamedPointCoords
-  ::GetName(vtkIdType theDim)
-  {
-    return myPointsDim[theDim];
-  }
-
-  const std::string&
-  TNamedPointCoords
-  ::GetName(vtkIdType theDim) const
-  {
-    return myPointsDim[theDim];
-  }
-
-  vtkIdType
-  TNamedPointCoords
-  ::GetObjID(vtkIdType theID) const
-  {
-    if(myVectorID.empty())
-      return theID;
-    else
-      return myVectorID[theID];
-  }
-
-
-  vtkIdType
-  TNamedPointCoords
-  ::GetVTKID(vtkIdType theID) const
-  {
-    if(myObj2VTKID.empty())
-      return theID;
-    else{
-      TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
-      if(anIter != myObj2VTKID.end())
-       return anIter->second;
-    }
-    return -1;
-  }
-
-  std::string 
-  TNamedPointCoords
-  ::GetNodeName(vtkIdType theObjID) const
-  {
-    return "";
-  }
-
-  //---------------------------------------------------------------
-  TMeshImpl::TMeshImpl():
-    myPoints(vtkPoints::New()),
-    myNbPoints(0) 
-  {
-    myPoints->Delete();
-  }
-
-
-  //---------------------------------------------------------------
-  TSubProfileImpl::TSubProfileImpl():
-    myStatus(eNone),
-    myGeom(eNONE)
-  {}
-
-
-  vtkIdType
-  TSubProfileImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    return theID;
-  }
-
-
-  //---------------------------------------------------------------
-  bool
-  operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
-  {
-    PSubProfileImpl aLeft(theLeft), aRight(theRight);
-
-    if(aLeft->myGeom != aRight->myGeom)
-      return aLeft->myGeom < aRight->myGeom;
-
-    if(aLeft->myStatus != aRight->myStatus)
-      return aLeft->myStatus < aRight->myStatus;
-
-    return aLeft->myName < aRight->myName;
-  }
-
-
-  //---------------------------------------------------------------
-  TProfileImpl::TProfileImpl():
-    myIsAll(true),
-    myMeshOnEntity(NULL)
-  {}
-
-  vtkIdType
-  TProfileImpl
-  ::GetNodeObjID(vtkIdType theID) const
-  {
-    return myNamedPointCoords->GetObjID(theID);
-  }
-  
-  vtkIdType
-  TProfileImpl
-  ::GetNodeVTKID(vtkIdType theID) const
-  {
-    return myNamedPointCoords->GetVTKID(theID);
-  }
-
-  vtkFloatingPointType*  
-  TProfileImpl
-  ::GetNodeCoord(vtkIdType theObjID)
-  {
-    if(myIsAll)
-      return myMeshOnEntity->GetNodeCoord(theObjID);
-
-    vtkIdType aVtkID = GetNodeVTKID(theObjID);
-    return GetFilter()->GetOutput()->GetPoint(aVtkID);
-  }
-
-  vtkIdType
-  TProfileImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    if(myIsAll)
-      return myMeshOnEntity->GetElemObjID(theID);
-
-    vtkIdType anInputID, aStartID, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(theID,anInputID,aStartID,anInputDataSetID);
-    PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
-    return aSubProfileImpl->GetElemObjID(anInputID);
-  }
-
-  vtkIdType
-  TProfileImpl
-  ::GetElemVTKID(vtkIdType theID) const
-  {
-    if(myIsAll)
-      return myMeshOnEntity->GetElemVTKID(theID);
-
-    if(myElemObj2VTKID.empty())
-      return theID;
-    else{
-      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
-      if(anIter != myElemObj2VTKID.end())
-       return anIter->second;
-    }
-    return -1;
-  }
-
-  vtkCell* 
-  TProfileImpl
-  ::GetElemCell(vtkIdType theObjID)
-  {
-    if(myIsAll)
-      return myMeshOnEntity->GetElemCell(theObjID);
-
-    vtkIdType aVtkID = GetElemVTKID(theObjID);
-    return GetFilter()->GetOutput()->GetCell(aVtkID);
-  }
-  
-  TVTKOutput* 
-  TProfileImpl
-  ::GetVTKOutput()
-  {
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    return anAppendFilter->GetOutput();
-  }
-
-  std::string 
-  TProfileImpl
-  ::GetNodeName(vtkIdType theObjID) const
-  {
-    return myNamedPointCoords->GetNodeName(theObjID);
-  }
-
-  std::string 
-  TProfileImpl
-  ::GetElemName(vtkIdType theObjID) const
-  {
-    if(myIsAll)
-      return myMeshOnEntity->GetElemName(theObjID);
-
-    vtkIdType aVTKId = GetElemVTKID(theObjID);
-    vtkIdType anInputID, aStartID, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartID,anInputDataSetID);
-    PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
-    vtkIdType anEntityObjId = aSubProfileImpl->GetElemObjID(anInputID);
-    return myMeshOnEntity->GetElemName(anEntityObjId);
-  }
-
-
-  //---------------------------------------------------------------
-  TVTKOutput* 
-  TIDMapperFilter
-  ::GetVTKOutput()
-  {
-    if(!myFilter.GetPointer()){
-      const TVTKAppendFilter& anAppendFilter = myIDMapper->GetFilter();
-      TVTKOutput* aGeometry = anAppendFilter->GetOutput();
-      
-      const TVTKSource& aSource = mySource.GetSource();
-      TDataSet* aDataSet = aSource.GetPointer();
-      aDataSet->ShallowCopy(aGeometry);
-      
-      const TVTKMergeFilter& aFilter = GetFilter();
-      aFilter->SetGeometry(aGeometry);
-      aFilter->SetScalars(aDataSet);
-      aFilter->SetVectors(aDataSet);
-      aFilter->AddField("VISU_FIELD",aDataSet);
-    }
-    return myFilter->GetUnstructuredGridOutput();
-  }
-
-  vtkIdType
-  TIDMapperFilter
-  ::GetNodeObjID(vtkIdType theID) const
-  {
-    return myIDMapper->GetNodeObjID(theID);
-  }
-  
-  vtkIdType
-  TIDMapperFilter
-  ::GetNodeVTKID(vtkIdType theID) const
-  {
-    return myIDMapper->GetNodeVTKID(theID);
-  }
-
-  vtkFloatingPointType*  
-  TIDMapperFilter
-  ::GetNodeCoord(vtkIdType theObjID)
-  {
-    return myIDMapper->GetNodeCoord(theObjID);
-  }
-
-  vtkIdType
-  TIDMapperFilter
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    return myIDMapper->GetElemObjID(theID);
-  }
-
-  vtkIdType
-  TIDMapperFilter
-  ::GetElemVTKID(vtkIdType theID) const
-  {
-    return myIDMapper->GetElemVTKID(theID);
-  }
-
-  vtkCell* 
-  TIDMapperFilter
-  ::GetElemCell(vtkIdType theObjID)
-  {
-    return myIDMapper->GetElemCell(theObjID);
-  }
-  
-
-  //---------------------------------------------------------------
-  void
-  TGaussImpl
-  ::LessThan(const PGaussImpl& theGauss,
-            bool& theResult) const
-  {
-    theResult = false;
-  }
-
-
-  //---------------------------------------------------------------
-  TGaussSubMeshImpl::TGaussSubMeshImpl():
-    myStatus(eNone)
-  {}
-  
-  TGaussPointID
-  TGaussSubMeshImpl
-  ::GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const
-  {
-    TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
-    TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
-    
-    return TGaussPointID(aCellID,aLocalPntID);
-  }
-
-  //---------------------------------------------------------------
-  bool
-  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
-  {
-    PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
-    const PGaussImpl& aGaussLeft = aLeft->myGauss;
-    const PGaussImpl& aGaussRight = aRight->myGauss;
-    
-    if(aGaussLeft->myGeom != aGaussRight->myGeom)
-      return aGaussLeft->myGeom < aGaussRight->myGeom;
-
-    if(aLeft->mySubProfile != aRight->mySubProfile)
-      return aLeft->mySubProfile < aRight->mySubProfile;
-
-    bool aResult;
-    aGaussLeft->LessThan(aGaussRight,aResult);
-
-    return aResult;
-  }
-
-
-  //---------------------------------------------------------------
-  TGaussMeshImpl
-  ::TGaussMeshImpl():
-    myParent(NULL)
-  {}
-
-  TGaussPointID 
-  TGaussMeshImpl
-  ::GetObjID(vtkIdType theID) const
-  {
-    vtkIdType anInputID, aStartId, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
-    const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID];
-
-    return aSubMeshImpl.GetObjID(anInputID,aStartId);
-  }
-  
-  TVTKOutput* 
-  TGaussMeshImpl
-  ::GetVTKOutput()
-  {
-    return mySource.GetVTKOutput();
-  }
-
-  TNamedIDMapper* 
-  TGaussMeshImpl::
-  GetParent()
-  {
-    return myParent;
-  }
-
-
-  //---------------------------------------------------------------
-  TGaussPointID 
-  TGaussPtsIDFilter
-  ::GetObjID(vtkIdType theID) const
-  {
-    return myGaussPtsIDMapper->GetObjID(theID);
-  }
-  
-  TNamedIDMapper* 
-  TGaussPtsIDFilter::
-  GetParent()
-  {
-    return myGaussPtsIDMapper->GetParent();
-  }
-
-
-  //---------------------------------------------------------------
-  vtkIdType
-  TSubMeshImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    return myStartID + theID;
-  }
-
-  std::string 
-  TSubMeshImpl
-  ::GetElemName(vtkIdType theObjID) const
-  {
-    return "";
-  }
-
-  //---------------------------------------------------------------
-  vtkIdType
-  TMeshOnEntityImpl
-  ::GetNodeVTKID(vtkIdType theID) const
-  {
-    return myNamedPointCoords->GetVTKID(theID);
-  }
-
-  vtkIdType
-  TMeshOnEntityImpl
-  ::GetNodeObjID(vtkIdType theID) const
-  {
-    return myNamedPointCoords->GetObjID(theID);
-  }
-
-  vtkIdType
-  TMeshOnEntityImpl
-  ::GetElemVTKID(vtkIdType theID) const
-  {
-    if(myElemObj2VTKID.empty())
-      return theID;
-    else{
-      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
-      if(anIter != myElemObj2VTKID.end())
-       return anIter->second;
-    }
-    return -1;
-  }
-
-  vtkIdType
-  TMeshOnEntityImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    vtkIdType anInputID, aStartId, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
-    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
-    return aSubMesh->GetElemObjID(anInputID);
-  }
-
-  std::string 
-  TMeshOnEntityImpl
-  ::GetNodeName(vtkIdType theObjID) const
-  {
-    return myNamedPointCoords->GetNodeName(theObjID);
-  }
-
-  std::string 
-  TMeshOnEntityImpl
-  ::GetElemName(vtkIdType theObjID) const
-  {
-    vtkIdType aVTKId = GetElemVTKID(theObjID);
-    vtkIdType anInputID, aStartId, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartId,anInputDataSetID);
-    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
-    return aSubMesh->GetElemName(anInputID);
-  }
-
-  //---------------------------------------------------------------
-  vtkIdType
-  TFamilyImpl
-  ::GetElemVTKID(vtkIdType theID) const
-  {
-    if(myElemObj2VTKID.empty())
-      return theID;
-    else{
-      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
-      if(anIter != myElemObj2VTKID.end())
-       return anIter->second;
-    }
-    return -1;
-  }
-
-  vtkIdType
-  TFamilyImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    return myMeshID[theID];
-  }
-
-  vtkIdType 
-  TFamilyImpl
-  ::GetNodeObjID(vtkIdType theID) const 
-  {
-    return myNamedPointCoords->GetObjID(theID);
-  }
-
-  vtkIdType
-  TFamilyImpl
-  ::GetNodeVTKID(vtkIdType theID) const 
-  {
-    return myNamedPointCoords->GetVTKID(theID);
-  }
-
-  TVTKOutput* 
-  TFamilyImpl
-  ::GetVTKOutput()
-  {
-    return TSource::GetVTKOutput();
-  }
-
-
-  //---------------------------------------------------------------
-  TNbASizeCells 
-  TGroupImpl
-  ::GetNbASizeCells() const
-  {
-    vtkIdType aNbCells = 0, aCellsSize = 0;
-    TFamilySet::const_iterator anIter = myFamilySet.begin();
-    for(; anIter != myFamilySet.end(); anIter++){
-      PFamilyImpl aFamily = *anIter; 
-      aNbCells += aFamily->myNbCells;
-      aCellsSize += aFamily->myCellsSize;
-    }
-    return make_pair(aNbCells,aCellsSize);
-  }
-
-  vtkIdType
-  TGroupImpl
-  ::GetElemVTKID(vtkIdType theID) const
-  {
-    if(myElemObj2VTKID.empty())
-      return theID;
-    else{
-      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
-      if(anIter != myElemObj2VTKID.end())
-       return anIter->second;
-    }
-    return -1;
-  }
-
-  vtkIdType
-  TGroupImpl
-  ::GetElemObjID(vtkIdType theID) const
-  {
-    vtkIdType anInputID, aStartId, anInputDataSetID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
-    const PFamilyImpl& aFamily = myFamilyArr[anInputDataSetID];
-    return aFamily->GetElemObjID(anInputID);
-  }
-
-  vtkIdType 
-  TGroupImpl
-  ::GetNodeObjID(vtkIdType theID) const 
-  {
-    return myNamedPointCoords->GetObjID(theID);
-  }
-
-  vtkIdType
-  TGroupImpl
-  ::GetNodeVTKID(vtkIdType theID) const 
-  {
-    return myNamedPointCoords->GetVTKID(theID);
-  }
-
-  
-  //---------------------------------------------------------------
-  TFieldImpl
-  ::TFieldImpl(): 
-    myDataSize(0)
-  {}
-
-  void 
-  TFieldImpl
-  ::InitArrays(vtkIdType theNbComp)
-  {
-    myNbComp = theNbComp;
-    myCompNames.resize(theNbComp);
-    myUnitNames.resize(theNbComp);
-    myMinMaxArr.resize(theNbComp + 1);
-    for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
-      TMinMax& aMinMax = myMinMaxArr[iComp];
-      aMinMax.first = VTK_LARGE_FLOAT;
-      aMinMax.second = -VTK_LARGE_FLOAT;
-    }
-  }
-
-  TMinMax 
-  TFieldImpl
-  ::GetMinMax(vtkIdType theCompID)
-  {
-    return myMinMaxArr[theCompID];
-  }
-
-
-  //---------------------------------------------------------------
-  void
-  TMeshValue
-  ::Init(vtkIdType theNbElem,
-        vtkIdType theNbGauss,
-        vtkIdType theNbComp)
-  {
-    myNbElem = theNbElem;
-    myNbGauss = theNbGauss;
-    myNbComp = theNbComp;
-    
-    myStep = theNbComp*theNbGauss;
-    
-    myValue.resize(theNbElem*myStep);
-  }
-
-  TCValueSliceArr 
-  TMeshValue
-  ::GetGaussValueSliceArr(vtkIdType theElemId) const
-  {
-    TCValueSliceArr aValueSliceArr(myNbGauss);
-    vtkIdType anId = theElemId*myStep;
-    for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
-      aValueSliceArr[aGaussId] =
-       TCValueSlice(myValue,std::slice(anId,myNbComp,1));
-      anId += myNbComp;
-    }
-    return aValueSliceArr;
-  }
-
-  TValueSliceArr 
-  TMeshValue
-  ::GetGaussValueSliceArr(vtkIdType theElemId)
-  {
-    TValueSliceArr aValueSliceArr(myNbGauss);
-    vtkIdType anId = theElemId*myStep;
-    for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
-      aValueSliceArr[aGaussId] =
-       TValueSlice(myValue,std::slice(anId,myNbComp,1));
-      anId += myNbComp;
-    }
-    return aValueSliceArr;
-  }
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
 
-  TCValueSliceArr 
-  TMeshValue
-  ::GetCompValueSliceArr(vtkIdType theElemId) const
-  {
-    TCValueSliceArr aValueSliceArr(myNbComp);
-    vtkIdType anId = theElemId*myStep;
-    for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){
-      aValueSliceArr[aCompId] =
-       TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
-      anId += 1;
-    }
-    return aValueSliceArr;
-  }
-
-  TValueSliceArr 
-  TMeshValue
-  ::GetCompValueSliceArr(vtkIdType theElemId)
-  {
-    TValueSliceArr aValueSliceArr(myNbComp);
-    vtkIdType anId = theElemId*myStep;
-    for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){
-      aValueSliceArr[aCompId] =
-       TValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
-      anId += 1;
-    }
-    return aValueSliceArr;
-  }
-
-
-  //---------------------------------------------------------------
-  TValForTimeImpl
-  ::TValForTimeImpl():
-    myGaussPtsIDFilter(new TGaussPtsIDFilter()),
-    myIDMapperFilter(new TIDMapperFilter())
-  {}
-
-  const TMeshValue& 
-  TValForTimeImpl
-  ::GetMeshValue(EGeometry theGeom) const
-  {
-    TGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
-    if(anIter == myGeom2Value.end())
-      EXCEPTION(runtime_error,"TValForTimeImpl::GetMeshValue - myGeom2Value.find(theGeom) fails");
-    return anIter->second;
-  }
-  
-  TMeshValue& 
-  TValForTimeImpl
-  ::GetMeshValue(EGeometry theGeom)
-  {
-    return myGeom2Value[theGeom];
-  }
-
-  int
-  TValForTimeImpl
-  ::GetNbGauss(EGeometry theGeom) const
-  {
-    TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
-    if(anIter == myGeom2NbGauss.end()){
-      //EXCEPTION(runtime_error,"TValForTimeImpl::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
-      return 1;
-    }
-    return anIter->second;
-  }
-  
-
-  //---------------------------------------------------------------
-  vtkIdType
-  VISUGeom2NbNodes(EGeometry theGeom)
-  { 
-    switch(theGeom){
-#ifndef VISU_ENABLE_QUADRATIC
-    case VISU::eSEG3: 
-      return 2;
-    case VISU::eTRIA6: 
-      return 3;
-    case VISU::eQUAD8: 
-      return 4;
-    case VISU::eTETRA10: 
-      return 4;
-    case VISU::eHEXA20: 
-      return 8;
-    case VISU::ePENTA15: 
-      return 6;
-    case VISU::ePYRA13: 
-      return 5;
-#endif
-    case VISU::ePOLYGONE: 
-    case VISU::ePOLYEDRE: 
-      return -1;
-    default:
-      return theGeom % 100;
-    }
-  }
+#include "VISU_AppendPolyData.hxx"
+#include "VTKViewer_AppendFilter.h"
+#include "VTKViewer_CellLocationsArray.h"
 
-  vtkIdType
-  VISUGeom2VTK(EGeometry theGeom)
-  { 
-    switch(theGeom){
-    case VISU::ePOINT1: 
-      return VTK_VERTEX;
-    case VISU::eSEG2: 
-      return VTK_LINE;
-    case VISU::eTRIA3: 
-      return VTK_TRIANGLE;
-    case VISU::eQUAD4: 
-      return VTK_QUAD;
-    case VISU::eTETRA4: 
-      return VTK_TETRA;
-    case VISU::eHEXA8: 
-      return VTK_HEXAHEDRON;
-    case VISU::ePENTA6: 
-      return VTK_WEDGE;
-    case VISU::ePYRA5: 
-      return VTK_PYRAMID;
-
-    case VISU::ePOLYGONE: 
-      return VTK_POLYGON;
-    case VISU::ePOLYEDRE: 
-      return VTK_CONVEX_POINT_SET;
-
-#ifndef VISU_ENABLE_QUADRATIC
-    case VISU::eSEG3: 
-      return VTK_LINE;
-    case VISU::eTRIA6: 
-      return VTK_TRIANGLE;
-    case VISU::eQUAD8: 
-      return VTK_QUAD;
-    case VISU::eTETRA10: 
-      return VTK_TETRA;
-    case VISU::eHEXA20: 
-      return VTK_HEXAHEDRON;
-    case VISU::ePENTA15: 
-      return VTK_WEDGE;
-    case VISU::ePYRA13: 
-      return VTK_PYRAMID;
+#include "VISU_ConvertorUtils.hxx"
 
-#else
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
 
-    case VISU::eSEG3: 
-#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_EDGE;
-#else
-      return VTK_POLY_LINE;
-#endif
+#include <vtkPoints.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
 
-    case VISU::eTRIA6: 
-#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_TRIANGLE;
-#else
-      return VTK_POLYGON;
-#endif
+#include <vtkIdList.h>
+#include <vtkCellType.h>
+#include <vtkCellArray.h>
+#include <vtkCellLinks.h>
+#include <vtkUnsignedCharArray.h>
 
-    case VISU::eQUAD8: 
-#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_QUAD;
-#else
-      return VTK_POLYGON;
-#endif
+#include <qstring.h>
+#include <qfileinfo.h>
 
-    case VISU::eTETRA10: 
-#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_TETRA;
-#else
-      return VTK_CONVEX_POINT_SET;
-#endif
+#include <memory>
 
-    case VISU::eHEXA20: 
-#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_HEXAHEDRON;
-#else
-      return VTK_CONVEX_POINT_SET;
-#endif
+static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
 
-    case VISU::ePENTA15: 
-#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_WEDGE;
-#else
-      return VTK_CONVEX_POINT_SET;
-#endif
+static int MYVTKDEBUG = 0;
 
-    case VISU::ePYRA13: 
-#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
-      return VTK_QUADRATIC_PYRAMID;
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+//#define _DEXCEPT_
 #else
-      return VTK_CONVEX_POINT_SET;
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
 #endif
 
-#endif //VISU_ENABLE_QUADRATIC
-
-    default:
-      return -1;
-    }
-  }
-}
-
 
 namespace
 {
@@ -1010,162 +80,6 @@ namespace
   }
 
 
-  //---------------------------------------------------------------
-  enum ECoordName{eX, eY, eZ, eNone};
-  typedef VISU::TCoord (*TGetCoord)(const VISU::TCCoordSlice& theCoordSlice);
-  
-  template<ECoordName TCoordId>
-  VISU::TCoord 
-  GetCoord(const VISU::TCCoordSlice& theCoordSlice)
-  {
-    return theCoordSlice[TCoordId];
-  }
-  
-  template<>
-  VISU::TCoord 
-  GetCoord<eNone>(const VISU::TCCoordSlice& theCoordSlice)
-  {
-    return 0.0;
-  }
-  
-  
-  TGetCoord aXYZGetCoord[3] = {
-    &GetCoord<eX>, 
-    &GetCoord<eY>, 
-    &GetCoord<eZ>
-  };
-  
-  
-  TGetCoord aXYGetCoord[3] = {
-    &GetCoord<eX>, 
-    &GetCoord<eY>, 
-    &GetCoord<eNone>
-  };
-  
-  TGetCoord aYZGetCoord[3] = {
-    &GetCoord<eNone>,
-    &GetCoord<eX>, 
-    &GetCoord<eY>
-  };
-  
-  TGetCoord aXZGetCoord[3] = {
-    &GetCoord<eX>, 
-    &GetCoord<eNone>,
-    &GetCoord<eY>
-  };
-  
-  
-  TGetCoord aXGetCoord[3] = {
-    &GetCoord<eX>, 
-    &GetCoord<eNone>,
-    &GetCoord<eNone>
-  };
-  
-  TGetCoord aYGetCoord[3] = {
-    &GetCoord<eNone>,
-    &GetCoord<eX>, 
-    &GetCoord<eNone>
-  };
-
-  TGetCoord aZGetCoord[3] = {
-    &GetCoord<eNone>,
-    &GetCoord<eNone>,
-    &GetCoord<eX>
-  };
-
-  
-  class TCoordHelper{
-    TGetCoord* myGetCoord;
-  public:
-    TCoordHelper(TGetCoord* theGetCoord):
-      myGetCoord(theGetCoord)
-    {}
-
-    virtual
-    ~TCoordHelper()
-    {}
-
-    VISU::TCoord 
-    GetCoord(VISU::TCCoordSlice& theCoordSlice, 
-            int theCoordId)
-    {
-      return (*myGetCoord[theCoordId])(theCoordSlice);
-    }
-  };
-  typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
-  
-
-  //---------------------------------------------------------------
-  vtkPoints*
-  GetPoints(const PMeshImpl& theMesh) 
-  {
-    TVTKPoints& aPoints = theMesh->myPoints;
-    const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-
-    if(!theMesh->myIsVTKDone){
-      TCoordHelperPtr aCoordHelperPtr;
-      {
-       int aMeshDimension = theMesh->myDim;
-       bool anIsDimPresent[3] = {false, false, false};
-       for(int iDim = 0; iDim < aMeshDimension; iDim++){
-         std::string aName = aCoords.GetName(iDim);
-          if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
-            aName = aName.substr(0,1);
-         if(aName == "x" || aName == "X")
-           anIsDimPresent[eX] = true;
-         else if(aName == "y" || aName == "Y")
-           anIsDimPresent[eY] = true;
-         else if(aName == "z" || aName == "Z")
-           anIsDimPresent[eZ] = true;
-       }
-
-       switch(aMeshDimension){
-       case 3:
-         aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
-         break;
-       case 2:
-         if(anIsDimPresent[eY] && anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
-         else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
-         else
-           aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
-         break;
-       case 1:
-         if(anIsDimPresent[eY])
-           aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
-         else if(anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
-         else
-           aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
-         break;
-       }
-      }
-
-      vtkIdType aNbPoints = aCoords.GetNbPoints();
-      aPoints->SetNumberOfPoints(aNbPoints);
-      
-      INITMSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<
-             "; aDim = "<<theMesh->myDim<<
-             endl);
-
-      for(vtkIdType aNodeId = 0; aNodeId < aNbPoints; aNodeId++){ 
-       TCCoordSlice aCoordSlice = aCoords.GetCoordSlice(aNodeId);
-       aPoints->SetPoint(aNodeId,
-                         aCoordHelperPtr->GetCoord(aCoordSlice,eX),
-                         aCoordHelperPtr->GetCoord(aCoordSlice,eY),
-                         aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
-      }
-      
-      theMesh->myIsVTKDone = true;
-
-      if(MYVTKDEBUG) aPoints->DebugOn();
-    }
-
-    return aPoints.GetPointer();
-  }
-  
-  
   //---------------------------------------------------------------
   void
   PrintCells(int& theStartId,
@@ -1184,11 +98,12 @@ namespace
 
   //---------------------------------------------------------------
   void
-  GetCellsOnSubMesh(const TVTKSource& theSource,
-                   const PMeshOnEntityImpl& theMeshOnEntity, 
-                   const PSubMeshImpl& theSubMesh,
+  GetCellsOnSubMesh(const VISU::PUnstructuredGrid& theSource,
+                   const VISU::PMeshOnEntityImpl& theMeshOnEntity, 
+                   const VISU::PSubMeshImpl& theSubMesh,
                    const vtkIdType theGeom) 
   {
+    VISU::TTimerLog aTimerLog(MYDEBUG,"GetCellsOnSubMesh");
     const VISU::TCell2Connect& anArray = theSubMesh->myCell2Connect;
     vtkIdType aCellsSize = theSubMesh->myCellsSize;
     vtkIdType aNbCells = theSubMesh->myNbCells;
@@ -1228,9 +143,9 @@ namespace
   
   //---------------------------------------------------------------
   void
-  GetCellsOnFamily(const TVTKSource& theSource,
-                  const PMeshOnEntityImpl& theMeshOnEntity, 
-                  const PFamilyImpl& theFamily) 
+  GetCellsOnFamily(const VISU::PUnstructuredGrid& theSource,
+                  const VISU::PMeshOnEntityImpl& theMeshOnEntity, 
+                  const VISU::PFamilyImpl& theFamily) 
   {
     INITMSG(MYDEBUG,"GetCellsOnFamily"<<endl);
 
@@ -1243,7 +158,7 @@ namespace
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
 
-    TSubMeshID& aMeshID = theFamily->myMeshID;
+    VISU::TSubMeshID& aMeshID = theFamily->myMeshID;
     aMeshID.resize(aNbCells);
 
     VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID;
@@ -1259,7 +174,7 @@ namespace
 
       const VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
       if(aGeom2SubMeshID.empty()) 
-       EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
+       EXCEPTION(std::runtime_error,"GetCells >> There is no elements on the family !!!");
 
       VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aEGeom);
       if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) 
@@ -1300,106 +215,12 @@ namespace
   }
   
   
-  //---------------------------------------------------------------
-  std::string
-  GenerateFieldName(const PFieldImpl& theField,
-                   const PValForTimeImpl& theValForTime)
-  {
-    const VISU::TTime& aTime = theValForTime->myTime;
-    string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + 
-      VISU_Convertor::GenerateName(aTime);
-    return aFieldName;
-  }
-
-
-  //---------------------------------------------------------------
-  void 
-  GetTimeStampOnProfile(const TVTKSource& theSource,
-                       const PFieldImpl& theField, 
-                       const PValForTimeImpl& theValForTime,
-                       const VISU::TEntity& theEntity)
-  {
-    int aNbTuples = theField->myDataSize/theField->myNbComp;
-    std::string aFieldName = GenerateFieldName(theField,theValForTime);
-    
-    vtkDataSetAttributes* aDataSetAttributes;
-    switch(theEntity){
-    case VISU::NODE_ENTITY : 
-      aDataSetAttributes = theSource->GetPointData();
-      break;
-    default: 
-      aDataSetAttributes = theSource->GetCellData();
-    }
-
-    int aNbComp = theField->myNbComp;
-    vtkFloatArray *aFloatArray = vtkFloatArray::New();
-
-    switch(aNbComp) {
-    case 1:
-      aFloatArray->SetNumberOfComponents(1);
-      aDataSetAttributes->SetScalars(aFloatArray);
-      break;
-    default:
-      aFloatArray->SetNumberOfComponents(3);
-      aDataSetAttributes->SetVectors(aFloatArray);
-    }
-    aFloatArray->SetNumberOfTuples(aNbTuples);
-    aFloatArray->SetName(aFieldName.c_str());
-
-    vtkFloatArray *aDataArray = vtkFloatArray::New();
-    aDataArray->SetNumberOfComponents(aNbComp);
-    aDataArray->SetNumberOfTuples(aNbTuples);
-    aDataArray->SetName("VISU_FIELD");
-    aDataSetAttributes->AddArray(aDataArray);
-
-    INITMSG(MYDEBUG,"GetTimeStampOnProfile "<<
-           "- theEntity = "<<theEntity<<
-           "; aNbTuples = "<<aNbTuples<<
-           "; aNbComp = "<<aNbComp<<
-           endl);
-    
-    int aSize = max(3,aNbComp);
-    TVector<float> aDataValues(aSize,0.0);
-
-    TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
-    TGeom2Value::const_iterator anIter = aGeom2Value.begin();
-    for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){
-      EGeometry aEGeom = anIter->first;
-      const TMeshValue& aMeshValue = anIter->second;
-      
-      int aNbElem = aMeshValue.myNbElem;
-      int aNbGauss = aMeshValue.myNbGauss;
-      INITMSG(MYDEBUG,
-             "- aEGeom = "<<aEGeom<<
-             "; aNbElem = "<<aNbElem<<
-             "; aNbGauss = "<<aNbGauss<<
-             endl);
-
-      for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
-       TCValueSliceArr aValueSliceArr = aMeshValue.GetCompValueSliceArr(iElem);
-       for(int iComp = 0; iComp < aNbComp; iComp++){
-         const TCValueSlice& aValueSlice = aValueSliceArr[iComp];
-         aDataValues[iComp] = 0.0;
-         for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
-           aDataValues[iComp] += aValueSlice[iGauss];
-         }
-         aDataValues[iComp] /= aNbGauss;
-       }
-       aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
-       aDataArray->SetTuple(aTupleId,&aDataValues[0]);
-      }
-    }
-    aFloatArray->Delete();
-    aDataArray->Delete();
-  }
-
-
   //---------------------------------------------------------------
   void
-  GetCells(const TVTKSource& theSource,
-          const PSubProfileImpl& theSubProfile,
-          const PProfileImpl& theProfile,
-          const PMeshOnEntityImpl& theMeshOnEntity)
+  GetCells(const VISU::PUnstructuredGrid& theSource,
+          const VISU::PSubProfileImpl& theSubProfile,
+          const VISU::PProfileImpl& theProfile,
+          const VISU::PMeshOnEntityImpl& theMeshOnEntity)
   {
     vtkIdType aNbCells = theSubProfile->myNbCells;
     vtkIdType aCellsSize = theSubProfile->myCellsSize;
@@ -1409,15 +230,15 @@ namespace
 
     INITMSG(MYDEBUG,"GetCells - aVGeom = "<<aVGeom<<endl);
 
-    const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
+    const VISU::TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
 
     const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
     VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.find(aEGeom);
     if(anIter == aGeom2SubMesh.end())
-      EXCEPTION(runtime_error,"GetCells >> There is no elements for the GEOM("<<aEGeom<<")");
+      EXCEPTION(std::runtime_error,"GetCells >> There is no elements for the GEOM("<<aEGeom<<")");
     
     const VISU::TSubMeshImpl& aSubMesh = anIter->second;
-    const TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
+    const VISU::TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
     
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
@@ -1425,10 +246,10 @@ namespace
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
     
-    if(theSubProfile->myStatus == eAddAll){
+    if(theSubProfile->myStatus == VISU::eAddAll){
       VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
       for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){
-       const TConnect& anArray = aCell2Connect[anId];
+       const VISU::TConnect& anArray = aCell2Connect[anId];
        PrintCells(aConnId,aConnectivity,anArray);
        aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
        aConnId += aNbNodes;
@@ -1438,7 +259,7 @@ namespace
       VISU::TSubMeshID::const_iterator anIter = aSubMeshID.begin();
       for(vtkIdType anId = 0, aConnId = 0; anIter != aSubMeshID.end(); anIter++){
        vtkIdType aSubId = *anIter;
-       const TConnect& anArray = aCell2Connect[aSubId];
+       const VISU::TConnect& anArray = aCell2Connect[aSubId];
        PrintCells(aConnId,aConnectivity,anArray);
        aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
        aConnId += aNbNodes;
@@ -1464,18 +285,18 @@ namespace
   
   //---------------------------------------------------------------
   void
-  GetMeshOnSubProfile(const PMeshImpl& theMesh,
-                     const PMeshOnEntityImpl& theMeshOnEntity,
-                     const PProfileImpl& theProfile,
-                     const PSubProfileImpl& theSubProfile)
+  GetMeshOnSubProfile(const VISU::PMeshImpl& theMesh,
+                     const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+                     const VISU::PProfileImpl& theProfile,
+                     const VISU::PSubProfileImpl& theSubProfile)
   {
     INITMSG(MYDEBUG,"GetMeshOnSubProfile - aEGeom = "<<theSubProfile->myGeom<<endl);
     
-    const TVTKSource& aSource = theSubProfile->GetSource();
+    const VISU::PUnstructuredGrid& aSource = theSubProfile->GetSource();
     if(theSubProfile->myIsVTKDone)
       return;
     
-    aSource->SetPoints(GetPoints(theMesh));
+    aSource->SetPoints(theMesh->GetPoints());
     INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
     GetCells(aSource,theSubProfile,theProfile,theMeshOnEntity);
     BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
@@ -1486,34 +307,35 @@ namespace
   
   //---------------------------------------------------------------
   void
-  GetMeshOnProfile(const PMeshImpl& theMesh,
-                  const PMeshOnEntityImpl& theMeshOnEntity,
-                  const PProfileImpl& theProfile)
+  GetMeshOnProfile(const VISU::PMeshImpl& theMesh,
+                  const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+                  const VISU::PProfileImpl& theProfile)
   {
-    INITMSG(MYDEBUG,"GetMeshOnProfile - anEntity = "<<theMeshOnEntity->myEntity<<endl);
-
     if(theProfile->myIsVTKDone)
       return;
     
+    VISU::TTimerLog aTimerLog(MYDEBUG,"GetMeshOnProfile");
+    INITMSG(MYDEBUG,"GetMeshOnProfile - anEntity = "<<theMeshOnEntity->myEntity<<endl);
+
     theProfile->myMeshOnEntity = theMeshOnEntity.get();
-    const TVTKAppendFilter& anAppendFilter = theProfile->GetFilter();
-    anAppendFilter->SetPoints(GetPoints(theMesh));
+    const VISU::PAppendFilter& anAppendFilter = theProfile->GetFilter();
+    anAppendFilter->SetPoints(theMesh->GetPoints());
 
     if(theProfile->myIsAll){
-      TVTKOutput* aDataSet = theMeshOnEntity->GetVTKOutput();
+      vtkUnstructuredGrid* aDataSet = theMeshOnEntity->GetUnstructuredGridOutput();
       anAppendFilter->AddInput(aDataSet);
     }else{
-      const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
+      const VISU::TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
 
-      TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
+      VISU::TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
 
-      TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr;
+      VISU::TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr;
       aSubProfileArr.resize(aGeom2SubProfile.size());
 
-      TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+      VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
       for(vtkIdType anInputID = 0, aCellID = 0; anIter != aGeom2SubProfile.end(); anIter++){
-       PSubProfileImpl aSubProfile = anIter->second;
-       if(aSubProfile->myStatus == eRemoveAll)
+       VISU::PSubProfileImpl aSubProfile = anIter->second;
+       if(aSubProfile->myStatus == VISU::eRemoveAll)
          continue;
        
        GetMeshOnSubProfile(theMesh,
@@ -1521,7 +343,7 @@ namespace
                            theProfile,
                            aSubProfile);
        
-       const TVTKSource& aSource = aSubProfile->GetSource();
+       const VISU::PUnstructuredGrid& aSource = aSubProfile->GetSource();
        anAppendFilter->AddInput(aSource.GetPointer());
 
        vtkIdType aNbCells = aSource->GetNumberOfCells();
@@ -1539,183 +361,43 @@ namespace
   }
   
   
-  //---------------------------------------------------------------
-  void 
-  GetTimeStampOnGaussMesh(const TVTKSource& theSource,
-                         const PFieldImpl& theField, 
-                         const PValForTimeImpl& theValForTime)
-  {
-    int aNbTuples = theSource->GetNumberOfPoints();
-    std::string aFieldName = GenerateFieldName(theField,theValForTime);
-
-    vtkDataSetAttributes* aDataSetAttributes;
-    switch(theField->myEntity){
-    case VISU::NODE_ENTITY : 
-      aDataSetAttributes = theSource->GetPointData();
-      break;
-    default: 
-      aDataSetAttributes = theSource->GetCellData();
-    }
-
-    int aNbComp = theField->myNbComp;
-    vtkFloatArray *aFloatArray = vtkFloatArray::New();
-    switch(aNbComp){
-    case 1:
-      aFloatArray->SetNumberOfComponents(1);
-      aDataSetAttributes->SetScalars(aFloatArray);
-      break;
-    default:
-      aFloatArray->SetNumberOfComponents(3);
-      aDataSetAttributes->SetVectors(aFloatArray);
-    }
-    aFloatArray->SetNumberOfTuples(aNbTuples);
-    aFloatArray->SetName(aFieldName.c_str());
-
-    vtkFloatArray *aDataArray = vtkFloatArray::New();
-    aDataArray->SetNumberOfComponents(aNbComp);
-    aDataArray->SetNumberOfTuples(aNbTuples);
-    aDataArray->SetName("VISU_FIELD");
-    aDataSetAttributes->AddArray(aDataArray);
-
-    INITMSG(MYDEBUG,"GetTimeStampOnGaussMesh "<<
-           "- aNbTuples = "<<aNbTuples<<
-           "; aNbComp = "<<aNbComp<<
-           endl);
-    
-    int aSize = max(3,aNbComp);
-    TVector<vtkFloatingPointType> aDataValues(aSize,0.0);
-
-    const TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
-
-    PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
-    const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-    TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
-    for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
-      EGeometry aEGeom = anIter->first;
-
-      PGaussSubMeshImpl aGaussSubMesh = anIter->second;
-      if(!aGaussSubMesh->myIsDone)
-       continue;
-      
-      TGeom2Value::const_iterator anIter2 = aGeom2Value.find(aEGeom);
-      if(anIter2 == aGeom2Value.end()){
-       EXCEPTION(runtime_error,
-                 "GetTimeStampOnGaussMesh >> Can't find values for corresponding Gauss Points SubMesh");
-      }
-      const TMeshValue& aMeshValue = anIter2->second;
-      int aNbGauss = aMeshValue.myNbGauss;
-      int aNbElem = aMeshValue.myNbElem;
-      
-      if(aNbGauss < 1)
-       continue;
-
-      const TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
-
-      INITMSG(MYDEBUG,
-             "- aEGeom = "<<aEGeom<<
-             "; aNbElem = "<<aNbElem<<
-             "; aNbGauss = "<<aNbGauss<<
-             "; aCoords.GetNbPoints() = "<<aCoords.GetNbPoints()<<
-             endl);
-
-      if(aCoords.GetNbPoints() == aNbElem*aNbGauss){
-       for(int iElem = 0; iElem < aNbElem; iElem++){
-         TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
-         for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
-           const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
-           for(int iComp = 0; iComp < aNbComp; iComp++){
-             aDataValues[iComp] = aValueSlice[iComp];
-           }
-           aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
-           aDataArray->SetTuple(aTupleId,&aDataValues[0]);
-         }
-       }
-      }else{
-       for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
-         TCValueSliceArr aValueSliceArr = aMeshValue.GetCompValueSliceArr(iElem);
-         for(int iComp = 0; iComp < aNbComp; iComp++){
-           const TCValueSlice& aValueSlice = aValueSliceArr[iComp];
-           aDataValues[iComp] = 0.0;
-           for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
-             aDataValues[iComp] += aValueSlice[iGauss];
-           }
-           aDataValues[iComp] /= aNbGauss;
-         }
-         aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
-         aDataArray->SetTuple(aTupleId,&aDataValues[0]);
-       }
-      }
-    }
-    aFloatArray->Delete();
-    aDataArray->Delete();
-  }
-
-
   //---------------------------------------------------------------
   void
-  GetSource(const TVTKSource& theSource,
-           const PGaussSubMeshImpl& theGaussSubMesh,
-           const PMeshOnEntityImpl& theMeshOnEntity)
+  GetSource(const VISU::PPolyData& theSource,
+           const VISU::PGaussSubMeshImpl& theGaussSubMesh,
+           const VISU::PMeshOnEntityImpl& theMeshOnEntity)
   {
-    const TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
-    vtkIdType aNbPoints = aCoords.GetNbPoints();
-    vtkIdType aDim = aCoords.GetDim();
-    
-    vtkIdType aNbCells = theGaussSubMesh->myNbCells;
-    vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
-    
     vtkCellArray* aConnectivity = vtkCellArray::New();
-    aConnectivity->Allocate(aCellsSize,0);
-    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-    aCellTypesArray->SetNumberOfComponents(1);
-    aCellTypesArray->SetNumberOfTuples(aNbCells);
+    vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
+    aConnectivity->Allocate(aCellsSize, 0);
     
-    const TVTKPoints& aPoints = aCoords.GetPoints();
     vtkIdList *anIdList = vtkIdList::New();
     anIdList->SetNumberOfIds(1);
+
+    const VISU::TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
+    vtkIdType aNbPoints = aCoords.GetNbPoints();
     for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
-      TCCoordSlice aSlice = aCoords.GetCoordSlice(aPointId);
-      
-      vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
-      for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
-       aCoords[aDimId] = aSlice[aDimId];
-      
-      aPoints->SetPoint(aPointId,aCoords);
-      
-      anIdList->SetId(0,aPointId);
+      anIdList->SetId(0, aPointId);
       aConnectivity->InsertNextCell(anIdList);
-      aCellTypesArray->SetValue(aPointId,(unsigned char)VTK_VERTEX);
     }
     anIdList->Delete();
     
-    VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
-    aCellLocationsArray->SetNumberOfComponents(1);
-    aCellLocationsArray->SetNumberOfTuples(aNbCells);
-    
-    vtkIdType *pts = 0, npts = 0;
-    aConnectivity->InitTraversal();
-    for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
-      aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
-    
-    const TVTKSource& aSource = theGaussSubMesh->GetSource();
-    aSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
-    aSource->SetPoints(aPoints.GetPointer());
+    const VISU::PPolyData& aSource = theGaussSubMesh->GetSource();
+    aSource->SetVerts(aConnectivity);
+    aSource->SetPoints(aCoords.GetPoints());
     
-    aCellLocationsArray->Delete();
-    aCellTypesArray->Delete();
     aConnectivity->Delete();
   }
   
   
   //---------------------------------------------------------------
   void
-  GetGaussSubMesh(const PMeshImpl& theMesh,
-                 const PMeshOnEntityImpl& theMeshOnEntity,
-                 const PGaussMeshImpl& theGaussMesh,
-                 const PGaussSubMeshImpl& theGaussSubMesh)
+  GetGaussSubMesh(const VISU::PMeshImpl& theMesh,
+                 const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+                 const VISU::PGaussMeshImpl& theGaussMesh,
+                 const VISU::PGaussSubMeshImpl& theGaussSubMesh)
   {
-    PGaussImpl aGauss = theGaussSubMesh->myGauss;
-    INITMSG(MYDEBUG,"GetGaussSubMesh - aVGeom = "<<aGauss->myGeom<<endl);
+    VISU::PGaussImpl aGauss = theGaussSubMesh->myGauss;
     
     if(!theGaussSubMesh->myIsDone)
       return;
@@ -1723,8 +405,12 @@ namespace
     if(theGaussSubMesh->myIsVTKDone)
       return;
     
-    const TVTKSource& aSource = theGaussSubMesh->GetSource();
-    GetSource(aSource,theGaussSubMesh,theMeshOnEntity);
+    VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussSubMesh");
+    INITMSG(MYDEBUG,"GetGaussSubMesh - aVGeom = "<<aGauss->myGeom<<endl);
+
+    const VISU::PPolyData& aSource = theGaussSubMesh->GetSource();
+    GetSource(aSource, theGaussSubMesh, theMeshOnEntity);
+
     INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
     BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
     
@@ -1734,20 +420,20 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildGaussMesh(const PMeshImpl& theMesh,
-                const PMeshOnEntityImpl& theMeshOnEntity,
-                const PGaussMeshImpl& theGaussMesh)
+  BuildGaussMesh(const VISU::PMeshImpl& theMesh,
+                const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+                const VISU::PGaussMeshImpl& theGaussMesh)
   {
     if(theGaussMesh->myIsVTKDone)
       return;
 
-    INITMSG(MYDEBUG,"BuildGaussMesh"<<endl);
-    const TVTKAppendFilter& anAppendFilter = theGaussMesh->GetFilter();
-    const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
-    TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGaussMesh");
+    const VISU::PAppendPolyData& anAppendFilter = theGaussMesh->GetFilter();
+    const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
+    VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
     for(; anIter != aGeom2GaussSubMesh.end(); anIter++){
-      PGaussSubMeshImpl aGaussSubMesh = anIter->second;
-      if(aGaussSubMesh->myStatus == eRemoveAll)
+      VISU::PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+      if(aGaussSubMesh->myStatus == VISU::eRemoveAll)
        continue;
       
       GetGaussSubMesh(theMesh,
@@ -1755,13 +441,13 @@ namespace
                      theGaussMesh,
                      aGaussSubMesh);
       
-      const TVTKSource& aSource = aGaussSubMesh->GetSource();
+      const VISU::PPolyData& aSource = aGaussSubMesh->GetSource();
       
       anAppendFilter->AddInput(aSource.GetPointer());
     }
     anAppendFilter->Update(); // Fix on VTK
 
-    theMeshOnEntity->GetVTKOutput()->Update();
+    theMeshOnEntity->GetOutput()->Update();
 
     vtkDataSet* aSource = anAppendFilter->GetOutput();
     INITMSGA(MYDEBUG,0,"aNbPoints - "<<aSource->GetNumberOfPoints()<<endl);
@@ -1850,7 +536,7 @@ VISU_Convertor_impl
 //---------------------------------------------------------------
 VISU::PNamedIDMapper 
 VISU_Convertor_impl
-::GetMeshOnEntity(const string& theMeshName, 
+::GetMeshOnEntity(const std::string& theMeshName, 
                  const VISU::TEntity& theEntity)
 {
   INITMSG(MYDEBUG,"GetMeshOnEntity"<<
@@ -1862,33 +548,34 @@ VISU_Convertor_impl
   TFindMeshOnEntity aFindMeshOnEntity = 
     FindMeshOnEntity(theMeshName,theEntity);
   
-  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
   
   //Main part of code
 #ifndef _DEXCEPT_
   try{
 #endif
     if(!aMeshOnEntity->myIsVTKDone){
-      const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter();
+      VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetMeshOnEntity");
+      const VISU::PAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter();
       if(MYVTKDEBUG) anAppendFilter->DebugOn();
 
       LoadMeshOnEntity(aMesh,aMeshOnEntity);
-      anAppendFilter->SetPoints(GetPoints(aMesh));
+      anAppendFilter->SetPoints(aMesh->GetPoints());
       
-      const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-      TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
+      const VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
 
-      TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
-      TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
+      VISU::TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
+      VISU::TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
       aSubMeshArr.resize(aGeom2SubMesh.size());
 
       for(vtkIdType anID = 0, aCellID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){
-       EGeometry aEGeom = anIter->first;
+       VISU::EGeometry aEGeom = anIter->first;
        vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
-       PSubMeshImpl aSubMesh = anIter->second;
-       const TVTKSource& aSource = aSubMesh->GetSource();
-       aSource->SetPoints(GetPoints(aMesh));
+       VISU::PSubMeshImpl aSubMesh = anIter->second;
+       const VISU::PUnstructuredGrid& aSource = aSubMesh->GetSource();
+       aSource->SetPoints(aMesh->GetPoints());
        GetCellsOnSubMesh(aSource,aMeshOnEntity,aSubMesh,aVGeom);
        anAppendFilter->AddInput(aSource.GetPointer());
 
@@ -1906,7 +593,7 @@ VISU_Convertor_impl
 
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
        VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
@@ -1928,7 +615,7 @@ VISU_Convertor_impl
 
 
 //---------------------------------------------------------------
-VISU::PIDMapper 
+VISU::PUnstructuredGridIDMapper 
 VISU_Convertor_impl
 ::GetFamilyOnEntity(const std::string& theMeshName, 
                    const VISU::TEntity& theEntity,
@@ -1944,22 +631,22 @@ VISU_Convertor_impl
   TFindFamilyOnEntity aFindFamilyOnEntity = 
     FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
 
-  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
-  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+  VISU::PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
 
   //Main part of code
 #ifndef _DEXCEPT_
   try{
 #endif
     if(!aFamily->myIsVTKDone){
-      const TVTKSource& aSource = aFamily->GetSource();
+      const VISU::PUnstructuredGrid& aSource = aFamily->GetSource();
       if(MYVTKDEBUG) aSource->DebugOn();
 
       GetMeshOnEntity(theMeshName,theEntity);
 
       LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily);
-      aSource->SetPoints(GetPoints(aMesh));
+      aSource->SetPoints(aMesh->GetPoints());
       GetCellsOnFamily(aSource,aMeshOnEntity,aFamily);
 
       aFamily->myNamedPointCoords = aMesh->myNamedPointCoords;
@@ -1969,7 +656,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
@@ -1991,10 +678,10 @@ VISU_Convertor_impl
 
 
 //---------------------------------------------------------------
-VISU::PIDMapper 
+VISU::PUnstructuredGridIDMapper 
 VISU_Convertor_impl
-::GetMeshOnGroup(const string& theMeshName, 
-                const string& theGroupName)
+::GetMeshOnGroup(const std::string& theMeshName, 
+                const std::string& theGroupName)
 {
   INITMSG(MYDEBUG,"GetMeshOnGroup\n");
   INITMSGA(MYDEBUG,0,
@@ -2004,33 +691,33 @@ VISU_Convertor_impl
 
   //Cheching possibility do the query
   TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
-  PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
-  PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+  VISU::PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
 
   //Main part of code
 #ifndef _DEXCEPT_
   try{
 #endif
     if(!aGroup->myIsVTKDone){
-      const TVTKAppendFilter& anAppendFilter = aGroup->GetFilter();
+      const VISU::PAppendFilter& anAppendFilter = aGroup->GetFilter();
       const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
 
       LoadMeshOnGroup(aMesh,aFamilySet);
-      anAppendFilter->SetPoints(GetPoints(aMesh));
+      anAppendFilter->SetPoints(aMesh->GetPoints());
 
-      TFamilySet::const_iterator anIter = aFamilySet.begin();
+      VISU::TFamilySet::const_iterator anIter = aFamilySet.begin();
 
-      TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
-      TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
+      VISU::TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
+      VISU::TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
       aFamilyArr.resize(aFamilySet.size());
 
       for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++, anID++){
-       PFamilyImpl aFamily = *anIter;
+       VISU::PFamilyImpl aFamily = *anIter;
        const std::string& aFamilyName = aFamily->myName;
        const VISU::TEntity& anEntity = aFamily->myEntity;
 
        VISU::PIDMapper anIDMapper = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName);
-       VISU::TVTKOutput* anOutput = anIDMapper->GetVTKOutput();
+       vtkDataSet* anOutput = anIDMapper->GetOutput();
        anAppendFilter->AddInput(anOutput);
 
        vtkIdType aStartID = anElemObj2VTKID.size();
@@ -2047,7 +734,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
        VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
@@ -2063,35 +750,34 @@ VISU_Convertor_impl
 
 
 //---------------------------------------------------------------
-VISU::TVTKOutput*
+vtkUnstructuredGrid*
 VISU_Convertor_impl
 ::GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
                        const VISU::PMeshOnEntityImpl& theMeshOnEntity,
                        const VISU::PFieldImpl& theField,
                        const VISU::PValForTimeImpl& theValForTime,
-                       const VISU::PIDMapperFilter& theIDMapperFilter,
+                       const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper,
                        const VISU::PProfileImpl& theProfile,
                        const VISU::TEntity& theEntity)
 {
-  LoadMeshOnEntity(theMesh,theMeshOnEntity);
-  GetMeshOnEntity(theMeshOnEntity->myMeshName,theMeshOnEntity->myEntity);
-  GetMeshOnProfile(theMesh,theMeshOnEntity,theProfile);
-
-  theIDMapperFilter->myIDMapper = theProfile;
-  TVTKOutput* anOutput = theIDMapperFilter->GetVTKOutput();
-  const TVTKSource& aSource = theIDMapperFilter->mySource.GetSource();
-  ::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity);
-
+  LoadMeshOnEntity(theMesh, theMeshOnEntity);
+  GetMeshOnEntity(theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity);
+  GetMeshOnProfile(theMesh, theMeshOnEntity, theProfile);
+
+  theUnstructuredGridIDMapper->myIDMapper = theProfile;
+  vtkUnstructuredGrid* anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+  const VISU::PUnstructuredGrid& aSource = theUnstructuredGridIDMapper->mySource.GetSource();
+  VISU::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity);
   return anOutput;
 }
 
 
 //---------------------------------------------------------------
-VISU::PIDMapper 
+VISU::PUnstructuredGridIDMapper 
 VISU_Convertor_impl
-::GetTimeStampOnMesh(const string& theMeshName, 
+::GetTimeStampOnMesh(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
-                    const string& theFieldName,
+                    const std::string& theFieldName,
                     int theStampsNum)
 {
   INITMSG(MYDEBUG,"GetTimeStampOnMesh"<<
@@ -2107,27 +793,28 @@ VISU_Convertor_impl
                                                theFieldName,
                                                theStampsNum);
 
-  PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
-  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
-  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
-  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+  VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
 
   //Main part of code
-  PIDMapperFilter anIDMapperFilter = aValForTime->myIDMapperFilter;
+  VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = aValForTime->myUnstructuredGridIDMapper;
 #ifndef _DEXCEPT_
   try{
 #endif
-    if(!anIDMapperFilter->myIsVTKDone){
-      LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
+    if(!anUnstructuredGridIDMapper->myIsVTKDone){
+      VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnMesh");
+      LoadValForTimeOnMesh(aMesh, aMeshOnEntity, aField, aValForTime);
 
-      TVTKOutput* anOutput;
+      vtkUnstructuredGrid* anOutput = NULL;
       try{
        anOutput = GetTimeStampOnProfile(aMesh,
                                         aVTKMeshOnEntity,
                                         aField,
                                         aValForTime,
-                                        anIDMapperFilter,
+                                        anUnstructuredGridIDMapper,
                                         aValForTime->myProfile,
                                         aMeshOnEntity->myEntity);
       }catch(std::exception& exc){
@@ -2136,23 +823,23 @@ VISU_Convertor_impl
                                         aMeshOnEntity,
                                         aField,
                                         aValForTime,
-                                        anIDMapperFilter,
+                                        anUnstructuredGridIDMapper,
                                         aValForTime->myProfile,
                                         aVTKMeshOnEntity->myEntity);
       }
 
-      anIDMapperFilter->myIsVTKDone = true;
+      anUnstructuredGridIDMapper->myIsVTKDone = true;
 
       if(MYDEBUGWITHFILES){
-       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
-       string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
-         aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
+         aFieldName + dtos("-%d", theStampsNum) + "-Conv.vtk";
        VISU::WriteToFile(anOutput,aFileName);
       }
       if(MYVTKDEBUG){
-       GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
+       GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
        anOutput->Update();
        if(theEntity == VISU::NODE_ENTITY)
          BEGMSG(MYVTKDEBUG,"GetPointData() = "<<vtkFloatingPointType(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
@@ -2169,16 +856,16 @@ VISU_Convertor_impl
   }
 #endif
 
-  return anIDMapperFilter;
+  return anUnstructuredGridIDMapper;
 }
 
 
 //---------------------------------------------------------------
 VISU::PGaussPtsIDMapper 
 VISU_Convertor_impl
-::GetTimeStampOnGaussPts(const string& theMeshName, 
+::GetTimeStampOnGaussPts(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
-                        const string& theFieldName,
+                        const std::string& theFieldName,
                         int theStampsNum)
 {
   INITMSG(MYDEBUG,"GetTimeStampOnGaussPts"<<
@@ -2188,57 +875,60 @@ VISU_Convertor_impl
          "; theStampsNum = "<<theStampsNum<<
          endl);
 
+  if(theEntity == VISU::NODE_ENTITY)
+    EXCEPTION(std::runtime_error, "It is impossible to reate Gauss Points on NODE_ENTITY !!!");
+
   //Cheching possibility do the query
   TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
                                                theEntity,
                                                theFieldName,
                                                theStampsNum);
   
-  PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
-  PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
-  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
-  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
+  VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
 
   //Main part of code
-  PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+  VISU::PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
 #ifndef _DEXCEPT_
   try{
 #endif
     if(!aGaussPtsIDFilter->myIsVTKDone){
-      LoadValForTimeOnGaussPts(aMesh,aMeshOnEntity,aField,aValForTime);
+      VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnGaussPts");
+      LoadValForTimeOnGaussPts(aMesh, aMeshOnEntity, aField, aValForTime);
       
-      GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
+      GetMeshOnEntity(aVTKMeshOnEntity->myMeshName, aVTKMeshOnEntity->myEntity);
       
-      PProfileImpl aProfile = aValForTime->myProfile;
-      GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
+      VISU::PProfileImpl aProfile = aValForTime->myProfile;
+      GetMeshOnProfile(aMesh, aVTKMeshOnEntity, aProfile);
 
-      PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
-      TSource& aGaussPtsSource = aGaussMesh->mySource;
-      if(!aGaussPtsSource.myIsVTKDone){
-       BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh);
+      VISU::PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
+      if(!aGaussMesh->myIsVTKDone){
+       BuildGaussMesh(aMesh, aVTKMeshOnEntity, aGaussMesh);
        aGaussMesh->myParent = aProfile.get();
-       aGaussPtsSource.myIsVTKDone = true;
+       aGaussMesh->myIsVTKDone = true;
       }
 
       aGaussPtsIDFilter->myIDMapper = aGaussMesh;
       aGaussPtsIDFilter->myGaussPtsIDMapper = aGaussMesh;
-      TVTKOutput* anOutput = aGaussPtsIDFilter->GetVTKOutput();
-      const TVTKSource& aSource = aGaussPtsIDFilter->mySource.GetSource();
-      GetTimeStampOnGaussMesh(aSource,aField,aValForTime);
+      vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput();
+      const VISU::PPolyData& aSource = aGaussPtsIDFilter->mySource.GetSource();
+      VISU::GetTimeStampOnGaussMesh(aSource, aField, aValForTime);
 
       aGaussPtsIDFilter->myIsVTKDone = true;
 
       if(MYDEBUGWITHFILES){
-       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
-       string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
          aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
-       VISU::WriteToFile(anOutput,aFileName);
+       VISU::WriteToFile(anOutput, aFileName);
       }
       if(MYVTKDEBUG){
-       GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
+       GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
        anOutput->Update();
        if(theEntity == VISU::NODE_ENTITY)
          BEGMSG(MYVTKDEBUG,"GetPointData() = "<<vtkFloatingPointType(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
@@ -2261,14 +951,14 @@ VISU_Convertor_impl
 //---------------------------------------------------------------
 VISU::PMeshImpl 
 VISU_Convertor_impl
-::FindMesh(const string& theMeshName)
+::FindMesh(const std::string& theMeshName)
 {
   GetMeshMap();
-  TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
+  VISU::TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
   if(aMeshMapIter == myMeshMap.end())
-    EXCEPTION(runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
+    EXCEPTION(std::runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
 
-  PMeshImpl aMesh = aMeshMapIter->second;
+  VISU::PMeshImpl aMesh = aMeshMapIter->second;
   return aMesh;
 }
 
@@ -2276,16 +966,16 @@ VISU_Convertor_impl
 //---------------------------------------------------------------
 VISU_Convertor_impl::TFindMeshOnEntity
 VISU_Convertor_impl
-::FindMeshOnEntity(const string& theMeshName,
+::FindMeshOnEntity(const std::string& theMeshName,
                   const VISU::TEntity& theEntity)
 {
-  PMeshImpl aMesh = FindMesh(theMeshName);
+  VISU::PMeshImpl aMesh = FindMesh(theMeshName);
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
   VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
   if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
-    EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+    EXCEPTION(std::runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
 
-  PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+  VISU::PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
   
   return TFindMeshOnEntity(aMesh,
                           aMeshOnEntity);
@@ -2295,23 +985,23 @@ VISU_Convertor_impl
 //---------------------------------------------------------------
 VISU_Convertor_impl::TFindFamilyOnEntity
 VISU_Convertor_impl
-::FindFamilyOnEntity(const string& theMeshName,
+::FindFamilyOnEntity(const std::string& theMeshName,
                     const VISU::TEntity& theEntity,
-                    const string& theFamilyName)
+                    const std::string& theFamilyName)
 {
   if(theFamilyName != ""){
-    PMeshImpl aMesh = FindMesh(theMeshName);
+    VISU::PMeshImpl aMesh = FindMesh(theMeshName);
     VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
     VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
     if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
-      EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+      EXCEPTION(std::runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
 
-    PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+    VISU::PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
 
-    TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-    TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+    VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+    VISU::TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
     if(aFamilyMapIter != aFamilyMap.end()){
-      const PFamily& aFamily = aFamilyMapIter->second;
+      const VISU::PFamily& aFamily = aFamilyMapIter->second;
       return TFindFamilyOnEntity(aMesh,
                                 aMeshOnEntity,
                                 aFamily);
@@ -2322,15 +1012,15 @@ VISU_Convertor_impl
 
 
 //---------------------------------------------------------------
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetSize() 
 {
-  vtkFloatingPointType aResult = 0.0;
+  size_t aResult = 0;
   const VISU::TMeshMap& aMeshMap = GetMeshMap();
   VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
   for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
-    const string& aMeshName = aMeshMapIter->first;
+    const std::string& aMeshName = aMeshMapIter->first;
     const VISU::PMesh aMesh = aMeshMapIter->second;
     const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
     VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
@@ -2342,7 +1032,7 @@ VISU_Convertor_impl
       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-       const string& aFieldName = aFieldMapIter->first;
+       const std::string& aFieldName = aFieldMapIter->first;
        const VISU::PField aField = aFieldMapIter->second;
        const VISU::TValField& aValField = aField->myValField;
        VISU::TValField::const_iterator aValFieldIter = aValField.begin();
@@ -2355,14 +1045,14 @@ VISU_Convertor_impl
       const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-       const string& aGroupName = aGroupMapIter->first;
+       const std::string& aGroupName = aGroupMapIter->first;
        aResult += GetMeshOnGroupSize(aMeshName,aGroupName);
       }
       //Import families
       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-       const string& aFamilyName = aFamilyMapIter->first;
+       const std::string& aFamilyName = aFamilyMapIter->first;
        aResult += GetFamilyOnEntitySize(aMeshName,anEntity,aFamilyName);
       }
       //Import mesh on entity
@@ -2375,29 +1065,29 @@ VISU_Convertor_impl
 
 
 //---------------------------------------------------------------
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetMeshOnEntitySize(const std::string& theMeshName, 
                      const VISU::TEntity& theEntity)
 {
   TFindMeshOnEntity aFindMeshOnEntity = 
-    FindMeshOnEntity(theMeshName,theEntity);
+    FindMeshOnEntity(theMeshName, theEntity);
 
-  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
-  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells = aMeshOnEntity->myNbCells;
-  vtkIdType aCellsSize = aMeshOnEntity->myCellsSize;
+  size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
+  size_t aNbCells = aMeshOnEntity->myNbCells;
+  size_t aCellsSize = aMeshOnEntity->myCellsSize;
 
-  vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
-  vtkIdType aTypesSize = aNbCells*sizeof(char);
-  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  size_t aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  size_t aTypesSize = aNbCells*sizeof(char);
+  size_t aLocationsSize = aNbCells*sizeof(int);
   vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1;
-  vtkIdType aLinksSize = aMesh->myNbPoints * 
+  size_t aLinksSize = aMesh->GetNbPoints() * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
 
   MSG(MYDEBUG,"GetMeshOnEntitySize "<<
       "- aResult = "<<vtkFloatingPointType(aResult)<<
@@ -2411,13 +1101,13 @@ VISU_Convertor_impl
     BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<vtkFloatingPointType(aLinksSize)<<"\n");
   }
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
 
 //---------------------------------------------------------------
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetFamilyOnEntitySize(const std::string& theMeshName, 
                        const VISU::TEntity& theEntity,
@@ -2425,22 +1115,22 @@ VISU_Convertor_impl
 {
   TFindFamilyOnEntity aFindFamilyOnEntity = 
     FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
-  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
-  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
+  VISU::PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
 
-  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells = aFamily->myNbCells;
-  vtkIdType aCellsSize = aFamily->myCellsSize;
+  size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
+  size_t aNbCells = aFamily->myNbCells;
+  size_t aCellsSize = aFamily->myCellsSize;
 
-  vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
-  vtkIdType aTypesSize = aNbCells*sizeof(char);
-  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  size_t aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  size_t aTypesSize = aNbCells*sizeof(char);
+  size_t aLocationsSize = aNbCells*sizeof(int);
   vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1;
-  vtkIdType aLinksSize = aMesh->myNbPoints * 
+  size_t aLinksSize = aMesh->GetNbPoints() * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
 
   MSG(MYDEBUG,"GetFamilyOnEntitySize "<<
       "- aResult = "<<vtkFloatingPointType(aResult)<<
@@ -2455,7 +1145,7 @@ VISU_Convertor_impl
     BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<vtkFloatingPointType(aLinksSize)<<"\n");
   }
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -2466,37 +1156,37 @@ VISU_Convertor_impl
 ::FindMeshOnGroup(const std::string& theMeshName, 
                  const std::string& theGroupName)
 {
-  PMeshImpl aMesh = FindMesh(theMeshName);
+  VISU::PMeshImpl aMesh = FindMesh(theMeshName);
   VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
   VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
   if(aGroupMapIter == aGroupMap.end())
-    EXCEPTION(runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
+    EXCEPTION(std::runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
 
   VISU::PGroupImpl aGroup = aGroupMapIter->second;
   return TFindMeshOnGroup(aMesh,aGroup);
 }
 
 
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName)
 {
   TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
-  PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
-  PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
-
-  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
-  vtkIdType aNbCells = aNbASizeCells.first;
-  vtkIdType aCellsSize = aNbASizeCells.second;
-  vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
-  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+  VISU::PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+
+  size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
+  VISU::TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
+  size_t aNbCells = aNbASizeCells.first;
+  size_t aCellsSize = aNbASizeCells.second;
+  size_t aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
+  size_t aLocationsSize = aNbCells*sizeof(int);
   vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1;
-  vtkIdType aLinksSize = aMesh->myNbPoints * 
+  size_t aLinksSize = aMesh->GetNbPoints() * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
   if(MYDEBUG){
     MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aPointsSize = "<<vtkFloatingPointType(aPointsSize));
     MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<vtkFloatingPointType(aConnectivityAndTypesSize));
@@ -2506,25 +1196,25 @@ VISU_Convertor_impl
   MSG(MYDEBUG,"GetMeshOnGroupSize - aResult = "<<vtkFloatingPointType(aResult)<<"; theMeshName = '"
       <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
 
 VISU_Convertor_impl::TFindField
 VISU_Convertor_impl
-::FindField(const string& theMeshName, 
+::FindField(const std::string& theMeshName, 
            const VISU::TEntity& theEntity, 
-           const string& theFieldName)
+           const std::string& theFieldName)
 {
   TFindMeshOnEntity aFindMeshOnEntity = 
     FindMeshOnEntity(theMeshName,theEntity);
 
-  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-  PMeshOnEntityImpl aVTKMeshOnEntity;
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
   if(theEntity == VISU::NODE_ENTITY){
     if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
       aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY];
@@ -2532,15 +1222,14 @@ VISU_Convertor_impl
       aVTKMeshOnEntity = aMeshOnEntityMap[VISU::FACE_ENTITY];
     else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end())
       aVTKMeshOnEntity = aMeshOnEntityMap[VISU::EDGE_ENTITY];
-  }else
-    aVTKMeshOnEntity = aMeshOnEntity;
+  }
   
   VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
   VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find(theFieldName);
   if(aFieldIter == aFieldMap.end())
-    EXCEPTION(runtime_error,"FindField >> There is no field on the mesh!!!");
+    EXCEPTION(std::runtime_error,"FindField >> There is no field on the mesh!!!");
   
-  PFieldImpl aField = aFieldIter->second;
+  VISU::PFieldImpl aField = aFieldIter->second;
 
   return TFindField(aMesh,
                    aMeshOnEntity,
@@ -2549,19 +1238,19 @@ VISU_Convertor_impl
 }
 
 
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetFieldOnMeshSize(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName)
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
-  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
-  PFieldImpl aField = boost::get<3>(aFindField);
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+  VISU::PFieldImpl aField = boost::get<3>(aFindField);
 
-  vtkFloatingPointType aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
-  vtkFloatingPointType aFieldOnMeshSize = vtkFloatingPointType(aField->myDataSize*sizeof(vtkFloatingPointType)*aField->myValField.size()*ERR_SIZE_CALC);
-  vtkFloatingPointType aResult = aMeshSize + aFieldOnMeshSize;
+  size_t aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
+  size_t aFieldOnMeshSize = size_t(aField->myDataSize*sizeof(vtkFloatingPointType)*aField->myValField.size()*ERR_SIZE_CALC);
+  size_t aResult = aMeshSize + aFieldOnMeshSize;
   if(MYDEBUG)
     MSG(MYVTKDEBUG,"GetFieldOnMeshSize - aFieldOnMeshSize = "<<vtkFloatingPointType(aFieldOnMeshSize));
   MSG(MYDEBUG,"GetFieldOnMeshSize - aResult = "<<vtkFloatingPointType(aResult)<<"; theMeshName = '"<<theMeshName<<
@@ -2579,17 +1268,17 @@ VISU_Convertor_impl
                int theStampsNum)
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
-  PField aField = boost::get<3>(aFindField);
+  VISU::PField aField = boost::get<3>(aFindField);
 
   VISU::TValField& aValField = aField->myValField;
   VISU::TValField::const_iterator aValFieldIter= aValField.find(theStampsNum);
   if(aValFieldIter == aValField.end())
-    EXCEPTION(runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
+    EXCEPTION(std::runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
   
-  PMeshImpl aMesh = boost::get<0>(aFindField);
-  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField);
-  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
-  PValForTimeImpl aValForTime = aValFieldIter->second;
+  VISU::PMeshImpl aMesh = boost::get<0>(aFindField);
+  VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField);
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+  VISU::PValForTimeImpl aValForTime = aValFieldIter->second;
 
   return TFindTimeStamp(aMesh,
                        aMeshOnEntity,
@@ -2599,7 +1288,7 @@ VISU_Convertor_impl
 }
 
 
-vtkFloatingPointType
+size_t
 VISU_Convertor_impl
 ::GetTimeStampSize(const std::string& theMeshName, 
                   const VISU::TEntity& theEntity,
@@ -2608,12 +1297,12 @@ VISU_Convertor_impl
 {
   TFindTimeStamp aFindTimeStamp = 
     FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
-  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
-  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+  VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+  VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
   
-  vtkFloatingPointType aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
-  vtkFloatingPointType aTimeStampSize = vtkFloatingPointType(aField->myDataSize*sizeof(vtkFloatingPointType) * ERR_SIZE_CALC);
-  vtkFloatingPointType aResult = aMeshSize + aTimeStampSize;
+  size_t aMeshSize = GetMeshOnEntitySize(theMeshName, aVTKMeshOnEntity->myEntity);
+  size_t aTimeStampSize = size_t(aField->myDataSize*sizeof(vtkFloatingPointType) * ERR_SIZE_CALC);
+  size_t aResult = aMeshSize + aTimeStampSize;
 
   MSG(MYDEBUG && MYVTKDEBUG,"GetTimeStampSize - aTimeStampSize = "<<vtkFloatingPointType(aTimeStampSize));
   MSG(MYDEBUG,"GetTimeStampSize - aResult = "<<vtkFloatingPointType(aResult)<<
@@ -2624,14 +1313,84 @@ VISU_Convertor_impl
 }
 
 
+size_t
+VISU_Convertor_impl
+::GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theTimeStampNumber,
+                        bool& theIsEstimated)
+{
+  size_t aSize = 0;
+
+  //Cheching possibility do the query
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theTimeStampNumber);
+
+  VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = aValForTime->myUnstructuredGridIDMapper;
+  if(anUnstructuredGridIDMapper->myIsVTKDone){
+    VISU::PIDMapper anIDMapper = GetTimeStampOnMesh(theMeshName, 
+                                                   theEntity, 
+                                                   theFieldName, 
+                                                   theTimeStampNumber);
+    anIDMapper->GetOutput();
+    aSize += anIDMapper->GetMemorySize();
+  }else
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theTimeStampNumber);
+
+  theIsEstimated = !(anUnstructuredGridIDMapper->myIsVTKDone);
+
+  //cout<<"VISU_Convertor_impl::GetTimeStampOnMeshSize - "<<aSize<<"; "<<(anIDMapperFilter->myIsVTKDone)<<endl;
+  return aSize;
+}
+
+
+size_t
+VISU_Convertor_impl
+::GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theTimeStampNumber,
+                            bool& theIsEstimated)
+{
+  size_t aSize = 0;
+
+  //Cheching possibility do the query
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theTimeStampNumber);
+
+  VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  VISU::PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+  if(aGaussPtsIDFilter->myIsVTKDone){
+    VISU::PGaussPtsIDMapper aGaussPtsIDMapper = GetTimeStampOnGaussPts(theMeshName, 
+                                                                      theEntity, 
+                                                                      theFieldName, 
+                                                                      theTimeStampNumber);
+    aGaussPtsIDMapper->GetOutput();
+    aSize += aGaussPtsIDMapper->GetMemorySize();
+  }else
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theTimeStampNumber);
+
+  theIsEstimated = !(aGaussPtsIDFilter->myIsVTKDone);
+
+  //cout<<"VISU_Convertor_impl::GetTimeStampOnGaussPtsSize - "<<aSize<<"; "<<(aGaussPtsIDFilter->myIsVTKDone)<<endl;
+  return aSize;
+}
+
+
 const VISU::PField
 VISU_Convertor_impl
-::GetField(const string& theMeshName, 
+::GetField(const std::string& theMeshName, 
           VISU::TEntity theEntity, 
-          const string& theFieldName) 
+          const std::string& theFieldName) 
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
-  PField aField = boost::get<3>(aFindField);
+  VISU::PField aField = boost::get<3>(aFindField);
   return aField;
 }
 
@@ -2645,6 +1404,6 @@ VISU_Convertor_impl
 {
   TFindTimeStamp aFindTimeStamp = 
     FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
-  PValForTime aValForTime = boost::get<4>(aFindTimeStamp);
+  VISU::PValForTime aValForTime = boost::get<4>(aFindTimeStamp);
   return aValForTime;
 }
index 6069283339856526210bf76e02700e45f765b0f6..ccb7cd20b739bb92ccb31e8becbaeb6d302c73d5 100644 (file)
 #ifndef VISU_Convertor_impl_HeaderFile
 #define VISU_Convertor_impl_HeaderFile
 
-#include <vtkSmartPointer.h>
-
-#include <boost/tuple/tuple.hpp>
-
-class vtkCell;
-class vtkPoints;
-class vtkUnstructuredGrid;
-class VTKViewer_AppendFilter;
-class VISU_MergeFilter;
-
 #include "VISU_Convertor.hxx"
-#include "MED_SliceArray.hxx"
-
-#ifndef VISU_ENABLE_QUADRATIC
-#define VISU_ENABLE_QUADRATIC
-#define VISU_USE_VTK_QUADRATIC
-#endif
-
-namespace VISU
-{
-  //! Defines VISU enumeration of geometrical types
-  enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
-                 eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
-                 ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310, 
-                 ePYRA13=313, ePENTA15=315, eHEXA20=320, 
-                 ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
-
-  //! Get number of nodes for defined geometrical type
-  vtkIdType
-  VISUGeom2NbNodes(EGeometry theGeom);
-
-  //! Maps VISU geometrical type to VTK one
-  vtkIdType
-  VISUGeom2VTK(EGeometry theGeom);
-
-  //---------------------------------------------------------------
-  using MED::TCSlice;
-  using MED::TSlice;
-
-  typedef vtkUnstructuredGrid TDataSet;
+#include "VISU_ConvertorDef_impl.hxx"
 
-  typedef vtkSmartPointer<TDataSet> TVTKSource;
-  typedef vtkSmartPointer<vtkPoints> TVTKPoints;
-  typedef vtkSmartPointer<VISU_MergeFilter> TVTKMergeFilter;
-
-  typedef vtkSmartPointer<VTKViewer_AppendFilter> TVTKAppendFilter;
-
-  typedef vtkFloatingPointType TCoord;
-
-  //---------------------------------------------------------------
-  //! Define an utility base class which is repsonsible for preventing repetion
-  struct TIsVTKDone: virtual TBaseStructure
-  {
-    TIsVTKDone();
-    bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure 
-    bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation  
-  };
-
-  
-  //---------------------------------------------------------------
-  //! Define an utility base class which allow to keep calculated number of cells and their size
-  struct TSizeCounter: virtual TIsVTKDone
-  {
-    TSizeCounter();
-    vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
-    vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
-  };
-
-
-  //---------------------------------------------------------------
-  //! Define a container for VTK representation
-  class TSource: public virtual TSizeCounter
-  {
-  protected:
-    mutable TVTKSource mySource;
-  public:
-    TSource();
-
-    //! This method allow to create corresponding VTK data set by demand (not at once)
-    const TVTKSource& 
-    GetSource() const;
-
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-  };
-
-
-  //---------------------------------------------------------------
-  //! Define a container for VTK representation
-  /*!
-    This container allow to combine other VTK representation into single one.
-  */
-  class TAppendFilter: public virtual TIsVTKDone,
-                      public virtual TIDMapper
-  {
-  protected:
-    mutable TVTKAppendFilter myFilter;
-  public:
-    TAppendFilter();
-
-    //! This method allow to create corresponding VTK filter by demand (not at once)
-    const TVTKAppendFilter& 
-    GetFilter() const;
-
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-  };
-
-
-  //---------------------------------------------------------------
-  //! Define a container for VTK representation
-  /*!
-    This container allow to assign data to mesh and represent them into single VTK representation
-  */
-  class TMergeFilter: public virtual TIsVTKDone,
-                     public virtual TIDMapper
-  {
-  protected:
-    mutable TVTKMergeFilter myFilter;
-  public:
-    TMergeFilter();
-
-    //! This method allow to create corresponding VTK filter by demand (not at once)
-    const TVTKMergeFilter& 
-    GetFilter() const;
-
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-  };
-  typedef SharedPtr<TAppendFilter> PAppendFilter;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<TCoord> TCoordArray;
-  typedef TSlice<TCoordArray> TCoordSlice;
-  typedef TCSlice<TCoordArray> TCCoordSlice;
-
-  //! This class is responsible for representation of mesh nodes
-  class TPointCoords: public virtual TBaseStructure
-  {
-  protected:
-    vtkIdType myDim; //!< Dimension of the nodal coordinates
-    vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
-
-    //! An container for coordinates of the nodes
-    /*!
-      Usage of slices allow to minimize amount of memory to store the nodal coordinates and
-      provide unifirm way of conversation with this coordinates (independant from mesh dimension)
-    */
-    TCoordArray myCoord; 
-    TVTKPoints myPoints; //!< VTK representation for the mesh nodes
-
-  public:
-    TPointCoords();
-
-    //! To initilize the class
-    void
-    Init(vtkIdType theNbPoints,
-        vtkIdType theDim);
-
-    //! Get slice of coordinates for defined node (const version)
-    TCCoordSlice
-    GetCoordSlice(vtkIdType theNodeId) const;
-
-    //! Get slice of coordinates for defined node
-    TCoordSlice 
-    GetCoordSlice(vtkIdType theNodeId);
-
-    vtkIdType
-    GetNbPoints() const { return myNbPoints; }
-
-    vtkIdType
-    GetDim() const { return myDim; }
-
-    vtkIdType
-    size() const { return GetNbPoints(); }
-
-    const TVTKPoints&
-    GetPoints() const { return myPoints;}
-  };
-  typedef SharedPtr<TPointCoords> PPointCoords;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<vtkIdType> TVectorID;
-  typedef std::map<vtkIdType,vtkIdType> TObj2VTKID;
-
-  //! This class is responsible for representation of mesh nodes
-  /*!
-    In additition to its base functionlity it support mapping of VTK to object numeration and
-    keeps names for each of nodes.
-  */
-  class TNamedPointCoords: public virtual TPointCoords
-  {
-  protected:
-    typedef TVector<std::string> TPointsDim;
-    TPointsDim myPointsDim; //!< Keeps name of each dimension
-    TVectorID myVectorID; //!< Keeps object¶ numeration
-    TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
-
-  public:
-
-    //! To initilize the class (numeration of the nodes can be missed)
-    void
-    Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const TVectorID& theVectorID = TVectorID());
-    
-    //! Get name for defined dimension
-    std::string&
-    GetName(vtkIdType theDim);
-    
-    //! Get name for defined dimension (const version)
-    const std::string&
-    GetName(vtkIdType theDim) const;
-
-    //! Get object number for node by its VTK one
-    virtual
-    vtkIdType
-    GetObjID(vtkIdType theID) const;
-
-    //! Get VTK number for node by its object one
-    virtual
-    vtkIdType
-    GetVTKID(vtkIdType theID) const;
-
-    //! Get name of node by its object number
-    virtual
-    std::string 
-    GetNodeName(vtkIdType theObjID) const;
-  };
-  typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
-
-
-  //---------------------------------------------------------------
-  //! Specialize TMesh to provide VTK mapping for nodes
-  struct TMeshImpl: virtual TMesh, 
-                   virtual TIsVTKDone
-  {
-    PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
-
-    TVTKPoints myPoints; //!< Keeps VTK representation of the nodes
-    vtkIdType myNbPoints; //!< Keeps number of the nodes
-
-    TMeshImpl();
-  };
-  typedef SharedPtr<TMeshImpl> PMeshImpl;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<vtkIdType> TSubMeshID;
-  typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
-
-  //! Specialize TSubProfile to provide VTK mapping
-  struct TSubProfileImpl: virtual TSubProfile, 
-                         virtual TSource
-  {
-    TSubProfileImpl();
-
-    EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
-    std::string myName; //!< Keeps its name
-
-    //! Get object number of mesh cell by its VTK one
-    virtual 
-    vtkIdType 
-    GetElemObjID(int theVtkI) const;
-
-    //! Keeps status of the structure
-    /*!
-      In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
-      in order to construct mesh for MED TIEMSTAMPS in uniform way.
-    */
-    ESubMeshStatus myStatus; 
-    TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
-  };
-  typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
-
-
-  //---------------------------------------------------------------
-  struct TMeshOnEntityImpl;
-
-  typedef std::map<vtkIdType,vtkIdType> TID2ID;
-  typedef TVector<PSubProfileImpl> TSubProfileArr;
-  typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
-
-  //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
-  struct TProfileImpl: virtual TProfile, 
-                      virtual TAppendFilter
-  {
-    TProfileImpl();
-    bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
-   
-    //! Reimplement the TIDMapper::GetNodeObjID
-    virtual 
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeVTKID
-    virtual 
-    vtkIdType 
-    GetNodeVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeCoord
-    virtual 
-    vtkFloatingPointType*  
-    GetNodeCoord(vtkIdType theObjID);
-
-    //! Reimplement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemVTKID
-    virtual 
-    vtkIdType 
-    GetElemVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemCell
-    virtual
-    vtkCell* 
-    GetElemCell(vtkIdType theObjID);
-    
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-
-    //! Reimplement the TNamedIDMapper::GetNodeName
-    virtual
-    std::string 
-    GetNodeName(vtkIdType theObjID) const;
-
-    //! Reimplement the TNamedIDMapper::GetElemName
-    virtual
-    std::string 
-    GetElemName(vtkIdType theObjID) const;
-
-    TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
-    TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilter
-    PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
-    TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
-
-    TSource mySource; //!< Keeps VTK representation of the MED TIMESTAMP mesh
-    TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
-  };
-  typedef SharedPtr<TProfileImpl> PProfileImpl;
-
-
-  //---------------------------------------------------------------
-  //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
-  struct TIDMapperFilter: virtual TMergeFilter
-  {
-    PAppendFilter myIDMapper; //!< Responsible for numbering
-    TSource mySource; //!< Keeps assigned data
-
-    //! Reimplement the TIDMapper::GetNodeObjID
-    virtual 
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeVTKID
-    virtual 
-    vtkIdType 
-    GetNodeVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeCoord
-    virtual 
-    vtkFloatingPointType*  
-    GetNodeCoord(vtkIdType theObjID);
-
-    //! Reimplement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemVTKID
-    virtual 
-    vtkIdType 
-    GetElemVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemCell
-    virtual
-    vtkCell* 
-    GetElemCell(vtkIdType theObjID);
-    
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-  };
-  typedef SharedPtr<TIDMapperFilter> PIDMapperFilter;
-
-
-  //---------------------------------------------------------------
-  struct TGaussImpl;
-  typedef SharedPtr<TGaussImpl> PGaussImpl;
-
-  //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
-  struct TGaussImpl: virtual TGauss
-  {
-    EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
-    std::string myName; //!< Keeps name of the MED GAUSS entity
-    vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
-
-    //! To define a way to implement more detail comparision of the TGaussSubMesh instances
-    virtual
-    void
-    LessThan(const PGaussImpl& theGauss,
-            bool& theResult) const;
-  };
-
-
-  //---------------------------------------------------------------
-  //! Specialize TGaussSubMesh to provide VTK mapping for the entity
-  struct TGaussSubMeshImpl: virtual TGaussSubMesh, 
-                           virtual TSource
-  {
-    TGaussSubMeshImpl();
-
-    //! To implement the TGaussPtsIDMapper::GetObjID
-    virtual
-    TGaussPointID
-    GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const;
-    
-    PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
-
-    //! Keeps status of the structure
-    /*!
-      In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
-      in order to construct mesh for MED TIEMSTAMPS in uniform way.
-    */
-    ESubMeshStatus myStatus;
-
-    TPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
-  };
-  typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
-  typedef std::map<EGeometry,PGaussSubMeshImpl> TGeom2GaussSubMesh;
-
-  //! Specialize TGaussMesh to provide VTK mapping for the entity
-  struct TGaussMeshImpl: virtual TGaussMesh, 
-                        virtual TAppendFilter
-  {
-    TGaussMeshImpl();
-
-    //! Reimplement the TGaussPtsIDMapper::GetObjID
-    virtual
-    TGaussPointID
-    GetObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-
-    //! Reimplement the TGaussPtsIDMapper::GetParent
-    virtual 
-    TNamedIDMapper*
-    GetParent();
-
-    TSource mySource; //!< Keeps VTK representation of the Gauss Points
-    TNamedIDMapper* myParent; //!< Refer to parent mesh
-    TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilter
-    TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
-  };
-  typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
-
-
-  //---------------------------------------------------------------
-  //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
-  struct TGaussPtsIDFilter: virtual TIDMapperFilter,
-                           virtual TGaussPtsIDMapper
-  { 
-    PGaussPtsIDMapper myGaussPtsIDMapper;
-
-    //! Reimplement the TGaussPtsIDMapper::GetObjID
-    virtual 
-    TGaussPointID 
-    GetObjID(vtkIdType theID) const;
-
-    //! Reimplement the TGaussPtsIDMapper::GetParent
-    virtual 
-    TNamedIDMapper*
-    GetParent();
-  };
-  typedef SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<vtkIdType> TConnect;
-  typedef TVector<TConnect> TCell2Connect;
-
-  //! The class is responsible for mapping of cells of defined geometrical type  
-  struct TSubMeshImpl: virtual TSource
-  {
-    
-    //! To implement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! To implement the TNamedIDMapper::GetElemName
-    virtual
-    std::string 
-    GetElemName(vtkIdType theObjID) const;
-
-    vtkIdType myStartID;
-    TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
-  };
-  typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
-
-
-  //---------------------------------------------------------------
-  typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
-  typedef TVector<PSubMeshImpl> TSubMeshArr;
-
-  //! Specialize TMeshOnEntity to provide VTK mapping for the entity
-  struct TMeshOnEntityImpl: virtual TMeshOnEntity, 
-                           virtual TAppendFilter, 
-                           virtual TSizeCounter
-  {
-    //! Reimplement the TIDMapper::GetNodeVTKID
-    virtual 
-    vtkIdType 
-    GetNodeVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeObjID
-    virtual 
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemVTKID
-    virtual 
-    vtkIdType 
-    GetElemVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! Reimplement the TNamedIDMapper::GetNodeName
-    virtual
-    std::string 
-    GetNodeName(vtkIdType theObjID) const;
-
-    //! Reimplement the TNamedIDMapper::GetElemName
-    virtual
-    std::string 
-    GetElemName(vtkIdType theObjID) const;
-
-    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping 
-    TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter
-    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
-
-    TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
-  };
-  typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
-
-
-  //---------------------------------------------------------------
-  typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
-
-  //! Specialize TFamily to provide VTK mapping for the entity
-  struct TFamilyImpl: virtual TFamily, 
-                     virtual TSource
-  {
-    //! Reimplement the TIDMapper::GetNodeObjID
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const ;
-
-    //! Reimplement the TIDMapper::GetNodeVTKID
-    virtual 
-    vtkIdType 
-    GetNodeVTKID(vtkIdType theID) const ;
-
-    //! Reimplement the TIDMapper::GetElemVTKID
-    virtual 
-    vtkIdType 
-    GetElemVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetVTKOutput
-    virtual
-    TVTKOutput* 
-    GetVTKOutput();
-
-    PNamedPointCoords myNamedPointCoords;  //!< Share the same instance with TMesh to implement nodal mapping
-    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
-    TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
-
-    TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
-  };
-  typedef SharedPtr<TFamilyImpl> PFamilyImpl;
-
-
-  //---------------------------------------------------------------
-  typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
-  typedef TVector<PFamilyImpl> TFamilyArr;
-
-  //! Specialize TGroup to provide VTK mapping for the entity
-  struct TGroupImpl: virtual TGroup, 
-                    virtual TAppendFilter
-  {
-    //! Calculate pair of values - number of cells and its size
-    TNbASizeCells 
-    GetNbASizeCells() const;
-
-    //! Reimplement the TIDMapper::GetElemVTKID
-    virtual 
-    vtkIdType 
-    GetElemVTKID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetElemObjID
-    virtual 
-    vtkIdType 
-    GetElemObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeObjID
-    virtual 
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const;
-
-    //! Reimplement the TIDMapper::GetNodeVTKID
-    virtual 
-    vtkIdType 
-    GetNodeVTKID(vtkIdType theID) const;
-
-    TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
-    TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter
-    PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
-  };
-  typedef SharedPtr<TGroupImpl> PGroupImpl;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<TMinMax> TMinMaxArr;
-
-  //! Specialize TField to provide VTK mapping for the entity
-  struct TFieldImpl: virtual TField
-  {
-    vtkIdType myDataSize; //!< Keeps size of the assigned data
-
-    TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
-
-    //! Implement the TField::GetMinMax
-    virtual
-    TMinMax 
-    GetMinMax(vtkIdType theCompID);
-
-    //! To initialize the data structure    
-    void 
-    InitArrays(vtkIdType theNbComp);
-
-    TFieldImpl();
-  };
-  typedef SharedPtr<TFieldImpl> PFieldImpl;
-
-
-  //---------------------------------------------------------------
-  typedef TVector<vtkFloatingPointType> TValue;
-  typedef TSlice<TValue> TValueSlice;
-  typedef TCSlice<TValue> TCValueSlice;
-
-  typedef TVector<TCValueSlice> TCValueSliceArr;
-  typedef TVector<TValueSlice> TValueSliceArr;
-
-  //! Define a container to get access to data assigned to mesh
-  struct TMeshValue
-  {
-    TValue myValue; //!< Keeps all values as one dimensional sequence
-
-    vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to
-    vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD
-    vtkIdType myNbGauss; //!< Defines number of Gauss Points
-    vtkIdType myStep; //! Internal variable
-
-    //! To intitilize the data strucutre
-    void
-    Init(vtkIdType theNbElem,
-        vtkIdType theNbGauss,
-        vtkIdType theNbComp);
-
-    //! To get assigned values first by Gauss Points and then by components (constant version)
-    TCValueSliceArr
-    GetGaussValueSliceArr(vtkIdType theElemId) const;
-
-    //! To get assigned values first by Gauss Points and then by components
-    TValueSliceArr 
-    GetGaussValueSliceArr(vtkIdType theElemId);
-
-    //! To get assigned values first by components and then by Gauss Points (constant version)
-    TCValueSliceArr
-    GetCompValueSliceArr(vtkIdType theElemId) const;
-
-    //! To get assigned values first by components and then by Gauss Points
-    TValueSliceArr 
-    GetCompValueSliceArr(vtkIdType theElemId);
-  };
-  
-
-  //---------------------------------------------------------------
-  typedef std::map<EGeometry,TMeshValue> TGeom2Value;
-  typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
-
-  //! Specialize TValForTime to provide VTK mapping for the entity
-  struct TValForTimeImpl: virtual TValForTime
-  {
-    PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
-    PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
-    TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
-    TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
-   
-    TValForTimeImpl();
-
-    //! Get mesh data for defined geometrical type (constant version)
-    const TMeshValue& 
-    GetMeshValue(EGeometry theGeom) const;
-
-    //! Get mesh data for defined geometrical type
-    TMeshValue& 
-    GetMeshValue(EGeometry theGeom);
-
-    //! Get number of Gauss Points for defined geometrical type
-    virtual
-    int
-    GetNbGauss(EGeometry theGeom) const;
-  };
-  typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
-}
+#include <boost/tuple/tuple.hpp>
 
 
+//---------------------------------------------------------------
 //! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
 /*!
   It implements VISU_Convertor public interface and declare new pure virtual functions
@@ -815,7 +76,7 @@ public:
 
   //! Implemention of the VISU_Convertor::GetSize
   virtual 
-  vtkFloatingPointType
+  size_t
   GetSize();
 
   //! Implemention of the VISU_Convertor::GetMeshOnEntity
@@ -826,51 +87,61 @@ public:
 
   //! Implemention of the VISU_Convertor::GetMeshOnEntitySize
   virtual 
-  vtkFloatingPointType 
+  size_t 
   GetMeshOnEntitySize(const std::string& theMeshName, 
                       const VISU::TEntity& theEntity);
 
   //! Implemention of the VISU_Convertor::GetFamilyOnEntity
   virtual 
-  VISU::PIDMapper 
+  VISU::PUnstructuredGridIDMapper 
   GetFamilyOnEntity(const std::string& theMeshName, 
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName);
 
   //! Implemention of the VISU_Convertor::GetFamilyOnEntitySize
   virtual 
-  vtkFloatingPointType 
+  size_t 
   GetFamilyOnEntitySize(const std::string& theMeshName, 
                        const VISU::TEntity& theEntity,
                        const std::string& theFamilyName);
 
   //! Implemention of the VISU_Convertor::GetMeshOnGroup
   virtual 
-  VISU::PIDMapper 
+  VISU::PUnstructuredGridIDMapper 
   GetMeshOnGroup(const std::string& theMeshName, 
                 const std::string& theGroupName);
   
   //! Implemention of the VISU_Convertor::GetMeshOnGroupSize
   virtual 
-  vtkFloatingPointType 
+  size_t 
   GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName);
 
   //! Implemention of the VISU_Convertor::GetTimeStampOnMesh
   virtual
-  VISU::PIDMapper 
+  VISU::PUnstructuredGridIDMapper 
   GetTimeStampOnMesh(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName,
-                    int theStampsNum);
+                    int theTimeStampNumber);
 
-  //! Implemention of the VISU_Convertor::GetTimeStampSize
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
-  vtkFloatingPointType 
-  GetTimeStampSize(const std::string& theMeshName, 
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFieldName,
-                  int theStampsNum);
+  size_t
+  GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theTimeStampNumber,
+                        bool& theIsEstimated);
+    
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
+  virtual 
+  size_t
+  GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theTimeStampNumber,
+                            bool& theIsEstimated);
 
   //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
   virtual
@@ -878,11 +149,11 @@ public:
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum);
+                        int theTimeStampNumber);
   
   //! Implemention of the VISU_Convertor::GetFieldOnMeshSize
   virtual 
-  vtkFloatingPointType 
+  size_t 
   GetFieldOnMeshSize(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName);
@@ -908,20 +179,23 @@ protected:
   FindMesh(const std::string& theMeshName);
 
   //! An utility method to find TMeshOnEntity by name of its parent mesh and entity
-  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
+  typedef boost::tuple<VISU::PMeshImpl,
+                      VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
   TFindMeshOnEntity
   FindMeshOnEntity(const std::string& theMeshName,
                   const VISU::TEntity& theEntity);
 
   //! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
-  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
+  typedef boost::tuple<VISU::PMeshImpl,
+                      VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
   TFindFamilyOnEntity
   FindFamilyOnEntity(const std::string& theMeshName,
                    const VISU::TEntity& theEntity,
                    const std::string& theFamilyName);
 
   //! An utility method to find Group by name of its parent mesh and its name
-  typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
+  typedef boost::tuple<VISU::PMeshImpl,
+                      VISU::PGroupImpl> TFindMeshOnGroup;
   TFindMeshOnGroup
   FindMeshOnGroup(const std::string& theMeshName, 
                  const std::string& theGroupName);
@@ -948,16 +222,24 @@ protected:
                const std::string& theFieldName, 
                int theStampsNum);
 
-  VISU::TVTKOutput*
+  vtkUnstructuredGrid*
   GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
                        const VISU::PMeshOnEntityImpl& theMeshOnEntity,
                        const VISU::PFieldImpl& theField,
                        const VISU::PValForTimeImpl& theValForTime,
-                       const VISU::PIDMapperFilter& theIDMapperFilter,
+                       const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
                        const VISU::PProfileImpl& theProfile,
                        const VISU::TEntity& theEntity);
   
 protected:
+  //! Implemention of the VISU_Convertor::GetTimeStampSize
+  virtual 
+  size_t 
+  GetTimeStampSize(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFieldName,
+                  int theStampsNum);
+
   //! To fill intermeiate representation of TMeshOnEntity from a MED source
   virtual
   int
index 2a70b379bdba9f9d6585b0d3c794f99faa3d42e3..66dfae5ba360b15eb4d43ec7ac8f8dcb887c1968 100644 (file)
@@ -27,6 +27,8 @@
 #include "VISU_IDMapper.hxx"
 
 #include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkDataSet.h>
 
 namespace VISU
 {
@@ -36,7 +38,7 @@ namespace VISU
   ::GetNodeCoord(vtkIdType theObjID)
   {
     vtkIdType aVTKID = GetNodeVTKID(theObjID);
-    return GetVTKOutput()->GetPoint(aVTKID);
+    return GetOutput()->GetPoint(aVTKID);
   }
 
   vtkIdType
@@ -58,7 +60,7 @@ namespace VISU
   ::GetElemCell(int theObjID)
   {
     vtkIdType aVtkID = GetElemVTKID(theObjID);
-    return GetVTKOutput()->GetCell(aVtkID);
+    return GetOutput()->GetCell(aVtkID);
   }
 
   vtkIdType
@@ -74,4 +76,25 @@ namespace VISU
   {
     return theID;
   }  
+  //---------------------------------------------------------------
+
+
+  vtkDataSet* 
+  TUnstructuredGridIDMapper
+  ::GetOutput()
+  {
+    return GetUnstructuredGridOutput();
+  }
+  //---------------------------------------------------------------
+
+
+  vtkDataSet* 
+  TPolyDataIDMapper
+  ::GetOutput()
+  {
+    return GetPolyDataOutput();
+  }
+
+
+  //---------------------------------------------------------------
 }
index a488a210c105ab42137511dce461db07634aeec5..53960d77a0bbf1a49389aaf7a0f14822e96a0519 100644 (file)
 #include <string>
 
 class vtkUnstructuredGrid;
+class vtkPolyData;
+class vtkDataSet;
 class vtkCell;
 
 namespace VISU
 {
-  using MED::SharedPtr;
-
   //---------------------------------------------------------------
   //! Defines a basic class for intemediate data structures
   struct TBaseStructure
@@ -54,11 +54,9 @@ namespace VISU
 
     std::string myEntry; //!< To simplify publication of the object tree
   };
-  typedef SharedPtr<TBaseStructure> PBaseStructure;
+  typedef MED::SharedPtr<TBaseStructure> PBaseStructure;
 
   //---------------------------------------------------------------
-  typedef vtkUnstructuredGrid TVTKOutput;
-
   //! Defines a basic abstract interface for VTK to object ID's and backward mapping
   /*!
     Where object ID means ID which attached to corresponding MED entity.
@@ -98,10 +96,31 @@ namespace VISU
 
     //! Get VTK representation of mesh for corresponding MED entity
     virtual
-    TVTKOutput*
-    GetVTKOutput() = 0;
+    vtkDataSet*
+    GetOutput() = 0;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize() = 0;
+  };
+  typedef MED::SharedPtr<TIDMapper> PIDMapper;
+  
+
+  //---------------------------------------------------------------
+  struct TUnstructuredGridIDMapper: virtual TIDMapper
+  {
+    //! Get VTK representation of mesh for corresponding MED entity
+    virtual
+    vtkUnstructuredGrid*
+    GetUnstructuredGridOutput() = 0;
+
+    //! Reimplement the TIDMapper::GetOutput
+    virtual
+    vtkDataSet*
+    GetOutput();
   };
-  typedef SharedPtr<TIDMapper> PIDMapper;
+  typedef MED::SharedPtr<TUnstructuredGridIDMapper> PUnstructuredGridIDMapper;
   
 
   //---------------------------------------------------------------
@@ -109,7 +128,7 @@ namespace VISU
   /*!
     This class defines some additional methods that allow get names for corresponding mesh elements
   */
-  struct TNamedIDMapper: virtual TIDMapper
+  struct TNamedIDMapper: virtual TUnstructuredGridIDMapper
   {
     //! Get name of mesh node for corresponding object ID
     virtual
@@ -121,7 +140,23 @@ namespace VISU
     std::string 
     GetElemName(vtkIdType theObjID) const = 0;
   };
-  typedef SharedPtr<TNamedIDMapper> PNamedIDMapper;
+  typedef MED::SharedPtr<TNamedIDMapper> PNamedIDMapper;
+  
+
+  //---------------------------------------------------------------
+  struct TPolyDataIDMapper: virtual TIDMapper
+  {
+    //! Get VTK representation of mesh for corresponding MED entity
+    virtual
+    vtkPolyData*
+    GetPolyDataOutput() = 0;
+
+    //! Reimplement the TIDMapper::GetOutput
+    virtual
+    vtkDataSet*
+    GetOutput();
+  };
+  typedef MED::SharedPtr<TPolyDataIDMapper> PPolyDataIDMapper;
   
 
   //---------------------------------------------------------------
@@ -130,7 +165,7 @@ namespace VISU
   //! Defines a type that represent complex ID for defined Gauss Point
   typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
 
-  struct TGaussPtsIDMapper: virtual TIDMapper
+  struct TGaussPtsIDMapper: virtual TPolyDataIDMapper
   {
     //! Gets complex Gauss Point ID by its VTK ID
     virtual 
@@ -142,7 +177,7 @@ namespace VISU
     TNamedIDMapper*
     GetParent() = 0;
   };
-  typedef SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
+  typedef MED::SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
 
   //---------------------------------------------------------------
 }
index 77c4351bc672620c0e6db9983e9131a193178822..3ea28058180ccdbc582d4e7c40a173a4b3eecfbd 100644 (file)
@@ -26,7 +26,6 @@
 
 
 #include "VISU_MedConvertor.hxx"
-#include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
 #include "MED_Factory.hxx"
 
 #include <vtkCellType.h>
 
-using namespace std;
-using namespace VISU;
-
 using MED::TInt;
 using MED::TFloat;
 using MED::EBooleen;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 static int MYVALUEDEBUG = 0;
 static int MY_FAMILY_DEBUG = 0;
 static int MY_GROUP_DEBUG = 0;
@@ -144,10 +140,10 @@ namespace
   MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
   {
     switch(theMEDEntity){
-    case MED::eNOEUD: return NODE_ENTITY;
-    case MED::eARETE: return EDGE_ENTITY;
-    case MED::eFACE: return FACE_ENTITY;
-    case MED::eMAILLE: return CELL_ENTITY;
+    case MED::eNOEUD: return VISU::NODE_ENTITY;
+    case MED::eARETE: return VISU::EDGE_ENTITY;
+    case MED::eFACE: return VISU::FACE_ENTITY;
+    case MED::eMAILLE: return VISU::CELL_ENTITY;
     }
     return VISU::TEntity(-1);
   }
@@ -155,20 +151,20 @@ namespace
 
   //---------------------------------------------------------------
   MED::EEntiteMaillage 
-  VTKEntityToMED(TEntity theVTKEntity)
+  VTKEntityToMED(VISU::TEntity theVTKEntity)
   {
     switch(theVTKEntity){
-    case NODE_ENTITY: return MED::eNOEUD;
-    case EDGE_ENTITY: return MED::eARETE;
-    case FACE_ENTITY: return MED::eFACE;
-    case CELL_ENTITY: return MED::eMAILLE;
+    case VISU::NODE_ENTITY: return MED::eNOEUD;
+    case VISU::EDGE_ENTITY: return MED::eARETE;
+    case VISU::FACE_ENTITY: return MED::eFACE;
+    case VISU::CELL_ENTITY: return MED::eMAILLE;
     }
     return MED::EEntiteMaillage(-1);
   }
 
 
   //---------------------------------------------------------------
-  PMEDSubProfile
+  VISU::PMEDSubProfile
   CrSubProfile(const MED::PWrapper& theMEDWrapper,
               const MED::PMeshInfo& theMeshInfo,
               MED::EEntiteMaillage theMEntity,
@@ -179,21 +175,21 @@ namespace
     VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
     vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
 
-    PMEDSubProfile aSubProfile(new TMEDSubProfile());
+    VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
     aSubProfile->myGeom = aEGeom;
     aSubProfile->myMGeom = theMGeom;
-    aSubProfile->myStatus = eAddAll;
+    aSubProfile->myStatus = VISU::eAddAll;
 
     MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
     if(aTimeStampIter == theGeom2Size.end())
-      aSubProfile->myStatus = eRemoveAll;
+      aSubProfile->myStatus = VISU::eRemoveAll;
     else{
       MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
       if(aProfileIter != theGeom2Profile.end()){
        MED::PProfileInfo aProfileInfo = aProfileIter->second;
 
        aSubProfile->myName = aProfileInfo->GetName();
-       aSubProfile->myStatus = eAddPart;
+       aSubProfile->myStatus = VISU::eAddPart;
 
        const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
        TInt aNbElem = anElemNum.size();
@@ -277,29 +273,29 @@ namespace
 
 
   //---------------------------------------------------------------
-  TProfileKey
+  VISU::TProfileKey
   GetProfileKey(const MED::PWrapper& theMEDWrapper,
                const MED::PMeshInfo& theMeshInfo,
-               const MED::TTimeStampVal& theTimeStampVal,
+               const MED::PTimeStampValueBase& theTimeStampValue,
                const VISU::TMEDMeshOnEntity& theMeshOnEntity,
                MED::EEntiteMaillage theMEntity,
                const MED::TGeom2Size& theGeom2Size)
   {
     INITMSG(MYDEBUG,"GetProfileKey"<<endl);
     
-    TProfileKey aProfileKey;
-    const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+    VISU::TProfileKey aProfileKey;
+    const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
     MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
     for(; anIter != aGeom2Size.end(); anIter++){
       MED::EGeometrieElement aMGeom = anIter->first;
-      PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
-                                            theMeshInfo,
-                                            theMEntity,
-                                            aMGeom,
-                                            theGeom2Size,
-                                            aGeom2Profile);
+      VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
+                                                  theMeshInfo,
+                                                  theMEntity,
+                                                  aMGeom,
+                                                  theGeom2Size,
+                                                  aGeom2Profile);
       aProfileKey.insert(aSubProfile);
     }
     
@@ -311,37 +307,37 @@ namespace
   void
   InitProfile(const MED::PWrapper& theMEDWrapper,
              const MED::PMeshInfo& theMeshInfo,
-             MED::TTimeStampVal& theTimeStampVal,
+             MED::PTimeStampValueBase& theTimeStampValue,
              VISU::TMEDMeshOnEntity& theMeshOnEntity,
              MED::EEntiteMaillage theMEntity,
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitProfile");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
     INITMSG(MYDEBUG,"InitProfile"<<endl);
     
-    TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+    VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
     
-    TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
+    VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
                                            theMeshInfo,
-                                           theTimeStampVal,
+                                           theTimeStampValue,
                                            theMeshOnEntity,
                                            theMEntity,
                                            theGeom2Size);
     
-    TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+    VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
     if(anIter != aProfileMap.end()){
       theValForTime.myProfile = anIter->second;
       INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
     }else{
-      PMEDProfile aProfile(new TMEDProfile());
-      TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+      VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
+      VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
       
-      TProfileKey::const_iterator anIter = aProfileKey.begin();
+      VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
       for(; anIter != aProfileKey.end(); anIter++){
-       PMEDSubProfile aSubProfile(*anIter);
+       VISU::PMEDSubProfile aSubProfile(*anIter);
 
-       if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+       if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
          aProfile->myIsAll = false;
 
        VISU::EGeometry aEGeom = aSubProfile->myGeom;
@@ -355,20 +351,20 @@ namespace
 
 
   //---------------------------------------------------------------
-  TGaussKey
-  GetGaussKey(const MED::TTimeStampVal& theTimeStampVal,
+  VISU::TGaussKey
+  GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
              const VISU::TMEDMeshOnEntity& theMeshOnEntity,
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
     INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
-    TGaussKey aGaussKey;
-    PMEDProfile aProfile = theValForTime.myProfile;
-    TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    VISU::TGaussKey aGaussKey;
+    VISU::PMEDProfile aProfile = theValForTime.myProfile;
+    VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-    const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+    const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
     const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
@@ -377,24 +373,24 @@ namespace
       MED::EGeometrieElement aMGeom = anIter->first;
       VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
 
-      TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+      VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
       if(anIter2 == aGeom2SubProfile.end()){
        INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
        continue;
       }
-      PMEDSubProfile aSubProfile = anIter2->second;
+      VISU::PMEDSubProfile aSubProfile = anIter2->second;
 
       MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
       if(aTimeStampIter != theGeom2Size.end()){
        TInt aNbCells = aTimeStampIter->second;
-       if(aSubProfile->myStatus == eAddPart)
+       if(aSubProfile->myStatus == VISU::eAddPart)
          aNbCells = aSubProfile->myNbCells;
 
-       PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+       VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
        aGaussSubMesh->mySubProfile = aSubProfile;
        aGaussSubMesh->myStatus = aSubProfile->myStatus;
          
-       PMEDGauss aGauss(new TMEDGauss());
+       VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
        aGaussSubMesh->myGauss = aGauss;
        aGauss->myGeom = aEGeom;
        aGauss->myNbPoints = 1;
@@ -431,50 +427,50 @@ namespace
 
   //---------------------------------------------------------------
   void
-  InitGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+  InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
                VISU::TMEDMeshOnEntity& theMeshOnEntity,
                const MED::TGeom2Size& theGeom2Size,
                VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
     INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
 
-    if(theMeshOnEntity.myEntity == NODE_ENTITY)
+    if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
       return;
 
-    TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
+    VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
     
-    TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
-                                     theMeshOnEntity,
-                                     theGeom2Size,
-                                     theValForTime);
+    VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
+                                           theMeshOnEntity,
+                                           theGeom2Size,
+                                           theValForTime);
 
-    TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
+    VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
     if(anIter != aGaussMeshMap.end()){
       theValForTime.myGaussMesh = anIter->second;
       INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
     }else{
-      PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
-      TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
+      VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
       {
-       TGaussKey::const_iterator anIter = aGaussKey.begin();
+       VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
        for(; anIter != aGaussKey.end(); anIter++){
-         PMEDGaussSubMesh aGaussSubMesh(*anIter);
-         PMEDGauss aGauss = aGaussSubMesh->myGauss;
+         VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
+         VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
          VISU::EGeometry aEGeom = aGauss->myGeom;
          aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
        }
       }
       {
-       TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
+       VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
        aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
-       TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+       VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
        for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
-         const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+         const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
          aGaussSubMeshArr[anID] = aGaussSubMesh;
        }
       }
-      INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<endl);
+      INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
       aGaussMeshMap[aGaussKey] = aGaussMesh;
       theValForTime.myGaussMesh = aGaussMesh;
     }
@@ -485,25 +481,25 @@ namespace
   void
   InitGaussProfile(const MED::PWrapper& theMEDWrapper,
                   const MED::PMeshInfo& theMeshInfo,
-                  MED::TTimeStampVal& theTimeStampVal,
+                  MED::PTimeStampValueBase& theTimeStampValue,
                   VISU::TMEDMeshOnEntity& theMeshOnEntity,
                   MED::EEntiteMaillage theMEntity,
                   const MED::TGeom2Size& theGeom2Size,
                   VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
-    INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
+    INITMSG(MYDEBUG,"InitGaussProfile"<<std::endl);
 
     // The order of the function calls is important
     InitProfile(theMEDWrapper,
                theMeshInfo,
-               theTimeStampVal,
+               theTimeStampValue,
                theMeshOnEntity,
                theMEntity,
                theGeom2Size,
                theValForTime);
 
-    InitGaussMesh(theTimeStampVal,
+    InitGaussMesh(theTimeStampValue,
                  theMeshOnEntity,
                  theGeom2Size,
                  theValForTime);
@@ -512,28 +508,29 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildMeshOnEntityMap(PMEDMesh theMesh,
+  BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
                       const MED::TEntityInfo& theEntityInfo,
                       const MED::PNodeInfo& theNodeInfo,
                       const MED::PWrapper& theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
     INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
-    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
     MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
     for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
       const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
       const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = 
+       aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
       aMeshOnEntity->myGeom2Size = aGeom2Size;
-      TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
 
       INITMSG(MYDEBUG,
              "- aMEntity = "<<aMEntity<<
@@ -553,7 +550,7 @@ namespace
        INITMSG(MYDEBUG,
                "- myNbCells = "<<aMeshOnEntity->myNbCells<<
                "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
-               endl);;
+               std::endl);
        
       }else{
        MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
@@ -636,28 +633,29 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildMeshGrilleOnEntityMap(PMEDMesh theMesh,
+  BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
                             const MED::TEntityInfo& theEntityInfo,
                             const MED::PGrilleInfo& theGrilleInfo,
                             const MED::PWrapper& theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
     INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
     
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
-    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
     MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
     for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
       const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
       const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = 
+       aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
       aMeshOnEntity->myGeom2Size = aGeom2Size;
-      TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
 
       INITMSG(MYDEBUG,
              "- aMEntity = "<<aMEntity<<
@@ -717,17 +715,17 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildFieldMap(PMEDMesh theMesh,
+  BuildFieldMap(VISU::PMEDMesh theMesh,
                const MED::TEntityInfo& theEntityInfo,
                MED::PWrapper theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
     TInt aNbFields = theMEDWrapper->GetNbFields(); 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
     INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
     for(TInt iField = 1; iField <= aNbFields; iField++){
-      TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
       MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
       TInt aNbComp = aFieldInfo->GetNbComp();
       std::string aFieldName = aFieldInfo->GetName();
@@ -741,12 +739,15 @@ namespace
       if(aNbTimeStamps < 1)
        continue;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
-      TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-      PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      vtkIdType aDataType = VTK_DOUBLE;
+      if(aFieldInfo->GetType() != MED::eFLOAT64)
+       aDataType = VTK_INT;
+      VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+      VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
       aField->myId = iField;
-      aField->InitArrays(aNbComp);
+      aField->Init(aNbComp, aDataType);
       aField->myEntity = aVEntity;
       aField->myName = aFieldName;
       aField->myMeshName = aMeshName;
@@ -764,7 +765,7 @@ namespace
       }
       
       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
-       TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
+       VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
        MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
                                                                              aMEntity,
                                                                              aGeom2Size,
@@ -772,8 +773,8 @@ namespace
        TFloat aDt = aTimeStampInfo->GetDt();
        std::string anUnitDt = aTimeStampInfo->GetUnitDt();
 
-       TValField& aValField = aField->myValField;
-       PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+       VISU::TValField& aValField = aField->myValField;
+       VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
        aValForTime->myId = iTimeStamp;
        aValForTime->myFieldName = aField->myName;
        aValForTime->myEntity = aField->myEntity;
@@ -781,12 +782,12 @@ namespace
        aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
        INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
        
-       TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
+       VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
        const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
        MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
        for(; anIter != aMGeom2NbGauss.end(); anIter++){
          const MED::EGeometrieElement& aMGeom = anIter->first;
-         EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+         VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
          TInt aNbGauss = anIter->second;
          aVGeom2NbGauss[aEGeom] = aNbGauss;
        }
@@ -797,13 +798,13 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildFamilyMap(PMEDMesh theMesh,
+  BuildFamilyMap(VISU::PMEDMesh theMesh,
                 const MED::TEntityInfo& theEntityInfo,
                 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
                 const MED::TFamilyInfoSet& theFamilyInfoSet,
                 MED::PWrapper theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
     INITMSG(MYDEBUG,"BuildFamilyMap\n");
 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
@@ -813,10 +814,10 @@ namespace
       const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
       const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
-      const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
-      TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        
       if(aFamilyTSizeSet.empty())
        continue;
@@ -837,14 +838,14 @@ namespace
        
        std::string aFamilyName = aFamilyInfo->GetName();
 
-       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+       VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
        aFamily->myId = anId;
        aFamily->myEntity = aVEntity;
        aFamily->myName = aFamilyName;
        aFamily->myNbCells = aSize;
 
        aFamily->myCellsSize = 0;
-       TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
+       VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
        if(anIter != aFamilyID2CellsSize.end())
          aFamily->myCellsSize = anIter->second;
        
@@ -874,15 +875,15 @@ namespace
    * Build grille family map
    */
   void
-  BuildGrilleFamilyMap(PMEDMesh theMesh,
+  BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
                       const MED::TEntityInfo& theEntityInfo,
                       const MED::TFamilyInfoSet& theFamilyInfoSet,
                       MED::PWrapper theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
     INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
     
-    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
 
     MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
 
@@ -891,33 +892,35 @@ namespace
 
     const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
 
-    MED::TFamilyInfoSet::iterator aFamInter = theFamilyInfoSet.begin();
-    for(;aFamInter != theFamilyInfoSet.end();aFamInter++){
-      TInt anId = (*aFamInter)->GetId();
+    MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
+    for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
+      const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
+      TInt anId = aFamilyInfo->GetId();
 
       if(anId == 0)
        continue;
 
-      std::string aFamilyName = (*aFamInter)->GetName();
+      std::string aFamilyName = aFamilyInfo->GetName();
       const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
                                                                      anId);
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
 
-      PMEDMeshOnEntity aMeshOnEntity;
-      TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity;
+      VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
       if(aMeshOnEntityIter != aMeshOnEntityMap.end())
        aMeshOnEntity = aMeshOnEntityIter->second;
 
-      TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
 
-      PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+      VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
       aFamily->myId = anId;
       aFamily->myEntity = aVEntity;
       aFamily->myName = aFamilyName;
       aFamily->myNbCells = 0;
       aFamily->myCellsSize = 0;
 
-      TFamilyID2CellsSize::iterator aFamilyid2CellsSizeIter = (aMeshOnEntity->myFamilyID2CellsSize).find(anId);
+      const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
       if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
        aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
       MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
@@ -927,8 +930,8 @@ namespace
       INITMSG(MY_FAMILY_DEBUG,
              "- aFamilyName =|"<<aFamily->myName<<"|"
              << "; myId = "<<aFamily->myId
-             << "; aNbAttr = "<<(*aFamInter)->GetNbAttr()
-             << "; aNbGroup = "<<(*aFamInter)->GetNbGroup()
+             << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
+             << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
              << "; aVEntity = "<<aVEntity
              << "; myNbCells = "<<aFamily->myNbCells
              << "; myCellsSize = "<<aFamily->myCellsSize
@@ -940,21 +943,21 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildGroupMap(PMEDMesh theMesh,
+  BuildGroupMap(VISU::PMEDMesh theMesh,
                const MED::TFamilyInfoSet& theFamilyInfoSet)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
     INITMSG(MYDEBUG,"BuildGroupMap\n");
 
-    TGroupMap& aGroupMap = theMesh->myGroupMap;
+    VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
     MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
     MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
     for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
       const std::string& aGroupName = aGroupInfoIter->first;
       INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
 
-      PMEDGroup aGroup(new TMEDGroup());
-      TFamilySet& aFamilySet = aGroup->myFamilySet;
+      VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
+      VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
 
       const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
       MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
@@ -962,16 +965,16 @@ namespace
        const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
        std::string aFamilyName = aFamilyInfo->GetName();
        
-       TEntity aVEntity = TEntity(-1);
-       PMEDFamily aFamily;
+       VISU::TEntity aVEntity = VISU::TEntity(-1);
+       VISU::PMEDFamily aFamily;
        
        // Find aVisuEntity
-       const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
-       TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
        for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
-         const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
-         const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-         TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+         const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+         const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+         VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
          for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
            const std::string& aName = aFamilyMapIter->first;
            aFamily = aFamilyMapIter->second;
@@ -996,39 +999,137 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  struct TSetIsDone
+  {
+    bool& myIsDone;
+    TSetIsDone(bool& theIsDone):
+      myIsDone(theIsDone)
+    {}
+
+    ~TSetIsDone()
+    {
+      myIsDone = true;
+    }
+
+  };
+
+
+  //---------------------------------------------------------------
+}
+
+namespace VISU
+{
   //---------------------------------------------------------------
   void
   TMEDNamedPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PNodeInfo& theNodeInfo)
+  ::Init(const MED::PNodeInfo& theNodeInfo,
+        MED::EVersion theVersion)
   {
+    TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
+    TInt aNbElem = theNodeInfo->GetNbElem();
+    TInt aDim = theNodeInfo->GetMeshInfo()->GetDim();
+    aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
+    TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
+    myVersion = theVersion;
+
+    for(TInt iDim = 0; iDim < aDim; iDim++)
+      myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
+      
+    myIsElemNum = theNodeInfo->IsElemNum();
     if(theNodeInfo->IsElemNum())
-      TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum);
-    else
-      TNamedPointCoords::Init(theNbPoints,theDim);
+      myElemNum = theNodeInfo->myElemNum;
+
+    myIsElemNames = theNodeInfo->IsElemNames();
     if(theNodeInfo->IsElemNames())
-      myNodeInfo = theNodeInfo;
+      myElemNames = theNodeInfo->myElemNames;
   }
 
   void
   TMEDNamedPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PGrilleInfo& theInfo)
+  ::Init(const MED::PGrilleInfo& theGrilleInfo)
+  {
+    TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
+    TInt aNbElem = theGrilleInfo->GetNbNodes();
+    TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim();
+    MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
+    aCoordHolder->Init(aNbElem, aDim, aCoord);
+    TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
+
+    for(TInt iDim = 0; iDim < aDim; iDim++)
+      myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
+
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
+      MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
+      for(TInt iDim = 0; iDim < aDim; iDim++){
+       aVCoordSlice[iDim] = aMCoord[iDim];
+      }
+    }
+  }
+
+  vtkIdType
+  TMEDNamedPointCoords
+  ::GetObjID(vtkIdType theID) const
+  {
+    if(myIsElemNum)
+      return (*myElemNum)[theID];
+    return TNamedPointCoords::GetObjID(theID);
+  }
+
+
+  vtkIdType
+  TMEDNamedPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    if(myIsElemNum){
+      // To prepare corresponding mapper engine
+      if(myObj2VTKID.empty()){
+       vtkIdType anEnd = myElemNum->size();
+       for(vtkIdType anID = 0; anID < anEnd; anID++)
+         myObj2VTKID[(*myElemNum)[anID]] = anID;
+      }
+      TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
+      if(anIter != myObj2VTKID.end())
+       return anIter->second;
+      return -1;
+    }
+    return TNamedPointCoords::GetVTKID(theID);
+  }
+
+  MED::TInt
+  GetPNOMLength(MED::EVersion theVersion)
   {
-    TNamedPointCoords::Init(theNbPoints,theDim);
+    if(theVersion == MED::eV2_1)
+      return MED::GetPNOMLength<MED::eV2_1>();
+    return MED::GetPNOMLength<MED::eV2_2>();
   }
 
   std::string 
   TMEDNamedPointCoords
   ::GetNodeName(vtkIdType theObjID) const
   {
-    if(myNodeInfo)
-      return myNodeInfo->GetElemName(theObjID);
+    if(myIsElemNames)
+      return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
     return TNamedPointCoords::GetNodeName(theObjID);
   }
 
+  unsigned long int
+  TMEDNamedPointCoords
+  ::GetMemorySize()
+  {
+    size_t aSize = TNamedPointCoords::GetMemorySize();
+
+    if(myElemNum){
+      aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    }
+
+    if(myIsElemNames)
+      aSize += myElemNames->size() * sizeof(char);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   vtkIdType
@@ -1036,11 +1137,21 @@ namespace
   ::GetElemObjID(vtkIdType theID) const
   {
     if(myIsElemNum)
-      return myElemNum[theID];
+      return (*myElemNum)[theID];
     else
       return theID;
   }
   
+  unsigned long int
+  TMEDSubProfile
+  ::GetMemorySize()
+  {
+    size_t aSize = TSubProfileImpl::GetMemorySize();
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   void
@@ -1069,43 +1180,51 @@ namespace
     TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
     
     if(myIsElemNum)
-      aCellID = myElemNum[aCellID];
+      aCellID = (*myElemNum)[aCellID];
     else
       aCellID += theStartID;
 
-    return TGaussPointID(aCellID,aLocalPntID);
+    return TGaussPointID(aCellID, aLocalPntID);
   }
   
+  unsigned long int
+  TMEDGaussSubMesh
+  ::GetMemorySize()
+  {
+    size_t aSize = TGaussSubMeshImpl::GetMemorySize();
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   void
   TMEDSubMesh
-  ::Init(const MED::PElemInfo& theElemInfo)
+  ::Init(const MED::PElemInfo& theElemInfo,
+        MED::EVersion theVersion)
   {
     myIsElemNum = theElemInfo->IsElemNum();
-
     if(myIsElemNum)
       myElemNum = theElemInfo->myElemNum;
 
+    myIsElemNames = theElemInfo->IsElemNames();
     if(theElemInfo->IsElemNames())
-      myElemInfo = theElemInfo;
+      myElemNames = theElemInfo->myElemNames;
   }
 
 
   void
   TMEDSubMesh
   ::Init(const MED::PGrilleInfo& theGrilleInfo)
-  {
-    myIsElemNum = MED::eFAUX;
-    // must be implemented
-  }
+  {}
 
   vtkIdType
   TMEDSubMesh
   ::GetElemObjID(vtkIdType theID) const
   {
     if(myIsElemNum)
-      return myElemNum[theID];
+      return (*myElemNum)[theID];
     else
       return TSubMeshImpl::GetElemObjID(theID);
   }
@@ -1114,24 +1233,28 @@ namespace
   TMEDSubMesh
   ::GetElemName(vtkIdType theObjID) const
   {
-    if(myElemInfo)
-      return myElemInfo->GetElemName(theObjID);
+    if(myIsElemNames)
+      return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
     return TSubMeshImpl::GetElemName(theObjID);
   }
 
-  struct TSetIsDone
+  unsigned long int
+  TMEDSubMesh
+  ::GetMemorySize()
   {
-    bool& myIsDone;
-    TSetIsDone(bool& theIsDone):
-      myIsDone(theIsDone)
-    {}
+    size_t aSize = TSubMeshImpl::GetMemorySize();
 
-    ~TSetIsDone()
-    {
-      myIsDone = true;
-    }
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
 
-  };
+    if(myIsElemNames)
+      aSize += myElemNames->size() * sizeof(char);
+
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
 }
 
 
@@ -1166,11 +1289,11 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsEntitiesDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1178,7 +1301,7 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
       MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
@@ -1186,12 +1309,12 @@ VISU_MedConvertor
       MED::EMaillage aType = aMeshInfo->GetType();
        
       // creating TMesh structure and TMeshOnEntityMap         
-      PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+      VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
       
       aMesh->myDim = aDim;
       aMesh->myName = aMeshName;
       aMesh->myMeshInfo = aMeshInfo;
-      aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+      aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
       
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
              "; aDim = "<<aDim<<"\n");
@@ -1278,11 +1401,11 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsFieldsDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildFields");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1290,15 +1413,15 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
       MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
       
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
 #ifndef _DEXCEPT_
@@ -1330,6 +1453,72 @@ VISU_MedConvertor
 }
 
 
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+                    const MED::TGeom2Gauss& theGeom2Gauss,
+                    VISU::TMinMaxArr& theMinMaxArr,
+                    TInt theNbComp,
+                    TInt theNbComp2)
+{
+  const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
+  typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+  for(; anIter != aGeom2Value.end(); anIter++){
+    const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
+    MED::EGeometrieElement aMGeom = anIter->first;
+                 
+    TInt aNbElem = aMMeshValue.myNbElem;
+    TInt aNbGauss = aMMeshValue.myNbGauss;
+                 
+    MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
+    if(aGaussIter == theGeom2Gauss.end())
+      aNbGauss = 1;
+                 
+    INITMSG(MYDEBUG,
+           "- aMGeom = "<<aMGeom<<
+           "; aNbElem = "<<aNbElem<<
+           "; aNbGauss = "<<aNbGauss<<
+           endl);
+                 
+    // To calculate min/max per components
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+      for(TInt iComp = 0; iComp < theNbComp; iComp++){
+       const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+       VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
+       vtkFloatingPointType& aMin = aMinMax.first;
+       vtkFloatingPointType& aMax = aMinMax.second;
+       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+         const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
+         aMin = min(aMin,aVal);
+         aMax = max(aMax,aVal);
+       }
+      }
+    }
+                 
+    // To calculate min/max per vector modulus
+    VISU::TMinMax& aMinMax = theMinMaxArr[0];
+    vtkFloatingPointType& aMin = aMinMax.first;
+    vtkFloatingPointType& aMax = aMinMax.second;
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+      for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+       const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+       vtkFloatingPointType aValue = 0.0;
+       for(TInt iComp = 0; iComp < theNbComp2; iComp++){
+         vtkFloatingPointType aVal = aMValueSlice[iComp];
+         aValue += aVal*aVal;
+       }
+       aValue = sqrt(aValue);
+       aMin = min(aMin,aValue);
+       aMax = max(aMax,aValue);
+      }
+    }
+  }
+}
+
+  
 //---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MedConvertor
@@ -1339,14 +1528,14 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsMinMaxDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
   MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
 
   TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1354,15 +1543,15 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
 
       MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
       
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
 #ifndef _DEXCEPT_
       try{
@@ -1376,7 +1565,7 @@ VISU_MedConvertor
        MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
 
        for(TInt iField = 1; iField <= aNbFields; iField++){
-         TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
+         VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
          MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
          std::string aFieldName = aFieldInfo->GetName();
          INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
@@ -1390,10 +1579,10 @@ VISU_MedConvertor
          if(aNbTimeStamps < 1)
            continue;
        
-         TEntity aVEntity = MEDEntityToVTK(aMEntity);
-         PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-         TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-         PMEDField aField = aFieldMap[aFieldName];
+         VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+         VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+         VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+         VISU::PMEDField aField = aFieldMap[aFieldName];
        
          TInt aNbComp = aField->myNbComp;
          int aNbComp2 = aNbComp;
@@ -1402,10 +1591,10 @@ VISU_MedConvertor
          else if(aNbComp > 4)
            aNbComp2 = 3;
 
-         TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
+         VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
          TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
          for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
-           TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
+           VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
            INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
            
 #ifndef _DEXCEPT_
@@ -1413,87 +1602,46 @@ VISU_MedConvertor
             try{
               OCC_CATCH_SIGNALS;
 #else
-            CASCatch_TRY{
-              try{
+             CASCatch_TRY{
+               try{
 #endif
 #endif
-               MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                                            aMEntity,
-                                                                            aGeom2Size,
-                                                                            iTimeStamp);
-               
-               MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
-                                                                         aMKey2Profile,
-                                                                         aKey2Gauss);
-               
-               const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-               
-               const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-               
-               const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
-               MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
-               for(; anIter != aGeom2Value.end(); anIter++){
-                 const MED::TMeshValue& aMMeshValue = anIter->second;
-                 MED::EGeometrieElement aMGeom = anIter->first;
-                 
-                 TInt aNbElem = aMMeshValue.myNbElem;
-                 TInt aNbGauss = aMMeshValue.myNbGauss;
-                 
-                 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
-                 if(aGaussIter == aGeom2Gauss.end())
-                   aNbGauss = 1;
+                 MED::PTimeStampInfo aTimeStampInfo = 
+                   aMed->GetPTimeStampInfo(aFieldInfo,
+                                           aMEntity,
+                                           aGeom2Size,
+                                           iTimeStamp);
                  
-                 INITMSG(MYDEBUG,
-                         "- aMGeom = "<<aMGeom<<
-                         "; aNbElem = "<<aNbElem<<
-                         "; aNbGauss = "<<aNbGauss<<
-                         endl);
-                 
-                 // To calculate min/max per components
-                 for(TInt iElem = 0; iElem < aNbElem; iElem++){
-                   MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-                   for(TInt iComp = 0; iComp < aNbComp; iComp++){
-                     const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
-                     TMinMax& aMinMax = aMinMaxArr[iComp+1];
-                     vtkFloatingPointType& aMin = aMinMax.first;
-                     vtkFloatingPointType& aMax = aMinMax.second;
-                     for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                       const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
-                       aMin = min(aMin,aVal);
-                       aMax = max(aMax,aVal);
-                     }
-                   }
-                 }
+                 MED::PTimeStampValueBase aTimeStampValue = 
+                   aMed->GetPTimeStampValue(aTimeStampInfo,
+                                            aMKey2Profile,
+                                            aKey2Gauss);
+               
+                 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
+
+                 if(aFieldInfo->GetType() == MED::eFLOAT64)
+                   BuildTimeStampMinMax<MED::TFloatTimeStampValue>(aTimeStampValue,
+                                                                   aGeom2Gauss,
+                                                                   aMinMaxArr,
+                                                                   aNbComp,
+                                                                   aNbComp2);
+                 else
+                   BuildTimeStampMinMax<MED::TIntTimeStampValue>(aTimeStampValue,
+                                                                 aGeom2Gauss,
+                                                                 aMinMaxArr,
+                                                                 aNbComp,
+                                                                 aNbComp2);
                  
-                 // To calculate min/max per vector modulus
-                 TMinMax& aMinMax = aMinMaxArr[0];
-                 vtkFloatingPointType& aMin = aMinMax.first;
-                 vtkFloatingPointType& aMax = aMinMax.second;
-                 for(TInt iElem = 0; iElem < aNbElem; iElem++){
-                   MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-                   for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                     const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-                     vtkFloatingPointType aValue = 0.0;
-                     for(TInt iComp = 0; iComp < aNbComp2; iComp++){
-                       vtkFloatingPointType aVal = aMValueSlice[iComp];
-                       aValue += aVal*aVal;
-                     }
-                     aValue = sqrt(aValue);
-                     aMin = min(aMin,aValue);
-                     aMax = max(aMax,aValue);
-                   }
-                 }
-               }
 #ifndef _DEXCEPT_
 #ifdef NO_CAS_CATCH
-              }catch(Standard_Failure){
-               Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
-               MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
-             }catch(std::exception& exc){
-               MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
-             }catch(...){
-               MSG(MYDEBUG,"Unknown exception !!!");
-             }
+               }catch(Standard_Failure){
+                 Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
+                 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
+               }catch(std::exception& exc){
+                 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+               }catch(...){
+                 MSG(MYDEBUG,"Unknown exception !!!");
+               }
 #else
              }catch(std::exception& exc){
                MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
@@ -1542,11 +1690,11 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsGroupsDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
   TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1554,15 +1702,15 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
       MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();      
 
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
 
@@ -1619,14 +1767,14 @@ VISU_MedConvertor
 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
                   VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
   INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
 
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
 
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity == NODE_ENTITY){
+  if(anEntity == VISU::NODE_ENTITY){
     isPointsUpdated += LoadPoints(aMed,theMesh);
   }else{
     isPointsUpdated += LoadPoints(aMed,theMesh);
@@ -1644,14 +1792,14 @@ VISU_MedConvertor
                     VISU::PMeshOnEntityImpl theMeshOnEntity, 
                     VISU::PFamilyImpl theFamily)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
   INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
 
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
 
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity == NODE_ENTITY){
+  if(anEntity == VISU::NODE_ENTITY){
     isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily);
   }else{
     isPointsUpdated += LoadPoints(aMed,theMesh);
@@ -1668,18 +1816,18 @@ VISU_MedConvertor
 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                  const VISU::TFamilySet& theFamilySet)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
   INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
 
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
+  VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
   for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
-    PMEDFamily aFamily = *aFamilyIter;
-    const TEntity& anEntity = aFamily->myEntity;
-    const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+    VISU::PMEDFamily aFamily = *aFamilyIter;
+    const VISU::TEntity& anEntity = aFamily->myEntity;
+    const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
     isPointsUpdated += LoadPoints(aMed,theMesh);
-    if(anEntity == NODE_ENTITY){
+    if(anEntity == VISU::NODE_ENTITY){
       isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily);
     }else{
       isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily);
@@ -1698,15 +1846,15 @@ VISU_MedConvertor
                       VISU::PFieldImpl theField, 
                       VISU::PValForTimeImpl theValForTime)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
   INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
 
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   isPointsUpdated += LoadPoints(aMed,theMesh);
-  if(anEntity != NODE_ENTITY)
+  if(anEntity != VISU::NODE_ENTITY)
     isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
   int isFieldUpdated = LoadValForTimeOnMesh(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
   
@@ -1722,14 +1870,14 @@ VISU_MedConvertor
                           VISU::PFieldImpl theField, 
                           VISU::PValForTimeImpl theValForTime)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
   INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
 
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
 
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity != NODE_ENTITY)
+  if(anEntity != VISU::NODE_ENTITY)
     isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
   int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
   
@@ -1743,12 +1891,12 @@ VISU_MedConvertor
 ::LoadPoints(const MED::PWrapper& theMed,
             VISU::PMEDMesh theMesh) 
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
   try{
     //Check on existing family
-    PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+    VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
     aMeshOnEntity->myMeshName = theMesh->myName;
-    aMeshOnEntity->myEntity = NODE_ENTITY;
+    aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
 
     INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
 
@@ -1762,30 +1910,18 @@ VISU_MedConvertor
       //Main part of code
       MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
       TInt aNbElem = aNodeInfo->GetNbElem();
-      TInt aDim = theMesh->myDim;
       
-      PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
-      TMEDNamedPointCoords& aCoords = aNamedPointCoords;
-      aCoords.Init(aNbElem,aDim,aNodeInfo);
-      
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
-      
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
-       MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
-       for(int iDim = 0; iDim < aDim; iDim++)
-         aVCoordSlice[iDim] = aMCoordSlice[iDim];
-      }
+      VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+      aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
       
-      TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-      PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+      VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
       
-      aSubMesh->Init(MED::PElemInfo(aNodeInfo)); 
+      aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion()); 
       aSubMesh->myNbCells = theMesh->myNbPoints;
       aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
       
-      TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+      VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
       aCell2Connect.resize(aNbElem);
       for (int iElem = 0; iElem < aNbElem; iElem++)
        aCell2Connect[iElem] = VISU::TConnect(1,iElem);
@@ -1794,33 +1930,20 @@ VISU_MedConvertor
       //Main part of code
       MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
       TInt aNbElem = aGrilleInfo->GetNbNodes();
-      TInt aDim = theMesh->myDim;
       
-      PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
-      TMEDNamedPointCoords& aCoords = aNamedPointCoords;
-      aCoords.Init(aNbElem,aDim,aGrilleInfo);
+      VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+      aNamedPointCoords->Init(aGrilleInfo);
       
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoords.GetName(iDim) = aGrilleInfo->GetCoordName(iDim);
-      
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
-       MED::TNodeCoord aMCoord = aGrilleInfo->GetCoord(iElem);
-       for(int iDim = 0; iDim < aDim; iDim++){
-         aVCoordSlice[iDim] = aMCoord[iDim];
-       }
-      }
-      
-      TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-      PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+      VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
       
       aSubMesh->Init(aGrilleInfo); 
       aSubMesh->myNbCells = theMesh->myNbPoints;
       aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
       
-      TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+      VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
       aCell2Connect.resize(aNbElem);
-      for (int iElem = 0; iElem < aNbElem; iElem++)
+      for(int iElem = 0; iElem < aNbElem; iElem++)
        aCell2Connect[iElem] = VISU::TConnect(1,iElem);
       
     }
@@ -1846,7 +1969,7 @@ VISU_MedConvertor
                     const VISU::PMEDMesh theMesh, 
                     const VISU::PMEDFamily theFamily) 
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
   try{
     if(theFamily->myIsDone) 
       return 0;
@@ -1855,13 +1978,13 @@ VISU_MedConvertor
     MED::EMaillage aType = aMeshInfo->GetType();
 
     //Main part of code
-    if(aType==MED::eNON_STRUCTURE){
+    if(aType == MED::eNON_STRUCTURE){
       MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
       TInt aNbElem = aNodeInfo->GetNbElem();
       
       if(aNbElem > 0){
        TInt anId = theFamily->myId;
-       TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+       VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
        for(TInt iElem = 0; iElem < aNbElem; iElem++) 
          if(aNodeInfo->GetFamNum(iElem) == anId)
            aSubMeshID.push_back(iElem);
@@ -1873,7 +1996,7 @@ VISU_MedConvertor
       
       if(aNbElem > 0){
        TInt anId = theFamily->myId;
-       TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+       VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
        for(TInt iElem = 0; iElem < aNbElem; iElem++) 
          if(aGrilleInfo->GetFamNumNode(iElem) == anId)
            aSubMeshID.push_back(iElem);
@@ -1901,11 +2024,11 @@ VISU_MedConvertor
                    const VISU::PMEDMesh theMesh,
                    const VISU::PMEDMeshOnEntity theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
 #ifndef _DEXCEPT_
   try{
 #endif
-    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
     const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
     INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
@@ -1927,7 +2050,7 @@ VISU_MedConvertor
       
       const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
       MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
-      TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+      VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
       
       for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
        const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
@@ -1940,21 +2063,21 @@ VISU_MedConvertor
          TInt aNbElem = aGrilleInfo->GetNbCells();
          
          if(aNbElem > 0){
-           PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+           VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
            
            aSubMesh->Init(aGrilleInfo); 
            aSubMesh->myNbCells = aNbElem;      
            aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
            
-           TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+           VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
            aCell2Connect.resize(aNbElem);
            
            TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
-           TVector<TInt> aConnect(aMNbNodes);
+           VISU::TVector<TInt> aConnect(aMNbNodes);
            
            for(TInt iElem = 0; iElem < aNbElem; iElem++) {
              MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
-             TConnect& anArray = aCell2Connect[iElem];
+             VISU::TConnect& anArray = aCell2Connect[iElem];
              anArray.resize(aVNbNodes);
              
              if(anIsNodeNum){
@@ -2024,7 +2147,7 @@ VISU_MedConvertor
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
     MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
-    TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+    VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
 
     for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
       const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
@@ -2035,19 +2158,19 @@ VISU_MedConvertor
        MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
        TInt aNbElem = aPolygoneInfo->GetNbElem();
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init(MED::PElemInfo(aPolygoneInfo)); 
+         aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
          
          for(TInt iElem = 0; iElem < aNbElem; iElem++) {
            MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
            TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
            aSubMesh->myCellsSize += aNbConn;
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            anArray.resize(aNbConn);
            for(TInt iConn = 0; iConn < aNbConn; iConn++)
              anArray[iConn] = aConnSlice[iConn] - 1;
@@ -2060,17 +2183,17 @@ VISU_MedConvertor
        TInt aNbElem = aPolyedreInfo->GetNbElem();
        
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init((MED::PElemInfo)aPolyedreInfo); 
+         aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
          
          for(TInt iElem = 0; iElem < aNbElem; iElem++){
            MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            typedef std::set<TInt> TConnectSet;
            TConnectSet aConnectSet;
            TInt aNbFaces = aConnSliceArr.size();
@@ -2103,21 +2226,21 @@ VISU_MedConvertor
        TInt aNbElem = aCellInfo->GetNbElem();
        
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init((MED::PElemInfo)aCellInfo); 
+         aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
          aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
        
          TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
-         TVector<TInt> aConnect(aMNbNodes);
+         VISU::TVector<TInt> aConnect(aMNbNodes);
        
          for(TInt iElem = 0; iElem < aNbElem; iElem++) {
            MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            anArray.resize(aVNbNodes);
            
            if(anIsNodeNum){
@@ -2253,11 +2376,11 @@ VISU_MedConvertor
                    const VISU::PMEDMeshOnEntity theMeshOnEntity,
                    const VISU::PMEDFamily theFamily)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
 #ifndef _DEXCEPT_
   try{
 #endif
-    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
     const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
     INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
@@ -2268,7 +2391,7 @@ VISU_MedConvertor
     TInt anId = theFamily->myId;
 
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-    TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+    VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
     MED::EMaillage aType = aMeshInfo->GetType();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
@@ -2292,14 +2415,14 @@ VISU_MedConvertor
        }}
        if(anElemInfo){
          if(TInt aNbElem = anElemInfo->GetNbElem()){
-           TSubMeshID aSubMeshID;
+           VISU::TSubMeshID aSubMeshID;
            for(TInt iElem = 0; iElem < aNbElem; iElem++) 
              if(anElemInfo->GetFamNum(iElem) == anId)
                aSubMeshID.push_back(iElem);
            if(!aSubMeshID.empty()){
              VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
              INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
-             aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+             aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
            }
          }
        }
@@ -2308,14 +2431,14 @@ VISU_MedConvertor
        if(anElemInfo){
          TInt aNbElem = anElemInfo->GetNbCells();
          if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
-           TSubMeshID aSubMeshID;
+           VISU::TSubMeshID aSubMeshID;
            for(TInt iElem = 0; iElem < aNbElem; iElem++) 
              if(anElemInfo->GetFamNum(iElem) == anId)
                aSubMeshID.push_back(iElem);
            if(!aSubMeshID.empty()){
              VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
              INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
-             aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+             aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
            }
          }
        }
@@ -2342,32 +2465,32 @@ VISU_MedConvertor
 void
 LoadProfile(const MED::PWrapper& theMed,
            VISU::PMEDMesh theMesh,
-           MED::TTimeStampVal& theTimeStampVal,
+           MED::PTimeStampValueBase theTimeStampValue,
            VISU::TMEDValForTime& theValForTime,
            VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
   INITMSG(MYDEBUG,"LoadProfile"<<endl);
 
-  PMEDProfile aProfile = theValForTime.myProfile;
+  VISU::PMEDProfile aProfile = theValForTime.myProfile;
   if(aProfile->myIsDone)
     return;
 
-  const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-  const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+  const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+  const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
   MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
   for(; anIter != aGeom2Profile.end(); anIter++){
     MED::PProfileInfo aProfileInfo = anIter->second;
     MED::EGeometrieElement aMGeom = anIter->first;
     VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
 
-    TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+    VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
     if(anIter2 != aGeom2SubProfile.end()){
-      PMEDSubProfile aSubProfile = anIter2->second;
+      VISU::PMEDSubProfile aSubProfile = anIter2->second;
 
       MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
       if(!anElemNum.empty()){
-       TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+       VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
        TInt aSize = anElemNum.size();
        aSubMeshID.resize(aSize);
        for(TInt anId = 0; anId < aSize; anId++)
@@ -2383,13 +2506,13 @@ LoadProfile(const MED::PWrapper& theMed,
   {
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
     
-    TEntity aVEntity = theMeshOnEntity.myEntity;
+    VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
     MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
     
-    const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-    TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+    const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
     for(; anIter != aGeom2SubProfile.end(); anIter++){
-      const PMEDSubProfile& aSubProfile = anIter->second;
+      const VISU::PMEDSubProfile& aSubProfile = anIter->second;
       MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
       MED::PElemInfo anElemInfo;
       anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
@@ -2406,41 +2529,41 @@ LoadProfile(const MED::PWrapper& theMed,
 void
 LoadGaussMesh(const MED::PWrapper& theMed,
              VISU::PMEDMesh theMesh,
-             MED::TTimeStampVal& theTimeStampVal,
+             MED::PTimeStampValueBase theTimeStampValue,
              VISU::TMEDValForTime& theValForTime,
              VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
   INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
 
   // this part of code must be reimplemented in connection with GRILLE structures
   if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
-    EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+    EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
   
-  PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
+  VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
   if(!aGaussMesh || aGaussMesh->myIsDone)
     return;
 
   const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
   MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
 
-  TEntity aVEntity = theMeshOnEntity.myEntity;
+  VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
   MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
 
-  const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-  const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+  const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+  const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
   const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
 
-  TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
+  VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
   for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
-    PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
+    VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
     VISU::EGeometry aEGeom = aSubMeshIter->first;
     
     if(aGaussSubMesh->myIsDone)
       continue;
 
-    PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
-    const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+    VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+    const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
     MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
 
     MED::PPolygoneInfo aPolygoneInfo;
@@ -2471,12 +2594,13 @@ LoadGaussMesh(const MED::PWrapper& theMed,
     aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
 
     std::string aName;
-    MED::TGaussCoord aGaussCoord;
     bool anIsGaussCoord3D = false;
+    MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
+    MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
 
     MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
     if(aGaussIter != aGeom2Gauss.end()){
-      PMEDGauss aGauss = aGaussSubMesh->myGauss;
+      VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
       MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
       if(aGaussInfo){
        aName = aGaussInfo->GetName();
@@ -2545,24 +2669,17 @@ LoadGaussMesh(const MED::PWrapper& theMed,
     }
     
     if(anIsGaussCoord3D){
-      TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
-      TInt aNbGauss = aGaussCoord.GetNbGauss();
-      TInt aNbElem = aGaussCoord.GetNbElem();
-      TInt aDim = aGaussCoord.GetDim();
-      vtkIdType aNbCells = aNbElem*aNbGauss;
-      aCoords.Init(aNbCells,aDim);
-      for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
-       MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
-       for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
-         MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
-         TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
-         for(TInt aDimId = 0; aDimId < aDim; aDimId++)
-           aSlice[aDimId] = aCoordSlice[aDimId];
-       }
-      }
+      VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+      VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
+      aCoordHolder->Init(aGaussCoordPtr);
+      aCoords.Init(VISU::PCoordHolder(aCoordHolder));
       
-      aGaussSubMesh->myIsDone = true;;
+      aGaussSubMesh->myIsDone = true;
       
+      TInt aNbGauss = aGaussCoord.GetNbGauss();
+      TInt aNbElem = aGaussCoord.GetNbElem();
+      TInt aNbCells = aNbElem*aNbGauss;
+
       INITMSG(MYDEBUG,
              "- aEGeom = "<<aEGeom<<
              "; aName = '"<<aName<<"'"<<
@@ -2572,13 +2689,55 @@ LoadGaussMesh(const MED::PWrapper& theMed,
              "; aNbCells = "<<aNbCells<<
              endl);
     }else
-      EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+      EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
   }
   
   aGaussMesh->myIsDone = true;
 }
 
 
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+              const VISU::TGeom2SubProfile& theGeom2SubProfile,
+              VISU::PMEDValForTime theValForTime,
+              VISU::PMEDField theField)
+{
+  theField->myDataSize = 0;
+  TInt aNbComp = theField->myNbComp;
+
+  VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
+  for(; anIter != theGeom2SubProfile.end(); anIter++){
+    VISU::EGeometry aEGeom = anIter->first;
+    VISU::PMEDSubProfile aSubProfile(anIter->second);
+
+    TInt aNbElem = aSubProfile->myNbCells;
+    theField->myDataSize += aNbElem * aNbComp;
+
+    if(aSubProfile->myStatus != VISU::eRemoveAll){
+      TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
+
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
+             endl);
+      
+      VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+      typedef typename TimeStampValueType::TElement TElement;
+      typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
+      TVMeshValue* aMeshValue = new TVMeshValue();
+
+      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+      typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
+      PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
+      aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
+      aVMeshValue.reset(aMeshValue);
+    }
+  }
+}
+
 //---------------------------------------------------------------
 int 
 LoadValForTime(const MED::PWrapper& theMed,
@@ -2589,7 +2748,7 @@ LoadValForTime(const MED::PWrapper& theMed,
               bool theIsGauss,
               bool& theIsDone)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
   INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
 
   //Check on loading already done
@@ -2618,14 +2777,14 @@ LoadValForTime(const MED::PWrapper& theMed,
   MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
   MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
 
-  MED::PTimeStampVal aTimeStampVal = 
-    theMed->GetPTimeStampVal(aTimeStampInfo,
-                            aMKey2Profile,
-                            aKey2Gauss);
-
+  MED::PTimeStampValueBase aTimeStampValue = 
+    theMed->GetPTimeStampValue(aTimeStampInfo,
+                              aMKey2Profile,
+                              aKey2Gauss);
+  
   InitGaussProfile(theMed,
                   aMeshInfo,
-                  aTimeStampVal,
+                  aTimeStampValue,
                   theMeshOnEntity,
                   aMEntity,
                   aGeom2Size,
@@ -2633,73 +2792,37 @@ LoadValForTime(const MED::PWrapper& theMed,
 
   LoadProfile(theMed,
              theMesh,
-             aTimeStampVal,
+             aTimeStampValue,
              theValForTime,
              theMeshOnEntity);
   
   if(theIsGauss)
     LoadGaussMesh(theMed,
                  theMesh,
-                 aTimeStampVal,
+                 aTimeStampValue,
                  theValForTime,
                  theMeshOnEntity);
   
-  PMEDProfile aProfile = theValForTime->myProfile;
-  TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-
-  TInt aNbComp = theField->myNbComp;
+  VISU::PMEDProfile aProfile = theValForTime->myProfile;
+  VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
   INITMSGA(MYDEBUG,0,
           "- aMeshName = '"<<aMeshName<<"'"<<
           "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
           "; aMEntity = "<<aMEntity<<
-          "; aNbComp = "<<aNbComp<<
+          "; aNbComp = "<<theField->myNbComp<<
           endl);
 
-  theField->myDataSize = 0;
-
-  const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-  TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
-  for(; anIter != aGeom2SubProfile.end(); anIter++){
-    VISU::EGeometry aEGeom = anIter->first;
-    PMEDSubProfile aSubProfile(anIter->second);
-
-    TInt aNbElem = aSubProfile->myNbCells;
-    theField->myDataSize += aNbElem*aNbComp;
-
-    if(aSubProfile->myStatus != eRemoveAll){
-      TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
-
-      INITMSG(MYDEBUG,
-             "- aEGeom = "<<aEGeom<<
-             "; aNbElem = "<<aNbElem<<
-             "; aNbGauss = "<<aNbGauss<<
-             endl);
-      
-      TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
-      aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
-
-      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
-      const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
-      for(TInt iElem = 0; iElem < aNbElem; iElem++){
-       TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
-       MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-       ADDMSG(MYVALUEDEBUG,"{");
-       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-         TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
-         const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-         for(TInt iComp = 0; iComp < aNbComp; iComp++){
-           aVValueSlice[iComp] = aMValueSlice[iComp];
-           ADDMSG(MYVALUEDEBUG,aVValueSlice[iComp]<<" ");
-         }
-         ADDMSG(MYVALUEDEBUG,"| ");
-       }
-       ADDMSG(MYVALUEDEBUG,"} ");
-      }
-      ADDMSG(MYDEBUG,"\n");
-    }
-  }
-
+  if(aFieldInfo->GetType() == MED::eFLOAT64)
+    FillValForTime<MED::TFloatTimeStampValue>(aTimeStampValue,
+                                             aGeom2SubProfile,
+                                             theValForTime,
+                                             theField);
+  else
+    FillValForTime<MED::TIntTimeStampValue>(aTimeStampValue,
+                                           aGeom2SubProfile,
+                                           theValForTime,
+                                           theField);
   theIsDone = true;
 
   return 1; 
@@ -2715,14 +2838,14 @@ VISU_MedConvertor
                       VISU::PMEDField theField, 
                       VISU::PMEDValForTime theValForTime)
 {
-  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+  VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
   return LoadValForTime(theMed,
                        theMesh,
                        theMeshOnEntity,
                        theField,
                        theValForTime,
                        false,
-                       anIDMapperFilter->myIsVTKDone);
+                       anUnstructuredGridIDMapper->myIsVTKDone);
 }
 
 
@@ -2735,7 +2858,7 @@ VISU_MedConvertor
                           VISU::PMEDField theField, 
                           VISU::PMEDValForTime theValForTime)
 {
-  PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
+  VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
   return LoadValForTime(theMed,
                        theMesh,
                        theMeshOnEntity,
index c467f0c13339ff24e35fbf8b9fed52f5d6ea1c54..0f3fa042326d37b0593f61b69408a23f31614307 100644 (file)
 #define VISU_MedConvertor_HeaderFile
 
 #include "VISU_Convertor_impl.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
 
 #include "MED_Common.hxx"
 #include "MED_Structures.hxx"
+#include "MED_GaussUtils.hxx"
 
 #include <boost/thread/mutex.hpp>
 #include <qfileinfo.h>
 
 namespace VISU
 {
-  typedef TVector<TName> TNames;
+  //---------------------------------------------------------------
+  struct TMEDCoordHolder: TCoordHolder<MED::PNodeCoord>
+  {
+    virtual
+    const TCoord*
+    GetPointer() const
+    {
+      return &(*myCoord)[0];
+    }
+
+    virtual
+    TCoord*
+    GetPointer()
+    {
+      return &(*myCoord)[0];
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  struct TMEDGaussCoordHolder: TCoordHolderBase
+  {
+    MED::PGaussCoord myGaussCoord;
+
+    //! To initilize the instance
+    void
+    Init(const MED::PGaussCoord& theGaussCoord)
+    {
+      MED::TInt aNbGauss = theGaussCoord->GetNbGauss();
+      MED::TInt aNbElem = theGaussCoord->GetNbElem();
+      MED::TInt aDim = theGaussCoord->GetDim();
+      MED::TInt aNbCells = aNbElem * aNbGauss;
+      TCoordHolderBase::Init(aNbCells, aDim);
+      myGaussCoord = theGaussCoord;
+    }
+
+    //! Get slice of coordinates for defined node (const version)
+    virtual
+    TCCoordSlice
+    GetCoordSlice(vtkIdType theNodeId) const
+    {
+      MED::TInt anElemId = theNodeId / myGaussCoord->GetNbGauss();
+      MED::TCCoordSliceArr aCoordSliceArr = myGaussCoord->GetCoordSliceArr(anElemId);
+      MED::TInt aGaussId = theNodeId % myGaussCoord->GetNbGauss();
+      return aCoordSliceArr[aGaussId];
+    }
+
+    //! Get slice of coordinates for defined node
+    virtual
+    TCoordSlice 
+    GetCoordSlice(vtkIdType theNodeId)
+    {
+      MED::TInt anElemId = theNodeId / myGaussCoord->GetNbGauss();
+      MED::TCoordSliceArr aCoordSliceArr = myGaussCoord->GetCoordSliceArr(anElemId);
+      MED::TInt aGaussId = theNodeId % myGaussCoord->GetNbGauss();
+      return aCoordSliceArr[aGaussId];
+    }
+
+    virtual
+    unsigned char*
+    GetValuePtr()
+    {
+      return myGaussCoord->GetValuePtr();
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<class TValueType>
+  struct TTMEDMeshValue: TTMeshValueHolder<TValueType, 
+                                          MED::SharedPtr<MED::TTMeshValue<MED::TVector<TValueType> > > >
+  {
+    virtual
+    const TValueType*
+    GetPointer() const
+    {
+      return this->myContainer->GetPointer();
+    }
+
+    virtual
+    TValueType*
+    GetPointer()
+    {
+      return this->myContainer->GetPointer();
+    }
+  };
+
 
   //---------------------------------------------------------------
+  typedef std::map<vtkIdType, vtkIdType> TObj2VTKID;
+
   class TMEDNamedPointCoords: public virtual TNamedPointCoords
   {
-    MED::PNodeInfo myNodeInfo;
-    TNames myPointNames;
+    MED::EBooleen myIsElemNum; //!< Keeps whether the numeration exists or not
+    MED::PElemNum myElemNum; //!< Keeps objects numeration
+    mutable TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
+
+    MED::EVersion myVersion;
+    MED::PString myElemNames; //!< Keeps whether the names exists or not
+    MED::EBooleen myIsElemNames; //!< Keeps objects names
+
   public:
+    TMEDNamedPointCoords():
+      myIsElemNum(MED::eFAUX),
+      myIsElemNames(MED::eFAUX)
+    {}
+
     void
-    Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PNodeInfo& theNodeInfo);
+    Init(const MED::PNodeInfo& theNodeInfo,
+        MED::EVersion theVersion);
 
     void
-    Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PGrilleInfo& theGrilleInfo);
+    Init(const MED::PGrilleInfo& theGrilleInfo);
+
+    //! Get object number for node by its VTK one
+    virtual
+    vtkIdType
+    GetObjID(vtkIdType theID) const;
+
+    //! Get VTK number for node by its object one
+    virtual
+    vtkIdType
+    GetVTKID(vtkIdType theID) const;
 
+    //! Get name of node by its object number
     virtual
     std::string 
     GetNodeName(vtkIdType theObjID) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
-  typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
+  typedef MED::SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
 
 
   //---------------------------------------------------------------
@@ -60,7 +176,7 @@ namespace VISU
     MED::PMeshInfo myMeshInfo;
     MED::TEntityInfo myEntityInfo;
   };
-  typedef SharedPtr<TMEDMesh> PMEDMesh;
+  typedef MED::SharedPtr<TMEDMesh> PMEDMesh;
 
 
   //---------------------------------------------------------------
@@ -73,19 +189,24 @@ namespace VISU
     {}
 
     MED::EBooleen myIsElemNum;
-    MED::TElemNum myElemNum;
+    MED::PElemNum myElemNum;
 
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
+    
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
-  typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
+  typedef MED::SharedPtr<TMEDSubProfile> PMEDSubProfile;
 
 
   //---------------------------------------------------------------
   struct TMEDProfile: virtual TProfileImpl
   {};
-  typedef SharedPtr<TMEDProfile> PMEDProfile;
+  typedef MED::SharedPtr<TMEDProfile> PMEDProfile;
 
 
   //---------------------------------------------------------------
@@ -99,7 +220,7 @@ namespace VISU
     LessThan(const PGaussImpl& theGauss,
             bool& theResult) const;
   };
-  typedef SharedPtr<TMEDGauss> PMEDGauss;
+  typedef MED::SharedPtr<TMEDGauss> PMEDGauss;
 
 
   //---------------------------------------------------------------
@@ -110,35 +231,45 @@ namespace VISU
     {}
 
     MED::EBooleen myIsElemNum;
-    MED::TElemNum myElemNum;
+    MED::PElemNum myElemNum;
 
     virtual
     TGaussPointID
     GetObjID(vtkIdType theID,
             vtkIdType theStartID) const;
+    
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
-  typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
+  typedef MED::SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
 
 
   //---------------------------------------------------------------
   struct TMEDGaussMesh: virtual TGaussMeshImpl
   {};
-  typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
+  typedef MED::SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
 
 
   //---------------------------------------------------------------
   struct TMEDSubMesh: virtual TSubMeshImpl
   {
     TMEDSubMesh():
-      myIsElemNum(MED::eFAUX)
+      myIsElemNum(MED::eFAUX),
+      myIsElemNames(MED::eFAUX)
     {}
 
     MED::EBooleen myIsElemNum;
-    MED::TElemNum myElemNum;
-    MED::PElemInfo myElemInfo;
+    MED::PElemNum myElemNum;
+
+    MED::EVersion myVersion;
+    MED::PString myElemNames;
+    MED::EBooleen myIsElemNames;
 
     void
-    Init(const MED::PElemInfo& theElemInfo);
+    Init(const MED::PElemInfo& theElemInfo,
+        MED::EVersion theVersion);
 
     void
     Init(const MED::PGrilleInfo& theGrilleInfo);
@@ -150,8 +281,13 @@ namespace VISU
     virtual
     std::string 
     GetElemName(vtkIdType theObjID) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
-  typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
+  typedef MED::SharedPtr<TMEDSubMesh> PMEDSubMesh;
 
 
   //---------------------------------------------------------------
@@ -162,31 +298,31 @@ namespace VISU
     TFamilyID2CellsSize myFamilyID2CellsSize;
     MED::TGeom2Size myGeom2Size;
   };
-  typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+  typedef MED::SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
 
 
   //---------------------------------------------------------------
   struct TMEDFamily: virtual TFamilyImpl
   {};
-  typedef SharedPtr<TMEDFamily> PMEDFamily;
+  typedef MED::SharedPtr<TMEDFamily> PMEDFamily;
   
 
   //---------------------------------------------------------------
   struct TMEDGroup: virtual TGroupImpl
   {};
-  typedef SharedPtr<TMEDGroup> PMEDGroup;
+  typedef MED::SharedPtr<TMEDGroup> PMEDGroup;
 
 
   //---------------------------------------------------------------
   struct TMEDField: virtual TFieldImpl
   {};
-  typedef SharedPtr<TMEDField> PMEDField;
+  typedef MED::SharedPtr<TMEDField> PMEDField;
 
 
   //---------------------------------------------------------------
   struct TMEDValForTime: virtual TValForTimeImpl
   {};
-  typedef SharedPtr<TMEDValForTime> PMEDValForTime;
+  typedef MED::SharedPtr<TMEDValForTime> PMEDValForTime;
 
 }
 
index 0563dad2b58238f88a1bdb38a619b98c493b8334..a44432db801fc4c494dd8194545912b2ad65287d 100644 (file)
@@ -189,6 +189,12 @@ namespace VISU{
     return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
   }
 
+  Prs3d_ptr VISU_Gen_i::CreatePrs3d(VISUType theType,
+                                  SALOMEDS::Study_ptr theStudy)
+  {
+    return myVisuGen->CreatePrs3d(theType,theStudy);
+  }
+
   Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult, 
                                          const char* theMeshName, 
                                          VISU::Entity theEntity, 
@@ -225,98 +231,118 @@ namespace VISU{
   }
 
 
-  ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, 
-                                            const char* theMeshName, 
-                                            VISU::Entity theEntity, 
-                                            const char* theFieldName, 
-                                            CORBA::Double theIteration)
+  ScalarMap_ptr
+  VISU_Gen_i
+  ::ScalarMapOnField(Result_ptr theResult, 
+                    const char* theMeshName, 
+                    VISU::Entity theEntity,
+                    const char* theFieldName, 
+                    CORBA::Long theIteration)
   {
     return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
 
-  GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, 
-                                                const char* theMeshName, 
-                                                VISU::Entity theEntity, 
-                                                const char* theFieldName, 
-                                                CORBA::Double theIteration)
+  GaussPoints_ptr 
+  VISU_Gen_i
+  ::GaussPointsOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration)
   {
     return myVisuGen->GaussPointsOnField(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)
+  DeformedShape_ptr 
+  VISU_Gen_i
+  ::DeformedShapeOnField(Result_ptr theResult, 
+                        const char* theMeshName, 
+                        VISU::Entity theEntity,
+                        const char* theFieldName, 
+                        CORBA::Long theIteration)
   {
     return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
-  ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult, 
-                                                                          const char* theMeshName, 
-                                                                          VISU::Entity theEntity, 
-                                                                          const char* theFieldName, 
-                                                                          CORBA::Double theIteration)
+  ScalarMapOnDeformedShape_ptr 
+  VISU_Gen_i
+  ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult, 
+                                   const char* theMeshName, 
+                                   VISU::Entity theEntity,
+                                   const char* theFieldName, 
+                                   CORBA::Long theIteration)
   {
     return myVisuGen->ScalarMapOnDeformedShapeOnField(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)
+  Vectors_ptr 
+  VISU_Gen_i
+  ::VectorsOnField(Result_ptr theResult, 
+                  const char* theMeshName, 
+                  VISU::Entity theEntity,
+                  const char* theFieldName, 
+                  CORBA::Long theIteration)
   {
     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)
+  IsoSurfaces_ptr 
+  VISU_Gen_i
+  ::IsoSurfacesOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration)
   {
     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)
+  StreamLines_ptr 
+  VISU_Gen_i
+  ::StreamLinesOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration)
   {
     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)
+  CutPlanes_ptr 
+  VISU_Gen_i
+  ::CutPlanesOnField(Result_ptr theResult, 
+                    const char* theMeshName, 
+                    VISU::Entity theEntity,
+                    const char* theFieldName, 
+                    CORBA::Long theIteration)
   {
     return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
 
-  CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult, 
-                                          const char* theMeshName, 
-                                          VISU::Entity theEntity, 
-                                          const char* theFieldName, 
-                                          CORBA::Double theIteration)
+  CutLines_ptr 
+  VISU_Gen_i
+  ::CutLinesOnField(Result_ptr theResult, 
+                   const char* theMeshName, 
+                   VISU::Entity theEntity,
+                   const char* theFieldName, 
+                   CORBA::Long theIteration)
   {
     return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
 
-  Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult, 
-                                      const char* theMeshName, 
-                                      VISU::Entity theEntity, 
-                                      const char* theFieldName, 
-                                      CORBA::Double theIteration)
+  Plot3D_ptr 
+  VISU_Gen_i
+  ::Plot3DOnField(Result_ptr theResult, 
+                 const char* theMeshName, 
+                 VISU::Entity theEntity,
+                 const char* theFieldName, 
+                 CORBA::Long theIteration)
   {
     return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
@@ -416,4 +442,10 @@ namespace VISU{
     return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
   }     
 
+  VISU::ColoredPrs3dCache_ptr
+  VISU_Gen_i::
+  GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+  {
+    return myVisuGen->GetColoredPrs3dCache(theStudy);
+  }
 };
index 3f605b435e65e61e1ca1a7eaa3f048b7d0419a4f..d123bd7d6387215d05232f2fd69d186211083233 100644 (file)
@@ -29,7 +29,8 @@
 
 #include "SALOME_Component_i.hxx"
 
-namespace VISU{
+namespace VISU
+{
   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
                     public virtual ::Engines_Component_i
   {
@@ -62,6 +63,10 @@ namespace VISU{
     virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
     virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
 
+    Prs3d_ptr
+    CreatePrs3d(VISUType theType,
+               SALOMEDS::Study_ptr theStudy);
+
     //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,
@@ -77,34 +82,86 @@ namespace VISU{
                                     const char* theGroupName, const char* theNewName);
 
     //Create Presentation Of Results
-    virtual ScalarMap_ptr ScalarMapOnField
-                                      (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
-                                      const char* theFieldName, CORBA::Double theIteration);
-    virtual GaussPoints_ptr GaussPointsOnField
-                                      (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 CutLines_ptr CutLinesOnField
-                                      (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);
-    virtual Plot3D_ptr Plot3DOnField  (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
-                                      const char* theFieldName, CORBA::Double theIteration);
-    virtual ScalarMapOnDeformedShape_ptr ScalarMapOnDeformedShapeOnField
-                                      (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
-                                      const char* theFieldName, CORBA::Double theIteration);
+    virtual 
+    ScalarMap_ptr
+    ScalarMapOnField(Result_ptr theResult, 
+                    const char* theMeshName, 
+                    VISU::Entity theEntity,
+                    const char* theFieldName, 
+                    CORBA::Long theIteration);
+
+    virtual 
+    GaussPoints_ptr 
+    GaussPointsOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration);
+
+    virtual 
+    DeformedShape_ptr
+    DeformedShapeOnField(Result_ptr theResult, 
+                        const char* theMeshName, 
+                        VISU::Entity theEntity,
+                        const char* theFieldName, 
+                        CORBA::Long theIteration);
+
+    virtual 
+    Vectors_ptr
+    VectorsOnField(Result_ptr theResult, 
+                  const char* theMeshName, 
+                  VISU::Entity theEntity,
+                  const char* theFieldName, 
+                  CORBA::Long theIteration);
+
+    virtual
+    IsoSurfaces_ptr
+    IsoSurfacesOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration);
+
+    virtual
+    CutPlanes_ptr
+    CutPlanesOnField(Result_ptr theResult, 
+                    const char* theMeshName, 
+                    VISU::Entity theEntity,
+                    const char* theFieldName, 
+                    CORBA::Long theIteration);
+
+    virtual
+    CutLines_ptr
+    CutLinesOnField(Result_ptr theResult, 
+                   const char* theMeshName, 
+                   VISU::Entity theEntity,
+                   const char* theFieldName, 
+                   CORBA::Long theIteration);
+
+    virtual
+    StreamLines_ptr 
+    StreamLinesOnField(Result_ptr theResult, 
+                      const char* theMeshName, 
+                      VISU::Entity theEntity,
+                      const char* theFieldName, 
+                      CORBA::Long theIteration);
+
+    virtual
+    Plot3D_ptr
+    Plot3DOnField(Result_ptr theResult, 
+                 const char* theMeshName, 
+                 VISU::Entity theEntity,
+                 const char* theFieldName, 
+                 CORBA::Long theIteration);
+
+    virtual
+    ScalarMapOnDeformedShape_ptr
+    ScalarMapOnDeformedShapeOnField(Result_ptr theResult, 
+                                   const char* theMeshName, 
+                                   VISU::Entity theEntity,
+                                   const char* theFieldName, 
+                                   CORBA::Long theIteration);
+
     //Create Digital Presentation
     virtual Table_ptr CreateTable(const char* theTableEntry);
     virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
@@ -161,6 +218,10 @@ namespace VISU{
     virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
                                         CORBA::Boolean theIsPublished,
                                         CORBA::Boolean& theIsValidScript);   
+
+    virtual
+    VISU::ColoredPrs3dCache_ptr
+    GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
   };
 };
 
diff --git a/src/MULTIPR/MULTIPR_API.cxx b/src/MULTIPR/MULTIPR_API.cxx
new file mode 100755 (executable)
index 0000000..c58c0b3
--- /dev/null
@@ -0,0 +1,259 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_API.cxx
+ *
+ * \brief   see MULTIPR_API.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_API.hxx"
+#include "MULTIPR_Globals.hxx"
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_MeshDis.hxx"
+#include "MULTIPR_Utils.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include "MEDSPLITTER_API.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+
+//*****************************************************************************
+// Implementation
+//*****************************************************************************
+
+const char* multipr::getVersion()
+{
+    return "1.0.5";
+}
+
+
+void multipr::partitionneDomaine(const char* pMEDfilename, const char* pMeshName)
+{    
+    if (pMEDfilename == NULL) throw NullArgumentException("pMEDfilename should not be NULL", __FILE__, __LINE__);
+    if (pMeshName == NULL)    throw NullArgumentException("pMeshName should not be NULL", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Read the sequential mesh
+    //---------------------------------------------------------------------
+    cout << "Read sequential MED file: " << pMEDfilename << ": please wait... " << endl;
+    
+    multipr::Mesh mesh;
+    mesh.readSequentialMED(pMEDfilename, pMeshName);
+    cout << mesh << endl;
+    
+    //---------------------------------------------------------------------
+    // Build distributed mesh from groups
+    //---------------------------------------------------------------------
+    cout << "Build distributed mesh: please wait... " << endl;
+    
+    multipr::MeshDis* meshDis = NULL;
+    
+    try
+    {
+        meshDis = mesh.splitGroupsOfElements();
+    
+        //-------------------------------------------------------------
+        // Write distributed mesh
+        //-------------------------------------------------------------
+        cout << "Write distributed mesh: please wait... " << endl;
+        string strPrefix = removeExtension(pMEDfilename, ".med");    
+        meshDis->writeDistributedMED(strPrefix.c_str());
+        
+        delete meshDis;
+    }
+    catch (RuntimeException& e)
+    {
+        delete meshDis;
+        throw e;
+    }
+}
+
+
+void multipr::partitionneGrain(
+    const char* pMEDfilename, 
+    const char* pGroupName, 
+    int         pNbParts, 
+    int         pPartitionner)
+{
+    if (pMEDfilename == NULL) throw NullArgumentException("pMEDfilename should not be NULL", __FILE__, __LINE__);
+    if (pGroupName == NULL)   throw NullArgumentException("pGroupName should not be NULL", __FILE__, __LINE__);
+    if (pNbParts < 2)         throw IllegalArgumentException("pNbParts should be >= 2", __FILE__, __LINE__);
+    if ((pPartitionner != MULTIPR_METIS) && (pPartitionner != MULTIPR_SCOTCH)) throw NullArgumentException("pPartitionner should be METIS (0) or SCOTCH (1)", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Read the distributed mesh
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Read distributed MED file: " << pMEDfilename << ": please wait... " << endl);
+    
+    int ret = MEDformatConforme(pMEDfilename);
+    if (ret == 0) throw IOException("waiting for a distributed MED file (not a sequential one)", __FILE__, __LINE__);
+
+    multipr::MeshDis meshDis;
+    meshDis.readDistributedMED(pMEDfilename);
+    cout << meshDis << endl;
+    
+    //---------------------------------------------------------------------
+    // Split the given part (pGroupName)
+    //---------------------------------------------------------------------
+    if (pPartitionner == MULTIPR_METIS)
+    {
+        cout << "Use METIS" << endl;
+    }
+    else if (pPartitionner == MULTIPR_SCOTCH)
+    {
+        cout << "Use SCOTCH" << endl;
+    }
+    
+    meshDis.splitPart(pGroupName, pNbParts, pPartitionner);
+    cout << meshDis << endl;
+    
+    //---------------------------------------------------------------------
+    // Write new distributed mesh
+    //---------------------------------------------------------------------
+    string strPrefix = multipr::removeExtension(pMEDfilename, ".med");
+    meshDis.writeDistributedMED(strPrefix.c_str());
+}
+
+
+void multipr::decimePartition(
+    const char* pMEDfilename,
+    const char* pPartName,
+    const char* pFieldName,
+    int         pFieldIt,
+    const char* pFilterName,
+    double      pTMed,
+    double      pTLow,
+    double      pRadius,
+    int         pBoxing)
+{
+    //---------------------------------------------------------------------
+    // Check arguments
+    //---------------------------------------------------------------------
+    if (pMEDfilename == NULL) throw NullArgumentException("pMEDfilename should not be NULL", __FILE__, __LINE__);
+    if (pPartName == NULL) throw NullArgumentException("pPartName should not be NULL", __FILE__, __LINE__);
+    if (pFieldName == NULL) throw NullArgumentException("pFieldName should not be NULL", __FILE__, __LINE__);
+    if (pFieldIt < 1) throw IllegalArgumentException("pFieldIt: invalid field iteration; should be >= 1", __FILE__, __LINE__);
+    if (pTMed < 0.0) throw IllegalArgumentException("med res.: threshold must be > 0", __FILE__, __LINE__);
+    if (pTMed >= pTLow) throw IllegalArgumentException("threshold for med res. must be < threshold for low res.", __FILE__, __LINE__);
+    if (pRadius <= 0.0) throw IllegalArgumentException("radius should be > 0", __FILE__, __LINE__);
+    if ((pBoxing < 1) || (pBoxing > 200)) throw IllegalArgumentException("boxing should be in [1..200]", __FILE__, __LINE__);
+    
+    cout << "--decim file=" << pMEDfilename << " part=" << pPartName << " filter=" << pFilterName << " tmed=" << pTMed << " tlow=" << pTLow << " radius=" << pRadius << endl;
+    
+    //---------------------------------------------------------------------
+    // Read the distributed mesh
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Read distributed MED file: " << pMEDfilename << ": please wait... " << endl);
+
+    int ret = MEDformatConforme(pMEDfilename);
+    if (ret == 0) throw IOException("waiting for a distributed MED file (not a sequential one)", __FILE__, __LINE__);
+    
+    multipr::MeshDis meshDis;
+    meshDis.readDistributedMED(pMEDfilename);
+    cout << meshDis << endl;
+    
+    //---------------------------------------------------------------------
+    // Create 3 resolutions of the given part
+    //---------------------------------------------------------------------
+    meshDis.decimatePart(
+        pPartName, 
+        pFieldName,
+        pFieldIt,
+        pFilterName,
+        pTMed,
+        pTLow,
+        pRadius,
+        pBoxing);
+    cout << meshDis << endl;
+    
+    //---------------------------------------------------------------------
+    // Write new distributed mesh
+    //---------------------------------------------------------------------
+    string strPrefix = removeExtension(pMEDfilename, ".med"); // get prefix from the original MED filename    
+    meshDis.writeDistributedMED(strPrefix.c_str());
+}
+
+
+int multipr::merge(
+    std::vector<std::string> pMEDFilenameSrc,
+    const char*              pMeshName,
+    const char*              pFieldName,
+    const char*              pMEDFilenameDst)
+{
+    if (pMEDFilenameSrc.size() < 2) throw IllegalArgumentException("list must contain two files at least", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("pMeshName1 should not be NULL", __FILE__, __LINE__);
+    if (pMEDFilenameDst == NULL)  throw NullArgumentException("pMEDFilenameDst should not be NULL", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Read sources
+    //---------------------------------------------------------------------
+    std::vector<multipr::Mesh*> meshes;
+    for (unsigned i = 0 ; i < pMEDFilenameSrc.size() ; i++)
+    {
+        multipr::Mesh* mesh = new multipr::Mesh();
+        mesh->readSequentialMED(pMEDFilenameSrc[i].c_str(), pMeshName);
+        //mesh->setPrintAll(true);
+        //cout << (*mesh) << endl;
+        if (mesh->getNumberOfElements() != 0)
+        {
+            meshes.push_back(mesh);
+        }
+        else
+        {
+            delete mesh;
+        }
+    }
+    
+    // if no mesh (all meshes are empty) => return
+    if (meshes.size() == 0) return 0;
+    
+    // if only one non-empty mesh
+    if (meshes.size() == 1)
+    {
+        multipr::Mesh* mesh = meshes[0];
+        mesh->writeMED(pMEDFilenameDst);        
+        delete mesh;
+        return 1;
+    }
+        
+    //---------------------------------------------------------------------
+    // Merge sources and write resulting mesh to disk
+    //---------------------------------------------------------------------    
+    multipr::Mesh* meshFirst = meshes.back();
+    meshes.pop_back();
+    multipr::Mesh* meshMerged = meshFirst->mergePartial(meshes, pFieldName, -1);
+    //meshMerged->setPrintAll(true);
+    //cout << (*meshMerged) << endl;
+    
+    meshMerged->writeMED(pMEDFilenameDst);
+    
+    delete meshMerged;
+    delete meshFirst;
+    for (unsigned i = 0 ; i < meshes.size(); i++)
+    {
+        delete meshes[i];
+    }
+    return 1;
+}
+
+    
+// EOF
diff --git a/src/MULTIPR/MULTIPR_API.hxx b/src/MULTIPR/MULTIPR_API.hxx
new file mode 100755 (executable)
index 0000000..8edb008
--- /dev/null
@@ -0,0 +1,128 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_API.hxx
+ *
+ * \brief   Main header of the high level MULTIPR API.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_API_HXX
+#define MULTIPR_API_HXX
+
+#include <vector>
+#include <string>
+
+namespace multipr
+{
+
+
+enum Partitionner
+{
+    MULTIPR_METIS   = 0,
+    MULTIPR_SCOTCH  = 1
+    
+}; // enum Partitionner
+
+
+/**
+ * \fn     const char* getVersion()
+ * \brief  returns the current version of the MULTIPR API.
+ * \return the current version of the MULTIPR API. 
+ */
+const char* getVersion();
+
+
+/**
+ * \fn     void partitionneDomaine(const char* medFilename, const char* meshName)
+ * \brief  creates a distributed MED file (v2.3) by extracting all the groups from the mesh of a sequential MED file.
+ *         Assumes:
+ *         - the file is in MED format and can be read using MED file v2.3.
+ *         - the file is sequential (not a distributed MED).
+ *         - the file only contains TETRA10 elements (dimension of space and mesh is 3).
+ *         - the file have no profil.
+ * \param  medFilename filename of any valid sequential MED file with TETRA10 elements only.
+ * \param  meshName    name of the mesh to be distributed.
+ * \throw  RuntimeException if any error occurs.
+ */
+void partitionneDomaine(
+    const char* medFilename, 
+    const char* meshName);
+
+
+/**
+ * \fn     void partitionneGrain(const char* medFilename, const char* groupName, int nbParts, int partitionner)
+ * \brief  creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
+ *         Assumes:
+ *         - the file is a distributed MED file, previously created by partitionneDomaine()
+ *           (=> each part only contain 1 mesh, TETRA10 elements only)
+ *         - nbPart > 1
+ * \param  medFilename  filename of any valid distributed MED file previously created by partitionneDomaine(). 
+ * \param  partName     name of the part to be splitted.
+ * \param  nbParts      number of parts; must be > 1.
+ * \param  partitionner use value MULTIPR_METIS for Metis or MULTIPR_SCOTCH for Scotch.
+ * \throw  RuntimeException if any error occurs.
+ */
+ void partitionneGrain(
+     const char* medFilename, 
+     const char* partName, 
+     int         nbParts, 
+     int         partitionner=MULTIPR_METIS);
+
+/**
+ * \fn     void decimePartition(const char* medFilename, const char* partName, const char* fieldName, int fieldIt, const char* filterName, double tmed, double tlow, double radius);
+ * \brief  creates 3 resolutions of the given part of a distributed MED file (V2.3).
+ *         Assumes:
+ *         - the file is a distributed MED file, previously created by partitionneDomaine() or partitionneGrain()
+ *           (=> each part only contain 1 mesh, TETRA10 elements only)
+ * \param  medFilename filename of any valid distributed MED file previously created by partitionneDomaine or partitionneGrain.
+ * \param  partName    name of the part to be decimated.
+ * \param  fieldName   name of the field used for decimation.
+ * \param  fieldIt     iteration (time step) of the field.
+ * \param  filterName  name of the filter to be used.
+ * \param  tmed        threshold used for medium resolution.
+ * \param  tlow        threshold used for low resolution; tmed must be less than tlow
+ * \param  radius      radius used to determine the neighbourhood.
+ * \param  boxing      number of cells along each axis; must be >= 1; e.g. if 100 then acceleration grid will have 100*100*100 = 10**6 cells.
+ * \throw  RuntimeException if any error occurs.
+ */
+void decimePartition(
+    const char* medFilename,
+    const char* partName,
+    const char* fieldName,
+    int         fieldIt,
+    const char* filterName,
+    double      tmed,
+    double      tlow,
+    double      radius,
+    int         boxing);
+
+    
+/**
+ * \fn     void merge(...);
+ * \brief  merge a list of sequential MED file if possible.
+ * \param  medFilenameSrc  list of source file (sequential MED files).
+ * \param  meshName        name of the mesh (all mesh must have the same name).
+ * \param  fieldName       name of the field to merge (if NULL, merge all fields).
+ * \param  medFilenameDst  destination file.
+ * \return 1 if a mesh has been generated, 0 otherwise (e.g. if all the sources are empty meshes).
+ * \throw  RuntimeException if any error occurs.
+ */
+int merge(
+    std::vector<std::string> medFilenameSrc,
+    const char* meshName,
+    const char* fieldName,
+    const char* medFilenameDst);
+
+        
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_API_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_DecimationAccel.cxx b/src/MULTIPR/MULTIPR_DecimationAccel.cxx
new file mode 100755 (executable)
index 0000000..773e3d0
--- /dev/null
@@ -0,0 +1,326 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_DecimationAccel.cxx
+ *
+ * \brief   see MULTIPR_DecimationAccel.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_DecimationAccel.hxx"
+#include "MULTIPR_PointOfField.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class DecimationAccel implementation
+//*****************************************************************************
+
+
+ostream& operator<<(ostream& pOs, DecimationAccel& pA)
+{
+    pOs << "DecimationAccel:" << endl;
+    return pOs;
+}
+
+
+//*****************************************************************************
+// Class DecimationAccelGrid
+//*****************************************************************************
+
+DecimationAccelGrid::DecimationAccelGrid() 
+{
+    mGrid = NULL;
+    
+    reset();
+}
+
+
+DecimationAccelGrid::~DecimationAccelGrid()  
+{ 
+    reset();
+}
+
+
+void DecimationAccelGrid::reset()
+{
+    mNum = 0;
+    
+    mMin[0] = numeric_limits<med_float>::quiet_NaN();
+    mMin[1] = numeric_limits<med_float>::quiet_NaN();
+    mMin[2] = numeric_limits<med_float>::quiet_NaN();
+    
+    mMax[0] = numeric_limits<med_float>::quiet_NaN();
+    mMax[1] = numeric_limits<med_float>::quiet_NaN();
+    mMax[2] = numeric_limits<med_float>::quiet_NaN();
+    
+    mInvLen[0] = numeric_limits<med_float>::quiet_NaN();
+    mInvLen[1] = numeric_limits<med_float>::quiet_NaN();
+    mInvLen[2] = numeric_limits<med_float>::quiet_NaN();
+    
+    mSize[0] = 0;
+    mSize[1] = 0;
+    mSize[2] = 0;
+    
+    if (mGrid != NULL)
+    {
+        delete[] mGrid;
+        mGrid = NULL;
+    }
+    
+    mFlagPrintAll = false;
+}
+
+
+void DecimationAccelGrid::create(const std::vector<PointOfField>& pPts)
+{
+    // check if grid have been initialized
+    if (mSize[0] == 0) throw IllegalStateException("call setSize() before", __FILE__, __LINE__);
+    
+    // compute bbox of the grid
+    computeBBox(pPts);
+    
+    // allocate the grid
+    int size = mSize[0] * mSize[1] * mSize[2];
+    mGrid = new vector<PointOfField>[size];
+    
+    // fill the grid
+    mNum = pPts.size();
+    for (int i = 0 ; i < mNum ; i++)
+    {
+        vector<PointOfField>& cell = getCell(pPts[i]);
+        cell.push_back(pPts[i]);
+    }
+}
+
+
+void DecimationAccelGrid::configure(const char* pArgv)
+{
+    // check arguments
+    if (pArgv == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    int sizeX = 0;
+    int sizeY = 0;
+    int sizeZ = 0;
+    
+    int ret = sscanf(pArgv, "%d %d %d", &sizeX, &sizeY, &sizeZ);
+    
+    if (ret != 3) throw IllegalArgumentException("expected 3 parameters", __FILE__, __LINE__);
+    if (sizeX <= 0) throw IllegalArgumentException("number of cells along X-axis must be > 0", __FILE__, __LINE__);
+    if (sizeY <= 0) throw IllegalArgumentException("number of cells along Y-axis must be > 0", __FILE__, __LINE__);
+    if (sizeZ <= 0) throw IllegalArgumentException("number of cells along Z-axis must be > 0", __FILE__, __LINE__);
+    
+    reset();
+    
+    mSize[0] = sizeX;
+    mSize[1] = sizeY;
+    mSize[2] = sizeZ;
+}
+
+
+void DecimationAccelGrid::getCellCoord(
+        med_float pX, med_float pY, med_float pZ,
+        int* pIx, int* pIy, int* pIz) const
+{
+    med_float cx = (pX - mMin[0]) * mInvLen[0];
+    med_float cy = (pY - mMin[1]) * mInvLen[1];
+    med_float cz = (pZ - mMin[2]) * mInvLen[2];
+    
+    // clamp all indices to avoid overflow
+    *pIx = med_int(cx);
+    if (*pIx >= mSize[0]) *pIx = mSize[0] - 1;
+    else if (*pIx < 0) *pIx = 0;
+    
+    *pIy = med_int(cy);
+    if (*pIy >= mSize[1]) *pIy = mSize[1] - 1;
+    else if (*pIy < 0) *pIy = 0;
+    
+    *pIz = med_int(cz);
+    if (*pIz >= mSize[2]) *pIz = mSize[2] - 1;
+    else if (*pIz < 0) *pIz = 0;
+}
+
+
+int DecimationAccelGrid::getCellIndex(int pI, int pJ, int pK) const
+{    
+    int index = pK * (mSize[0] * mSize[1]) + pJ * mSize[0] + pI;
+    
+    return index;
+}
+
+
+vector<PointOfField>& DecimationAccelGrid::getCell(const PointOfField& pPt)
+{
+    int ix, iy, iz;
+    
+    getCellCoord(
+        pPt.mXYZ[0], pPt.mXYZ[1], pPt.mXYZ[2],
+        &ix, &iy, &iz);
+    
+    int index = getCellIndex(ix, iy, iz);
+    
+    return mGrid[index];
+}
+
+
+vector<PointOfField> DecimationAccelGrid::findNeighbours(
+    med_float pCenterX,
+    med_float pCenterY,
+    med_float pCenterZ,
+    med_float pRadius) const
+{    
+    //---------------------------------------------------------------------
+    // Determine the axis aligned bounding box of the sphere ((x, y, z), r)
+    //---------------------------------------------------------------------
+    med_float sphereBBoxMin[3];
+    med_float sphereBBoxMax[3];
+    
+    sphereBBoxMin[0] = pCenterX - pRadius;
+    sphereBBoxMin[1] = pCenterY - pRadius;
+    sphereBBoxMin[2] = pCenterZ - pRadius;
+
+    sphereBBoxMax[0] = pCenterX + pRadius;
+    sphereBBoxMax[1] = pCenterY + pRadius;
+    sphereBBoxMax[2] = pCenterZ + pRadius;
+
+    //---------------------------------------------------------------------
+    // Determine the cells of the grid intersected by the sphere ((x, y, z), r)
+    // => range of cells are [iMinCell[0], iMaxCell[0]] x [iMinCell[1], iMaxCell[1]] x [iMinCell[2], iMaxCell[2]]
+    //---------------------------------------------------------------------
+    int iMinCell[3];
+    int iMaxCell[3];
+
+    getCellCoord(sphereBBoxMin[0], sphereBBoxMin[1], sphereBBoxMin[2], 
+            &iMinCell[0], &iMinCell[1], &iMinCell[2]);
+
+    getCellCoord(sphereBBoxMax[0], sphereBBoxMax[1], sphereBBoxMax[2], 
+            &iMaxCell[0], &iMaxCell[1], &iMaxCell[2]);
+
+    //---------------------------------------------------------------------
+    // Collect points of the field which are in the sphere
+    //---------------------------------------------------------------------
+    vector<PointOfField> res;
+    
+/*
+// debug
+cout << "Center = " << pCenterX << " " << pCenterY << " " << pCenterZ << endl;
+cout << "Radius = " << pRadius << endl;
+cout << "Visited cells : [" << iMinCell[0] << " ; " << iMaxCell[0] << "] x ["<< iMinCell[1] << " ; " << iMaxCell[1] << "] x [" << iMinCell[2] << " ; " << iMaxCell[2] << "]" << endl;
+*/
+    
+    // for all the cells in the grid intersected by the sphere ((x, y, z), r)
+    for (int i = iMinCell[0] ; i <= iMaxCell[0] ; i++)
+    {
+        for (int j = iMinCell[1] ; j <= iMaxCell[1] ; j++)
+        {
+            for (int k = iMinCell[2] ; k <= iMaxCell[2] ; k++)
+            {
+                int idCell = getCellIndex(i, j, k);
+
+//printf("DEBUG: visited cell(%d %d %d) -> %d\n", i, j, k, idCell);
+
+                vector<PointOfField>& cell = mGrid[idCell];
+            
+                // for all the points in the current cell
+                for (vector<PointOfField>::const_iterator itPoint = cell.begin() ; itPoint != cell.end() ; itPoint++)
+                {
+                    const PointOfField& currentPt = *itPoint;
+                    
+                    // test if currentPt is in the sphere ((x, y, z), r)
+                    med_float vecX = currentPt.mXYZ[0] - pCenterX;
+                    med_float vecY = currentPt.mXYZ[1] - pCenterY;
+                    med_float vecZ = currentPt.mXYZ[2] - pCenterZ;
+                    
+                    med_float norm = med_float( sqrt( vecX*vecX + vecY*vecY + vecZ*vecZ ) );
+                    if (norm < pRadius)
+                    {
+                        // only add the point if it is different from (x, y, z)
+                        if ((currentPt.mXYZ[0] != pCenterX) ||
+                            (currentPt.mXYZ[1] != pCenterY) ||
+                            (currentPt.mXYZ[2] != pCenterZ))
+                        {
+                            res.push_back(currentPt);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    return res;
+}
+
+
+void DecimationAccelGrid::computeBBox(const std::vector<PointOfField>& pPts)
+{
+    for (int itDim = 0 ; itDim < 3 ; itDim++) 
+    { 
+        mMin[itDim] = numeric_limits<med_float>::max();
+        mMax[itDim] = -mMin[itDim];
+    }
+    
+    for (unsigned i = 0 ; i < pPts.size() ; i++)
+    {
+        for (int itDim = 0 ; itDim < 3 ; itDim++)
+        {
+            med_float coord = pPts[i].mXYZ[itDim];
+            if (coord < mMin[itDim]) mMin[itDim] = coord;
+            if (coord > mMax[itDim]) mMax[itDim] = coord;
+        }
+    }
+
+    mInvLen[0] = med_float(mSize[0]) / (mMax[0] - mMin[0]);
+    mInvLen[1] = med_float(mSize[1]) / (mMax[1] - mMin[1]);
+    mInvLen[2] = med_float(mSize[2]) / (mMax[2] - mMin[2]);
+}
+
+
+ostream& operator<<(ostream& pOs, DecimationAccelGrid& pG)
+{
+    pOs << "DecimationAccelGrid:" << endl;
+    pOs << "    Num=" << pG.mNum << endl;
+    pOs << "    Size=" << pG.mSize[0] << " x " << pG.mSize[1] << " x " << pG.mSize[2] << endl;
+    pOs << "    BBox=[" << pG.mMin[0] << " ; " << pG.mMax[0] << "] x [" << pG.mMin[1] << " ; " << pG.mMax[1] << "] x [" << pG.mMin[2] << " ; " << pG.mMax[2] << "]" << endl;
+    pOs << "    Inv len.=" << pG.mInvLen[0] << " ; " << pG.mInvLen[1] << " ; " << pG.mInvLen[2] << endl;
+    
+    if (pG.mFlagPrintAll)
+    {
+        int checkNumCells = 0;
+        int numCells = pG.mSize[0] * pG.mSize[1] * pG.mSize[2];
+        for (int i = 0 ; i < numCells ; i++)
+        {
+            vector<PointOfField>& cell = pG.mGrid[i];
+            cout << "    Cell " << i << ": #=" << cell.size() << ": " << endl;
+            for (unsigned j = 0 ; j < cell.size() ; j++)
+            {
+                cout << "        " << cell[j] << endl;
+            }
+            checkNumCells += cell.size();
+        }
+        
+        if (pG.mNum != checkNumCells) throw IllegalStateException("", __FILE__, __LINE__);
+    }
+    
+    return pOs;
+}
+
+
+} // namespace multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_DecimationAccel.hxx b/src/MULTIPR/MULTIPR_DecimationAccel.hxx
new file mode 100755 (executable)
index 0000000..3697558
--- /dev/null
@@ -0,0 +1,258 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_DecimationAccel.hxx
+ *
+ * \brief   Interface DecimationAccel: acceleration structure used for decimation.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_DECIMATION_ACCEL_HXX
+#define MULTIPR_DECIMATION_ACCEL_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+#include <vector>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Predeclaration
+//*****************************************************************************
+
+class PointOfField;
+
+
+//*****************************************************************************
+// Interface DecimationAccel
+//*****************************************************************************
+
+class DecimationAccel
+{    
+public:
+    
+    /** 
+     * Builds an empty DecimationAccel (default constructor).
+     */
+    DecimationAccel() { /* do nothing */ }
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~DecimationAccel() { /* do nothing */ } 
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Interface. Configures this acceleration structure. String is used for genericity.
+     * \param  pArgv all the configuration parameters in a string.
+     */
+    virtual void configure(const char* pArgv) = 0;
+    
+    /**
+     * Interface. Creates a new acceleration structure and fills it with the given list of points.
+     * \param  pPts list of points to be inserted in the acceleration structure.
+     */
+    virtual void create(const std::vector<PointOfField>& pPts) = 0;
+    
+    /**
+     * Interface. Finds all the points in a sphere defined by its center (x,y,z) and its radius.
+     * \param  pCenterX x-coordinates of the center of the sphere.
+     * \param  pCenterY y-coordinates of the center of the sphere.
+     * \param  pCenterZ z-coordinates of the center of the sphere.
+     * \param  pRadius  radius of the sphere.
+     * \return all the points in a sphere defined by its center (x,y,z) and its radius.
+     */
+    virtual std::vector<PointOfField> findNeighbours(
+        med_float pCenterX,
+        med_float pCenterY,
+        med_float pCenterZ,
+        med_float pRadius) const = 0;
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any GaussLoc to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pA  any DecimationAccel.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, DecimationAccel& pA);
+    
+protected:
+
+    bool mFlagPrintAll;  /** Flag to control the behaviour of the stream operator <<. */
+    
+private:
+    
+    // do not allow copy constructor
+    DecimationAccel(const DecimationAccel&);
+    
+    // do not allow copy
+    DecimationAccel& operator=(const DecimationAccel&);
+    
+    // do not allow operator ==
+    bool operator==(const DecimationAccel&); 
+
+}; // class DecimationAccel
+
+
+//*****************************************************************************
+// Interface DecimationFilter and factory to build filters.
+//*****************************************************************************
+
+class DecimationAccelGrid : public DecimationAccel
+{
+public:
+
+    /**
+     * Builds an empty DecimationAccelGrid (default constructor).
+     */
+    DecimationAccelGrid();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~DecimationAccelGrid();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Configures this acceleration structure. String is used for genericity.
+     * \param  pArgv assumes "size_x size_y size_z": number of cells along each axis.
+     */
+    virtual void configure(const char* pArgv);
+    
+    /**
+     * Creates a new acceleration structure and fills it with the given list of points.
+     * setSize() must have been called before.
+     * \param  pPts list of points to be inserted in the acceleration structure.
+     * \throw  IllegalStateException if setSize() has not been called before.
+     */
+    virtual void create(const std::vector<PointOfField>& pPts);
+    
+    /**
+     * Finds all the points in a sphere defined by its center (x,y,z) and its radius.
+     * \param  pCenterX x-coordinates of the center of the sphere.
+     * \param  pCenterY y-coordinates of the center of the sphere.
+     * \param  pCenterZ z-coordinates of the center of the sphere.
+     * \param  pRadius  radius of the sphere.
+     * \return all the points in a sphere defined by its center (x,y,z) and its radius.
+     */
+    virtual std::vector<PointOfField> findNeighbours(
+        med_float pCenterX,
+        med_float pCenterY,
+        med_float pCenterZ,
+        med_float pRadius) const;
+    
+    /**
+     * Returns the coordinates of the cell which contain the point (x,y,z).
+     * Clamping is performed on (pIx, pIy, pIz) to avoid out of bounds.
+     * \param  pX  (in) X-coordinates of the point.
+     * \param  pY  (in) Y-coordinates of the point.
+     * \param  pZ  (in) Z-coordinates of the point.
+     * \param  pIx (out) X-index of the cell which contain the point (x,y,z).
+     * \param  pIy (out) Y-index.
+     * \param  pIz (out) Z-index.
+     */
+    void getCellCoord(
+        med_float pX, med_float pY, med_float pZ,
+        int* pIx, int* pIy, int* pIz) const;
+    
+    /**
+     * Returns the index of the cell whose coordinates are (i, j, k).
+     * \param  pI
+     * \param  pJ
+     * \param  pK
+     * \return the index of the cell (i, j, k).
+     */
+    int getCellIndex(int pI, int pJ, int pK) const;
+    
+    /**
+     * Returns the list of points contained in the cell of pPt.
+     * \param  pPt any point which coordinates are in the bbox of this acceleration structure.
+     * \return the list of points contained in the cell of pPt.
+     */
+    std::vector<PointOfField>& getCell(const PointOfField& pPt);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Dumps any GaussLoc to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pG  any DecimationAccelGrid.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, DecimationAccelGrid& pG);
+    
+private:
+    
+    /**
+     * Computes the axis-aligned bounding box of a set of points.
+     * Sets the fields mMin/mMax.
+     * \param  pPts list of points.
+     */
+    void computeBBox(const std::vector<PointOfField>& pPts);
+    
+private:
+    
+    int                         mNum;        /**< Number of points in the grid. */
+    med_float                   mMin[3];     /**< Bounding box, min corner. */
+    med_float                   mMax[3];     /**< Bounding box, max corner. */
+    med_float                   mInvLen[3];  /**< 1/length of cells, along each dimension; used to accelerate getCellCoord(). */
+    med_int                     mSize[3];    /**< Number of cells along each dimension. */
+    std::vector<PointOfField>*  mGrid;       /**< Flatten grid structure; each cell is a vector of PointOfField. */        
+    
+private:
+    
+    // do not allow copy constructor
+    DecimationAccelGrid(const DecimationAccelGrid&);
+    
+    // do not allow copy
+    DecimationAccelGrid& operator=(const DecimationAccelGrid&);
+    
+    // do not allow operator ==
+    bool operator==(const DecimationAccelGrid&); 
+    
+}; // class DecimationAccelGrid
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_DECIMATION_ACCEL_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_DecimationFilter.cxx b/src/MULTIPR/MULTIPR_DecimationFilter.cxx
new file mode 100755 (executable)
index 0000000..05c5c57
--- /dev/null
@@ -0,0 +1,309 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_DecimationFilter.cxx
+ *
+ * \brief   see MULTIPR_DecimationFilter.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_DecimationFilter.hxx"
+#include "MULTIPR_Field.hxx"
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_PointOfField.hxx"
+#include "MULTIPR_DecimationAccel.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class DecimationFilter implementation
+//*****************************************************************************
+
+// Factory used to build all filters from their name.
+DecimationFilter* DecimationFilter::create(const char* pFilterName)
+{
+    if (pFilterName == NULL) throw NullArgumentException("filter name should not be NULL", __FILE__, __LINE__);
+    
+    if (strcmp(pFilterName, "Filtre_GradientMoyen") == 0)
+    {
+        return new DecimationFilterGradAvg();
+    }
+    else
+    {
+        throw IllegalArgumentException("unknown filter", __FILE__, __LINE__);
+    }
+}
+
+
+//*****************************************************************************
+// Class DecimationFilterGradAvg
+//*****************************************************************************
+
+DecimationFilterGradAvg::DecimationFilterGradAvg() 
+{
+    // do nothing
+}
+
+
+DecimationFilterGradAvg::~DecimationFilterGradAvg()  
+{ 
+    // do nothing
+}
+
+
+Mesh* DecimationFilterGradAvg::apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh)
+{
+    //---------------------------------------------------------------------
+    // Retrieve and check parameters
+    //---------------------------------------------------------------------
+    if (pMesh == NULL) throw NullArgumentException("pMesh should not be NULL", __FILE__, __LINE__);
+    if (pArgv == NULL) throw NullArgumentException("pArgv should not be NULL", __FILE__, __LINE__);
+    if (pNameNewMesh == NULL) throw NullArgumentException("pNameNewMesh should not be NULL", __FILE__, __LINE__);
+    
+    char   fieldName[MED_TAILLE_NOM + 1];
+    int    fieldIt;
+    double threshold;
+    double radius;
+    int    boxing; // number of cells along axis (if 100 then grid will have 100*100*100 = 10**6 cells)
+    
+    int ret = sscanf(pArgv, "%s %d %lf %lf %d",
+        fieldName,
+        &fieldIt,
+        &threshold,
+        &radius,
+        &boxing);
+    
+    if (ret != 5) throw IllegalArgumentException("wrong number of arguments for filter GradAvg; expected 5 parameters", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Retrieve field = for each point: get its coordinate and the value of the field
+    //---------------------------------------------------------------------
+    Field* field = pMesh->getFieldByName(fieldName);
+    
+    if (field == NULL) throw IllegalArgumentException("field not found", __FILE__, __LINE__);
+    if ((fieldIt < 1) || (fieldIt > field->getNumberOfTimeSteps())) throw IllegalArgumentException("invalid field iteration", __FILE__, __LINE__);
+    
+    vector<PointOfField> points;
+    pMesh->getAllPointsOfField(field, fieldIt, points);
+
+    //---------------------------------------------------------------------
+    // Creates acceleration structure used to compute gradient
+    //---------------------------------------------------------------------
+    DecimationAccel* accel = new DecimationAccelGrid();
+    char strCfg[256]; // a string is used for genericity
+    sprintf(strCfg, "%d %d %d", boxing, boxing, boxing);
+    accel->configure(strCfg);
+    accel->create(points);
+    
+    //---------------------------------------------------------------------
+    // Collects elements of the mesh to be kept
+    //---------------------------------------------------------------------
+    set<int> elementsToKeep;
+    
+    int numElements = pMesh->getNumberOfElements();
+    int numGaussPointsByElt = points.size() / numElements; // for a TETRA10, should be 5 for a field of elements and 10 for a field of nodes
+    
+    // for each element
+    for (int itElt = 0 ; itElt < numElements ; itElt++)
+    {
+        bool keepElement = false;
+        
+        // for each Gauss point of the current element
+        for (int itPtGauss = 0 ; itPtGauss < numGaussPointsByElt ; itPtGauss++)
+        {
+            const PointOfField& currentPt = points[itElt * numGaussPointsByElt + itPtGauss];
+            
+            vector<PointOfField> neighbours = accel->findNeighbours(
+                currentPt.mXYZ[0], 
+                currentPt.mXYZ[1], 
+                currentPt.mXYZ[2], 
+                radius);
+            
+            // if no neighbours => keep element
+            if (neighbours.size() == 0)
+            {
+                keepElement = true;
+                break;
+            }
+            
+            // otherwise compute gradient...
+            med_float normGrad = computeNormGrad(currentPt, neighbours);
+            
+            // debug
+            //cout << (itElt * numGaussPointsByElt + j) << ": " << normGrad << endl;
+            
+            if ((normGrad >= threshold) || isnan(normGrad))
+            {
+                keepElement = true;
+                break;
+            }
+        }
+        
+        if (keepElement)
+        {
+            // add index of the element to keep (index must start at 1)
+            elementsToKeep.insert(itElt + 1);
+        }
+    }
+
+    //---------------------------------------------------------------------
+    // Cleans
+    //---------------------------------------------------------------------
+    delete accel;
+    
+    //---------------------------------------------------------------------
+    // Create the final mesh by extracting elements to keep from the current mesh
+    //---------------------------------------------------------------------
+    Mesh* newMesh = pMesh->createFromSetOfElements(elementsToKeep, pNameNewMesh);
+    
+    return newMesh;
+}
+
+
+void DecimationFilterGradAvg::getGradientInfo(
+        Mesh*       pMesh, 
+        const char* pFieldName, 
+        int         pFieldIt, 
+        double      pRadius,
+        int         pBoxing,
+        double*     pOutGradMin,
+        double*     pOutGradAvg,
+        double*     pOutGradMax)
+{
+    if (pMesh == NULL) throw NullArgumentException("pMesh should not be NULL", __FILE__, __LINE__);
+    if (pFieldName == NULL) throw NullArgumentException("pFieldName should not be NULL", __FILE__, __LINE__);
+    
+    Field* field = pMesh->getFieldByName(pFieldName);
+    
+    if (field == NULL) throw IllegalArgumentException("field not found", __FILE__, __LINE__);
+    if ((pFieldIt < 1) || (pFieldIt > field->getNumberOfTimeSteps())) throw IllegalArgumentException("invalid field iteration", __FILE__, __LINE__);
+    
+    vector<PointOfField> points;
+    pMesh->getAllPointsOfField(field, pFieldIt, points);
+
+    //---------------------------------------------------------------------
+    // Creates acceleration structure used to compute gradient
+    //---------------------------------------------------------------------
+    DecimationAccel* accel = new DecimationAccelGrid();
+    char strCfg[256]; // a string is used for genericity
+    sprintf(strCfg, "%d %d %d", pBoxing, pBoxing, pBoxing);
+    accel->configure(strCfg);
+    accel->create(points);
+    
+    //---------------------------------------------------------------------
+    // Collects elements of the mesh to be kept
+    //---------------------------------------------------------------------
+    
+    int numElements = pMesh->getNumberOfElements();
+    int numGaussPointsByElt = points.size() / numElements; // for a TETRA10, should be 5 for a field of elements and 10 for a field of nodes
+    
+    *pOutGradMax = -1e300;
+    *pOutGradMin = 1e300;
+    *pOutGradAvg = 0.0;
+    int count = 0;
+    
+    //cout << "numElements=" << numElements << endl;
+    //cout << "num gauss pt by elt=" << numGaussPointsByElt << endl;
+    
+    // for each element
+    for (int itElt = 0 ; itElt < numElements ; itElt++)
+    {
+        // for each Gauss point of the current element
+        for (int itPtGauss = 0 ; itPtGauss < numGaussPointsByElt ; itPtGauss++)
+        {
+            const PointOfField& currentPt = points[itElt * numGaussPointsByElt + itPtGauss];
+            
+            vector<PointOfField> neighbours = accel->findNeighbours(
+                currentPt.mXYZ[0], 
+                currentPt.mXYZ[1], 
+                currentPt.mXYZ[2], 
+                pRadius);
+            
+            // if no neighbours => keep element
+            if (neighbours.size() == 0)
+            {
+                continue;
+            }
+            
+            // otherwise compute gradient...
+            med_float normGrad = computeNormGrad(currentPt, neighbours);
+            
+            // debug
+            //cout << (itElt * numGaussPointsByElt + j) << ": " << normGrad << endl;
+            
+            if (!isnan(normGrad))
+            {
+                if (normGrad > *pOutGradMax) *pOutGradMax = normGrad;
+                if (normGrad < *pOutGradMin) *pOutGradMin = normGrad;
+                *pOutGradAvg += normGrad;
+                count++;
+            }
+        }
+    }
+    
+    if (count != 0) *pOutGradAvg /= double(count);
+
+    //---------------------------------------------------------------------
+    // Cleans
+    //---------------------------------------------------------------------
+    delete accel;
+}
+
+
+med_float DecimationFilterGradAvg::computeNormGrad(const PointOfField& pPt, const std::vector<PointOfField>& pNeighbours) const
+{
+    med_float gradX = 0.0;
+    med_float gradY = 0.0;
+    med_float gradZ = 0.0;
+    // for each neighbour
+    for (unsigned i = 0 ; i < pNeighbours.size() ; i++)
+    {
+        const PointOfField& neighbourPt = pNeighbours[i];
+        
+        med_float vecX = neighbourPt.mXYZ[0] - pPt.mXYZ[0];
+        med_float vecY = neighbourPt.mXYZ[1] - pPt.mXYZ[1];
+        med_float vecZ = neighbourPt.mXYZ[2] - pPt.mXYZ[2];
+        
+        med_float norm = med_float( sqrt( vecX*vecX + vecY*vecY + vecZ*vecZ ) );
+        med_float val =  neighbourPt.mVal - pPt.mVal;
+        
+        val /= norm;
+        
+        gradX += vecX * val;
+        gradY += vecY * val;
+        gradZ += vecZ * val;
+    }
+    
+    med_float invSize = 1.0 / med_float(pNeighbours.size());
+    
+    gradX *= invSize;
+    gradY *= invSize;
+    gradZ *= invSize;
+    
+    med_float norm = med_float( sqrt( gradX*gradX + gradY*gradY + gradZ*gradZ ) );
+    
+    return norm;
+    
+}
+
+
+} // namespace multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_DecimationFilter.hxx b/src/MULTIPR/MULTIPR_DecimationFilter.hxx
new file mode 100755 (executable)
index 0000000..34e201e
--- /dev/null
@@ -0,0 +1,168 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_DecimationFilter.hxx
+ *
+ * \brief   Interface DecimationFilter: filter used for decimation.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_DECIMATION_FILTER_HXX
+#define MULTIPR_DECIMATION_FILTER_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+#include <vector>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Predeclaration
+//*****************************************************************************
+
+class Mesh;
+class PointOfField;
+
+
+//*****************************************************************************
+// Interface DecimationFilter and factory to build filters.
+// Should be derivated to implement new filter.
+//*****************************************************************************
+
+class DecimationFilter
+{
+public:
+    /**
+     * Decimation filter factory. Must be used to build any new filter from its name.
+     * \param  pFilterName name of the filter to be instanciated.
+     * \return a new instance of the given filter. 
+     */
+    static DecimationFilter* create(const char* pFilterName);
+    
+public:
+    
+    /** 
+     * Builds an empty DecimationFilter (default constructor).
+     */
+    DecimationFilter() { /* do nothing */ }
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~DecimationFilter() { /* do nothing */ } 
+    
+    /**
+     * Interface. Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
+     * \param  pMesh        any mesh to be decimated; must not be NULL.
+     * \param  pArgv        all the arguments of the filter as a string; must not be NULL.
+     * \param  pNameNewMesh name of the decimated mesh; must not be NULL.
+     * \return the decimated mesh.
+     */
+    virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh) = 0;
+    
+private:
+    
+    // do not allow copy constructor
+    DecimationFilter(const DecimationFilter&);
+    
+    // do not allow copy
+    DecimationFilter& operator=(const DecimationFilter&);
+    
+    // do not allow operator ==
+    bool operator==(const DecimationFilter&); 
+
+}; // class DecimationFilter
+
+
+//*****************************************************************************
+// Filter : Average Gradient
+//*****************************************************************************
+
+class DecimationFilterGradAvg : public DecimationFilter
+{
+public:
+
+    /**
+     * Builds an empty DecimationFilterGradAvg (default constructor).
+     */
+    DecimationFilterGradAvg();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~DecimationFilterGradAvg();
+    
+    /**
+     * Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
+     * 
+     * For each element
+     *     Keep this element if all its points (related to a field) have a |gradient| > threshold.
+     *
+     * For each point, gradient is computed by considering all the neighbours in a sphere of radius r.
+     *
+     * \param  pMesh        any mesh to be decimated; must not be NULL.
+     * \param  pArgv        all the arguments of the filter as a string; must not be NULL.
+     *                      for GradAvg, expected "fieldName fieldIt threshold radius boxing" (5 parameters).
+     * \param  pNameNewMesh name of the decimated mesh; must not be NULL.
+     * \return the decimated mesh.
+     */
+    virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh);
+    
+    /**
+     * Returns information about gradient.
+     */
+    void getGradientInfo(
+        Mesh*       pMesh, 
+        const char* pFieldName, 
+        int         pFieldIt, 
+        double      pRadius,
+        int         pBoxing,
+        double*     pOutGradMin,
+        double*     pOutGradAvg,
+        double*     pOutGradMax);
+    
+private:
+
+    /**
+     * Returns the norm of the gradient of the field at the given point.
+     * Sub-method used by apply().
+     * \param  pPt        any point in the field.
+     * \param  pNeigbours neighbourhood of pPt.
+     * \return the norm of the gradient of the field in pPt.
+     */
+    med_float computeNormGrad(const PointOfField& pPt, const std::vector<PointOfField>& pNeighbours) const;
+    
+private:
+    
+    // do not allow copy constructor
+    DecimationFilterGradAvg(const DecimationFilterGradAvg&);
+    
+    // do not allow copy
+    DecimationFilterGradAvg& operator=(const DecimationFilterGradAvg&);
+    
+    // do not allow operator ==
+    bool operator==(const DecimationFilterGradAvg&); 
+    
+}; // class DecimationFilterGradAvg
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_DECIMATION_FILTER_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Elements.cxx b/src/MULTIPR/MULTIPR_Elements.cxx
new file mode 100755 (executable)
index 0000000..6d06cbc
--- /dev/null
@@ -0,0 +1,572 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Elements.cxx
+ *
+ * \brief   see MULTIPR_Elements.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Elements.hxx"
+#include "MULTIPR_Nodes.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+#include <set>
+#include <map>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Elements implementation
+//*****************************************************************************
+
+Elements::Elements() 
+{
+    mId       = NULL;
+    mFamIdent = NULL;
+    mNames    = NULL;
+    mCon      = NULL;
+    
+    reset(); 
+}
+
+
+Elements::~Elements()  
+{ 
+    reset();  
+}
+
+
+void Elements::reset() 
+{ 
+    mNum           = 0;
+    mEntity        = MED_MAILLE;
+    mGeom          = MED_NONE;
+    mNumNodesByElt = 0;
+    mDim           = 0;
+    
+    if (mId != NULL)       { delete[] mId;       mId       = NULL; }
+    if (mFamIdent != NULL) { delete[] mFamIdent; mFamIdent = NULL; }
+    if (mNames != NULL)    { delete[] mNames;    mNames    = NULL; }
+    if (mCon != NULL)      { delete[] mCon;      mCon      = NULL; }
+
+    mSetOfNodes.clear();
+    
+    mFlagPrintAll = false;
+}
+
+
+med_int Elements::getFamilyIdentifier(med_int pIndex) const 
+{ 
+    if ((pIndex < 0) || (pIndex >= mNum)) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mFamIdent[pIndex]; 
+}
+
+
+const med_int* Elements::getConnectivity(int pIndex) const
+{
+    if ((pIndex < 0) || (pIndex >= mNum)) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mCon + mNumNodesByElt * pIndex;
+}
+
+
+void Elements::getCoordinates(med_int pIndexElt, const Nodes* pNodes, med_float* pCoo, int pFirst) const
+{
+    if ((pIndexElt < 0) || (pIndexElt >= mNum)) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    if (pNodes == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pCoo == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    // get the list of nodes of the element
+    const med_int* con = getConnectivity(pIndexElt);
+    
+    med_float* destCoo = pCoo;
+    int size = sizeof(med_float) * mDim;
+    
+    // for each node of the element
+    int n = (mNumNodesByElt < pFirst) ? mNumNodesByElt : pFirst;
+    for (int i = 0 ; i < n ; i++)
+    {
+        // get index of node (MED index start at 1)
+        med_int indexNode = con[i] - 1;
+        
+        // get coordinates of this node
+        const med_float* srcCoo = pNodes->getCoordinates(indexNode);
+        
+        // copy coordinates to destCoo
+        memcpy(destCoo, srcCoo, size);
+        
+        // prepare next point
+        destCoo += mDim;
+    }
+}
+
+
+Elements* Elements::extractSubSet(const set<med_int>& pSetIndices) const
+{
+    Elements* subset = new Elements();
+    
+    //---------------------------------------------------------------------
+    // Copy parameters
+    //---------------------------------------------------------------------
+    subset->mNum           = pSetIndices.size();
+    subset->mEntity        = mEntity;
+    subset->mGeom          = mGeom;          // e.g. 310 for a TETRA10
+    subset->mNumNodesByElt = mNumNodesByElt; // e.g. 10 for a TETRA10
+    subset->mDim           = mDim;           // e.g. 3 for a TETRA10
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    subset->mFamIdent     = new med_int[subset->mNum];
+    subset->mCon          = new med_int[mNumNodesByElt * subset->mNum];
+    
+    //---------------------------------------------------------------------
+    // Copy subset of familys id and connectivity.
+    //---------------------------------------------------------------------
+    med_int* destCon = subset->mCon;
+    set<med_int>::iterator itSet = pSetIndices.begin();
+    for (int itElt = 0 ; itElt < subset->mNum; itElt++)
+    {
+        med_int srcIndex = (*itSet) - 1; // MED index start at 1
+        subset->mFamIdent[itElt] = mFamIdent[srcIndex];
+        
+        med_int* srcCon = mCon + srcIndex * mNumNodesByElt;
+        memcpy(destCon, srcCon, sizeof(med_int) * mNumNodesByElt);
+        
+        destCon += mNumNodesByElt;
+        itSet++;
+    }
+    
+    //---------------------------------------------------------------------
+    // Copy subset of identifiers if necessary
+    //---------------------------------------------------------------------
+    if (isIdentifiers())  
+    { 
+        itSet = pSetIndices.begin();
+        subset->mId = new med_int[subset->mNum]; 
+        for (int itElt = 0 ; itElt < subset->mNum; itElt++)
+        {
+            med_int srcIndex = (*itSet) - 1; // MED index start at 1
+            subset->mId[itElt] = mId[srcIndex];
+            
+            itSet++;
+        }
+    }
+    
+    //---------------------------------------------------------------------
+    // Copy subset of names if necessary
+    //---------------------------------------------------------------------
+    if (isNames())       
+    { 
+        itSet = pSetIndices.begin();
+        subset->mNames = new char[MED_TAILLE_PNOM * subset->mNum + 1]; 
+        char* destPtr = subset->mNames;
+        for (int itElt = 0 ; itElt < subset->mNum; itElt++)
+        {
+            med_int srcIndex = (*itSet) - 1; // MED index start at 1
+            char* srcPtr = mNames + srcIndex * MED_TAILLE_PNOM;
+            memcpy(destPtr, srcPtr, MED_TAILLE_PNOM);
+            
+            destPtr += MED_TAILLE_PNOM;
+            itSet++;
+        }
+        subset->mNames[MED_TAILLE_PNOM * subset->mNum] = '\0';
+    }
+    
+    return subset;
+}
+
+
+const set<med_int>& Elements::getSetOfNodes()
+{    
+    // lazy get: test if mSetOfNodes has already been built
+    if (mSetOfNodes.size() == 0)
+    {
+        buildSetOfNodes();
+    }
+    
+    return mSetOfNodes;
+}
+
+
+set<med_int> Elements::getSetOfFamilies() const
+{
+    // set of families is empty at the beginning
+    set<med_int> setOfFamilies;
+    
+    // for each element, add its family to the set
+    for (int itElt = 0 ; itElt < mNum ; itElt++)
+    {
+        setOfFamilies.insert(mFamIdent[itElt]);
+    }
+    
+    return setOfFamilies;
+}
+
+
+void Elements::remap()
+{
+    // build set of nodes if necessary
+    if (mSetOfNodes.size() == 0)
+    {
+        buildSetOfNodes();
+    }
+    
+    // build the map for indices convertion
+    map<med_int, med_int> mapOldIndexToNewIndex;
+    med_int newIndex = 1; // MED index start at 1
+    for (set<med_int>::iterator itSet = mSetOfNodes.begin(); itSet != mSetOfNodes.end() ; itSet++)
+    {
+        med_int oldIndex = (*itSet);
+        mapOldIndexToNewIndex.insert(make_pair(oldIndex, newIndex));
+        newIndex++;
+    }
+    
+    // for each node referenced by this set of elements
+    for (int itNode = 0, size = mNum * mNumNodesByElt ; itNode < size ; itNode++)
+    {
+        // convert old index to new index (remap)
+        mCon[itNode] = mapOldIndexToNewIndex[mCon[itNode]];
+    }
+    
+    buildSetOfNodes();
+}
+
+
+Elements* Elements::mergePartial(Elements* pElements, int pOffset)
+{
+    Elements* elements = new Elements();
+    
+    //---------------------------------------------------------------------
+    // Copy parameters
+    //---------------------------------------------------------------------
+    elements->mNum           = mNum + pElements->mNum;
+    
+    if (mEntity != pElements->mEntity) throw IllegalStateException("entity should be the same", __FILE__, __LINE__);
+    elements->mEntity        = mEntity;
+    
+    elements->mGeom          = mGeom;          // e.g. 310 for a TETRA10
+    elements->mNumNodesByElt = mNumNodesByElt; // e.g. 10 for a TETRA10
+    
+    if (mDim != pElements->mDim) throw IllegalStateException("dimension should be the same", __FILE__, __LINE__);
+    elements->mDim           = mDim;           // e.g. 3 for a TETRA10
+    
+    elements->mId            = NULL;
+    elements->mNames         = NULL;
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    elements->mFamIdent     = new med_int[elements->mNum];
+    elements->mCon          = new med_int[mNumNodesByElt * elements->mNum];
+    
+    //---------------------------------------------------------------------
+    // Copy familys id and connectivity.
+    //---------------------------------------------------------------------
+    memcpy(elements->mFamIdent, mFamIdent, mNum * sizeof(med_int));
+    memcpy(elements->mFamIdent + mNum, pElements->mFamIdent, pElements->mNum * sizeof(med_int));
+    
+    memcpy(elements->mCon, mCon, mNum * mNumNodesByElt * sizeof(med_int));
+    
+    med_int* dst = elements->mCon + mNum * mNumNodesByElt;
+    for (int i = 0, n = pElements->mNum * mNumNodesByElt ; i < n ; i++)
+    {
+        dst[i] = pElements->mCon[i] + pOffset;
+    }    
+    
+    //cout << "WARNING: do no build set of nodes" << endl;
+    //elements->buildSetOfNodes();
+    
+    return elements;
+}
+
+
+Elements* Elements::mergePartial(vector<Elements*> pElements, vector<int> pOffsets)
+{
+    if (pElements.size() == 0) throw IllegalArgumentException("pElements should contain at least 1 element", __FILE__, __LINE__);
+    
+    Elements* elements = new Elements();
+    
+    //---------------------------------------------------------------------
+    // Copy parameters
+    //---------------------------------------------------------------------
+    elements->mNum = mNum;
+    for (unsigned i = 0 ; i < pElements.size() ; i++)
+    {
+        elements->mNum += pElements[i]->mNum;
+    
+        if (mEntity != pElements[i]->mEntity) throw IllegalStateException("entity should be the same", __FILE__, __LINE__);
+        if (mDim != pElements[i]->mDim) throw IllegalStateException("dimension should be the same", __FILE__, __LINE__);
+    }
+        
+    elements->mEntity        = mEntity;    
+    elements->mGeom          = mGeom;          // e.g. 310 for a TETRA10
+    elements->mNumNodesByElt = mNumNodesByElt; // e.g. 10 for a TETRA10    
+    elements->mDim           = mDim;           // e.g. 3 for a TETRA10
+    
+    elements->mId            = NULL;
+    elements->mNames         = NULL;
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    elements->mFamIdent     = new med_int[elements->mNum];
+    elements->mCon          = new med_int[mNumNodesByElt * elements->mNum];
+    
+    //---------------------------------------------------------------------
+    // Copy familys id and connectivity.
+    //---------------------------------------------------------------------
+    memcpy(elements->mFamIdent, mFamIdent, mNum * sizeof(med_int));
+    memcpy(elements->mCon, mCon, mNum * mNumNodesByElt * sizeof(med_int));
+    
+    int offsetFamIdent = mNum;
+    int offsetCon      = mNum;
+    for (unsigned j = 0 ; j < pElements.size() ; j++)
+    {            
+        memcpy(elements->mFamIdent + offsetFamIdent, pElements[j]->mFamIdent, pElements[j]->mNum * sizeof(med_int));  offsetFamIdent += pElements[j]->mNum;
+        
+        med_int* dst = elements->mCon + offsetCon * mNumNodesByElt;
+        for (int i = 0, n = pElements[j]->mNum * mNumNodesByElt ; i < n ; i++)
+        {
+            dst[i] = pElements[j]->mCon[i] + pOffsets[j];
+        }    
+        offsetCon += pElements[j]->mNum;
+    }
+    
+    //cout << "WARNING: do no build set of nodes" << endl;
+    //elements->buildSetOfNodes();
+
+    return elements;
+}
+
+
+void Elements::buildSetOfNodes()
+{
+    if (mSetOfNodes.size() != 0)
+    {
+        mSetOfNodes.clear();
+    }
+    
+    // for each node referenced by this set of elements
+    for (int itNode = 0, size = mNum * mNumNodesByElt ; itNode < size ; itNode++)
+    {
+        // add the node to the set
+        mSetOfNodes.insert(mCon[itNode]);
+    }
+}
+
+
+void Elements::readMED(
+    med_idt               pMEDfile, 
+    char*                 pMeshName, 
+    med_int               pMeshDim, 
+    med_entite_maillage   pEntity, 
+    med_geometrie_element pGeom)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if ((pMeshDim < 1) || (pMeshDim > 3)) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    
+    mEntity        = pEntity;
+    mGeom          = pGeom;
+    mNumNodesByElt = mGeom % 100;
+    mDim           = mGeom / 100;
+    
+    mNum = MEDnEntMaa(
+        pMEDfile, 
+        pMeshName, 
+        MED_CONN,  // type of information requested = CONNECTIVITY
+        pEntity, 
+        pGeom, 
+        MED_NOD);  // nodal connectivity
+    
+    if (mNum < 0) throw IOException("i/o error while reading information about elements in MED file", __FILE__, __LINE__);
+    
+    if (mNum == 0)
+    {
+        // empty mesh
+        return;
+    }
+    
+    mCon      = new med_int[mNumNodesByElt * mNum];
+    mNames    = new char[MED_TAILLE_PNOM * mNum + 1];
+    mId       = new med_int[mNum];
+    mFamIdent = new med_int[mNum]; 
+    med_booleen isNames;
+    med_booleen isIdentifiers;
+    
+    med_err ret = MEDelementsLire(
+        pMEDfile, 
+        pMeshName, 
+        pMeshDim, 
+        mCon, 
+        MED_FULL_INTERLACE,
+        mNames, 
+        &isNames,
+        mId,
+        &isIdentifiers,
+        mFamIdent,
+        mNum, 
+        mEntity, 
+        mGeom, 
+        MED_NOD); // NODAL CONNECTIVITY
+    
+    if (ret != 0) throw IOException("i/o error while reading elements in MED file", __FILE__, __LINE__);
+    
+    if (!isNames)
+    {
+        delete[] mNames;
+        mNames = NULL;
+    }
+    
+    if (!isIdentifiers)
+    {
+        delete[] mId;
+        mId = NULL;
+    }
+}
+
+
+void Elements::writeMED(med_idt pMEDfile, char* pMeshName, med_int pMeshDim)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if ((pMeshDim < 1) || (pMeshDim > 3)) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    // special case: if no elements => do nothing
+    if (mNum == 0) return;
+    
+    med_err ret = MEDelementsEcr(
+        pMEDfile,
+        pMeshName,
+        pMeshDim,
+        mCon,
+        MED_FULL_INTERLACE,
+        mNames,
+        isNames()?MED_VRAI:MED_FAUX,
+        mId,
+        isIdentifiers()?MED_VRAI:MED_FAUX,
+        mFamIdent,
+        mNum,
+        mEntity,
+        mGeom,
+        MED_NOD); // NODAL CONNECTIVITY
+        
+    if (ret != 0) throw IOException("i/o error while writing elements in MED file", __FILE__, __LINE__);
+}
+
+
+ostream& operator<<(ostream& pOs, Elements& pE)
+{
+    char strEntity[16];
+    switch (pE.mEntity) 
+    {
+        case MED_MAILLE: strcpy(strEntity, "MED_MAILLE"); break;
+        case MED_FACE:   strcpy(strEntity, "MED_FACE"); break;
+        case MED_ARETE:  strcpy(strEntity, "MED_ARETE"); break;
+        case MED_NOEUD:  strcpy(strEntity, "MED_NOEUD"); break;
+        default:         strcpy(strEntity, "UNKNOWN"); break;
+    }
+    
+    pOs << "Elements: " << endl;
+    pOs << "    #number  =" << pE.mNum << endl;
+    pOs << "    Entity   =" << strEntity << endl;
+    pOs << "    Geom     =" << pE.mGeom << endl; 
+    pOs << "    Has names?" << (pE.isNames()?"yes":"no") << endl;
+    pOs << "    Has id   ?" << (pE.isIdentifiers()?"yes":"no") << endl;
+
+    {
+        set<med_int> setOfFam = pE.getSetOfFamilies();
+        if (setOfFam.size() == 0)
+        {
+            pOs << "    Families: #fam=0" << endl;
+        }
+        else
+        {
+            set<med_int>::iterator itFam = setOfFam.end();
+            itFam--;
+            pOs << "    Families: #fam=" << setOfFam.size() << " id_min=" << (*(setOfFam.begin())) << " id_max=" << (*itFam) << endl;
+            
+            if (pE.mFlagPrintAll)
+            {
+                for (int i = 0 ; i < pE.mNum; i++)
+                {
+                    pOs << "        Elt " << (i + 1) << ": " << pE.mFamIdent[i] << endl;
+                }
+            }
+        }
+    }
+    
+    {
+        set<med_int> setOfNodes = pE.getSetOfNodes();
+        if (setOfNodes.size() == 0)
+        {
+            pOs << "    Connectivity: #nodes=0" << endl;
+        }
+        else
+        {
+            set<med_int>::iterator itNode = setOfNodes.end();
+            itNode--;
+            pOs << "    Connectivity: #nodes=" << setOfNodes.size() << " id_min=" << (*(setOfNodes.begin())) << " id_max=" << (*itNode) << endl;
+            
+            if (pE.mFlagPrintAll)
+            {
+                for (int i = 0 ; i < pE.mNum ; i++)
+                {
+                    pOs << "        Elt " << (i + 1) << ": ";
+                    for (int j = 0 ; j < pE.mNumNodesByElt ; j++)
+                    {
+                        pOs << pE.mCon[i * pE.mNumNodesByElt + j] << " ";
+                    }
+                    pOs << endl;
+                }
+            }
+        }
+    }
+    
+    if (pE.mFlagPrintAll)
+    {
+        
+        if (pE.isIdentifiers())
+        {
+            pOs << "    Num (identifier): " << endl;
+            for (int i = 0 ; i < pE.mNum; i++)
+            {
+                pOs << "        Elt " << (i + 1) << ": " << pE.mId[i] << " " << endl;
+            }
+        }
+        
+        if (pE.isNames())
+        {
+            pE.mNames[MED_TAILLE_PNOM * pE.mNum] = '\0';
+            pOs << "    Names: |" << pE.mNames << "|" << endl;
+        }
+        
+    }
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Elements.hxx b/src/MULTIPR/MULTIPR_Elements.hxx
new file mode 100755 (executable)
index 0000000..c14baaf
--- /dev/null
@@ -0,0 +1,260 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Elements.hxx
+ *
+ * \brief   Class Elements = table of elements in a mesh.
+ *          All elements share the same type (e.g. MED_MAILLE) and the same geometric description (e.g. TETRA10).
+ *          Each element has a family and a table of connectivity.
+ *          Optional: each element has a name and an id.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_ELEMENTS_HXX
+#define MULTIPR_ELEMENTS_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <set>
+#include <vector>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Predeclaration
+//*****************************************************************************
+
+class Nodes;
+
+
+//*****************************************************************************
+// Class Elements
+//*****************************************************************************
+
+class Elements
+{
+public:
+
+    /** 
+     * Builds an empty set of elements (default constructor).
+     */
+    Elements();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Elements();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns true iff this object contains no elements (table of elements is empty).
+     * \return true iff this object contains no elements.
+     */
+    bool isEmpty() const { return (mNum == 0); }
+    
+    /**
+     * Returns true iff elements have a name.
+     * \return true iff elements have a name.
+     */
+    bool isNames() const { return (mNames != NULL); }
+    
+    /**
+     * Returns true iff elements have an identifier (= a number).
+     * \return true iff elements have an identifier (= a number).
+     */
+    bool isIdentifiers() const { return (mId != NULL); }    
+    
+    /**
+     * Returns the number of elements.
+     * \return the number of elements.
+     */
+    int getNumberOfElements() const { return mNum; }
+    
+    /**
+     * Returns the type of primitives (e.g. MED_TETRA10).
+     * \return the type of primitives
+     */
+    med_geometrie_element getTypeOfPrimitives() const { return mGeom; }
+    
+    /**
+     * Returns the number of nodes that composed an element.
+     * \return the number of nodes that composed an element.
+     */
+     int getNumberOfNodesByElement() const { return mNumNodesByElt; }
+     
+    /**
+     * Returns the family associated with an element.
+     * \param  pIndex index of any element in [0..NUMBER_OF_ELEMENTS-1].
+     * \return the family associated with an element.
+     * \throw  IndexOutOfBoundsException if pIndex is invalid.
+     */
+    med_int getFamilyIdentifier(med_int pIndex) const;
+    
+    /**
+     * Returns the connectivity of one element.
+     * \param  pIndex must be in [0..NUMBER_OF_ELEMENTS-1].
+     * \return a pointer towards the table of connectivity of the element.
+     * \throw  IndexOutOfBoundsException if pIndex is invalid.
+     */
+    const med_int* getConnectivity(int pIndex) const;
+    
+    /**
+     * Returns the coordinates of all the nodes of one element.
+     * \param  pIndexElt must be in [0..NUMBER_OF_ELEMENTS-1].
+     * \param  pNodes    table of nodes, used to retrieve coordinates.
+     * \param  pCoo      (out) table of coordinates of nodes (e.g. 30 = 3 * 10 med_float for a TETRA10).
+     * \param  pFirst    only get the pFirst coordinates.
+     * \throw  IndexOutOfBoundsException if pIndex is invalid.
+     */
+    void getCoordinates(med_int pIndexElt, const Nodes* pNodes, med_float* pCoo, int pFirst = 100) const;
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Constructor. Creates a subset of this set of elements from a set of indices.
+     * \param  pSetIndices set of indices (start at 1).
+     * \return a restriction of this set of elements.
+     */
+    Elements* extractSubSet(const std::set<med_int>& pSetIndices) const;
+    
+    /**
+     * Returns the set of indices (starting at 1) of all nodes used by this set of elements.
+     * \return the set of indices of all nodes used by this set of elements.
+     */
+    const std::set<med_int>& getSetOfNodes();
+    
+    /**
+     * Returns the set of families referenced by this set of elements.
+     * Each family is described by its identifier.
+     * \return Returns the set of families referenced by this set of elements.
+     */
+    std::set<med_int> getSetOfFamilies() const;
+    
+    /**
+     * Remaps this set of elements such that indices of nodes are continous 1 2 3 4 5 ... *
+     * This method is intended to be used after extractSubSet().
+     */
+    void remap();
+    
+    /**
+     * Builds a new set of elements by merging two set of elements (this and pElements) if possible.
+     * Merge is partial because Id and Names are not take into account.
+     * \param  pElements any set of nodes to be merged with this.
+     * \param  pOffset
+     * \return a new set of nodes.
+     * \throw  IllegalStateException if the two sets of elements are incompatible.
+     */
+    Elements* mergePartial(Elements* pElements, int pOffset);
+    Elements* mergePartial(std::vector<Elements*> pElements, std::vector<int> pOffsets);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads a set of elements from a MED file.
+     * You must give: name of mesh, dimension of the mesh, type of entity and type of elements.
+     * \param  pMEDfile   any valid MED file opened for reading.
+     * \param  pMeshName  name of the mesh.
+     * \param  pMeshDim   dimension of the mesh.
+     * \param  pEntity    entity to be read (e.g. MED_MAILLE).
+     * \param  pGeom      type of primitves to be read (e.g. MED_TETRA10).
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMED(
+        med_idt               pMEDfile, 
+        char*                 pMeshName, 
+        med_int               pMeshDim,
+        med_entite_maillage   pEntity, 
+        med_geometrie_element pGeom);
+    
+    /**
+     * Writes this set of elements to a MED file.
+     * WARNING: mesh must have been created and added to the MED file before.
+     * \param  pMEDfile  any valid MED file opened for writing.
+     * \param  pMeshName name of the mesh.
+     * \param  pMeshDim  dimension of the mesh.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile, char* pMeshName, med_int pMeshDim);
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any Elements to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pE  any Elements.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Elements& pE);
+
+private:
+    
+    /**
+     * Builds the set of nodes used by this set of elements.
+     * If the set already exist, then it is cleared and a new set is computed.
+     */
+    void buildSetOfNodes();
+    
+private:
+    
+    med_int               mNum;           /**< Number of elements. */
+    med_entite_maillage   mEntity;        /**< Type of entity, e.g. MED_MAILLE. */
+    med_geometrie_element mGeom;          /**< Type of primitive, e.g. MED_TETRA10. */
+    int                   mDim;           /**< Dimension of elements = mGeom / 100. */
+    int                   mNumNodesByElt; /**< Number of nodes by element = mGeom % 100. */
+    med_int*              mId;            /**< Optional; for each element, its identifier; NULL if undefined. */
+    med_int*              mFamIdent;      /**< For each element, its family (identifier). */
+    char*                 mNames;         /**< Optional; for each element, its name; NULL if undefined. */
+    med_int*              mCon;           /**< For each element, list of nodes (index in 1..*) = table of connectivity. */
+    std::set<med_int>     mSetOfNodes;    /**< Set of all nodes used by this set of elements. */
+    
+    bool                  mFlagPrintAll;  /** Flag to control the behaviour of the stream operator <<. */
+    
+private:
+
+    // do not allow copy constructor
+    Elements(const Elements&);
+    
+    // do not allow copy
+    Elements& operator=(const Elements&);
+    
+    // do not allow operator ==
+    bool operator==(const Elements&); 
+    
+}; // class Elements
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_NODES_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Exceptions.hxx b/src/MULTIPR/MULTIPR_Exceptions.hxx
new file mode 100755 (executable)
index 0000000..14c200e
--- /dev/null
@@ -0,0 +1,203 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Exceptions.hxx
+ *
+ * \brief   All the exceptions used by MULTIPR.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_EXCEPTIONS_HXX
+#define MULTIPR_EXCEPTIONS_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include <string>
+#include <iostream>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Class RuntimeException
+// Super class for all exceptions used by the module MULTIPR
+//*****************************************************************************
+
+class RuntimeException
+{
+public:
+    
+    /**
+     * Constructor. Build a new RuntimeException.
+     * \param  pMsg   message to be associated with this exception.
+     * \param  pFile  name of the file where the probem occur (you can use the macro __FILE__); "unknown" by default.
+     * \param  pLine  number of the line where the probem occur (you can use the macro __LINE__); 0 by default.
+     */
+    RuntimeException(
+        const std::string& pMsg, 
+        const std::string& pFile = "unknown", 
+        int                pLine = 0) 
+    { 
+        mMsg  = pMsg; 
+        mFile = pFile;
+        mLine = pLine;
+        mType = "RuntimeException";
+    }
+    
+    /**
+     * Dumps info about this exception to the given output stream.
+     */
+    void dump(std::ostream& pOs) const 
+    { 
+        pOs << "MULTIPR: " << mType << " (" << mFile << ", line " << mLine << "): " << mMsg << std::endl; 
+    }
+    
+protected:
+
+    std::string mMsg;    /**< Message associated with this exception. */
+    std::string mFile;   /**< Name of the source file where the problem occurs (macro __FILE__ can be used to retrieve this field). */
+    int         mLine;   /**< Number of the line where the problem occurs (macro __LINE__ can be used to retrieve this field). */
+    std::string mType;   /**< Type of this exception. */
+};
+
+
+//*****************************************************************************
+// Class NullArgumentException
+// Should be used when an unexpected NULL pointer occurs
+//*****************************************************************************
+
+class NullArgumentException : public RuntimeException
+{
+public:
+    NullArgumentException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine) 
+    { 
+        mType = "NullArgumentException";
+    }
+};
+
+
+//*****************************************************************************
+// Class IllegalArgumentException
+// Should be used when an invalid parameter is detected (check precondition)
+//*****************************************************************************
+
+class IllegalArgumentException : public RuntimeException
+{
+public:
+    IllegalArgumentException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine) 
+    { 
+        mType = "IllegalArgumentException";
+    }
+};
+
+
+//*****************************************************************************
+// Class IllegalStateException
+// Should be used when the internal state of an object is invalid
+//*****************************************************************************
+
+class IllegalStateException : public RuntimeException
+{
+public:
+    IllegalStateException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine)
+    { 
+        mType = "IllegalStateException";
+    }
+};
+
+
+//*****************************************************************************
+// Class IndexOutOfBoundsException
+// Should be used when an index is out of bounds
+//*****************************************************************************
+
+class IndexOutOfBoundsException : public RuntimeException
+{
+public:
+    IndexOutOfBoundsException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine)
+    { 
+        mType = "IndexOutOfBoundsException";
+    }
+};
+
+
+//*****************************************************************************
+// Class IOException
+// Should be used when any i/o error occurs
+//*****************************************************************************
+
+class IOException : public RuntimeException
+{
+public:
+    IOException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine)
+    { 
+        mType = "IOException";
+    }
+};
+
+
+//*****************************************************************************
+// Class FileNotFoundException
+// Should be used to indicate that a file has not been found
+//*****************************************************************************
+
+class FileNotFoundException : public IOException
+{
+public:
+    FileNotFoundException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : IOException(pMsg, pFile, pLine)
+    { 
+        mType = "FileNotFoundException";
+    }
+};
+
+
+//*****************************************************************************
+// Class UnsupportedOperationException
+// Should be used when a function/method is not yet implemented or 
+// if an operation is not supported in a given context
+//*****************************************************************************
+
+class UnsupportedOperationException : public RuntimeException
+{
+public:
+    UnsupportedOperationException(
+        const std::string& pMsg, 
+        const std::string& pFile="unknown", 
+        int pLine=0) : RuntimeException(pMsg, pFile, pLine)
+    { 
+        mType = "UnsupportedOperationException";
+    }
+};
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_EXCEPTIONS_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Family.cxx b/src/MULTIPR/MULTIPR_Family.cxx
new file mode 100755 (executable)
index 0000000..bdf2e9f
--- /dev/null
@@ -0,0 +1,475 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Family.cxx
+ *
+ * \brief   see MULTIPR_Family.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Family.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Attributs implementation
+//*****************************************************************************
+
+Attributs::Attributs()
+{
+    mId   = NULL;
+    mVal  = NULL;
+    mDesc = NULL;
+    
+    reset();
+}
+
+
+Attributs::~Attributs()
+{
+    reset();
+}
+
+
+Attributs& Attributs::operator=(const Attributs& pAttr)
+{
+    if (this != &pAttr) // check for self-assignement
+    {
+        reset();
+        
+        mNum = pAttr.mNum;
+        
+        if (mNum < 0) throw IllegalStateException("", __FILE__, __LINE__);
+        
+        if (pAttr.mId != NULL)
+        {
+            mId = new med_int[mNum];
+            memcpy(mId, pAttr.mId, sizeof(med_int) * mNum);
+        }
+        
+        if (pAttr.mVal != NULL)
+        {
+            mVal = new med_int[mNum];
+            memcpy(mVal, pAttr.mVal, sizeof(med_int) * mNum);
+        }
+        
+        if (pAttr.mDesc != NULL)
+        {
+            mDesc = new char[MED_TAILLE_DESC * mNum + 1];
+            memcpy(mDesc, pAttr.mDesc, MED_TAILLE_DESC * mNum + 1);
+        }
+    }
+    
+    return *this;
+}
+
+
+void Attributs::reset()
+{
+    mNum = 0;
+    
+    if (mId   != NULL) { delete[] mId;   mId   = NULL; }
+    if (mVal  != NULL) { delete[] mVal;  mVal  = NULL; }
+    if (mDesc != NULL) { delete[] mDesc; mDesc = NULL; }
+}
+
+
+ostream& operator<<(ostream& pOs, Attributs& pA)
+{
+    if (pA.mNum == 0)
+    {
+        pOs << "NONE" << endl;
+    }
+    else
+    {
+        pOs << endl << "        #attr=" << pA.mNum << endl;
+        
+        if (pA.mId != NULL)
+        {
+            pOs << "        Id  =[";
+            for (int i = 0 ; i < pA.mNum ; i++)
+            {
+                pOs << pA.mId[i] << " ";
+            }
+            pOs << "]" << endl;
+        }
+        else
+        {
+            pOs << "        Id  =NULL" << endl;
+        }
+        
+        if (pA.mVal != NULL)
+        {
+            pOs << "        Val =[";
+            for (int i = 0 ; i < pA.mNum ; i++)
+            {
+                pOs << pA.mVal[i] << " ";
+            }
+            pOs << "]" << endl;
+        }
+        else
+        {
+            pOs << "        Val =NULL";
+        }
+        
+        if (pA.mDesc != NULL)
+        {
+            pOs << "        Desc=|" << pA.mDesc << "|" << endl;
+        }
+        else
+        {
+            pOs << "        Desc=NULL" << endl;
+        }
+    }
+    
+    return pOs;
+}
+
+
+//*****************************************************************************
+// Class Family implementation
+//*****************************************************************************
+
+Family::Family() 
+{
+    reset(); 
+}
+
+
+Family::Family(const Family& pFamily)  
+{ 
+    strcpy(mName, pFamily.mName);
+    mId            = pFamily.mId;
+    mStrNameGroups = pFamily.mStrNameGroups;
+    mNameGroups    = pFamily.mNameGroups;
+    mAttributs     = pFamily.mAttributs;
+}
+
+
+Family::~Family()  
+{ 
+    reset();  
+}
+
+
+void Family::reset() 
+{ 
+    mName[0]       = '\0';
+    mId            = 0;
+    mStrNameGroups = "";
+    
+    mElt.clear();
+    mNameGroups.clear();
+    mAttributs.reset();
+    
+    mIsFamilyOfNodes = true;
+    
+    mFlagPrintAll = false;
+}
+
+
+void Family::insertElt(med_int pIndexElt) 
+{ 
+    if (pIndexElt < 1) throw new IllegalArgumentException("", __FILE__, __LINE__);
+    
+    mElt.insert(pIndexElt); 
+}
+
+
+void Family::buildGroups(vector<Group*>& pGroups, map<string, Group*>& pGroupNameToGroup) const
+{
+    // pGroups / pGroupNameToGroup can be empty or not
+    
+    // for each group in this family
+    for (unsigned itGroup = 0 ; itGroup < mNameGroups.size() ; itGroup++)
+    {
+        const string& keyName = mNameGroups[itGroup];
+        
+        // check if the group already exist
+        map<string, Group*>::iterator it = pGroupNameToGroup.find(keyName);
+        
+        Group* group = NULL;
+        if (it != pGroupNameToGroup.end())
+        {
+            // the group already exists
+            group = (*it).second;
+        }
+        else
+        {
+            // a new group have been identified: create a new entry
+            group = new Group();
+            group->setName(keyName);
+            group->setIsGroupOfNodes(isFamilyOfNodes());
+            
+            pGroups.push_back(group);
+            pGroupNameToGroup.insert(make_pair(keyName, group));
+        }
+        
+        // add all elements of the this family to the group
+        for (set<med_int>::iterator itElt = mElt.begin() ; itElt != mElt.end() ; itElt++)
+        {
+            group->insertElt(*itElt);
+        }
+        
+    }
+}
+
+
+Family* Family::extractGroup(const char* pGroupName)
+{
+    Family* family = new Family();
+    
+    strcpy(family->mName, mName);
+    family->mId = mId;
+    family->mAttributs = mAttributs;
+    
+    if (pGroupName == NULL)
+    {
+        family->mStrNameGroups = mStrNameGroups;
+        family->mNameGroups = mNameGroups;
+    }
+    else
+    {
+        if (strlen(pGroupName) > MED_TAILLE_LNOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+        if (strlen(pGroupName) == 0) throw IllegalArgumentException("", __FILE__, __LINE__);
+        
+        if (strstr(mStrNameGroups.c_str(), pGroupName) == 0)
+        {
+            // pGroupName found in the list of groups => just keep pGroupName
+            family->mStrNameGroups = mStrNameGroups;
+            family->mNameGroups = mNameGroups;
+        }
+        else
+        {
+            // pGroupName not found in the current list of groups 
+            // probably not a group of the same nature => keep all the groups
+            family->mStrNameGroups = pGroupName;
+            family->mNameGroups.push_back(pGroupName);
+        }
+    }
+    
+    return family;
+}
+
+
+void Family::readMED(med_idt pMEDfile, char* pMeshName, med_int pIndex)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (pIndex < 1) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    
+    med_int numGroups = MEDnGroupe(pMEDfile, pMeshName, pIndex);
+    
+    if (numGroups < 0) throw IOException("i/o error while reading number of groups in MED file", __FILE__, __LINE__);
+    
+    med_int numAttr = MEDnAttribut(pMEDfile, pMeshName, pIndex);
+    
+    med_int* attrId   = new med_int[numAttr];
+    med_int* attrVal  = new med_int[numAttr];
+    char*    attrDesc = new char[MED_TAILLE_DESC * numAttr + 1];
+    attrDesc[0] = '\0';
+    
+    char* nameGroups = new char[MED_TAILLE_LNOM * numGroups + 1];
+    nameGroups[0] = '\0';
+    
+    med_err ret = MEDfamInfo(
+        pMEDfile, 
+        pMeshName, 
+        pIndex, 
+        mName, 
+        &mId, 
+        attrId, 
+        attrVal, 
+        attrDesc, 
+        &numAttr, 
+        nameGroups, 
+        &numGroups);
+    
+    if (ret != 0) throw IOException("i/o error while reading family information in MED file", __FILE__, __LINE__);
+    
+    attrDesc[MED_TAILLE_DESC * numAttr] = '\0';
+    
+    mAttributs.mNum  = numAttr;
+    mAttributs.mId   = attrId;
+    mAttributs.mVal  = attrVal;
+    mAttributs.mDesc = attrDesc;
+    
+    mStrNameGroups = nameGroups;
+    
+    // split nameGroups
+    for (int itGroup = 0 ; itGroup < numGroups ; itGroup++)
+    {
+        char str[MED_TAILLE_LNOM + 1];
+        strncpy(str, nameGroups + itGroup * MED_TAILLE_LNOM, MED_TAILLE_LNOM);
+        str[MED_TAILLE_LNOM] = '\0';
+        mNameGroups.push_back(str);
+    }
+    
+    delete[] nameGroups;
+    
+    // MEDfamLire is not necessary as we used MEDnoeudsLire/MEDelementsLire instead
+}
+
+
+void Family::writeMED(med_idt pMEDfile, char* pMeshName)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (strlen(mName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (mAttributs.mVal == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mAttributs.mDesc == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mAttributs.mId == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+        
+    //cout << "Write family: " << mName << " " << mId << endl;
+    
+    med_err ret = MEDfamCr(
+        pMEDfile,
+        pMeshName,
+        mName,
+        mId,
+        mAttributs.mId,
+        mAttributs.mVal,
+        mAttributs.mDesc,
+        mAttributs.mNum,
+        const_cast<char*>(mStrNameGroups.c_str()),
+        mNameGroups.size());
+    
+    if (ret != 0) throw IOException("i/o error while creating family in MED file", __FILE__, __LINE__);
+    
+    // MEDfamEcr is not necessary as we used MEDnoeudsEcr/MEDelementsEcr instead
+
+}
+
+
+ostream& operator<<(ostream& pOs, Family& pF)
+{
+    pOs << "Family: " << endl;
+    pOs << "    Name      =|" << pF.mName << "| size=" << strlen(pF.mName) << endl;
+    pOs << "    Id        =" << pF.mId << endl;
+    pOs << "    Family of =" << (pF.isFamilyOfNodes()?"NODES":"ELEMENTS") << endl;    
+    
+    pOs << "    Groups: #groups=" << pF.mNameGroups.size() << endl;
+    for (unsigned itGroup = 0 ; itGroup < pF.mNameGroups.size() ; itGroup++)
+    {
+        pOs << "        Group " << (itGroup + 1) << ": |" << pF.mNameGroups[itGroup] << "| size=" << pF.mNameGroups[itGroup].length() << endl;
+    }
+    pOs << "    Attributs: " << pF.mAttributs;
+    
+    if (pF.mElt.size() != 0)
+    {
+        set<med_int>::iterator itSet = pF.mElt.end();
+        itSet--;
+        pOs << "    Elements: #elt=" << pF.mElt.size() << " min_id=" << (*(pF.mElt.begin())) << " max_id=" << (*itSet) << endl;
+        if (pF.mFlagPrintAll)
+        {
+            pOs << "        ";
+            for (set<med_int>::iterator itSet = pF.mElt.begin() ; itSet != pF.mElt.end() ; itSet++)
+            {
+                pOs << (*itSet) << " ";
+            }
+            pOs << endl;
+        }
+    }
+    else
+    {
+        pOs << "    Elements: #elt=0" << endl;
+    }
+    
+    return pOs;
+}
+
+
+//*****************************************************************************
+// Class Group implementation
+//*****************************************************************************
+
+Group::Group() 
+{
+    reset(); 
+}
+
+
+Group::~Group()  
+{ 
+    reset();  
+}
+
+
+void Group::reset() 
+{ 
+    mName = "";
+    mElt.clear();
+    mIsGroupOfNodes = true;
+    
+    mFlagPrintAll = false;
+}
+
+
+void Group::setName(const string& pName) 
+{ 
+    if (pName.length() > MED_TAILLE_LNOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    mName = pName; 
+}
+
+
+void Group::insertElt(med_int pIndexElt) 
+{ 
+    if (pIndexElt < 1) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    mElt.insert(pIndexElt); 
+}
+
+ostream& operator<<(ostream& pOs, Group& pG)
+{
+    pOs << "Group: " << endl;
+    pOs << "    Name     =|" << pG.mName << "| size=" << pG.mName.length() << endl;
+    pOs << "    Group of =" << (pG.isGroupOfNodes()?"NODES":"ELEMENTS") << endl;    
+
+    if (pG.mElt.size() != 0)
+    {
+        set<med_int>::iterator itSet = pG.mElt.end();
+        itSet--;
+        pOs << "    Elements: #elt=" << pG.mElt.size() << " min_id=" << (*(pG.mElt.begin())) << " max_id=" << (*itSet) << endl;
+        if (pG.mFlagPrintAll)
+        {
+            pOs << "        ";
+            for (set<med_int>::iterator itSet = pG.mElt.begin() ; itSet != pG.mElt.end() ; itSet++)
+            {
+                pOs << (*itSet) << " ";
+            }
+            pOs << endl;
+        }
+    }
+    else
+    {
+        pOs << "    Elements: #elt=0" << endl;
+    }
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Family.hxx b/src/MULTIPR/MULTIPR_Family.hxx
new file mode 100755 (executable)
index 0000000..31d42fa
--- /dev/null
@@ -0,0 +1,372 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Family.hxx
+ *
+ * \brief   Class Family, Group and Attributs used to wrap MED file structures.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_FAMILY_HXX
+#define MULTIPR_FAMILY_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+
+#include <iostream>
+#include <vector>
+#include <set>
+#include <map>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Predeclaration
+//*****************************************************************************
+
+class Group;
+
+
+//*****************************************************************************
+// Class Attributs
+//*****************************************************************************
+
+class Attributs
+{
+public:
+    
+    /** 
+     * Builds an empty Attributs (default constructor).
+     */
+    Attributs();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Attributs();
+    
+    /**
+     * Assignment operator (deep copy).
+     * \param  pAttr any Atttibuts to be copied.
+     * \return a reference towards the copy.
+     */
+    Attributs& operator=(const Attributs& pAttr);
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Dumps any Attributs to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pA  any Attributs.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Attributs& pA);
+    
+public:
+
+    med_int   mNum;     /**< Number of attributes. */
+    med_int*  mId;      /**< Table of identifiers: for each attribute, its identifier. */
+    med_int*  mVal;     /**< Table of values; for each attribute, its value. */
+    char*     mDesc;    /**< Table of description; for each attribute, its description. */
+    
+private:
+
+    // do not allow copy constructor
+    Attributs(const Attributs&);
+    
+    // do not allow operator ==
+    bool operator==(const Attributs&); 
+    
+}; // class Attribut
+
+
+//*****************************************************************************
+// Class Family
+//*****************************************************************************
+
+class Family
+{
+public:
+
+    /** 
+     * Builds an empty Family (default constructor).
+     */
+    Family();
+    
+    /**
+     * Copy constructor.
+     */
+    Family(const Family& pFamily);
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Family();    
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns the identifier (= number) of this Family.
+     * \return the identifier of this Family.
+     */
+    med_int getId() const { return mId; }
+    
+    /**
+     * Returns the name of this Family.
+     * \return the name of this Family.
+     */
+    const char* getName() const { return mName; }
+    
+    /**
+     * Returns true if this Family if a family of nodes, false if is a family of elements (=cells)).
+     * \return true iff this Family if a family of nodes.
+     */
+    bool isFamilyOfNodes() const { return mIsFamilyOfNodes; }
+    
+    /**
+     * Sets whether this Family is a family of nodes or family of elements (= cells).
+     * \param  pIsFamilyOfNodes flag.
+     */
+    void setIsFamilyOfNodes(bool pIsFamilyOfNodes) { mIsFamilyOfNodes = pIsFamilyOfNodes; }
+    
+    /**
+     * Inserts a new element (by its index) into this Family.
+     * \param  pIndexElt index of the element to be added; must be >= 1.
+     * \throw  IllegalArgumentException if pIndexElt <= 0.
+     */
+    void insertElt(med_int pIndexElt);
+    
+    /**
+     * Returns the number of elements in this Family.
+     * \return the number of elements in this Family.
+     */
+    int getSize() const { return mElt.size(); }
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+
+    /**
+     * Adds all the groups of this Family into the set of groups described by (pGroups, pGroupNameToGroup).
+     * \param  pGroups            current list of groups.
+     * \param  pGroupNameToGroup  table (map) to retrieve a Group* from its name.
+     */
+    void buildGroups(
+        std::vector<Group*>&            pGroups, 
+        std::map<std::string, Group*>&  pGroupNameToGroup) const;
+    
+    /**
+     * Constructor. Returns a copy of this family restricted to the given group if pGroupName != NULL.
+     * Examples: 
+     * 1. If current family have 3 groups "A", "B" and "C" and pGroupName="B", then the new family will only reference the group "B"
+     * 2. If current family have 3 groups "A", "B" and "C" and pGroupName="D", then the new family will reference groups "A", "B" and "C".
+     * WARNING: elements are not copied
+     * \param   pGroupName name of the group to keep.
+     * \return  a copy of this family.
+     */
+    Family* extractGroup(const char* pGroupName);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+
+    /**
+     * Reads a Family from a MED file.
+     * \param  pMEDfile  any valid MED file opened for reading.
+     * \param  pMeshName name of the mesh. 
+     * \param  pIndex    index of the family to be read (must be >= 1).
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMED(med_idt pMEDfile, char* pMeshName, med_int pIndex);
+    
+    /**
+     * Writes this Family to a MED file.
+     * WARNING: mesh must have been created and added to the MED file before.
+     * \param  pMEDfile  any valid MED file opened for writing.
+     * \param  pPeshName name of the mesh.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile, char* pMeshName);
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any Family to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pF  any Family.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Family& pF);
+    
+private:
+    
+    char                     mName[MED_TAILLE_NOM + 1];   /** Name of the Family */
+    med_int                  mId;               /**< Id: > 0 if family of nodes; < 0 if family of elements. */
+    std::set<med_int>        mElt;              /**< Set of all the elements (by their index in 1..*). */
+    std::string              mStrNameGroups;    /**< A string with name of all groups which contain the Family. */
+    std::vector<std::string> mNameGroups;       /**< List of groups (by name) which contain the Family. */
+    Attributs                mAttributs;        /**< All the attributed related to the Family. */
+    bool                     mIsFamilyOfNodes;  /**< Is it a family of nodes or a family of elements? */
+    
+    bool                     mFlagPrintAll;     /** Flag to control the behaviour of the stream operator <<. */
+    
+private:
+
+    // do not allow copy constructor
+    //Family(const Family&);
+    
+    // do not allow copy
+    Family& operator=(const Family&);
+    
+    // do not allow operator ==
+    bool operator==(const Family&); 
+    
+}; // class Family
+
+
+//*****************************************************************************
+// Class Group
+//*****************************************************************************
+
+class Group
+{
+public:
+
+    /** 
+     * Builds an empty group (default constructor).
+     */
+    Group();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Group();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns true if it is a group of nodes, false if it is a group of elements.
+     * \return true if it is a group of nodes, false if it is a group of elements.
+     */
+    bool isGroupOfNodes() const { return mIsGroupOfNodes; }
+    
+    /**
+     * Sets whether it is a group of nodes or a group of elements. 
+     * \param  pIsGroupOfNodes true for a group of nodes, false for a group of elements.
+     */
+    void setIsGroupOfNodes(bool pIsGroupOfNodes) { mIsGroupOfNodes = pIsGroupOfNodes; }
+    
+    /**
+     * Returns the name of this Group.
+     * \return the name of this Group.
+     */
+    const std::string& getName() const { return mName; }
+     
+    /**
+     * Sets the name of this Group.
+     * \param  pName new name of this Group (length of name must not exceed MED_TAILLE_LNOM).
+     */
+    void setName(const std::string& pName);
+    
+    /**
+     * Adds the index of a new element to this Group.
+     * \param  pIndexElt must be >= 1.
+     */
+    void insertElt(med_int pIndexElt);
+    
+    /**
+     * Returns the set of all the elements referenced in this Group.
+     * \return the set of all the elements referenced in this Group.
+     */
+    const std::set<med_int>& getSetOfElt() const { return mElt; }
+    
+    /**
+     * Returns the number of elements referenced in this Group.
+     * \return the number of elements referenced in this Group.
+     */
+    int getSize() const { return mElt.size(); }
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any Group to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pG  any Group.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Group& pG);
+    
+private:
+    
+    std::string        mName;            /**< Name of the group. */
+    std::set<med_int>  mElt;             /**< All elements of this group; each element is referenced by its index >= 1; each element is unique. */
+    bool               mIsGroupOfNodes;  /**< Is it a group of nodes or a group of elements? */
+    
+    bool               mFlagPrintAll;    /** Flag to control the behaviour of the stream operator <<. */
+    
+private:
+
+    // do not allow copy constructor
+    Group(const Group&);
+    
+    // do not allow copy
+    Group& operator=(const Group&);
+    
+    // do not allow operator ==
+    bool operator==(const Group&); 
+    
+}; // class Group
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_FAMILY_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Field.cxx b/src/MULTIPR/MULTIPR_Field.cxx
new file mode 100755 (executable)
index 0000000..19cd05e
--- /dev/null
@@ -0,0 +1,654 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Field.cxx
+ *
+ * \brief   see MULTIPR_Field.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Field.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Field implementation
+//*****************************************************************************
+
+Field::Field() 
+{
+    reset(); 
+}
+
+
+Field::~Field()  
+{ 
+    reset();  
+}
+
+
+void Field::reset() 
+{ 
+    mName[0]       = '\0';
+    mEntity        = MED_NOEUD;
+    mGeom          = MED_NONE;
+    mType          = MED_FLOAT64;
+    mSizeOfType    = 8;
+    mNumComponents = 0;
+    mStrComponent  = "";
+    mStrUnit       = "";
+    
+    mNGauss.clear();
+    mDT.clear();
+    mNumDT.clear();
+    mDTUnit.clear();
+    mNumO.clear();
+    mGaussLoc.clear();
+    mProfil.clear();
+    mSizeOfData.clear();
+    mNVal.clear();
+    
+    for (unsigned it = 0 ; it < mVal.size() ; it++)
+    {
+        delete[] mVal[it];
+    }
+    mVal.clear();
+    
+    mFlagPrintAll = false;
+}
+
+
+bool Field::isEmpty() const
+{
+    return (mNGauss.size() == 0);
+}
+
+
+int Field::getNumberOfGaussPointsByElement(int pTimeStepIt) const
+{
+    if ((pTimeStepIt < 1) || (pTimeStepIt > int(mNGauss.size()))) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mNGauss[pTimeStepIt - 1];
+}
+
+
+const string& Field::getNameGaussLoc(int pTimeStepIt) const
+{
+    if ((pTimeStepIt < 1) || (pTimeStepIt > int(mNGauss.size()))) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mGaussLoc[pTimeStepIt - 1];
+}
+
+
+const unsigned char* Field::getValue(int pTimeStepIt, int pIndex) const
+{
+    if ((pTimeStepIt < 1) || (pTimeStepIt > int(mNGauss.size()))) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    if ((pIndex < 1) || (pIndex > mNVal[pTimeStepIt - 1] / mNGauss[pTimeStepIt - 1])) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    // size of one data = size of type * number of components * number of Gauss points
+    int sizeOfOneData = mSizeOfType * mNumComponents * mNGauss[pTimeStepIt - 1];
+    
+    unsigned char* ret = mVal[pTimeStepIt - 1] + (pIndex - 1) * sizeOfOneData;
+    
+    return ret;
+}
+
+
+Field* Field::extractSubSet(const set<med_int>& pSetIndices) const
+{
+    Field* subset = new Field();
+    
+    memcpy(subset->mName, mName, MED_TAILLE_NOM + 1);
+    subset->mEntity        = mEntity;
+    subset->mGeom          = mGeom;
+    subset->mType          = mType;
+    subset->mSizeOfType    = mSizeOfType;
+    subset->mNumComponents = mNumComponents;
+    subset->mStrComponent  = mStrComponent;
+    subset->mStrUnit       = mStrUnit;
+    
+    subset->mNGauss        = mNGauss;
+    subset->mDT            = mDT;
+    subset->mNumDT         = mNumDT;
+    subset->mDTUnit        = mDTUnit;
+    subset->mNumO          = mNumO;
+    subset->mGaussLoc      = mGaussLoc;
+    subset->mProfil        = mProfil;
+    
+    // for each time step
+    for (unsigned itTimeStep = 0 ; itTimeStep < mNGauss.size() ; itTimeStep++)
+    {
+        if (mProfil[itTimeStep].size() != 0) throw UnsupportedOperationException("", __FILE__, __LINE__);
+        // WARNING : do not manage profil for the moment
+        // if there is a profil,
+        // 1. we should set mProfil to NO_PROFIL for this time_step
+        // 2. we should extract data according to the profil
+        
+        int nval = pSetIndices.size() * subset->mNGauss[itTimeStep];
+        subset->mNVal.push_back(nval);
+        
+        int sizeOfData = nval * mSizeOfType * mNumComponents;
+        subset->mSizeOfData.push_back(sizeOfData);
+        
+        unsigned char* data = new unsigned char[sizeOfData];
+        unsigned char* dest = data;
+        int sizeOfOneData = mSizeOfType * mNumComponents * subset->mNGauss[itTimeStep];
+        
+        // for each element to extract
+        for (set<med_int>::iterator itSet = pSetIndices.begin() ; itSet != pSetIndices.end() ; itSet++)
+        {
+            int indexElt = (*itSet);
+            
+            // MED index start at 1.
+            if (indexElt < 1) throw new IllegalArgumentException("", __FILE__, __LINE__);
+            
+            unsigned char* src = mVal[itTimeStep] + (indexElt - 1) * sizeOfOneData;
+            memcpy(dest, src, sizeOfOneData);
+            
+            dest += sizeOfOneData;
+        }
+        subset->mVal.push_back(data);
+    }
+    
+    return subset;
+}
+
+
+Field* Field::merge(Field* pField)
+{    
+    Field* field = new Field();
+    
+    if (strcmp(mName, pField->mName) != 0) throw IllegalStateException("incompatible field", __FILE__, __LINE__);    
+    memcpy(field->mName, mName, MED_TAILLE_NOM + 1);
+    
+    if (mEntity != pField->mEntity) throw IllegalStateException("incompatible entity", __FILE__, __LINE__);
+    field->mEntity        = mEntity;
+    
+    if (mGeom != pField->mGeom) throw IllegalStateException("incompatible geom", __FILE__, __LINE__);
+    field->mGeom          = mGeom;
+    
+    if (mType != pField->mType) throw IllegalStateException("incompatible type", __FILE__, __LINE__);
+    field->mType          = mType;
+    
+    field->mSizeOfType    = mSizeOfType;
+    
+    if (mNumComponents != pField->mNumComponents) throw IllegalStateException("incompatible #components", __FILE__, __LINE__);
+    field->mNumComponents = mNumComponents;
+    
+    field->mStrComponent  = mStrComponent;
+    field->mStrUnit       = mStrUnit;
+    
+    if (mNGauss.size() != pField->mNGauss.size()) throw IllegalStateException("incompatible #time stamps", __FILE__, __LINE__);
+    field->mNGauss        = mNGauss;
+    
+    field->mDT            = mDT;
+    field->mNumDT         = mNumDT;
+    field->mDTUnit        = mDTUnit;
+    field->mNumO          = mNumO;
+    field->mGaussLoc      = mGaussLoc;
+    field->mProfil        = mProfil;
+    
+    // for each time step
+    for (unsigned itTimeStep = 0 ; itTimeStep < mNGauss.size() ; itTimeStep++)
+    {
+        int sizeOfData = mSizeOfData[itTimeStep] + pField->mSizeOfData[itTimeStep];
+        field->mSizeOfData.push_back(sizeOfData);
+        
+        int nVal = mNVal[itTimeStep] + pField->mNVal[itTimeStep];
+        field->mNVal.push_back(nVal);
+        
+        unsigned char* data = new unsigned char[sizeOfData];
+        memcpy(data, mVal[itTimeStep], mSizeOfData[itTimeStep]);
+        memcpy(data + mSizeOfData[itTimeStep], pField->mVal[itTimeStep], pField->mSizeOfData[itTimeStep]);
+        field->mVal.push_back(data);
+    }
+    
+    return field;
+}
+
+
+Field* Field::merge(vector<Field*> pFields, int pFieldIt)
+{    
+    if (pFields.size() == 0) throw IllegalArgumentException("pElements should contain at least 1 element", __FILE__, __LINE__);
+
+    Field* field = new Field();
+    
+    // check if fields are compatible
+    for (unsigned i = 0 ; i < pFields.size() ; i++)
+    {    
+        if (strcmp(mName, pFields[i]->mName) != 0) throw IllegalStateException("incompatible field", __FILE__, __LINE__);
+        if (mEntity != pFields[i]->mEntity) throw IllegalStateException("incompatible entity", __FILE__, __LINE__);
+        if (mGeom != pFields[i]->mGeom) throw IllegalStateException("incompatible geom", __FILE__, __LINE__);
+        if (mType != pFields[i]->mType) throw IllegalStateException("incompatible type", __FILE__, __LINE__);
+        if (mNumComponents != pFields[i]->mNumComponents) throw IllegalStateException("incompatible #components", __FILE__, __LINE__);
+        if (mNGauss.size() != pFields[i]->mNGauss.size()) throw IllegalStateException("incompatible #time stamps", __FILE__, __LINE__);
+    }   
+    
+    memcpy(field->mName, mName, MED_TAILLE_NOM + 1);        
+    field->mEntity        = mEntity;        
+    field->mGeom          = mGeom;        
+    field->mType          = mType;    
+    field->mSizeOfType    = mSizeOfType;        
+    field->mNumComponents = mNumComponents;    
+    field->mStrComponent  = mStrComponent;
+    field->mStrUnit       = mStrUnit;
+    
+    if (pFieldIt == -1) // merge all time step
+    {       
+        field->mNGauss        = mNGauss;    
+        field->mDT            = mDT;
+        field->mNumDT         = mNumDT;
+        field->mDTUnit        = mDTUnit;
+        field->mNumO          = mNumO;
+        field->mGaussLoc      = mGaussLoc;
+        field->mProfil        = mProfil;      
+        
+        // for each time step
+        for (unsigned itTimeStep = 0 ; itTimeStep < mNGauss.size() ; itTimeStep++)
+        {
+            int sizeOfData = mSizeOfData[itTimeStep];
+            int nVal = mNVal[itTimeStep];
+            
+            for (unsigned i = 0 ; i < pFields.size() ; i++)
+            {
+                sizeOfData += pFields[i]->mSizeOfData[itTimeStep];
+                nVal += pFields[i]->mNVal[itTimeStep];
+            }                        
+            
+            field->mSizeOfData.push_back(sizeOfData);                        
+            field->mNVal.push_back(nVal);
+            
+            unsigned char* data = new unsigned char[sizeOfData];
+            memcpy(data, mVal[itTimeStep], mSizeOfData[itTimeStep]);
+            
+            int offsetData = mSizeOfData[itTimeStep];
+            for (unsigned i = 0 ; i < pFields.size() ; i++)
+            {
+                memcpy(data + offsetData, pFields[i]->mVal[itTimeStep], pFields[i]->mSizeOfData[itTimeStep]);
+                offsetData += pFields[i]->mSizeOfData[itTimeStep];
+            }
+            
+            field->mVal.push_back(data);
+        }
+    }
+    else // only merge the given time step
+    {        
+        field->mNGauss.push_back(mNGauss[pFieldIt]);
+        field->mDT.push_back(mDT[pFieldIt]);
+        field->mNumDT.push_back(mNumDT[pFieldIt]);
+        field->mDTUnit.push_back(mDTUnit[pFieldIt]);
+        field->mNumO.push_back(mNumO[pFieldIt]);
+        
+        if (mGaussLoc.size() != 0) field->mGaussLoc.push_back(mGaussLoc[pFieldIt]);
+        if (mProfil.size() != 0) field->mProfil.push_back(mProfil[pFieldIt]);
+        
+        // to finish
+        throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+    }
+    
+    return field;
+}
+
+
+void Field::getSetOfGaussLoc(set<string>& pSetOfGaussLoc) const
+{
+    for (unsigned itGaussLoc = 0 ; itGaussLoc < mGaussLoc.size() ; itGaussLoc++)
+    {
+        const string& gaussLocName = mGaussLoc[itGaussLoc];
+        
+        if (gaussLocName.length() != 0)
+        {
+            pSetOfGaussLoc.insert(gaussLocName);
+        }
+    }
+}
+
+
+void Field::readMED(med_idt pMEDfile, med_int pIndex, char* pMeshName)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (pIndex < 1) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    
+    mNumComponents = MEDnChamp(pMEDfile, pIndex);
+    
+    if (mNumComponents < 0) throw IOException("", __FILE__, __LINE__);
+    
+    char* strComponent = new char[mNumComponents * MED_TAILLE_PNOM + 1];
+    char* strUnit      = new char[mNumComponents * MED_TAILLE_PNOM + 1];
+    
+    strComponent[0] = '\0';
+    strUnit[0] = '\0';
+    
+    med_err ret = MEDchampInfo(
+        pMEDfile, 
+        pIndex, 
+        mName, 
+        &(mType), 
+        strComponent, 
+        strUnit, 
+        mNumComponents);
+    
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    
+    mStrComponent = strComponent;
+    mStrUnit = strUnit;
+    
+    delete[] strUnit;
+    delete[] strComponent;
+    
+    switch (mType)
+    {
+        case MED_FLOAT64: mSizeOfType = 8; break;
+        case MED_INT64: mSizeOfType = 8; break;
+        case MED_INT32: mSizeOfType = 4; break;
+        case MED_INT: mSizeOfType = 4; break;
+        default: throw IllegalStateException("should not be there", __FILE__, __LINE__);
+    }
+    
+    //---------------------------------------------------------------------
+    // Read fields over nodes
+    //---------------------------------------------------------------------
+    bool fieldOnNodes = false;
+    {
+        med_int numTimeStepNodes = MEDnPasdetemps(
+            pMEDfile, 
+            mName, 
+            MED_NOEUD, 
+            (med_geometrie_element) 0);
+        
+        if (numTimeStepNodes < 0) throw IOException("", __FILE__, __LINE__);
+        
+        if (numTimeStepNodes != 0)
+        {
+            fieldOnNodes = true;
+            mEntity = MED_NOEUD;
+            mGeom = (med_geometrie_element) 0;
+            readMEDtimeSteps(pMEDfile, numTimeStepNodes, pMeshName);
+        }
+    }
+
+    //---------------------------------------------------------------------
+    // Read fields over elements
+    //---------------------------------------------------------------------
+    {
+        med_int numTimeStepElt = MEDnPasdetemps(
+            pMEDfile, 
+            mName, 
+            MED_MAILLE, 
+            MED_TETRA10);
+        
+        if (numTimeStepElt  < 0) throw IOException("", __FILE__, __LINE__);    
+        
+        if (numTimeStepElt != 0)
+        {
+            if (fieldOnNodes) throw IllegalStateException("", __FILE__, __LINE__);
+            
+            mEntity = MED_MAILLE;
+            mGeom = MED_TETRA10;
+            readMEDtimeSteps(pMEDfile, numTimeStepElt, pMeshName);
+        }
+    }
+}
+
+
+void Field::readMEDtimeSteps(med_idt pMEDfile, med_int pNumberOfTimeSteps, char* pMeshName)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (pNumberOfTimeSteps < 0) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    char strEntity[8];
+    switch (mEntity)
+    {
+        case MED_ARETE:
+        case MED_FACE:
+        case MED_MAILLE: strcpy(strEntity, "CELLS"); break;
+        case MED_NOEUD: strcpy(strEntity, "NODES"); break;
+        default: strcpy(strEntity, "UNKNOWN"); break;
+    }
+    
+    // iterates over time step
+    for (int itTimeStep = 1 ; itTimeStep <= pNumberOfTimeSteps ; itTimeStep++)
+    {
+        med_int ngauss;
+        med_int numdt;
+        med_int numo;
+        char dtunit[MED_TAILLE_PNOM + 1];
+        med_float dt;
+        char maa[MED_TAILLE_NOM + 1];
+        med_booleen local;
+        med_int nmaa;
+        
+        med_err ret = MEDpasdetempsInfo(
+            pMEDfile, 
+            mName, 
+            mEntity, 
+            mGeom, 
+            itTimeStep, 
+                &ngauss, 
+            &numdt, 
+            &numo, 
+            dtunit, 
+            &dt, 
+            maa, 
+            &local, 
+            &nmaa);
+            
+        if (ret != 0) throw IOException("i/o error while reading #timesteps in MED file", __FILE__, __LINE__);
+        
+        // mesh must be local
+        if (local != MED_VRAI) throw IllegalStateException("only local fields are currently supported", __FILE__, __LINE__);
+        
+        // #mesh must be 1
+        if (nmaa != 1) throw IllegalStateException("field shoud be associated with 1 mesh only", __FILE__, __LINE__);
+        
+        // mesh must be pMeshName
+        // if field does not apply on the current mesh, skip
+        if (strcmp(maa, pMeshName) != 0) 
+        {
+            continue;
+        }
+        
+        mNGauss.push_back(ngauss);
+        mDT.push_back(dt);
+        mNumDT.push_back(numdt);
+        mDTUnit.push_back(dtunit);
+        mNumO.push_back(numo);
+        
+        med_int nval = MEDnVal(
+            pMEDfile, 
+            mName, 
+            mEntity, 
+            mGeom, 
+            numdt, 
+            numo, 
+            pMeshName, 
+            MED_GLOBAL);
+        
+        if (nval < 0) throw IOException("i/o error while reading field in MED file", __FILE__, __LINE__);
+        
+        mNVal.push_back(nval);
+        
+        char gaussLocName[MED_TAILLE_NOM + 1];
+        char profilName[MED_TAILLE_NOM + 1];
+        int sizeOfData = mSizeOfType * mNumComponents * nval;
+        mSizeOfData.push_back(sizeOfData);
+        unsigned char* fieldData = new unsigned char[sizeOfData];
+        
+        ret = MEDchampLire(
+            pMEDfile, 
+            pMeshName,
+            mName, 
+            fieldData, 
+            MED_FULL_INTERLACE, 
+            MED_ALL, 
+            gaussLocName, 
+            profilName, 
+            MED_COMPACT, // should be: MED_GLOBAL, MED_NO_PFLMOD, MED_COMPACT
+            mEntity, 
+            mGeom, 
+            numdt, 
+            numo);
+        
+        if (ret != 0) throw IOException("i/o error while reading field in MED file", __FILE__, __LINE__);
+    
+        mGaussLoc.push_back(gaussLocName);
+        mProfil.push_back(profilName);
+        mVal.push_back(fieldData);
+    }
+}
+
+
+void Field::writeMED(med_idt pMEDfile, char* pMeshName)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (mNumComponents < 1) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    med_err ret = MEDchampCr(
+        pMEDfile, 
+        mName,                                        // name of the field
+        mType,                                        // type of data (MED_FLOAT64, MED_INT32, etc.)
+        const_cast<char*>(mStrComponent.c_str()),     // name of components
+        const_cast<char*>(mStrUnit.c_str()),          // name of units
+        mNumComponents);                              // number of components
+    
+    if (ret != 0) throw IOException("i/o error while creating field in MED file", __FILE__, __LINE__);
+    
+    // for each time step
+    for (unsigned i = 0 ; i < mNGauss.size() ; i++)
+    {
+        // skip if no values
+        if (mNVal[i] == 0) continue;
+        
+        ret = MEDchampEcr(
+            pMEDfile,
+            pMeshName,          // name of the mesh (first call to MEDchampEcr => name of reference)
+            mName,              // name of the field
+            mVal[i],            // data (= values)
+            MED_FULL_INTERLACE, // data organization
+            mNVal[i],           // number of values
+            const_cast<char*>(mGaussLoc[i].c_str()), // name of Gauss reference
+            MED_ALL,            // components to be selected
+            const_cast<char*>(mProfil[i].c_str()), // name of profil
+            MED_GLOBAL,         // how to read data: MED_NO_PFLMOD,MED_COMPACT,MED_GLOBAL
+            mEntity,            // type of entity (MED_NOEUD, MED_MAILLE, etc.)
+            mGeom,              // type of geometry (TETRA10, etc.)
+            mNumDT[i],          // time step iteration
+            const_cast<char*>(mDTUnit[i].c_str()), // unit of time step
+            mDT[i],             // time key
+            mNumO[i]);          // order number
+        
+        if (ret != 0) throw IOException("i/o error while writing field in MED file", __FILE__, __LINE__);
+    }
+}
+
+
+ostream& operator<<(ostream& pOs, Field& pF)
+{
+    char strEntity[16];
+    switch (pF.mEntity) 
+    {
+        case MED_MAILLE: strcpy(strEntity, "MED_MAILLE"); break;
+        case MED_FACE:   strcpy(strEntity, "MED_FACE"); break;
+        case MED_ARETE:  strcpy(strEntity, "MED_ARETE"); break;
+        case MED_NOEUD:  strcpy(strEntity, "MED_NOEUD"); break;
+        default:         strcpy(strEntity, "UNKNOWN"); break;
+    }
+    
+    char strType[16];
+    switch (pF.mType) 
+    {
+        case MED_FLOAT64: strcpy(strType, "MED_FLOAT64"); break;
+        case MED_INT32:   strcpy(strType, "MED_INT32"); break;
+        case MED_INT64:   strcpy(strType, "MED_INT64"); break;
+        case MED_INT:     strcpy(strType, "MED_INT"); break;
+        default:          strcpy(strType, "UNKNOWN"); break;
+    }
+    
+    pOs << "Field: " << endl;
+    pOs << "    Name       =|" << pF.mName << "|" << endl;
+    pOs << "    Entity     =" << strEntity << endl;
+    pOs << "    Geom       =" << pF.mGeom << endl;
+    pOs << "    Type       =" << strType << " (size=" << pF.mSizeOfType << ")" << endl;
+    pOs << "    #Components=" << pF.mNumComponents << endl;
+    pOs << "        Name component=|" << pF.mStrComponent << "|" << endl;
+    pOs << "        Unit component=|" << pF.mStrUnit << "|" << endl;
+    pOs << "    #Time steps=" << pF.mNGauss.size() << endl;
+    
+    for (unsigned itTimeStep = 0 ; itTimeStep < pF.mNGauss.size() ; itTimeStep++)
+    {
+        pOs << "        Time=" << pF.mDT[itTimeStep];
+        pOs << "  it=" << pF.mNumDT[itTimeStep];
+        pOs << "  order=" << pF.mNumO[itTimeStep];
+        pOs << "  #gauss=" << pF.mNGauss[itTimeStep];
+        pOs << "  #val=" << pF.mNVal[itTimeStep];
+        pOs << "  sizeof_val=" << pF.mSizeOfData[itTimeStep];
+        pOs << "  gauss_loc=|" << ((pF.mGaussLoc[itTimeStep].size() == 0)?"NONE":pF.mGaussLoc[itTimeStep]) << "|  size=" << pF.mGaussLoc[itTimeStep].size();
+        pOs << "  profil=|" << ((pF.mProfil[itTimeStep].size() == 0)?"NONE":pF.mProfil[itTimeStep]) << "|  size=" << pF.mProfil[itTimeStep].size() << endl; 
+        
+        if (pF.mFlagPrintAll)
+        {
+            cout << "    Values: ";
+            switch (pF.mType)
+            {
+            case MED_FLOAT64: 
+                {
+                    med_float* src = reinterpret_cast<med_float*>(pF.mVal[itTimeStep]);
+                    for (int itVal = 0 ; itVal < pF.mNVal[itTimeStep] * pF.mNumComponents ; itVal++)
+                    {
+                        cout << src[itVal] << " ";
+                    }  
+                }
+                break;
+            case MED_INT:
+            case MED_INT32:   
+                {
+                    med_int* src = reinterpret_cast<med_int*>(pF.mVal[itTimeStep]);
+                    for (int itVal = 0 ; itVal < pF.mNVal[itTimeStep] * pF.mNumComponents ; itVal++)
+                    {
+                        cout << src[itVal] << " ";
+                    }  
+                }
+                break;
+            case MED_INT64:
+                // not yet implemented
+                throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+            default:          
+                // should not be there
+                throw IllegalStateException("should not be there", __FILE__, __LINE__);
+            }
+            cout << endl;
+        }
+        
+    }
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Field.hxx b/src/MULTIPR/MULTIPR_Field.hxx
new file mode 100755 (executable)
index 0000000..bdd4033
--- /dev/null
@@ -0,0 +1,244 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Field.hxx
+ *
+ * \brief   Class Field used to wrap MED file fields.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_FIELD_HXX
+#define MULTIPR_FIELD_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <string>
+#include <vector>
+#include <set>
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Field
+//*****************************************************************************
+
+class Field
+{
+public:
+
+    /** 
+     * Builds an empty field (default constructor).
+     */
+    Field();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Field();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns true iff this field is empty (no data).
+     * \return true if this field is empty, false otherwise.
+     */
+    bool isEmpty() const;
+    
+    /**
+     * Returns true iff this field apply on nodes (otherwise, information are related to elements).
+     * \return true iff this field apply on nodes.
+     */
+    bool isFieldOnNodes() const { return (mEntity == MED_NOEUD); }
+    
+    /**
+     * Returns the name of this Field.
+     * \return the name of this Field.
+     */
+    const char* getName() const { return mName; }
+    
+    /**
+     * Returns the number of time steps in this Field.
+     * \return the number of time steps in this Field.
+     */
+    int getNumberOfTimeSteps() const { return mNGauss.size(); }
+    
+    /**
+     * Returns the numeric type of information contained in this Field (e.g. MED_FLOAT64).
+     * \return the numeric type of this Field.
+     */
+    med_type_champ getType() const { return mType; }
+    
+    /**
+     * Returns the number of components of this Field.
+     * \return the number of components of this Field.
+     */
+    int getNumberOfComponents() const { return mNumComponents; }
+    
+    /**
+     * Returns the number of Gauss points for each element at the given time step.
+     * \param  pTimeStepIt iteration of the field; must be in [1..MAX_ITERATION].
+     * \return number of Gauss points in the elements of this Field at the given iteration.
+     * \throw  IndexOutOfBoundsException if pTimeStepIt not in [1..MAX_ITERATION].
+     */
+    int getNumberOfGaussPointsByElement(int pTimeStepIt) const;
+    
+    /**
+     * Returns the name of the Gauss localization related to the given iteration.
+     * \param  pTimeStepIt iteration of the field; must be in [1..MAX_ITERATION].
+     * \return the name of the Gauss localization related to the given iteration.
+     * \throw  IndexOutOfBoundsException if pTimeStepIt not in [1..MAX_ITERATION].
+     */
+    const std::string& getNameGaussLoc(int pTimeStepIt) const;
+    
+    /**
+     * Returns a pointer towards the first value of this Field for the given element at the given time step.
+     * \param  pTimeStepIt iteration of the field; must be in [1..MAX_ITERATION].
+     * \param  pIndex      index of the element; must be >= 1.
+     * \return the value of this Field for the given element at the given time step.
+     * \throw  IndexOutOfBoundsException if pTimeStepIt or pIndex are invalid.
+     */
+    const unsigned char* getValue(int pTimeStepIt, int pIndex) const;
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Creates a subset of this Field restricted to a set of elements (NODES or CELLS).
+     * This method performs a projection of this Field on the given set of elements.     
+     * \param  pSetIndices WARNING: indices start at 1.
+     * \return a new Field restricted to the given set of elements.
+     */
+    Field* extractSubSet(const std::set<med_int>& pSetIndices) const;
+    
+    /**
+     * Adds the set of GaussLoc used by this Field into the given set.
+     * \param  pSetOfGauss any set of Gauss localisation.
+     */
+    void getSetOfGaussLoc(std::set<std::string>& pSetOfGaussLoc) const;
+    
+    /**
+     * Builds a new field by merging data of this and pField if they are compatible.
+     * \param  pField the field to be merged with this.
+     * \throw  IllegalStateException if the two fields are incompatible.
+     */
+    Field* merge(Field* pField);
+    Field* merge(std::vector<Field*> pFields, int pFieldIt = -1);
+
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads a field from a MED file.
+     * If the field is not related to the given mesh, the result is an empty field.
+     * \param  pMEDfile  any valid MED file opened for reading.
+     * \param  pIndex    index of the field to be read; must be >= 1.
+     * \param  pMeshName name of the mesh (a field is always related to a mesh).
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMED(med_idt pMEDfile, med_int pIndex, char* pMeshName);
+    
+    /**
+     * Writes this field to a MED file. The field is linked to the given mesh.
+     * WARNING: all related Gauss info must have been added to the MED file before.
+     * \param  pMEDfile  any valid MED file opened for writing.
+     * \param  pMeshName name of the mesh.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile, char* pMeshName);
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any Field to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pF  any Field.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Field& pF);
+    
+private:
+
+    /**
+     * Reads all the information related to its field and a given time step (by its index).
+     * \param  pMEDfile           MED file handle.
+     * \param  pNumberOfTimeSteps number of timesteps (iteration) to be read.
+     * \param  pMeshName          name of the mesh.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMEDtimeSteps(med_idt pMEDfile, med_int pNumberOfTimeSteps, char* pMeshName);
+    
+private:
+    
+    char                         mName[MED_TAILLE_NOM + 1];
+    med_entite_maillage          mEntity;      // type of entity, e.g. MED_MAILLE
+    med_geometrie_element        mGeom;        // type of primitives, e.g. MED_TETRA10 (MED_NONE for a field on nodes)
+    med_type_champ               mType;        // type of field, e.g. MED_FLOAT64, MED_INT32
+    int                          mSizeOfType;  // 8 for MED_FLOAT64, 4 for MED_INT32, etc.
+    med_int                      mNumComponents;
+    std::string                  mStrComponent;
+    std::string                  mStrUnit;
+    
+    // Information related to time steps.
+    // Each vector should contain the same number of elements.
+    // Number of time step = mNGauss.size() = mDT.size() = ...
+    
+    std::vector<med_int>         mNGauss;        /**< For each time step, number of Gauss points in the field. */
+    std::vector<med_float>       mDT;            /**< For each time step, value of time step. */
+    std::vector<med_int>         mNumDT;         /**< For each time step, iteration number. */
+    std::vector<std::string>     mDTUnit;        /**< For each time step, units. */
+    std::vector<med_int>         mNumO;          /**< For each time step, order number. */
+    std::vector<std::string>     mGaussLoc;      /**< For each time step, name of Gauss localization to be used (empty if none). */
+    std::vector<std::string>     mProfil;        /**< For each time step, name of the profil to be used (empty if none). */
+    std::vector<int>             mSizeOfData;    /**< For each time step, sizeof data (mVal) in bytes. */
+    std::vector<med_int>         mNVal;          /**< For each time step, number of values. */
+    std::vector<unsigned char*>  mVal;           /**< For each time step, raw data; can be MED_FLOAT64, MED_INT32, etc. see mType. */
+
+    bool                         mFlagPrintAll;  /**< Flag to control the behaviour of the stream operator <<. */
+    
+private:
+
+    // do not allow copy constructor
+    Field(const Field&);
+    
+    // do not allow copy
+    Field& operator=(const Field&);
+    
+    // do not allow operator ==
+    bool operator==(const Field&); 
+    
+}; // class Field
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_FIELD_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_GaussLoc.cxx b/src/MULTIPR/MULTIPR_GaussLoc.cxx
new file mode 100755 (executable)
index 0000000..31ad42b
--- /dev/null
@@ -0,0 +1,233 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_GaussLoc.cxx
+ *
+ * \brief   see MULTIPR_GaussLoc.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_GaussLoc.hxx"
+#include "MULTIPR_Utils.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class GaussLoc implementation
+//*****************************************************************************
+
+GaussLoc::GaussLoc() 
+{
+    mRefCoo    = NULL;
+    mGaussCoo  = NULL;
+    mWeight    = NULL;
+    
+    reset(); 
+}
+
+
+GaussLoc::GaussLoc(const GaussLoc& pGaussLoc)
+{
+    mRefCoo   = NULL;
+    mGaussCoo = NULL;
+    mWeight   = NULL;
+    
+    strcpy(mName, pGaussLoc.mName);
+    
+    mGeom     = pGaussLoc.mGeom;
+    mDim      = pGaussLoc.mDim;
+    mNumNodes = pGaussLoc.mNumNodes;
+    mNumGauss = pGaussLoc.mNumGauss;
+    
+    if (mDim != (mGeom / 100)) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mNumNodes != (mGeom % 100)) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    if (pGaussLoc.mRefCoo != NULL)
+    {
+        mRefCoo = new med_float[mDim * mNumNodes];
+        memcpy(mRefCoo, pGaussLoc.mRefCoo, sizeof(med_float) * mDim * mNumNodes);
+    }
+    
+    if (pGaussLoc.mGaussCoo != NULL)
+    {
+        mGaussCoo  = new med_float[mDim * mNumGauss];
+        memcpy(mGaussCoo, pGaussLoc.mGaussCoo, sizeof(med_float) * mDim * mNumGauss);
+    }
+    
+    if (pGaussLoc.mWeight != NULL)
+    {
+        mWeight = new med_float[mNumGauss];
+        memcpy(mWeight, pGaussLoc.mWeight, sizeof(med_float) * mNumGauss);
+    }
+}
+
+
+GaussLoc::~GaussLoc()  
+{ 
+    reset();  
+}
+
+
+void GaussLoc::reset() 
+{ 
+    mName[0]  = '\0';
+    mGeom     = MED_NONE;
+    mDim      = 0;
+    mNumNodes = 0;
+    mNumGauss = 0;
+    
+    if (mRefCoo   != NULL) { delete[] mRefCoo;   mRefCoo   = NULL; }
+    if (mGaussCoo != NULL) { delete[] mGaussCoo; mGaussCoo = NULL; }
+    if (mWeight   != NULL) { delete[] mWeight;   mWeight   = NULL; }
+}
+
+
+void GaussLoc::getCoordGaussPoints(
+    const med_float* pCooElt,  
+    med_float* pCooGaussPoints) const
+{
+    // debug
+    //printArray2D(pCooElt, mNumNodes, mDim, "Node");
+    
+    // WARNING: assumes TETRA10 !!!
+    // This method is not completely generic and should be extended to support all cases.
+    if (mGeom != MED_TETRA10) throw UnsupportedOperationException("only support TETRA10 for the moment", __FILE__, __LINE__);
+    
+    const med_float* pt1 = pCooElt;
+    const med_float* pt2 = pt1 + mDim;
+    const med_float* pt3 = pt2 + mDim;
+    const med_float* pt4 = pt3 + mDim;
+    
+    const med_float* coeff = mGaussCoo;
+    med_float* dest        = pCooGaussPoints;
+    
+    // for each Gauss point
+    for (int i = 0 ; i < mNumGauss ; i++)
+    {
+        dest[0] = pt2[0] + (pt4[0] - pt2[0]) * coeff[0] + (pt1[0] - pt2[0]) * coeff[1] + (pt3[0] - pt2[0]) * coeff[2];
+        dest[1] = pt2[1] + (pt4[1] - pt2[1]) * coeff[0] + (pt1[1] - pt2[1]) * coeff[1] + (pt3[1] - pt2[1]) * coeff[2];
+        dest[2] = pt2[2] + (pt4[2] - pt2[2]) * coeff[0] + (pt1[2] - pt2[2]) * coeff[1] + (pt3[2] - pt2[2]) * coeff[2];
+        
+        // prepare next point
+        coeff += mDim;
+        dest += mDim;
+    }
+}
+
+
+void GaussLoc::readMED(med_idt pMEDfile, med_int pIndex)
+{
+    if (pMEDfile == 0) throw IOException("pMEDfile should not be NULL", __FILE__, __LINE__);
+    if (pIndex < 1) throw IllegalArgumentException("pIndex should be >= 1", __FILE__, __LINE__);
+    
+    reset();
+    
+    med_err ret = MEDgaussInfo(
+        pMEDfile, 
+        pIndex, 
+        mName, 
+        &mGeom, 
+        &mNumGauss);
+    
+    if (ret != 0) throw IOException("i/o error while reading Gauss localization information in MED file", __FILE__, __LINE__);
+    
+    mDim      = mGeom / 100;
+    mNumNodes = mGeom % 100;
+    
+    mRefCoo   = new med_float[mDim * mNumNodes];
+    mGaussCoo = new med_float[mDim * mNumGauss];
+    mWeight   = new med_float[mNumGauss];
+    
+    ret = MEDgaussLire(
+        pMEDfile, 
+        mRefCoo, 
+        mGaussCoo, 
+        mWeight, 
+        MED_FULL_INTERLACE, 
+        mName);
+        
+    if (ret != 0) throw IOException("i/o error while reading Gauss localization in MED file", __FILE__, __LINE__);
+}
+
+
+void GaussLoc::writeMED(med_idt pMEDfile)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (mNumGauss < 0) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mRefCoo == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mGaussCoo == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mWeight == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (strlen(mName) > MED_TAILLE_NOM) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    med_err ret = MEDgaussEcr(
+        pMEDfile,  
+        mGeom, 
+        mRefCoo, 
+        MED_FULL_INTERLACE, 
+        mNumGauss, 
+        mGaussCoo,
+        mWeight,
+        mName); 
+        
+    if (ret != 0) throw IOException("i/o error while writing Gauss localization", __FILE__, __LINE__);
+}
+
+
+ostream& operator<<(ostream& pOs, GaussLoc& pG)
+{
+    pOs << "Gauss ref:" << endl;
+    pOs << "    Name     =|" << pG.mName << "|" << endl;
+    pOs << "    Geom     =" << pG.mGeom << endl;
+    pOs << "    #Pt Gauss=" << pG.mNumGauss << endl;
+    
+    pOs << "    Ref nodes coords.: (#nodes=" << pG.mNumNodes << " dim=" << pG.mDim << ")" << endl;
+    for (int itNode = 0 ; itNode < pG.mNumNodes ; itNode++)
+    {
+        pOs << "        Node " << (itNode + 1) << ": ";
+        for (int itDim = 0; itDim < pG.mDim ; itDim++)
+        {
+            pOs << pG.mRefCoo[itNode * pG.mDim + itDim] << " ";
+        }
+        pOs << endl;
+    }
+    
+    pOs << "    Gauss coords. and weight:" << endl;
+    for (int itGauss = 0 ; itGauss < pG.mNumGauss ; itGauss++)
+    {
+        pOs << "        Pt " << (itGauss+1) << ": ";
+        for (int itDim = 0; itDim < pG.mDim ; itDim++)
+        {
+            pOs << pG.mGaussCoo[itGauss * pG.mDim + itDim] << " ";
+        }
+        pOs << "weight=" << pG.mWeight[itGauss];
+        pOs << endl;
+    }
+
+    // debug
+    //med_float res[15];
+    //pG.getCoordGaussPoints(pG.mRefCoo, res);
+    //printArray2D(res, pG.mNumGauss, pG.mDim, "Gauss pt");
+    
+    return pOs;
+}
+
+
+} // namespace multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_GaussLoc.hxx b/src/MULTIPR/MULTIPR_GaussLoc.hxx
new file mode 100755 (executable)
index 0000000..dcaa4d4
--- /dev/null
@@ -0,0 +1,150 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_GaussLoc.hxx
+ *
+ * \brief   Class GaussLoc. Allow to locate all the Gauss points in an element of reference (e.g. a TETRA10).
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_GAUSSLOC_HXX
+#define MULTIPR_GAUSSLOC_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class GaussLoc
+//*****************************************************************************
+
+class GaussLoc
+{
+public:
+
+    /** 
+     * Builds an empty Gauss reference (default constructor).
+     */
+    GaussLoc();
+    
+    /**
+     * Copy constructor (deep copy).
+     * \param  pGaussLoc the GaussLoc to copy.
+     */
+    GaussLoc(const GaussLoc& pGaussLoc);
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~GaussLoc();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //--------------------------------------------------------------------
+    
+    /**
+     * Returns the name of this GaussLoc.
+     * \return the name of this GaussLoc.
+     */
+    std::string getName() const { return mName; }
+    
+    /**
+     * Returns dimension of Gauss points which is also the dimension of reference nodes.
+     * \return dimension of Gauss points.
+     */
+    int getDim() const { return mDim; }
+     
+    /**
+     * Returns number of Gauss points.
+     * \return number of Gauss points.
+     */
+    int getNumGaussPoints() const { return mNumGauss; }
+      
+    //---------------------------------------------------------------------
+    // Algorithms
+    //--------------------------------------------------------------------
+    
+    /**
+     * Returns the coordinates of all the Gauss points for a given element.
+     * \param  pCooElt (in)  coordinates of nodes of an element.
+     * \param  pCoo    (out) coordinates of all the Gauss points (interlaced); memory must have been allocated.
+     */
+    void getCoordGaussPoints(const med_float* pCooElt, med_float* pCooGaussPoints) const;
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads a GaussLoc object from a MED file.
+     * \param  pMEDfile any valid MED file opened for reading.
+     * \param  pIndex   index of the gauss localization to be read; must be >= 1.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMED(med_idt pMEDfile, med_int pIndex);
+    
+    /**
+     * Writes this GaussLoc object to the given MED file.
+     * \param  pMEDfile any valid MED file opened for writing.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile);
+
+    /**
+     * Dumps any GaussLoc to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pF  any Field.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, GaussLoc& pG);
+
+private:
+    
+    char                  mName[MED_TAILLE_NOM + 1];  /**< Name of the Gauss info. */
+    med_geometrie_element mGeom;                      /**< Type of elements, e.g. TETRA10 (code is 310). */
+    int                   mDim;                       /**< Dimension of nodes, e.g. 3 for a TETRA10. */
+    int                   mNumNodes;                  /**< Number of nodes in the reference element, e.g. 10 for a TETRA10. */
+    med_int               mNumGauss;                  /**< Number of Gauss points. */
+    med_float*            mRefCoo;                    /**< Table of coordinates of nodes.
+                                                           Example: for a TETRA10: 10 nodes, 3 components => 30 med_float. */
+    med_float*            mGaussCoo;                  /**< Table of coordinates of Gauss points. */
+    med_float*            mWeight;                    /**< Table of weights of Gauss points. */
+    
+private:
+    
+    // do not allow copy
+    GaussLoc& operator=(const GaussLoc&);
+    
+    // do not allow operator ==
+    bool operator==(const GaussLoc&); 
+    
+}; // class GaussLoc
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_GAUSSLOC_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Globals.hxx b/src/MULTIPR/MULTIPR_Globals.hxx
new file mode 100755 (executable)
index 0000000..ff51f67
--- /dev/null
@@ -0,0 +1,29 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Globals.hxx
+ *
+ * \brief   Some useful macros.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+  
+#ifndef MULTIPR_GLOBALS_HXX
+#define MULTIPR_GLOBALS_HXX
+
+//*****************************************************************************
+// Some useful macros
+//*****************************************************************************
+
+#define ENABLE_LOG 0
+#define MULTIPR_LOG(STR) if (ENABLE_LOG) cout << STR;
+
+
+#endif // MULTIPR_GLOBALS_HXX
+
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Mesh.cxx b/src/MULTIPR/MULTIPR_Mesh.cxx
new file mode 100755 (executable)
index 0000000..5d305ce
--- /dev/null
@@ -0,0 +1,1430 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Mesh.cxx
+ *
+ * \brief   see MULTIPR_Mesh.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_Nodes.hxx"
+#include "MULTIPR_Elements.hxx"
+#include "MULTIPR_Family.hxx"
+#include "MULTIPR_Profil.hxx"
+#include "MULTIPR_GaussLoc.hxx"
+#include "MULTIPR_Field.hxx"
+#include "MULTIPR_MeshDis.hxx"
+#include "MULTIPR_PointOfField.hxx"
+#include "MULTIPR_DecimationFilter.hxx"
+#include "MULTIPR_Utils.hxx"
+#include "MULTIPR_Exceptions.hxx"
+#include "MULTIPR_Globals.hxx"
+#include "MULTIPR_API.hxx"
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Mesh implementation
+//*****************************************************************************
+
+Mesh::Mesh()
+{
+    mNodes    = NULL;
+    mElements = NULL;
+    
+    reset();
+}
+
+
+Mesh::~Mesh()
+{
+    reset();
+}
+
+
+void Mesh::reset()
+{
+    mMEDfilename[0] = '\0';
+    mMEDfile        = 0;
+    
+    mMeshName[0]    = '\0';
+    mMeshUName[0]   = '\0';
+    mMeshDesc[0]    = '\0';
+    mMeshDim        = -1;
+    mMeshType       = MED_NON_STRUCTURE;
+    
+    for (int itDim = 0 ; itDim < 3 ; itDim++) 
+    { 
+        mMeshBBoxMin[itDim] = numeric_limits<med_float>::quiet_NaN();
+        mMeshBBoxMax[itDim] = numeric_limits<med_float>::quiet_NaN();
+    }
+    
+    if (mNodes != NULL)    { delete mNodes;    mNodes = NULL; }
+    if (mElements != NULL) { delete mElements; mElements = NULL; }
+    
+    for (unsigned itFam = 0 ; itFam < mFamilies.size() ; itFam++)
+    {
+        delete mFamilies[itFam];
+    }  
+    mFamilies.clear();
+    mFamIdToFam.clear();
+    
+    for (unsigned itGroup = 0 ; itGroup < mGroups.size() ; itGroup++)
+    {
+        delete mGroups[itGroup];
+    }  
+    mGroups.clear();
+    mGroupNameToGroup.clear();
+    
+    for (unsigned itGaussLoc = 0 ; itGaussLoc < mGaussLoc.size() ; itGaussLoc++)
+    {
+        delete mGaussLoc[itGaussLoc];
+    }  
+    mGaussLoc.clear();
+    mGaussLocNameToGaussLoc.clear();
+    
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        delete mFields[itField];
+    }  
+    mFields.clear();
+    
+    for (unsigned itProfil = 0 ; itProfil < mProfils.size() ; itProfil++)
+    {
+        delete mProfils[itProfil];
+    }  
+    mProfils.clear();
+    
+    mFlagPrintAll = false;
+}
+
+
+vector<string> Mesh::getNameScalarFields() const
+{
+    vector<string> res;
+    
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* currentField = mFields[itField];
+        
+        // only get scalar fields, not vectorial fields
+        // (because, currently, decimation can only be performed on scalar fields)
+        if (currentField->getNumberOfComponents() == 1)
+        {
+            res.push_back(currentField->getName());
+        }
+    }
+    
+    return res;
+}
+
+
+int Mesh::getTimeStamps(const char* pFieldName) const
+{
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* currentField = mFields[itField];
+        if (strcmp(currentField->getName(), pFieldName) == 0)
+        {
+            return currentField->getNumberOfTimeSteps();
+        }
+    }
+    
+    return 0;
+}
+
+
+Field* Mesh::getFieldByName(const char* pFieldName) const
+{
+    if (pFieldName == NULL) throw NullArgumentException("pFieldName should not be NULL", __FILE__, __LINE__);
+    
+    Field* retField = NULL;
+    
+    // for each field
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* currentField = mFields[itField];
+        if (strcmp(pFieldName, currentField->getName()) == 0)
+        {
+            // field found!
+            retField = currentField;
+            break;
+        }
+    }
+    
+    return retField;
+}
+
+
+GaussLoc* Mesh::getGaussLocByName(const char* pGaussLocName) const
+{
+    if (pGaussLocName == NULL) throw NullArgumentException("pGaussLocName should not be NULL", __FILE__, __LINE__);
+    
+    map<string, GaussLoc*>::const_iterator itGaussLoc = mGaussLocNameToGaussLoc.find(pGaussLocName);
+    GaussLoc* retGaussLoc = NULL;
+    
+    if (itGaussLoc != mGaussLocNameToGaussLoc.end())
+    {
+        retGaussLoc = (*itGaussLoc).second;
+    }
+    
+    return retGaussLoc;
+}
+
+
+int Mesh::getNumberOfElements() const
+{
+    if (mElements == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    return mElements->getNumberOfElements();
+}
+
+
+Mesh* Mesh::createFromSetOfElements(const std::set<med_int>& pSetOfElements, const char* pNewMeshName)
+{
+    if (pNewMeshName == NULL) throw NullArgumentException("pNewMeshName", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Create a new mesh
+    //---------------------------------------------------------------------
+    Mesh* mesh = new Mesh();
+    
+    //---------------------------------------------------------------------
+    // Build name of the new mesh
+    //---------------------------------------------------------------------    
+    strcpy(mesh->mMeshName, pNewMeshName);
+    
+    MULTIPR_LOG("Mesh name=|" << mesh->mMeshName << "|" << endl);
+    
+    //---------------------------------------------------------------------
+    // Fill general infos
+    //---------------------------------------------------------------------
+    strcpy(mesh->mMeshUName, mMeshUName);
+    strcpy(mesh->mMeshDesc, mMeshDesc);
+    
+    mesh->mMeshDim = mMeshDim;
+    mesh->mMeshType = mMeshType;
+    
+    MULTIPR_LOG("Mesh u. name=|" << mesh->mMeshUName << "|" << endl);
+    MULTIPR_LOG("Mesh desc=|" << mesh->mMeshDesc << "|" << endl);
+    MULTIPR_LOG("Mesh dim=" << mesh->mMeshDim << endl);
+    MULTIPR_LOG("Mesh Type=" << mesh->mMeshType << endl);
+    
+    //---------------------------------------------------------------------
+    // Build nodes and elements
+    //---------------------------------------------------------------------
+    // get all elements involved
+    mesh->mElements = mElements->extractSubSet(pSetOfElements);
+    MULTIPR_LOG((*(mesh->mElements)) << endl);
+    
+    // get all nodes involved
+    const set<med_int> setOfNodes = mesh->mElements->getSetOfNodes();
+    mesh->mNodes = mNodes->extractSubSet(setOfNodes);
+    MULTIPR_LOG((*(mesh->mNodes)) << endl);
+    
+    //---------------------------------------------------------------------
+    // Remap nodes
+    //---------------------------------------------------------------------
+    mesh->mElements->remap();
+    MULTIPR_LOG((*(mesh->mElements)) << endl);
+
+    //---------------------------------------------------------------------
+    // Build families
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Build fam.:" << endl);
+    // get families of nodes
+    {
+        set<med_int> famOfNodes = mesh->mNodes->getSetOfFamilies();
+        for (set<med_int>::iterator itFam = famOfNodes.begin() ; itFam != famOfNodes.end() ; itFam++)
+        {
+            Family* famSrc = mFamIdToFam[*itFam];
+            cout << (*famSrc) << endl;
+            Family* famDest = famSrc->extractGroup(NULL);
+            mesh->mFamilies.push_back(famDest);
+        }
+    }
+    
+    // get families of elements
+    {
+        set<med_int> famOfElt = mesh->mElements->getSetOfFamilies();
+        for (set<med_int>::iterator itFam = famOfElt.begin() ; itFam != famOfElt.end() ; itFam++)
+        {
+            Family* famSrc = mFamIdToFam[*itFam];
+            Family* famDest = famSrc->extractGroup(NULL);
+            mesh->mFamilies.push_back(famDest);
+        }
+    }
+    
+    MULTIPR_LOG("Finalize:");
+    
+    // fill families with elements and build groups
+    mesh->finalizeFamiliesAndGroups();
+    
+    MULTIPR_LOG("OK\n");
+    
+    //---------------------------------------------------------------------
+    // Create new fields and collect Gauss
+    //---------------------------------------------------------------------
+    // for each field
+    set<string> newSetOfGauss;
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* currentField = mFields[itField];
+        
+        Field* newField;
+        if (currentField->isFieldOnNodes())
+        {
+            newField = currentField->extractSubSet(setOfNodes);
+        }
+        else
+        {
+            newField = currentField->extractSubSet(pSetOfElements);
+        }
+        
+        if (!newField->isEmpty())
+        {
+            mesh->mFields.push_back(newField);
+            newField->getSetOfGaussLoc(newSetOfGauss);
+        }
+    }
+    MULTIPR_LOG("Collect fields: ok: #gauss=" << newSetOfGauss.size() << endl);
+
+    //---------------------------------------------------------------------
+    // Build Gauss infos
+    //---------------------------------------------------------------------
+    for (set<string>::iterator itSet = newSetOfGauss.begin() ; itSet != newSetOfGauss.end(); itSet++)
+    {
+        const string& keyName = (*itSet);
+        
+        GaussLoc* gaussLoc = getGaussLocByName(keyName.c_str());
+        if (gaussLoc != NULL)
+        {
+            GaussLoc* copyGaussLoc = new GaussLoc(*gaussLoc);
+            mesh->mGaussLoc.push_back(copyGaussLoc);
+            mesh->mGaussLocNameToGaussLoc.insert(make_pair(copyGaussLoc->getName(), copyGaussLoc));
+        }
+    }
+    
+    //---------------------------------------------------------------------
+    // Compute bbox
+    //---------------------------------------------------------------------
+    mesh->mNodes->getBBox(mesh->mMeshBBoxMin, mesh->mMeshBBoxMax);
+    
+    return mesh;
+}
+
+
+Mesh* Mesh::createFromGroup(const Group* pGroup, const char* pNewMeshName)
+{
+    if (pGroup == NULL) throw NullArgumentException("pGroup should not be NULL", __FILE__, __LINE__);
+    if (pNewMeshName == NULL) throw NullArgumentException("pNewMeshName should not be NULL", __FILE__, __LINE__);
+    if (strlen(pNewMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("pNewMeshName length too long", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Create a new mesh
+    //---------------------------------------------------------------------
+    Mesh* mesh = new Mesh();
+    
+    //---------------------------------------------------------------------
+    // Build name of the new mesh
+    //---------------------------------------------------------------------    
+    strcpy(mesh->mMeshName, pNewMeshName);
+    
+    MULTIPR_LOG("Mesh name=|" << mesh->mMeshName << "|" << endl);
+    
+    //---------------------------------------------------------------------
+    // Fill general infos
+    //---------------------------------------------------------------------
+    strcpy(mesh->mMeshUName, mMeshUName);
+    strcpy(mesh->mMeshDesc, mMeshDesc);
+    
+    mesh->mMeshDim = mMeshDim;
+    mesh->mMeshType = mMeshType;
+    
+    MULTIPR_LOG("Mesh u. name=|" << mesh->mMeshUName << "|" << endl);
+    MULTIPR_LOG("Mesh desc=|" << mesh->mMeshDesc << "|" << endl);
+    MULTIPR_LOG("Mesh dim=" << mesh->mMeshDim << endl);
+    MULTIPR_LOG("Mesh Type=" << mesh->mMeshType << endl);
+    
+    //---------------------------------------------------------------------
+    // Build nodes and elements
+    //---------------------------------------------------------------------
+    // get all elements involved
+    const set<med_int> setOfElt = pGroup->getSetOfElt();
+    mesh->mElements = mElements->extractSubSet(setOfElt);
+    MULTIPR_LOG((*(mesh->mElements)) << endl);
+    
+    // get all nodes involved
+    const set<med_int> setOfNodes = mesh->mElements->getSetOfNodes();
+    mesh->mNodes = mNodes->extractSubSet(setOfNodes);
+    MULTIPR_LOG((*(mesh->mNodes)) << endl);
+    
+    //---------------------------------------------------------------------
+    // Remap nodes
+    //---------------------------------------------------------------------
+    mesh->mElements->remap();
+    MULTIPR_LOG((*(mesh->mElements)) << endl);
+
+    //---------------------------------------------------------------------
+    // Build families
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Build fam.:" << endl);
+    // get families of nodes
+    {
+        set<med_int> famOfNodes = mesh->mNodes->getSetOfFamilies();
+        for (set<med_int>::iterator itFam = famOfNodes.begin() ; itFam != famOfNodes.end() ; itFam++)
+        {
+            Family* famSrc = mFamIdToFam[*itFam];
+            Family* famDest = famSrc->extractGroup(pGroup->getName().c_str());
+            mesh->mFamilies.push_back(famDest);
+        }
+    }
+    
+    // get families of elements
+    {
+        set<med_int> famOfElt = mesh->mElements->getSetOfFamilies();
+        for (set<med_int>::iterator itFam = famOfElt.begin() ; itFam != famOfElt.end() ; itFam++)
+        {
+            Family* famSrc = mFamIdToFam[*itFam];
+            Family* famDest = famSrc->extractGroup(pGroup->getName().c_str());
+            mesh->mFamilies.push_back(famDest);
+        }
+    }
+    
+    MULTIPR_LOG("Finalize:");
+    
+    // fill families with elements and build groups
+    mesh->finalizeFamiliesAndGroups();
+    
+    MULTIPR_LOG("OK\n");
+    
+    //---------------------------------------------------------------------
+    // Create new fields and collect Gauss
+    //---------------------------------------------------------------------
+    // for each field
+    set<string> newSetOfGauss;
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* currentField = mFields[itField];
+        
+        Field* newField;
+        if (currentField->isFieldOnNodes())
+        {
+            newField = currentField->extractSubSet(setOfNodes);
+        }
+        else
+        {
+            newField = currentField->extractSubSet(setOfElt);
+        }
+        
+        if (!newField->isEmpty())
+        {
+            mesh->mFields.push_back(newField);
+            newField->getSetOfGaussLoc(newSetOfGauss);
+        }
+    }
+    MULTIPR_LOG("Collect fields: ok: #gauss=" << newSetOfGauss.size() << endl);
+
+    //---------------------------------------------------------------------
+    // Build Gauss infos
+    //---------------------------------------------------------------------
+    for (set<string>::iterator itSet = newSetOfGauss.begin() ; itSet != newSetOfGauss.end(); itSet++)
+    {
+        const string& keyName = (*itSet);
+        
+        GaussLoc* gaussLoc = getGaussLocByName(keyName.c_str());
+        if (gaussLoc != NULL)
+        {
+            GaussLoc* copyGaussLoc = new GaussLoc(*gaussLoc);
+            mesh->mGaussLoc.push_back(copyGaussLoc);
+            mesh->mGaussLocNameToGaussLoc.insert(make_pair(copyGaussLoc->getName(), copyGaussLoc));
+        }
+    }
+    
+    //---------------------------------------------------------------------
+    // Compute bbox
+    //---------------------------------------------------------------------
+    mesh->mNodes->getBBox(mesh->mMeshBBoxMin, mesh->mMeshBBoxMax);
+    
+    return mesh;
+}
+
+
+Mesh* Mesh::mergePartial(const Mesh* pMesh)
+{
+    if (pMesh == NULL) throw NullArgumentException("pMesh should not be NULL", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Create a new mesh
+    //---------------------------------------------------------------------
+    Mesh* mesh = new Mesh();
+    
+    //---------------------------------------------------------------------
+    // Build name of the new mesh
+    //---------------------------------------------------------------------    
+    strcpy(mesh->mMeshName, mMeshName);
+    
+    //---------------------------------------------------------------------
+    // Merge general infos
+    //---------------------------------------------------------------------
+    strcpy(mesh->mMeshUName, mMeshUName);
+    strcpy(mesh->mMeshDesc, mMeshDesc);
+    
+    if (mMeshDim != pMesh->mMeshDim) throw IllegalStateException("the two mesh should have same dimension", __FILE__, __LINE__);
+    if (mMeshType != pMesh->mMeshType) throw IllegalStateException("the two mesh should have same type", __FILE__, __LINE__);
+    
+    mesh->mMeshDim  = mMeshDim;
+    mesh->mMeshType = mMeshType;
+    
+    //---------------------------------------------------------------------
+    // Merge nodes and elements
+    //---------------------------------------------------------------------
+    mesh->mNodes    = mNodes->mergePartial(pMesh->mNodes);
+    mesh->mElements = mElements->mergePartial(pMesh->mElements, mNodes->getNumberOfNodes());
+    
+    //---------------------------------------------------------------------
+    // Merge families
+    //---------------------------------------------------------------------
+    for (unsigned i = 0 ; i < mFamilies.size() ; i++)
+    {
+        Family* family = new Family(*(mFamilies[i]));
+        mesh->mFamilies.push_back(family);
+        mesh->mFamIdToFam.insert(make_pair(family->getId(), family));
+    }
+    
+    for (unsigned i = 0 ; i < pMesh->mFamilies.size() ; i++)
+    {   
+        // test if there is a fimaly with the same id
+        map<med_int, Family*>::iterator itFam = mesh->mFamIdToFam.find(pMesh->mFamilies[i]->getId());        
+        
+        if (itFam == mesh->mFamIdToFam.end())
+        {        
+            // id not found: create a new family
+            Family* family = new Family(*(pMesh->mFamilies[i]));
+            mesh->mFamilies.push_back(family);
+            mesh->mFamIdToFam.insert(make_pair(family->getId(), family));
+        }
+    }
+    
+    // fill families with elements and build groups
+    //mesh->finalizeFamiliesAndGroups();
+    
+    //---------------------------------------------------------------------
+    // Merge fields
+    //---------------------------------------------------------------------
+    // for each field
+    set<string> newSetOfGauss;
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* field = mFields[itField]->merge(pMesh->mFields[itField]);
+        mesh->mFields.push_back(field);
+        field->getSetOfGaussLoc(newSetOfGauss);
+    }    
+    
+    //---------------------------------------------------------------------
+    // Merge Gauss infos
+    //---------------------------------------------------------------------    
+    // WARNING: assume Gauss infos are the same for the two meshes.    
+    if (mGaussLoc.size() != pMesh->mGaussLoc.size()) throw IllegalStateException("gauss localization should be the same", __FILE__, __LINE__);
+    for (unsigned i = 0 ; i < mGaussLoc.size() ; i++)
+    {
+        GaussLoc* copyGaussLoc = new GaussLoc(*(mGaussLoc[i]));
+        mesh->mGaussLoc.push_back(copyGaussLoc);
+        mesh->mGaussLocNameToGaussLoc.insert(make_pair(copyGaussLoc->getName(), copyGaussLoc));
+    }    
+    
+    //---------------------------------------------------------------------
+    // Compute bbox
+    //---------------------------------------------------------------------
+    //mesh->mNodes->getBBox(mesh->mMeshBBoxMin, mesh->mMeshBBoxMax);
+    
+    return mesh;
+}
+
+
+Mesh* Mesh::mergePartial(vector<Mesh*> pMeshes, const char* pFieldName, int pFieldIt)
+{   
+    if (pMeshes.size() == 0) throw IllegalArgumentException("list must contain one mesh", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Create a new mesh
+    //---------------------------------------------------------------------
+    Mesh* mesh = new Mesh();
+    
+    //---------------------------------------------------------------------
+    // Build name of the new mesh
+    //---------------------------------------------------------------------    
+    strcpy(mesh->mMeshName, mMeshName);
+    
+    //---------------------------------------------------------------------
+    // Merge general infos
+    //---------------------------------------------------------------------
+    strcpy(mesh->mMeshUName, mMeshUName);
+    strcpy(mesh->mMeshDesc, mMeshDesc);    
+    
+    mesh->mMeshDim  = mMeshDim;
+    mesh->mMeshType = mMeshType;
+    
+    //---------------------------------------------------------------------
+    // Merge nodes and elements
+    //---------------------------------------------------------------------
+    vector<Nodes*>    nodes;    
+    vector<Elements*> elements;
+    vector<int>       offsets;
+    
+    int offset = mNodes->getNumberOfNodes();
+    offsets.push_back(offset);
+    
+    
+    for (unsigned i = 0 ; i < pMeshes.size() ; i++)
+    {
+        if (mMeshDim != pMeshes[i]->mMeshDim) throw IllegalStateException("meshes should have same dimension", __FILE__, __LINE__);
+        if (mMeshType != pMeshes[i]->mMeshType) throw IllegalStateException("meshes should have same type", __FILE__, __LINE__);
+        
+        nodes.push_back(pMeshes[i]->mNodes);
+        //cout << *(pMeshes[i]->mNodes) << endl;
+        elements.push_back(pMeshes[i]->mElements);
+        offset += pMeshes[i]->mNodes->getNumberOfNodes();
+        offsets.push_back(offset);
+    }
+    
+    mesh->mNodes    = mNodes->mergePartial(nodes);
+    //cout << *(mesh->mNodes) << endl;
+    mesh->mElements = mElements->mergePartial(elements, offsets);
+    
+    //---------------------------------------------------------------------
+    // Merge families
+    //---------------------------------------------------------------------
+    for (unsigned i = 0 ; i < mFamilies.size() ; i++)
+    {
+        Family* family = new Family(*(mFamilies[i]));
+        mesh->mFamilies.push_back(family);
+        mesh->mFamIdToFam.insert(make_pair(family->getId(), family));
+    }
+    
+    for (unsigned j = 0 ; j < pMeshes.size() ; j++)
+    {
+        for (unsigned i = 0 ; i < pMeshes[j]->mFamilies.size() ; i++)
+        {   
+            // test if there is a fimaly with the same id
+            map<med_int, Family*>::iterator itFam = mesh->mFamIdToFam.find(pMeshes[j]->mFamilies[i]->getId());        
+            
+            if (itFam == mesh->mFamIdToFam.end())
+            {        
+                // id not found: create a new family
+                Family* family = new Family(*(pMeshes[j]->mFamilies[i]));
+                mesh->mFamilies.push_back(family);
+                mesh->mFamIdToFam.insert(make_pair(family->getId(), family));
+            }
+        }
+    }
+    
+    // fill families with elements and build groups
+    //mesh->finalizeFamiliesAndGroups();
+    
+    //---------------------------------------------------------------------
+    // Merge fields
+    //---------------------------------------------------------------------
+    // for each field
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        if (pFieldName == NULL) // merge all field
+        {
+            vector<Field*> fields;
+            for (unsigned i = 0 ; i < pMeshes.size() ; i++)
+            {
+                fields.push_back(pMeshes[i]->mFields[itField]);
+            }
+            
+            Field* field = mFields[itField]->merge(fields);
+            mesh->mFields.push_back(field);
+        }
+        else if (strcmp(mFields[itField]->getName(), pFieldName) == 0) // only merge the given field
+        {   
+            vector<Field*> fields;
+            for (unsigned i = 0 ; i < pMeshes.size() ; i++)
+            {
+                fields.push_back(pMeshes[i]->mFields[itField]);
+            }                    
+            
+            Field* field = mFields[itField]->merge(fields, pFieldIt);
+            mesh->mFields.push_back(field);
+        }
+    }    
+    
+    //---------------------------------------------------------------------
+    // Merge Gauss infos
+    //---------------------------------------------------------------------    
+    // WARNING: assume Gauss infos are the same for the two meshes.    
+    for (unsigned i = 0 ; i < mGaussLoc.size() ; i++)
+    {
+        GaussLoc* copyGaussLoc = new GaussLoc(*(mGaussLoc[i]));
+        mesh->mGaussLoc.push_back(copyGaussLoc);
+        mesh->mGaussLocNameToGaussLoc.insert(make_pair(copyGaussLoc->getName(), copyGaussLoc));
+    }    
+    
+    //---------------------------------------------------------------------
+    // Compute bbox
+    //---------------------------------------------------------------------
+    //mesh->mNodes->getBBox(mesh->mMeshBBoxMin, mesh->mMeshBBoxMax);
+    
+    return mesh;
+}
+
+
+MeshDis* Mesh::splitGroupsOfElements()
+{
+    MeshDis* meshDis = new MeshDis();
+    meshDis->setSequentialMEDFilename(mMEDfilename);
+    
+    // get prefix from the original MED filename
+    string strPrefix = removeExtension(mMEDfilename, ".med");
+    
+    int numGroup = 1;
+    
+    // for each group
+    for (unsigned itGroup = 0 ; itGroup < mGroups.size() ; itGroup++)
+    {
+        Group* currentGroup = mGroups[itGroup];
+        
+        // skip this group if it is a group of nodes
+        if (currentGroup->isGroupOfNodes()) 
+        {
+            continue;
+        }
+        
+        char strPartName[256];
+        sprintf(strPartName, "%s_%d", mMeshName, numGroup);
+        
+        char strMEDfilename[256];
+        sprintf(strMEDfilename, "%s_grain%d.med", strPrefix.c_str(), numGroup);
+        
+        Mesh* mesh = createFromGroup(currentGroup, mMeshName);
+        
+        // skip the group which contain all the others groups, even it contains only 1 group
+        if ((mesh->mElements->getNumberOfElements() == mElements->getNumberOfElements()) && (mGroups.size() > 1))
+        {
+            delete mesh;
+            continue;
+        }
+        
+        meshDis->addMesh(
+            MeshDisPart::MULTIPR_WRITE_MESH,
+            mMeshName,
+            numGroup,
+            strPartName,
+            "localhost",
+            strMEDfilename,
+            mesh);
+        
+        numGroup++;
+    }
+    
+    return meshDis;
+}
+
+
+Mesh* Mesh::decimate(
+    const char* pFilterName,
+    const char* pArgv,
+    const char* pNameNewMesh)
+{
+    //---------------------------------------------------------------------
+    // Check parameters
+    //---------------------------------------------------------------------    
+    if (pFilterName == NULL) throw NullArgumentException("pFilterName should not be NULL", __FILE__, __LINE__);
+    if (pArgv == NULL) throw NullArgumentException("pArgv should not be NULL", __FILE__, __LINE__);
+    if (pNameNewMesh == NULL) throw NullArgumentException("pNameNewMesh should not be NULL", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Instanciate filter used for decimation
+    //---------------------------------------------------------------------
+    DecimationFilter* filter = DecimationFilter::create(pFilterName);
+    
+    //---------------------------------------------------------------------
+    // Create new mesh by decimating current one
+    //---------------------------------------------------------------------
+    Mesh* decimatedMesh = filter->apply(this, pArgv, pNameNewMesh);
+    
+    //---------------------------------------------------------------------
+    // Cleans
+    //---------------------------------------------------------------------
+    delete filter;
+    
+    return decimatedMesh;
+}
+
+
+
+void Mesh::getAllPointsOfField(Field* pField, int pTimeStepIt, std::vector<PointOfField>& pPoints)
+{
+    //---------------------------------------------------------------------
+    // Check arguments
+    //---------------------------------------------------------------------
+    
+    if (pField == NULL) throw NullArgumentException("field should not be NULL", __FILE__, __LINE__);
+    if (pTimeStepIt < 1) throw IllegalArgumentException("invalid field iteration; should be >= 1", __FILE__, __LINE__);
+    
+    if (mMeshDim != 3) throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+    if (pField->getType() != MED_FLOAT64) throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+    if (pField->getNumberOfComponents() != 1) throw UnsupportedOperationException("field have more than 1 component (vectorial field, expected scalar field)", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Collect points
+    //---------------------------------------------------------------------
+    
+    if (pField->isFieldOnNodes())
+    {
+        //-------------------------------------------------------------
+        // Case 1: field of nodes
+        //-------------------------------------------------------------
+        if (mNodes == NULL) throw IllegalStateException("no nodes in the current mesh", __FILE__, __LINE__);
+        
+        // for each node
+        for (int itNode = 0, size = mNodes->getNumberOfNodes() ; itNode < size ; itNode++)
+        {
+            // collect coordinates and value of the point
+            const med_float* coo = mNodes->getCoordinates(itNode);
+            
+            const med_float* val = 
+                reinterpret_cast<const med_float*>(pField->getValue(pTimeStepIt, itNode + 1));
+
+            // add new point
+            pPoints.push_back(PointOfField(coo[0], coo[1], coo[2], val[0]));
+        }
+    }
+    else
+    {
+        //-------------------------------------------------------------
+        // Case 2: field of elements
+        //-------------------------------------------------------------
+    
+        if (mElements == NULL) throw IllegalStateException("no elements in the current mesh", __FILE__, __LINE__);
+        if (mElements->getTypeOfPrimitives() != MED_TETRA10) throw UnsupportedOperationException("only support TETRA10 mesh", __FILE__, __LINE__);
+        
+        const string& nameGaussLoc = pField->getNameGaussLoc(pTimeStepIt);
+        GaussLoc* gaussLoc = getGaussLocByName(nameGaussLoc.c_str());
+        if (gaussLoc == NULL) throw IllegalStateException("no Gauss localization for these elements", __FILE__, __LINE__);
+        
+        int numGauss = pField->getNumberOfGaussPointsByElement(pTimeStepIt);
+        
+        int size = gaussLoc->getDim() * gaussLoc->getNumGaussPoints();
+        med_float* cooGaussPts = new med_float[size];
+        
+        int dim = mElements->getTypeOfPrimitives() / 100;
+        int numNodes = mElements->getTypeOfPrimitives() % 100;
+        size = dim * numNodes;
+        med_float* cooNodes = new med_float[size];
+        
+        // for each elements
+        for (int itElt = 0, size = mElements->getNumberOfElements() ; itElt < size ; itElt++)
+        {
+            // get coordinates of nodes of the current elements
+            // OPTIMIZATION: ASSUME TETRA10: ONLY GETS THE 4 FIRST NODES OF EACH ELEMENT
+            mElements->getCoordinates(itElt, mNodes, cooNodes, 4);
+            
+            // compute coordinates of gauss points
+            gaussLoc->getCoordGaussPoints(cooNodes, cooGaussPts);
+            
+            //printArray2D(cooGaussPts, 5, 3, "Gauss pt"); // debug
+            
+            const med_float* val = 
+                reinterpret_cast<const med_float*>(pField->getValue(pTimeStepIt, itElt + 1));
+        
+            // for each point of Gauss of the element
+            med_float* srcCoo = cooGaussPts;
+            for (int itPtGauss = 0 ; itPtGauss < numGauss ; itPtGauss++)
+            {
+                pPoints.push_back(PointOfField(srcCoo[0], srcCoo[1], srcCoo[2], val[itPtGauss]));
+                srcCoo += 3;
+            }
+        }
+        
+        delete[] cooNodes;
+        delete[] cooGaussPts;
+    }
+}
+
+
+float Mesh::evalDefaultRadius(int pN) const
+{
+    if (mFields.size() == 0) return 1.0f;
+    
+    //---------------------------------------------------------------------
+    // Compute default radius
+    //---------------------------------------------------------------------    
+    
+    med_float volumeBBox = 
+        (mMeshBBoxMax[0] - mMeshBBoxMin[0]) * 
+        (mMeshBBoxMax[1] - mMeshBBoxMin[1]) *
+        (mMeshBBoxMax[2] - mMeshBBoxMin[2]);
+        
+    if (isnan(volumeBBox))
+    {
+        return 1.0f;
+    }
+    
+    const med_float k = 0.8; // considered 80% of the volume
+    
+    // get nunmber of gauss points in the field
+    try
+    {
+        Field* anyField = mFields[mFields.size()-1];
+        int numTimeSteps = anyField->getNumberOfTimeSteps();
+        
+        int numGaussPoints = getNumberOfElements() * anyField->getNumberOfGaussPointsByElement(numTimeSteps-1);
+    
+        med_float radius = med_float(pow( (3.0/4.0) * pN * k * volumeBBox / (3.1415 * numGaussPoints), 1.0/3.0));
+    
+        return float(radius);
+    }
+    catch (...)
+    {
+        return 1.0f;
+    }
+}
+
+
+med_geometrie_element CELL_TYPES[MED_NBR_GEOMETRIE_MAILLE] = 
+{
+    MED_POINT1,
+    MED_SEG2, 
+    MED_SEG3,
+    MED_TRIA3,
+    MED_TRIA6,
+    MED_QUAD4,
+    MED_QUAD8,
+    MED_TETRA4,
+    MED_TETRA10,
+    MED_HEXA8,
+    MED_HEXA20,
+    MED_PENTA6,
+    MED_PENTA15
+};
+
+   
+char CELL_NAMES[MED_NBR_GEOMETRIE_MAILLE][MED_TAILLE_NOM + 1] =  
+{
+    "MED_POINT1",
+    "MED_SEG2", 
+    "MED_SEG3",
+    "MED_TRIA3",
+    "MED_TRIA6",
+    "MED_QUAD4",
+    "MED_QUAD8",
+    "MED_TETRA4",
+    "MED_TETRA10",
+    "MED_HEXA8",
+    "MED_HEXA20",
+    "MED_PENTA6",
+    "MED_PENTA15",
+    "MED_PYRA5",
+    "MED_PYRA13"
+};
+
+
+void Mesh::readSequentialMED(const char* pMEDfilename, const char* pMeshName)
+{    
+    reset();
+    
+    //---------------------------------------------------------------------
+    // Check arguments
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Check arguments: ");
+    if (pMEDfilename == NULL) throw NullArgumentException("pMEDfilename should not be NULL", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("pMeshName should not be NULL", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    strncpy(mMEDfilename, pMEDfilename, 256);
+    strncpy(mMeshName, pMeshName, MED_TAILLE_NOM);
+    
+    //---------------------------------------------------------------------
+    // Open MED file (READ_ONLY)
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Open MED file: ");
+    mMEDfile = MEDouvrir(mMEDfilename, MED_LECTURE); // open MED file for reading
+    if (mMEDfile <= 0) throw FileNotFoundException("MED file not found", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    //---------------------------------------------------------------------
+    // Check valid HDF format
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Format HDF: ");
+    if (MEDformatConforme(mMEDfilename) != 0) throw IOException("invalid file", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    //---------------------------------------------------------------------
+    // Get MED version
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("MED version: ");
+    med_int verMajor, verMinor, verRelease;
+    med_err ret = MEDversionLire(mMEDfile, &verMajor, &verMinor, &verRelease);
+    if (ret != 0) throw IOException("error while reading MED version", __FILE__, __LINE__);
+    MULTIPR_LOG(verMajor << "." << verMinor << "." << verRelease << ": OK\n");
+    
+    //---------------------------------------------------------------------
+    // Check that there is no profil
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("#profils must be 0: ");
+    med_int nbProfils = MEDnProfil(mMEDfile);
+    if (nbProfils != 0) throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    //---------------------------------------------------------------------
+    // Read all Gauss localizations
+    //---------------------------------------------------------------------
+    readGaussLoc();
+    
+    //---------------------------------------------------------------------
+    // Read scalars (should be 0)
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Scalars: ");
+    med_int nbScalars = MEDnScalaire(mMEDfile);
+    if (nbScalars != 0) throw UnsupportedOperationException("not yet implemented", __FILE__, __LINE__);
+    MULTIPR_LOG(nbScalars << ": OK\n");    
+    
+    //---------------------------------------------------------------------
+    // Find the mesh
+    //---------------------------------------------------------------------
+    // read number of meshes
+    MULTIPR_LOG("Num meshes: ");
+    med_int nbMeshes = MEDnMaa(mMEDfile);
+    if (nbMeshes <= 0) throw IOException("i/o error while reading number of meshes in MED file", __FILE__, __LINE__);
+    MULTIPR_LOG(nbMeshes << ": OK\n");
+    
+    med_int meshIndex = -1;
+    // iteration over mesh to find the mesh we want
+    // for each mesh in the file (warning: first mesh is number 1)
+    for (int itMesh = 1 ; itMesh <= nbMeshes ; itMesh++)
+    {
+        char meshName[MED_TAILLE_NOM + 1];
+        
+        ret = MEDmaaInfo(
+            mMEDfile, 
+            itMesh, 
+            meshName, 
+            &mMeshDim, 
+            &mMeshType, 
+            mMeshDesc);
+            
+        if (ret != 0) throw IOException("i/o error while reading mesh information in MED file", __FILE__, __LINE__);
+        MULTIPR_LOG("Mesh: |" << meshName << "|");
+        
+        // test if the current mesh is the mesh we want
+        if (strcmp(pMeshName, meshName) == 0)
+        {
+            // *** mesh found ***
+            MULTIPR_LOG(" OK (found)\n");
+            meshIndex = itMesh;
+            break;
+        }
+        else
+        {
+            // not the mesh we want: skip this mesh
+            MULTIPR_LOG(" skipped\n");
+        }
+    }
+    
+    if (meshIndex == -1)
+    {
+        throw IllegalStateException("mesh not found in the given MED file", __FILE__, __LINE__);
+    }
+    
+    //---------------------------------------------------------------------
+    // Check mesh validity
+    //---------------------------------------------------------------------
+    // dimension of the mesh must be 3 (= 3D mesh)
+    MULTIPR_LOG("Mesh is 3D: ");
+    if (mMeshDim != 3) throw UnsupportedOperationException("dimension of the mesh should be 3; other dimension not yet implemented", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    // mesh must not be a grid
+    MULTIPR_LOG("Mesh is not a grid: ");
+    if (mMeshType != MED_NON_STRUCTURE) 
+        throw UnsupportedOperationException("grid not supported", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+    
+    // mesh must only contain TETRA10 elements
+    MULTIPR_LOG("Only TETRA10: ");
+    med_connectivite connectivite = MED_NOD; // NODAL CONNECTIVITY ONLY
+    bool onlyTETRA10 = true;
+    int numTetra10 = -1;
+    for (int itCell = 0 ; itCell < MED_NBR_GEOMETRIE_MAILLE ; itCell++)
+    {
+        med_int meshNumCells = MEDnEntMaa(
+            mMEDfile, 
+            mMeshName, 
+            MED_CONN, 
+            MED_MAILLE, 
+            CELL_TYPES[itCell], 
+            connectivite);
+        
+        if ((meshNumCells > 0) && (strcmp(CELL_NAMES[itCell], "MED_TETRA10") != 0))
+        {
+            onlyTETRA10 = false;
+            break;
+        }
+        if (strcmp(CELL_NAMES[itCell], "MED_TETRA10") == 0)
+        {
+            numTetra10 = meshNumCells;
+        }
+    }
+    
+    if (!onlyTETRA10) throw UnsupportedOperationException("mesh should only contain TETRA10 elements", __FILE__, __LINE__);
+    MULTIPR_LOG(numTetra10 << ": OK\n");
+    
+    // everything is OK...
+    
+    //---------------------------------------------------------------------
+    // Check num joint = 0
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Num joints: ");
+    med_int numJoints = MEDnJoint(mMEDfile, mMeshName);
+    MULTIPR_LOG(numJoints << ": OK\n");
+    
+    //---------------------------------------------------------------------
+    // Check num equivalence = 0
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Num equivalences: ");
+    med_int numEquiv = MEDnEquiv(mMEDfile, mMeshName);
+    MULTIPR_LOG(numEquiv << ": OK\n");
+    
+    //---------------------------------------------------------------------
+    // Read nodes
+    //---------------------------------------------------------------------
+    mNodes = new Nodes();
+    mNodes->readMED(mMEDfile, mMeshName, mMeshDim);
+    mNodes->getBBox(mMeshBBoxMin, mMeshBBoxMax);
+    
+    //---------------------------------------------------------------------
+    // Read elements
+    //---------------------------------------------------------------------
+    mElements = new Elements();
+    mElements->readMED(mMEDfile, mMeshName, mMeshDim, MED_MAILLE, MED_TETRA10);
+    
+    if (mNodes->getNumberOfNodes() != 0)
+    {
+    
+        //---------------------------------------------------------------------
+        // Read families
+        //---------------------------------------------------------------------
+        readFamilies();
+        finalizeFamiliesAndGroups();
+    
+        //---------------------------------------------------------------------
+        // Read fields
+        //---------------------------------------------------------------------
+        readFields();
+    }
+    
+    //---------------------------------------------------------------------
+    // Close the MED file
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Close MED file: ");
+    ret = MEDfermer(mMEDfile);
+    if (ret != 0) throw IOException("i/o error while closing MED file", __FILE__, __LINE__);
+    MULTIPR_LOG("OK\n");
+}
+
+
+void Mesh::writeMED(const char* pMEDfilename)
+{
+    MULTIPR_LOG("Write MED: " << pMEDfilename << endl);
+
+    if (pMEDfilename == NULL) throw NullArgumentException("pMEDfilename should not be NULL", __FILE__, __LINE__);
+    if (strlen(pMEDfilename) == 0) throw IllegalArgumentException("pMEDfilename size is 0", __FILE__, __LINE__);
+    
+    remove(pMEDfilename);
+    
+    //---------------------------------------------------------------------
+    // Create the new MED file (WRITE_ONLY)
+    //---------------------------------------------------------------------
+    med_idt newMEDfile = MEDouvrir(const_cast<char*>(pMEDfilename), MED_CREATION);
+    if (newMEDfile == -1) throw IOException("", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Write scalars
+    //---------------------------------------------------------------------
+    // no scalars to write
+    
+    //---------------------------------------------------------------------
+    // Create mesh: must be created first
+    //---------------------------------------------------------------------
+    med_err ret = MEDmaaCr(
+        newMEDfile,
+        mMeshName,
+        mMeshDim,
+        MED_NON_STRUCTURE,
+        mMeshDesc);
+    
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    MULTIPR_LOG("    Create mesh: |" << mMeshName << "|: OK" << endl);
+    
+    //---------------------------------------------------------------------
+    // Write nodes and elements (mesh must exist)
+    //---------------------------------------------------------------------
+    if (mNodes == NULL) throw IllegalStateException("mNodes should not be NULL", __FILE__, __LINE__);
+    mNodes->writeMED(newMEDfile, mMeshName);
+    MULTIPR_LOG("    Write nodes: ok" << endl);
+    
+    if (mElements == NULL) throw IllegalStateException("mElements should not be NULL", __FILE__, __LINE__);
+    mElements->writeMED(newMEDfile, mMeshName, mMeshDim);
+    MULTIPR_LOG("    write elt: ok" << endl);
+    
+    //---------------------------------------------------------------------
+    // Write families (mesh must exist)
+    //---------------------------------------------------------------------
+    for (unsigned itFam = 0 ; itFam < mFamilies.size() ; itFam++)
+    {
+        Family* fam = mFamilies[itFam];
+        fam->writeMED(newMEDfile, mMeshName);
+    }
+    MULTIPR_LOG("    Write families: ok" << endl);
+    
+    //---------------------------------------------------------------------
+    // Write profil
+    //---------------------------------------------------------------------
+    // no profil
+    
+    //---------------------------------------------------------------------
+    // Write Gauss localization (must be written before fields)
+    //---------------------------------------------------------------------
+    for (unsigned itGaussLoc = 0 ; itGaussLoc < mGaussLoc.size() ; itGaussLoc++)
+    {
+        
+        GaussLoc* gaussLoc = mGaussLoc[itGaussLoc];
+        gaussLoc->writeMED(newMEDfile);
+    }
+    MULTIPR_LOG("    Write Gauss: ok" << endl);
+    
+    //---------------------------------------------------------------------
+    // Write fields
+    //---------------------------------------------------------------------
+    for (unsigned itField = 0 ; itField < mFields.size() ; itField++)
+    {
+        Field* field = mFields[itField];
+        field->writeMED(newMEDfile, mMeshName);
+    }
+    MULTIPR_LOG("    Write fields: ok" << endl);
+    
+    //---------------------------------------------------------------------
+    // Close the new MED file
+    //---------------------------------------------------------------------
+    ret = MEDfermer(newMEDfile);
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+}
+
+
+void Mesh::readGaussLoc()
+{
+    MULTIPR_LOG("Gauss ref: ");
+    med_int numGauss = MEDnGauss(mMEDfile);
+    if (numGauss < 0) throw IOException("", __FILE__, __LINE__);
+    MULTIPR_LOG(numGauss << ": OK\n");
+    
+    for (int itGauss = 1 ; itGauss <= numGauss ; itGauss++)
+    {
+        GaussLoc* gaussLoc = new GaussLoc();
+        gaussLoc->readMED(mMEDfile, itGauss);
+        
+        MULTIPR_LOG((*gaussLoc) << endl);
+        
+        mGaussLoc.push_back(gaussLoc);
+        mGaussLocNameToGaussLoc.insert(make_pair(gaussLoc->getName(), gaussLoc));
+    }
+}
+
+
+void Mesh::readFamilies()
+{
+    med_int numFamilies = MEDnFam(mMEDfile, mMeshName);
+    if (numFamilies <= 0) throw IOException("", __FILE__, __LINE__);
+    
+    for (int itFam = 1 ; itFam <= numFamilies ; itFam++)
+    {
+        Family* fam = new Family();
+        fam->readMED(mMEDfile, mMeshName, itFam);
+        mFamilies.push_back(fam);
+    }
+}
+
+
+void Mesh::finalizeFamiliesAndGroups()
+{
+    //---------------------------------------------------------------------
+    // Build mapping between family id and pointers towards families
+    //---------------------------------------------------------------------
+    for (unsigned itFam = 0 ; itFam < mFamilies.size() ; itFam++)
+    {
+        Family* fam  = mFamilies[itFam];
+        mFamIdToFam.insert(make_pair(fam->getId(), fam));
+    }
+    
+    //---------------------------------------------------------------------
+    // Fill families of nodes
+    //---------------------------------------------------------------------
+    for (int itNode = 1 ; itNode <= mNodes->getNumberOfNodes() ; itNode++)
+    {
+        // get family of the ith nodes
+        int famIdent = mNodes->getFamIdent(itNode - 1); // MED nodes start at 1
+        map<med_int, Family*>::iterator itFam = mFamIdToFam.find(famIdent);
+        
+        if (itFam == mFamIdToFam.end()) throw IllegalStateException("", __FILE__, __LINE__);
+        
+        Family* fam = (*itFam).second;
+        
+        // insert the current node to its family
+        fam->insertElt(itNode);
+        fam->setIsFamilyOfNodes(true);
+    }
+    
+    //---------------------------------------------------------------------
+    // Fill families of elements
+    //---------------------------------------------------------------------
+    for (int itElt = 1 ; itElt <= mElements->getNumberOfElements() ; itElt++)
+    {
+        // get family of the ith element (MED index start at 1)
+        int famIdent = mElements->getFamilyIdentifier(itElt - 1);
+        map<med_int, Family*>::iterator itFam = mFamIdToFam.find(famIdent);
+        
+        if (itFam == mFamIdToFam.end()) throw IllegalStateException("", __FILE__, __LINE__);
+        
+        Family* fam = (*itFam).second;
+        
+        // insert the current node its family
+        fam->insertElt(itElt);
+        fam->setIsFamilyOfNodes(false);
+    }
+    
+    //---------------------------------------------------------------------
+    // Build groups
+    //---------------------------------------------------------------------
+    // for each family
+    for (unsigned itFam = 0 ; itFam < mFamilies.size() ; itFam++)
+    {
+        mFamilies[itFam]->buildGroups(mGroups, mGroupNameToGroup);
+    }
+}
+
+
+void Mesh::readFields()
+{
+    //---------------------------------------------------------------------
+    // Read number of fields
+    //---------------------------------------------------------------------
+    MULTIPR_LOG("Read fields: ");
+    med_int numFields = MEDnChamp(mMEDfile, 0);
+    if (numFields <= 0) throw IOException("", __FILE__, __LINE__);
+    MULTIPR_LOG(numFields << ": OK\n");
+
+    //---------------------------------------------------------------------
+    // Iterate over fields
+    //---------------------------------------------------------------------
+    // for each field, read number of components and others infos
+    for (int itField = 1 ; itField <= numFields ; itField++)
+    {
+        Field* field = new Field();
+        field->readMED(mMEDfile, itField, mMeshName);
+        
+        // if the nth field does not apply on our mesh => slip it
+        if (field->isEmpty())
+        {
+            delete field;
+        }
+        else
+        {
+            mFields.push_back(field);
+        }
+    }
+}
+
+
+ostream& operator<<(ostream& pOs, Mesh& pM)
+{
+    pOs << "Mesh: " << endl;
+    pOs << "    MED file =|" << pM.mMEDfilename << "|" << endl;
+    pOs << "    Name     =|" << pM.mMeshName << "|" << endl;
+    pOs << "    Unv name =|" << pM.mMeshUName << "|" << endl;
+    pOs << "    Desc     =|" << pM.mMeshDesc << "|" << endl;
+    pOs << "    Dim      =" << pM.mMeshDim << endl;
+    pOs << "    Type     =" << ((pM.mMeshType == MED_STRUCTURE)?"STRUCTURE":"NON_STRUCTURE") << endl;
+    pOs << "    BBox     =[" << pM.mMeshBBoxMin[0] << " ; " << pM.mMeshBBoxMax[0] << "] x [" << pM.mMeshBBoxMin[1] << " ; " << pM.mMeshBBoxMax[1] << "] x [" << pM.mMeshBBoxMin[2] << " ; " << pM.mMeshBBoxMax[2] << "]" << endl;    
+    
+    if (pM.mFlagPrintAll)
+    {
+        cout << (*(pM.mNodes)) << endl;
+        cout << (*(pM.mElements)) << endl;
+        
+        pOs << "    Families : #=" << pM.mFamilies.size() << endl;
+        for (unsigned i = 0 ; i < pM.mFamilies.size() ; i++)
+        {
+            cout << (*(pM.mFamilies[i])) << endl;
+        }
+        
+        pOs << "    Groups   : #=" << pM.mGroups.size() << endl;
+        for (unsigned i = 0 ; i < pM.mGroups.size() ; i++)
+        {
+            cout << (*(pM.mGroups[i])) << endl;
+        }
+        
+        pOs << "    Gauss loc: #=" << pM.mGaussLoc.size() << endl;
+        for (unsigned i = 0 ; i < pM.mGaussLoc.size() ; i++)
+        {
+            cout << (*(pM.mGaussLoc[i])) << endl;
+        }
+        
+        pOs << "    Fields   : #=" << pM.mFields.size() << endl;
+        for (unsigned i = 0 ; i < pM.mFields.size() ; i++)
+        {
+            cout << (*(pM.mFields[i])) << endl;
+        }
+    }
+    else
+    {
+        if (pM.mNodes != NULL)
+        {
+            pOs << "    Nodes    : #=" << pM.mNodes->getNumberOfNodes() << endl;
+        }
+        
+        if (pM.mElements != NULL)
+        {
+            const set<med_int>& setOfNodes = pM.mElements->getSetOfNodes();
+            if (setOfNodes.size() == 0)
+            {
+                pOs << "    Elt      : #=" << pM.mElements->getNumberOfElements() << endl;
+            }
+            else
+            {
+                set<med_int>::iterator itNode = setOfNodes.end();
+                itNode--;
+                pOs << "    Elt      : #=" << pM.mElements->getNumberOfElements() << " node_id_min=" << (*(setOfNodes.begin())) << " node_id_max=" << (*itNode) << endl;
+            }
+        }
+        
+        pOs << "    Families : #=" << pM.mFamilies.size() << endl;
+        pOs << "    Groups   : #=" << pM.mGroups.size() << endl;
+        pOs << "    Gauss loc: #=" << pM.mGaussLoc.size() << endl;
+        pOs << "    Fields   : #=" << pM.mFields.size() << endl;
+    }
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Mesh.hxx b/src/MULTIPR/MULTIPR_Mesh.hxx
new file mode 100755 (executable)
index 0000000..f4d50d3
--- /dev/null
@@ -0,0 +1,376 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Mesh.hxx
+ *
+ * \brief   Class Mesh used by the MULTIPR API; used to wrap MED file meshes.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_MESH_HXX
+#define MULTIPR_MESH_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+#include <fstream>
+#include <set>
+#include <map>
+#include <vector>
+#include <string>
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Pre-declaration
+//*****************************************************************************
+
+class GaussLoc;
+class Profil;
+class Nodes;
+class Elements;
+class Family;
+class Field;
+class Group;
+class MeshDis;
+class PointOfField;
+
+
+//*****************************************************************************
+// Class Mesh
+//*****************************************************************************
+
+/**
+ * Assumes:
+ * - 3D mesh in a 3D space
+ * - Unstructured mesh (not a grid)
+ * - Nodal connectivity
+ * - Cartesian coordinates system
+ * Always use FULL_INTERLACE arrays
+ */
+class Mesh
+{
+public:
+
+    /**
+     * Builds an empty Mesh (default constructor).
+     */
+    Mesh();
+     
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Mesh();
+     
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns the name of this Mesh.
+     * \return the name of this Mesh.
+     */
+    const char* getName() const { return mMeshName; }
+    
+    /**
+     * Returns the name of all the scalar fields.
+     * \return the name of all the scalar fields.
+     */
+    std::vector<std::string> getNameScalarFields() const; 
+    
+    /**
+     * Returns the number of iteration for a given field.
+     * \return the number of iteration for a given field.
+     */
+    int getTimeStamps(const char* pFieldName) const; 
+    
+    /**
+     * Returns a Field from its name; NULL if it does not exist.
+     * \param  pFieldName name of the field to be retrieved.
+     * \return the Field pFieldName of it exists, NULL otherwise.
+     * \throw  NullArgumentException if pFieldName is NULL.
+     */
+    Field* getFieldByName(const char* pFieldName) const;
+    
+    /**
+     * Returns a GaussLoc from its name; NULL if it does not exist.
+     * \param  pGaussLocName name of the GaussLoc to be retrieved.
+     * \return the GaussLoc pGaussLocName if it exists, NULL otherwise.
+     * \throw  NullArgumentException if pGaussLocName is NULL.
+     */
+    GaussLoc* getGaussLocByName(const char* pGaussLocName) const;    
+     
+    /**
+     * Returns the number of elements.
+     * \return the number of elements.
+     */
+    int getNumberOfElements() const;
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Creates a Mesh from a subset of its elements (cells).
+     * \param  pSetOfElements subset of elements to keep.
+     * \param  pNewMeshName   name of the new Mesh.
+     * \return a new Mesh which is a restriction of this Mesh to the given set of elements.
+     * \throw  NullArgumentException if pNewMeshName is NULL.
+     */
+    Mesh* createFromSetOfElements(const std::set<med_int>& pSetOfElements, const char* pNewMeshName);
+    
+    /**
+     * Creates a Mesh from one of its group.
+     * \param  pGroup       any group of this Mesh.  
+     * \param  pNewMeshName name of the new Mesh.
+     * \return a new Mesh which is a restriction of this Mesh to pGroup.
+     * \throw  NullArgumentException if pGroup or pNewMeshName is NULL.
+     */
+    Mesh* createFromGroup(const Group* pGroup, const char* pNewMeshName);
+    
+    /**
+     * Creates a Mesh by merging this one with the given one.
+     * Warning: not all the data are merged (e.g. bounding box if not computed and family/groups are partially filled).
+     * This method is intended to be used to build mesh for visualization (VISU integration).
+     * Merge is partial to improve speed.
+     * \param  pMesh any Mesh
+     * \return a new Mesh which is a the union of this and pMesh.
+     * \throw  NullArgumentException if pGroup or pNewMeshName is NULL.
+     */
+    Mesh* mergePartial(const Mesh* pMesh);
+    Mesh* mergePartial(std::vector<Mesh*> pMeshes, const char* pFieldName, int pFieldIt);
+    
+    /**
+     * Creates a distributed mesh (MeshDis) by creating a new mesh for each group of elements in this Mesh.
+     * \return a distributed mesh from groups of this Mesh.
+     */
+    MeshDis* splitGroupsOfElements();
+    
+    /**
+     * Creates a new mesh by decimating this one.
+     * \param  pFilterName  name of the filter to be used for decimation (e.g. Filtre_GradientMoyen); should not be NULL.
+     * \param  pArgv        all the arguments for filtering as a single string.
+     * \param  pNameNewMesh name of the new mesh.
+     * \return the decimated mesh.
+     * \throw  NullArgumentException if one of the arguments is NULL.
+     * \throw  RuntimeException if any error occurs while decimating data.
+     */
+    Mesh* decimate(
+        const char* pFilterName,
+        const char* pArgv,
+        const char* pNameNewMesh);
+    
+    /**
+     * Gets all the points in a field. Each point has coordinates and a value.
+     * \param  pField      any field of this Mesh.
+     * \param  pTimeStepIt time step iteration.
+     * \param  pPoints     (out) list of points.
+     * \throw  NullArgumentException if pField is NULL.
+     * \throw  IllegalArgumentException if pTimeStepIt is invalid.
+     */
+    void getAllPointsOfField(Field* pField, int pTimeStepIt, std::vector<PointOfField>& pPoints);
+    
+    /**
+     * Returns a default value for neighborhood radius.
+     * Return value is such that, for any point in the field, average number of neighbours is pN.
+     * \param  pN average number of neighbours.
+     * \return a default value for neighborhood radius; 1.0 if some error occurs.
+     */
+    float evalDefaultRadius(int pN) const;
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads a Mesh from a sequential MED file. Resets the object before.
+     * \param  pMEDfilename
+     * \param  pMeshName
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readSequentialMED(const char* pMEDfilename, const char* pMeshName);
+    
+    /**
+     * Writes this Mesh and all related things into a MED file.
+     * \param  pMEDfilename
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(const char* pMEDfilename);
+    
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+    
+    /**
+     * Dumps any Mesh to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pM  any Mesh.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Mesh& pM);
+    
+private:
+     
+    /**
+     * Reads all Gauss localizations in the current MED file.
+     * \throw  IOException if an i/o error occurs.
+     */
+    void readGaussLoc();
+     
+    /**
+     * Reads families in the currentMED file and build groups.
+     * \throw  IOException if an i/o error occurs.
+     */
+    void readFamilies();
+    
+    /**
+     * Finalizes the constructions of families and groups. 
+     * Fill structures with elements.
+     */
+    void finalizeFamiliesAndGroups();
+    
+    /**
+     * Reads fields related to this mesh in the current MED file.
+     * \throw  IOException if an i/o error occurs.
+     */
+    void readFields();
+    
+private:
+
+    /**
+     * Name of the associated MED file.
+     */
+    char                              mMEDfilename[256];
+    
+    /**
+     * MED file handle.
+     */
+    med_idt                           mMEDfile;
+    
+    /**
+     * Name of this mesh.
+     */
+    char                              mMeshName[MED_TAILLE_NOM + 1];
+    
+    /**
+     * Universal name of this mesh.
+     */ 
+    char                              mMeshUName[MED_TAILLE_DESC + 1];
+    
+    /**
+     * Description.
+     */
+    char                              mMeshDesc[MED_TAILLE_DESC + 1]; 
+    
+    /**
+     * Dimension.
+     */
+    med_int                           mMeshDim;
+    
+    /**
+     * Type of mesh (MED_NON_STRUCTURE or MED_STRUCTURE (=grid)) 
+     */
+    med_maillage                      mMeshType;
+    
+    /** 
+     * Axis aligned bounding box of this mesh.
+     */
+    med_float                         mMeshBBoxMin[3];
+    med_float                         mMeshBBoxMax[3];
+
+    /**
+     * All the nodes used by this mesh. 
+     */
+    Nodes*                            mNodes;
+    
+    /**
+     * All the TETRA10 elements used by this mesh.
+     */
+    Elements*                         mElements;
+    
+    /**
+     * Table of families used by this mesh.
+     */
+    std::vector<Family*>              mFamilies;
+    
+    /**
+     * Map to retrieve a Family from its id.
+     */
+    std::map<med_int, Family*>        mFamIdToFam;
+    
+    /**
+     * Table of groups used by this mesh.
+     */
+    std::vector<Group*>               mGroups;
+    
+    /**
+     * Map to retrieve a Group from its name.
+     */
+    std::map<std::string, Group*>     mGroupNameToGroup;
+    
+    /**
+     * Table of GaussLoc. 
+     */
+    std::vector<GaussLoc*>            mGaussLoc; 
+    
+    /**
+     * Map to retrieve a Gauss info from its name.
+     */
+    std::map<std::string, GaussLoc*>  mGaussLocNameToGaussLoc;
+    
+    /**
+     * Table of fields related to this mesh.
+     * Number of fiels = mFields.size().
+     */
+    std::vector<Field*>               mFields;
+    
+    /**
+     * Table of profils.
+     */
+    std::vector<Profil*>              mProfils;
+    
+    /** 
+     * Flag to control the behaviour of the stream operator <<. 
+     */
+    bool                              mFlagPrintAll;
+    
+private:
+
+    // do not allow copy constructor
+    Mesh(const Mesh&);
+    
+    // do not allow copy
+    Mesh& operator=(const Mesh&);
+    
+    // do not allow operator ==
+    bool operator==(const Mesh&); 
+    
+}; // class Mesh
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_MESH_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_MeshDis.cxx b/src/MULTIPR/MULTIPR_MeshDis.cxx
new file mode 100755 (executable)
index 0000000..29d1163
--- /dev/null
@@ -0,0 +1,1074 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_MeshDis.cxx
+ *
+ * \brief   see MULTIPR_MeshDis.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_MeshDis.hxx"
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_DecimationFilter.hxx"
+#include "MULTIPR_Utils.hxx"
+#include "MULTIPR_Globals.hxx"
+#include "MULTIPR_API.hxx"
+#include "MULTIPR_Exceptions.hxx"
+#include "MULTIPR_ProgressCallback.hxx"
+
+#include "MEDSPLITTER_API.hxx"
+
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Global variables (exported)
+//*****************************************************************************
+
+// callback used to report progress about a long task (e.g. save to disk)
+MULTIPR_ProgressCallback* gProgressCallback = NULL;
+
+// callback used to report empty meshes
+MULTIPR_EmptyMeshCallback* gEmptyMeshCallback = NULL;
+
+
+//*****************************************************************************
+// Class MeshDisEntry implementation
+//*****************************************************************************
+
+MeshDisPart::MeshDisPart()
+{
+    mMesh             = NULL;
+    mCollection       = NULL;
+    mOldCollection    = NULL;
+    
+    reset();
+}
+
+
+MeshDisPart::~MeshDisPart()
+{
+    reset();
+}
+
+
+void MeshDisPart::reset()
+{
+    mToDoOnNextWrite = MULTIPR_UNDEFINED;
+    
+    mMeshName[0]     = '\0';
+    mId              = 0;
+    mPartName[0]     = '\0';
+    mPath[0]         = '\0';
+    mMEDFileName[0]  = '\0';
+    
+    if (mMesh != NULL)
+    {
+        delete mMesh;
+        mMesh = NULL;
+    }
+    
+    mSplit           = 0;
+    
+    if (mCollection != NULL)
+    {
+        delete mCollection;
+        mCollection = NULL;
+    }
+    
+    if (mOldCollection != NULL)
+    {
+        delete mOldCollection;
+        mOldCollection = NULL;
+    }
+}
+
+
+const char* MeshDisPart::getMEDFileNameSuffix() const
+{    
+    // Examples:
+    //    "agregat100grains_12pas_grain97.med"                       -> "grain97"
+    //    "agregat100grains_12pas_grain100_part2.med"                -> "grain100_part2"
+    //    "aagregat100grains_12pas_grain98_gradmoy-low-25.0-0.3.med" -> "grain98_gradmoy-low-25-0.3"
+    
+    string prefix = removeExtension(mMEDFileName, ".med");
+    prefix.erase(0, prefix.rfind("grain"));
+    return prefix.c_str();
+}
+
+
+void MeshDisPart::create(
+        OnNextWrite pToDoOnNextWrite,
+        const char* pMeshName, 
+        int         pId,
+        const char* pPartName,
+        const char* pPath,
+        const char* pMEDFileName,
+        Mesh*       pMesh)
+{
+    if (pToDoOnNextWrite == MULTIPR_UNDEFINED) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pId < 1) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if (pPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pPath == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pMEDFileName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    
+    mToDoOnNextWrite = pToDoOnNextWrite;
+    strcpy(mMeshName, pMeshName);
+    mId = pId;
+    strcpy(mPartName, pPartName);
+    strcpy(mPath, pPath);
+    strcpy(mMEDFileName, pMEDFileName);
+    mMesh = pMesh;
+    
+}
+
+
+void MeshDisPart::readMED()
+{
+    if (mMesh != NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mCollection != NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mOldCollection != NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    mMesh = new Mesh();
+    mMesh->readSequentialMED(mMEDFileName, mMeshName);
+}
+
+
+ostream& operator<<(ostream& pOs, MeshDisPart& pM)
+{
+    switch (pM.mToDoOnNextWrite)
+    {
+        case MeshDisPart::MULTIPR_UNDEFINED: 
+            pOs << "undefined"; 
+            break;
+            
+        case MeshDisPart::MULTIPR_KEEP_AS_IT: 
+            pOs << pM.mMeshName << " " << pM.mId << " " << pM.mPartName << " " << pM.mPath << " " << pM.mMEDFileName;
+            break;
+            
+        case MeshDisPart::MULTIPR_WRITE_MESH:
+            pOs << pM.mMeshName << " " << pM.mId << " " << pM.mPartName << " " << pM.mPath << " " << pM.mMEDFileName;
+            break;
+            
+        case MeshDisPart::MULTIPR_WRITE_PARTS:
+            pOs << pM.mMeshName << " " << pM.mId << " " << pM.mPartName << " " << pM.mPath << " " << pM.mMEDFileName << " SPLIT " << pM.mSplit;
+            break;
+        
+        default: throw IllegalStateException("", __FILE__, __LINE__);
+    }
+    
+    return pOs;
+}
+
+
+//*****************************************************************************
+// Class MeshDis implementation
+//*****************************************************************************
+
+MeshDis::MeshDis()
+{
+    reset();
+}
+
+
+MeshDis::~MeshDis()
+{
+    reset();
+}
+
+
+void MeshDis::reset()
+{
+    mSequentialMEDFilename[0]  = '\0';
+    mDistributedMEDFilename[0] = '\0';
+    
+    for (unsigned itPart = 0 ; itPart != mParts.size() ; itPart++)
+    {
+        MeshDisPart* part = mParts[itPart];
+        delete part;
+    }
+    mParts.clear();
+    
+    //mProgressCallback = NULL;
+}
+
+
+void MeshDis::setSequentialMEDFilename(const char* pFilename) 
+{ 
+    strcpy(mSequentialMEDFilename, pFilename); 
+}
+
+
+void MeshDis::addMesh(
+    MeshDisPart::OnNextWrite pToDoOnNextWrite,
+    const char* pMeshName, 
+    int         pId,
+    const char* pPartName,
+    const char* pPath,
+    const char* pMEDFileName,
+    Mesh*       pMesh)
+{
+    MeshDisPart* part = new MeshDisPart();
+    
+    part->create(
+        pToDoOnNextWrite,
+        pMeshName,
+        pId,
+        pPartName,
+        pPath,
+        pMEDFileName,
+        pMesh);
+    
+    mParts.push_back(part);
+}
+
+
+void MeshDis::insertMesh(
+    MeshDisPart::OnNextWrite pToDoOnNextWrite,
+    const char* pMeshName, 
+    int         pId,
+    const char* pPartName,
+    const char* pPath,
+    const char* pMEDFileName,
+    Mesh*       pMesh,
+    int         pPosition)
+{
+    MeshDisPart* part = new MeshDisPart();
+    
+    part->create(
+        pToDoOnNextWrite,
+        pMeshName,
+        pId,
+        pPartName,
+        pPath,
+        pMEDFileName,
+        pMesh);
+    
+    mParts.insert(mParts.begin() + pPosition, part);
+    
+    // rename id of following parts
+    for (unsigned i = pPosition + 1 ; i < mParts.size() ; i++)
+    {
+        mParts[i]->mId++;
+    }
+}
+
+
+void MeshDis::removeParts(const char* pPrefixPartName)
+{
+    if (pPrefixPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    char strPrefix[256];
+    sprintf(strPrefix, "%s_", pPrefixPartName);
+    
+    for (vector<MeshDisPart*>::iterator itPart = mParts.begin() ; itPart != mParts.end() ; itPart++)
+    {
+        MeshDisPart* currentPart = (*itPart);
+        
+        // remove part which have the same name and all sub_parts
+        // e.g. if pPrefixPartName="PART_4" => remove "PART_4" and "PART_4_*", but not "PART41"        
+        if ((strcmp(currentPart->getPartName(), pPrefixPartName) == 0) || 
+            startsWith(currentPart->getPartName(), strPrefix))
+        {
+            mParts.erase(itPart);
+        
+            // decrement id of following parts
+            for (vector<MeshDisPart*>::iterator itPart2 = itPart ; itPart2 != mParts.end() ; itPart2++)
+            {
+                (*itPart2)->mId--;
+            }
+            
+            itPart--;
+            if (currentPart->mMEDFileName != NULL)
+            {
+                remove(currentPart->mMEDFileName);
+            }
+            
+            delete currentPart;
+        }
+    }
+}
+
+
+MeshDisPart* MeshDis::findPart(const char* pPartName)
+{
+    if (pPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    MeshDisPart* part = NULL;
+    
+    for (unsigned itPart = 0 ; itPart < mParts.size() ; itPart++)
+    {
+        MeshDisPart* currentPart = mParts[itPart];
+        
+        if (strcmp(currentPart->getPartName(), pPartName) == 0)
+        {
+             part = currentPart;
+            break;
+        }
+    }
+    
+    return part;
+    
+}
+
+
+vector<string> MeshDis::getMeshes() const
+{
+    vector<string> res;
+    
+    if (mParts.size() > 0)
+    {
+        MeshDisPart* part = mParts[0];
+        const char* meshName = part->getMeshName();
+        res.push_back(meshName);
+    }
+    
+    return res;
+}
+
+
+vector<string> MeshDis::getFields() const
+{
+    vector<string> res;
+    
+    if (mParts.size() == 0)
+    {
+        return res;
+    }
+    
+    // all the parts of the distributed MED file should have the same fields
+    // => just return the name of fields of the first part
+    switch (mParts[0]->mToDoOnNextWrite)
+    {
+        case MeshDisPart::MULTIPR_KEEP_AS_IT: 
+        case MeshDisPart::MULTIPR_WRITE_PARTS:
+        {
+            vector<pair<string, int> > tmp = multipr::getListScalarFields(mParts[0]->getMEDFileName());
+    
+            for (unsigned i = 0 ; i < tmp.size() ; i++)
+            {
+                res.push_back(tmp[i].first);
+            }
+            return res;
+        }
+            
+        case MeshDisPart::MULTIPR_WRITE_MESH:
+            return mParts[0]->mMesh->getNameScalarFields();
+        
+        default: 
+            throw IllegalStateException("", __FILE__, __LINE__);
+    }
+}
+
+
+int MeshDis::getTimeStamps(const char* pFieldName) const
+{
+    if (mParts.size() == 0)
+    {
+        // no parts in this distributed MED file => no fields => #iteration = 0
+        return 0;
+    }
+    
+    // all the parts of the distributed MED file should have the same fields
+    // => just return the number of iteration found in the field of the first part
+    switch (mParts[0]->mToDoOnNextWrite)
+    {
+        case MeshDisPart::MULTIPR_KEEP_AS_IT: 
+        case MeshDisPart::MULTIPR_WRITE_PARTS:
+        {
+            vector<pair<string, int> > tmp = multipr::getListScalarFields(mParts[0]->getMEDFileName());
+        
+            for (unsigned i = 0 ; i < tmp.size() ; i++)
+            {
+                if (strcmp(tmp[i].first.c_str(), pFieldName) == 0)
+                {
+                    return tmp[i].second;
+                }
+            }
+            
+            // pFieldName not found in the list of fields
+            return 0;
+        }
+            
+        case MeshDisPart::MULTIPR_WRITE_MESH:
+            return mParts[0]->mMesh->getTimeStamps(pFieldName);
+        
+        default: 
+            throw IllegalStateException("", __FILE__, __LINE__);
+    }
+}
+
+
+string MeshDis::getPartInfo(const char* pPartName)
+{
+    MeshDisPart* part = findPart(pPartName);
+    
+    if (part != NULL)
+    {
+        char num[16];
+        sprintf(num, "%d", part->mId);
+        
+        string res = 
+            string(part->mMeshName) + 
+            string(" ") +
+            string(num) +
+            string(" ") +
+            string(part->mPartName) +
+            string(" ") +
+            string(part->mPath) +
+            string(" ") +
+            string(part->mMEDFileName);
+
+        return res;
+    }
+    else
+    {
+        // part not found => return empty string
+        return "";
+    }
+}
+
+
+void MeshDis::splitPart(const char* pPartName, int pNbParts, int pPartitionner)
+{
+    //cout << "MULTIPR: MeshDis::splitPart()" << endl;
+    if (pPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pNbParts < 2) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if ((pPartitionner != MULTIPR_METIS) && (pPartitionner != MULTIPR_SCOTCH)) throw IllegalArgumentException("should be 0=METIS or 1=SCOTCH", __FILE__, __LINE__);
+    
+    //cout << "MULTIPR: file=" << __FILE__ << " line=" << __LINE__ << " args OK" << endl;
+    
+    //---------------------------------------------------------------------
+    // Find the MED file corresponding to the given part
+    //---------------------------------------------------------------------
+    MeshDisPart* part = findPart(pPartName);
+    
+    if (part == NULL)
+    {
+        throw IllegalArgumentException("part not found in this distributed MED file", __FILE__, __LINE__);
+    }
+
+    //cout << "MULTIPR: file=" << __FILE__ << " line=" << __LINE__ << " find part OK" << endl;
+    
+    //---------------------------------------------------------------------
+    // Load the sequential MED file
+    //---------------------------------------------------------------------
+    MEDSPLITTER::MESHCollection* collection;
+    collection = new MEDSPLITTER::MESHCollection(part->getMEDFileName(), part->getMeshName());
+    
+    //cout << "MULTIPR: file=" << __FILE__ << " line=" << __LINE__ << " MEDSPLITTER collection OK" << endl;
+    //---------------------------------------------------------------------
+    // Partition the group
+    //---------------------------------------------------------------------
+    MEDSPLITTER::Topology* topology;
+    if (pPartitionner == MULTIPR_METIS)
+    {
+        try
+        {
+            topology = collection->createPartition(pNbParts, MEDSPLITTER::Graph::METIS);
+        }
+        catch (...)
+        {
+            throw RuntimeException("MEDSPLITTER error: createPartition(), using METIS", __FILE__, __LINE__);
+        }
+    }
+    else if (pPartitionner == MULTIPR_SCOTCH)
+    {
+        try
+        {
+            //cout << "MULTIPR: file=" << __FILE__ << " line=" << __LINE__ << " try to create partition using SCOTCH: #parts=" << pNbParts << endl;
+            topology = collection->createPartition(pNbParts, MEDSPLITTER::Graph::SCOTCH);
+            //cout << "MULTIPR: file=" << __FILE__ << " line=" << __LINE__ << " assigned SCOTCH" << endl;
+        }
+        catch (...)
+        {
+            throw RuntimeException("MEDSPLITTER error: createPartition(), using SCOTCH", __FILE__, __LINE__);
+        }
+    }
+    else
+    {
+        throw IllegalStateException("unknown partitionner", __FILE__, __LINE__);
+    }
+    
+    try
+    {
+        MEDSPLITTER::MESHCollection* newCollection = new MEDSPLITTER::MESHCollection(*collection, topology);
+        
+        part->mToDoOnNextWrite = MeshDisPart::MULTIPR_WRITE_PARTS; 
+        part->mSplit           = pNbParts;
+        part->mOldCollection   = collection;
+        part->mCollection      = newCollection;
+    }
+    catch (...)
+    {
+        //cout << "MEDSPLITTER error: new MESHCollection()" << endl;
+        throw RuntimeException("MEDSPLITTER error: new MESHCollection()", __FILE__, __LINE__);
+    }
+}
+
+
+void MeshDis::decimatePart(
+    const char* pPartName, 
+    const char* pFieldName,
+    med_int     pFieldIt,
+    const char* pFilterName,
+    med_float   pTMed, 
+    med_float   pTLow,
+    med_float   pRadius,
+    int         pBoxing)
+{
+    //---------------------------------------------------------------------
+    // Check arguments
+    //---------------------------------------------------------------------
+    if (pPartName == NULL) throw NullArgumentException("partname should not be NULL", __FILE__, __LINE__);
+    if (pFieldName == NULL) throw NullArgumentException("fieldname should not be NULL", __FILE__, __LINE__);
+    if (pFieldIt < med_int(1)) throw IllegalArgumentException("invalid field iteration; should be >= 1", __FILE__, __LINE__);
+    if (pTMed < 0.0) throw IllegalArgumentException("med res.: threshold must be > 0", __FILE__, __LINE__);
+    if (pTMed >= pTLow) throw IllegalArgumentException("threshold for med res. must be < threshold for low res.", __FILE__, __LINE__);    
+    if (pRadius <= med_float(0.0)) throw IllegalArgumentException("radius should be > 0", __FILE__, __LINE__);
+    if ((pBoxing < 1) || (pBoxing > 200)) throw IllegalArgumentException("boxing should be in [1..200]", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Find the MED file corresponding to the given part
+    //---------------------------------------------------------------------
+    MeshDisPart* part = findPart(pPartName);
+    if (part == NULL)
+    {
+        throw IllegalArgumentException("part not found in the given distributed MED file", __FILE__, __LINE__);
+    }
+    
+    //---------------------------------------------------------------------
+    // Load the associated sequential MED file
+    //---------------------------------------------------------------------
+    if (part->mMesh == NULL)
+    {
+        part->readMED();
+    }
+    
+    Mesh* meshFull = part->mMesh;
+    cout << (*meshFull) << endl;
+    
+    const char* originalFilename = part->getMEDFileName();
+    string strPrefix = removeExtension(originalFilename, ".med");
+    
+    // debug
+    //cout << (*this) << endl;
+    
+    //---------------------------------------------------------------------
+    // Decimates the given mesh
+    //---------------------------------------------------------------------
+    // arguments for decimation are passed as a string for genericity
+    char argv[256];
+    char newPartName[MED_TAILLE_NOM + 1];
+    char newMEDFileName[256];
+    
+    // *** create a new mesh = MEDIUM resolution ***
+    sprintf(argv, "%s %d %lf %lf %d", pFieldName, pFieldIt, pTMed, pRadius, pBoxing);
+    sprintf(newPartName, "%s_MED", pPartName);
+    sprintf(newMEDFileName, "%s_gradmoy-med-%s-%s.med", 
+        strPrefix.c_str(), 
+        realToString(pTMed).c_str(), 
+        realToString(pRadius).c_str());
+    
+    {
+        Mesh* meshMedium = meshFull->decimate(pFilterName, argv, part->getMeshName());
+        cout << (*meshMedium) << endl;
+        
+        insertMesh(
+            MeshDisPart::MULTIPR_WRITE_MESH,
+            part->getMeshName(),
+            part->mId + 1,
+            newPartName,
+            "localhost",
+            newMEDFileName,
+            meshMedium,
+            part->mId + 0);
+            
+            if ((meshMedium->getNumberOfElements() == 0) && (gEmptyMeshCallback != NULL))
+            {
+                gEmptyMeshCallback->reportEmptyMesh(newPartName);
+            }
+    }
+    
+    // *** create a new mesh = LOW resolution ***
+    sprintf(argv, "%s %d %lf %lf %d", pFieldName, pFieldIt, pTLow, pRadius, pBoxing);
+    sprintf(newPartName, "%s_LOW", pPartName);
+    sprintf(newMEDFileName, "%s_gradmoy-low-%s-%s.med", 
+        strPrefix.c_str(), 
+        realToString(pTLow).c_str(), 
+        realToString(pRadius).c_str());
+    
+    {
+        Mesh* meshLow = meshFull->decimate(pFilterName, argv, part->getMeshName());
+        cout << (*meshLow) << endl;
+        
+        insertMesh(
+            MeshDisPart::MULTIPR_WRITE_MESH,
+            part->getMeshName(),
+            part->mId + 2,
+            newPartName,
+            "localhost",
+            newMEDFileName,
+            meshLow,
+            part->mId + 1);
+            
+            if ((meshLow->getNumberOfElements() == 0) && (gEmptyMeshCallback != NULL))
+            {
+                gEmptyMeshCallback->reportEmptyMesh(newPartName);
+            }
+    }
+    
+    // debug
+    //cout << (*this) << endl;
+}
+
+
+string MeshDis::evalDecimationParams(
+    const char* pPartName, 
+    const char* pFieldName, 
+    int         pFieldIt, 
+    const char* pFilterName,
+    const char* pFilterParams)
+{
+    MeshDisPart* part = findPart(pPartName);
+    if (part == NULL) 
+    {
+        return "";
+    }
+    
+    try
+    {
+        if (part->mMesh == NULL)
+        {
+            part->readMED();
+        }
+    
+        multipr::DecimationFilter* filter = multipr::DecimationFilter::create(pFilterName);
+        if (filter == NULL) 
+        {
+            return "";
+        }
+        
+        multipr::DecimationFilterGradAvg* filterGrad = dynamic_cast<multipr::DecimationFilterGradAvg*>(filter);
+        
+        if (filterGrad != NULL)
+        {
+            int mode;
+            
+            int ret = sscanf(pFilterParams, "%d", &mode);
+            
+            // mode 2 = GET RADIUS
+            if ((ret == 1) && (mode == 2))
+            {
+                double radius = part->mMesh->evalDefaultRadius(8);
+                char res[256];
+                sprintf(res, "%f", radius);
+                return res;
+            }
+            
+            float radius;
+            int boxing;
+            
+            ret = sscanf(pFilterParams, "%d %f %d", &mode, &radius, &boxing);
+            
+            // mode 1 = GET GRADIENT MIN, MAX and AVG
+            if ((ret == 3) && (mode == 1))
+            {
+                double gradMin = 0.1, gradAvg = 0.15, gradMax = 0.2;
+                
+                filterGrad->getGradientInfo(
+                    part->mMesh,
+                    pFieldName,
+                    pFieldIt,
+                    radius,
+                    boxing,
+                    &gradMin,
+                    &gradAvg,
+                    &gradMax);
+                
+                char res[2048];
+                sprintf(res, "%f %f %f", gradMin, gradAvg, gradMax);
+                return res;
+            }
+        }
+        
+        delete filter;
+    }
+    catch(...)
+    {
+    }
+    
+    return "";
+}
+
+
+int MeshDis::computeNumParts()
+{
+    int numParts = 0;
+    
+    for (unsigned itPart = 0 ; itPart < mParts.size() ; itPart++)
+    {
+        switch (mParts[itPart]->mToDoOnNextWrite)
+        {
+        case MeshDisPart::MULTIPR_KEEP_AS_IT: 
+        case MeshDisPart::MULTIPR_WRITE_MESH:
+            numParts++;
+            break;
+        
+        case MeshDisPart::MULTIPR_WRITE_PARTS:
+            numParts += mParts[itPart]->mSplit;
+            break;
+        
+        default: throw IllegalStateException("", __FILE__, __LINE__);
+        }
+    }
+    
+    return numParts;
+}
+
+
+void MeshDis::readDistributedMED(const char* pMEDfilename)
+{
+    if (pMEDfilename == NULL) throw NullArgumentException("filename should not be NULL", __FILE__, __LINE__);
+    
+    const int MAX_SIZEOF_LINE = 1024;
+    
+    reset();
+    strcpy(mDistributedMEDFilename, pMEDfilename);
+    
+    //---------------------------------------------------------------------
+    // Open master file (ASCII file)
+    //---------------------------------------------------------------------
+    ifstream fileMaster(mDistributedMEDFilename);
+    if (fileMaster.fail()) throw IOException("i/o error while opening MED master file", __FILE__, __LINE__);
+
+    //---------------------------------------------------------------------
+    // Read header
+    //---------------------------------------------------------------------
+    char charbuffer[MAX_SIZEOF_LINE];
+    fileMaster.getline(charbuffer, MAX_SIZEOF_LINE);
+    if (fileMaster.fail()) throw IOException("i/o error while reading MED master file", __FILE__, __LINE__);
+    
+    // check format
+    if ((charbuffer[0] != '#') ||
+        (charbuffer[1] != ' ') ||
+        (charbuffer[2] != 'M') ||
+        (charbuffer[3] != 'E') ||
+        (charbuffer[4] != 'D'))
+        throw IOException("not a valid distributed MED file", __FILE__, __LINE__);
+        
+    while ((charbuffer[0] == '#') || (strlen(charbuffer) == 0))
+    {
+        char* strTag = NULL;
+        if ((charbuffer[0] == '#') && ((strTag = strstr(charbuffer, "[SOURCE]=")) != NULL))
+        {
+            char strSequentialMEDFilename[256];
+            int ret = sscanf(strTag, "[SOURCE]=%s", strSequentialMEDFilename);
+            if (ret == 1)
+            {
+                setSequentialMEDFilename(strSequentialMEDFilename);
+            }
+        }
+        fileMaster.getline(charbuffer, MAX_SIZEOF_LINE);
+        if (fileMaster.fail()) throw IOException("i/o error while reading MED master file", __FILE__, __LINE__);
+    }
+    
+    // read number of parts
+    int nbParts = atoi(charbuffer);
+    
+    //---------------------------------------------------------------------
+    // Read infos about sub-parts
+    //---------------------------------------------------------------------
+    char   lMeshName[MED_TAILLE_NOM + 1];
+    int    lId;
+    char   lPartName[MED_TAILLE_NOM + 1];
+    char   lPath[256];
+    char   lMEDFileName[256];    
+    
+    for (int i = 0 ; i < nbParts ; i++)
+    {
+        fileMaster.getline(charbuffer, MAX_SIZEOF_LINE);
+        if (fileMaster.fail()) throw IOException("i/o error while reading MED master file", __FILE__, __LINE__);
+        
+        while ((charbuffer[0] == '#') || (strlen(charbuffer) == 0))
+        {
+            fileMaster.getline(charbuffer, MAX_SIZEOF_LINE);
+            if (fileMaster.fail()) throw IOException("i/o error while reading MED master file", __FILE__, __LINE__);
+        }
+        
+        lMeshName[0]    = '\0';
+        lId             = 0;
+        lPartName[0]    = '\0';
+        lPath[0]        = '\0';
+        lMEDFileName[0] = '\0';
+        
+        int ret = sscanf(charbuffer, "%s %d %s %s %s", 
+            lMeshName,
+            &lId,
+            lPartName,
+            lPath,
+            lMEDFileName);
+    
+        if (ret != 5) throw IOException("i/o error while reading MED master file; bad format", __FILE__, __LINE__);
+
+        //cout << "DBG: read: " << lMeshName << " " << lId << " " << lPartName << endl;
+        addMesh(
+            MeshDisPart::MULTIPR_KEEP_AS_IT,
+            lMeshName,
+            lId,
+            lPartName,
+            lPath,
+            lMEDFileName,
+            NULL);
+    }
+    
+    //---------------------------------------------------------------------
+    // Close master file
+    //---------------------------------------------------------------------
+    fileMaster.close();
+    if (fileMaster.fail()) throw IOException("i/o error while closing MED master file", __FILE__, __LINE__);
+}
+
+
+/**
+ * Retrieves the output of MEDSPLITTER and convert it for MULTIPR.
+ */
+int convertMedsplitterToMultipr(ofstream& pFileMaster, const char* pTmpFilename, int pId, MeshDisPart* pPart, string pDestPath)
+{
+    MULTIPR_LOG("convert" << endl);
+    
+    const int MAX_SIZEOF_LINE = 1024;
+    char charbuffer[MAX_SIZEOF_LINE];
+    
+    // Open medsplitter master file (ASCII file)
+    ifstream fileMasterMedsplitter(pTmpFilename);
+    if (fileMasterMedsplitter.fail()) throw IOException("i/o error while opening MEDSPLITTER master file", __FILE__, __LINE__);
+    
+    fileMasterMedsplitter.getline(charbuffer, MAX_SIZEOF_LINE);
+    if (fileMasterMedsplitter.fail()) throw IOException("i/o error while reading MEDSPLITTER master file", __FILE__, __LINE__);    
+
+    while ((charbuffer[0] == '#') || (strlen(charbuffer) == 0))
+    {
+        fileMasterMedsplitter.getline(charbuffer, MAX_SIZEOF_LINE);
+        if (fileMasterMedsplitter.fail()) throw IOException("i/o error while reading MEDSPLITTER master file", __FILE__, __LINE__);
+    }
+
+    // read number of parts
+    int nbParts = atoi(charbuffer);
+    //cout << "nb parts=" << nbParts << endl;
+
+    char   lMeshName[MED_TAILLE_NOM + 1];
+    int    lId;
+    char   lPartName[MED_TAILLE_NOM + 1];
+    char   lPath[256];
+    char   lMEDFileName[256];
+    
+    for (int i = 0 ; i < nbParts ; i++)
+    {
+        fileMasterMedsplitter.getline(charbuffer, MAX_SIZEOF_LINE);
+        if (fileMasterMedsplitter.fail()) throw IOException("", __FILE__, __LINE__);
+        
+        // parses the current line
+        lMeshName[0]    = '\0';
+        lId             = 0;
+        lPartName[0]    = '\0';
+        lPath[0]        = '\0';
+        lMEDFileName[0] = '\0';
+        
+        int ret = sscanf(charbuffer, "%s %d %s %s %s", 
+            lMeshName,
+            &lId,
+            lPartName,
+            lPath,
+            lMEDFileName);
+            
+        if (ret != 5) throw IOException("i/o error while reading MEDSPLITTER master file; bad format", __FILE__, __LINE__);
+        
+        string strDestFilename = pDestPath + multipr::getFilenameWithoutPath(lMEDFileName);
+        if (strcmp(lMEDFileName, strDestFilename.c_str()) != 0)
+        {
+            multipr::copyFile(lMEDFileName, pDestPath.c_str());
+            strcpy(lMEDFileName, strDestFilename.c_str());
+        }
+                
+        pFileMaster << lMeshName << " " << (pId + i) << " " << pPart->getPartName() << "_" << (i + 1) << " " << lPath << " " << lMEDFileName << endl;
+    }
+    
+    fileMasterMedsplitter.close();
+    if (fileMasterMedsplitter.fail()) throw IOException("i/o error while closing MEDSPLITTER master file", __FILE__, __LINE__);
+    
+    // remove master file generated by MEDSPLITTER
+    remove(pTmpFilename);
+    
+    return nbParts;
+}
+
+
+void MeshDis::writeDistributedMED(const char* pMEDfilenamePrefix)
+{
+    if (pMEDfilenamePrefix == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Build master filename
+    //---------------------------------------------------------------------
+    string strPrefix = string(pMEDfilenamePrefix);
+    const char* strExtension = ".med";
+    string strMasterFilename;
+    
+    // add suffix "_grains_maitre" iff it is not yet in the filename
+    if (strstr(pMEDfilenamePrefix, "_grains_maitre") == 0)
+    {
+        strMasterFilename= strPrefix + "_grains_maitre" + strExtension;
+    }
+    else
+    {
+        strMasterFilename = strPrefix + strExtension;
+    }
+    
+    string strDestPath = multipr::getPath(strMasterFilename.c_str());
+    
+    MULTIPR_LOG("Create master: " << strMasterFilename << endl);
+    strcpy(mDistributedMEDFilename, strMasterFilename.c_str());
+    
+    //---------------------------------------------------------------------
+    // Create an ASCII master file for the resulting distributed mesh and write header
+    //---------------------------------------------------------------------
+    remove(strMasterFilename.c_str());
+    ofstream fileMaster(strMasterFilename.c_str());
+    
+    if (fileMaster == 0) throw IOException("i/o error while creating MED master file", __FILE__, __LINE__);
+    
+    fileMaster << "# MED file v2.3 - Master file created by MULTIPR v" << getVersion() << endl;
+    fileMaster << "#" << " " << endl;
+    fileMaster << "# [SOURCE]=" << mSequentialMEDFilename << endl;
+    fileMaster << "#" << " " << endl;
+    
+    fileMaster << computeNumParts() << endl;
+    if (fileMaster.fail()) throw IOException("i/o error while writing MED master file", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Create a new MED file (v2.3)
+    //---------------------------------------------------------------------
+    int id = 1;
+    
+    if (gProgressCallback != NULL) gProgressCallback->start("Save mesh", mParts.size());
+    
+    try
+    {
+    
+    // for each sub-meshes
+    for (unsigned itPart = 0 ; itPart < mParts.size() ; itPart++)
+    {
+        switch (mParts[itPart]->mToDoOnNextWrite)
+        {
+            case MeshDisPart::MULTIPR_KEEP_AS_IT: 
+            {
+                mParts[itPart]->mId = id;
+                id++;
+                
+                // copy file in another directory?
+                string strSrcPath = multipr::getPath(mParts[itPart]->getMEDFileName());
+                if (strSrcPath != strDestPath)
+                {
+                    cout << "Write: KEEP_AS_IT: copy file" << endl;
+                    string strDestFilename = strDestPath + multipr::getFilenameWithoutPath(mParts[itPart]->getMEDFileName());
+                    multipr::copyFile(mParts[itPart]->getMEDFileName(), strDestPath.c_str());
+                    strcpy(mParts[itPart]->mMEDFileName, strDestFilename.c_str());
+                }
+                
+                fileMaster << (*mParts[itPart]) << endl;
+                cout << (*mParts[itPart]) << endl;
+                break;
+            }
+            
+            case MeshDisPart::MULTIPR_WRITE_MESH:
+            {
+                if (strlen(mParts[itPart]->getMEDFileName()) == 0) throw IOException("MED filename is empty", __FILE__, __LINE__);
+                if (mParts[itPart]->mMesh == NULL) throw IllegalStateException("invalid mesh (shoult not be NULL)", __FILE__, __LINE__);
+                
+                string strDestFilename = strDestPath + multipr::getFilenameWithoutPath(mParts[itPart]->getMEDFileName());
+                strcpy(mParts[itPart]->mMEDFileName, strDestFilename.c_str());
+                
+                mParts[itPart]->mMesh->writeMED(mParts[itPart]->getMEDFileName());
+                mParts[itPart]->mId = id;
+                id++;
+                fileMaster << (*mParts[itPart]) << endl;
+                cout << (*mParts[itPart]) << endl;
+                break;
+            }
+            
+            case MeshDisPart::MULTIPR_WRITE_PARTS:
+            {
+                // split this part using medsplitter
+                if (mParts[itPart]->mOldCollection == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+                string strPrefix = removeExtension(mParts[itPart]->getMEDFileName(), ".med"); 
+                char tmpFilename[256];
+                sprintf(tmpFilename, "%s_part", strPrefix.c_str());
+                mParts[itPart]->mCollection->write(tmpFilename);
+                mParts[itPart]->mCollection->castAllFields(*(mParts[itPart]->mOldCollection));
+                int ret = convertMedsplitterToMultipr(fileMaster, tmpFilename, id, mParts[itPart], strDestPath);
+                id += ret;
+                remove(mParts[itPart]->getMEDFileName());
+                break;
+            }
+        
+            default: throw IllegalStateException("should not be there", __FILE__, __LINE__);
+        }
+        
+        if (gProgressCallback != NULL) gProgressCallback->moveOn();
+    }
+    
+    }
+    catch (RuntimeException& e)
+    {
+        if (gProgressCallback != NULL) gProgressCallback->done();
+        throw e;
+    }
+    
+    if (gProgressCallback != NULL) gProgressCallback->done();
+    
+    //---------------------------------------------------------------------
+    // Close master file
+    //---------------------------------------------------------------------
+    fileMaster.close();
+    if (fileMaster.fail()) throw IOException("i/o error while closing MED master file", __FILE__, __LINE__);
+}
+
+
+ostream& operator<<(ostream& pOs, MeshDis& pM)
+{
+    pOs << "Mesh Dis.:" << endl;
+    pOs << "    Sequential filename (source) =|" << pM.mSequentialMEDFilename << "|" << endl;
+    pOs << "    Distributed filename (master)=|" << pM.mDistributedMEDFilename << "|" << endl;
+    pOs << "    #Sub-meshes =" << pM.mParts.size() << endl;
+    
+    for (unsigned itPart = 0 ; itPart < pM.mParts.size() ; itPart++)
+    {
+        cout << "        " << (itPart + 1) << ": " << (*(pM.mParts[itPart])) << endl; 
+    }
+    
+    return pOs;
+}
+
+
+} // namespace multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_MeshDis.hxx b/src/MULTIPR/MULTIPR_MeshDis.hxx
new file mode 100755 (executable)
index 0000000..81b6b4d
--- /dev/null
@@ -0,0 +1,473 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_MeshDis.hxx
+ *
+ * \brief   Class MeshDis: distributed mesh.
+ *          = MASTER file (ASCII) -> list of sequential MED file.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_MESHDIS_HXX
+#define MULTIPR_MESHDIS_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+#include <vector>
+
+// include MEDSPLITTER used to split mesh using METIS or SCOTCH
+#include "MEDMEM_define.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDSPLITTER_Graph.hxx"
+#include "MEDSPLITTER_MESHCollection.hxx"
+#include "MEDSPLITTER_Topology.hxx"
+
+
+namespace multipr
+{
+
+//*****************************************************************************
+// Pre-declaration
+//*****************************************************************************
+
+class Mesh;
+
+
+//*****************************************************************************
+// Class MeshDisPart = a sub-part of a distributed mesh.
+//
+// It can be :
+// - a sequential MED file representing a Group (scenario 1)
+// - a sequential MED file representing a part of a Group (scenario 2 -> MEDSPLITTER)
+// - a lower resolution of a part (decimation)
+//*****************************************************************************
+
+class MeshDisPart
+{
+
+public:
+
+    /**
+     * Action to be done for this part on next writing on disk.
+     */
+    enum OnNextWrite
+    {
+        MULTIPR_UNDEFINED,
+        MULTIPR_KEEP_AS_IT,
+        MULTIPR_WRITE_MESH,
+        MULTIPR_WRITE_PARTS
+    };
+    
+public:
+
+    /**
+     * Builds an empty part of a distributed mesh (default constructor).
+     */
+    MeshDisPart();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~MeshDisPart();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    /**
+     * Creates a MeshDisPart.
+     * \param  pToDoOnNextWrite
+     * \param  pMeshName
+     * \param  pId
+     * \param  pPartName
+     * \param  pPath
+     * \param  pMEDFileName file name excluding the path.
+     * \param  pMesh can be NULL.
+     */
+    void create(
+        OnNextWrite pToDoOnNextWrite,
+        const char* pMeshName, 
+        int         pId,
+        const char* pPartName,
+        const char* pPath,
+        const char* pMEDFileName,
+        Mesh*       pMesh);
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns the name of this part.
+     * \return the name of this part.
+     */
+    const char* getPartName() const { return mPartName; }
+    
+    /**
+     * Returns the name of the mesh of this part.
+     * \return the name of the mesh of this part.
+     */
+    const char* getMeshName() const { return mMeshName; }
+    
+    /**
+     * Returns the MED filename which contain this part.
+     * \return the MED filename which contain this part.
+     */
+    const char* getMEDFileName() const { return mMEDFileName; }
+    
+    /**
+     * Returns the suffix of the related MED filename (without .med extension).
+     * For examples:
+     * 1. "agregat100grains_12pas_grain97.med"                       -> "grain97"
+     * 2. "agregat100grains_12pas_grain100_part2.med"                -> "grain100_part2"
+     * 3. "aagregat100grains_12pas_grain98_gradmoy-low-25.0-0.3.med" -> "grain98_gradmoy-low-25-0.3"
+     */
+    const char* getMEDFileNameSuffix() const;
+    
+    /**
+     * Returns the action to be performed on this part on next write.
+     * \return the action to be performed on this part on next write.
+     */
+    OnNextWrite getOnNextWrite() const { return mToDoOnNextWrite; }
+     
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads the sequentiel MED file corresponding to this part.
+     * \throw  IOException if an i/o error occurs.
+     */
+    void readMED();
+     
+    /**
+     * Dumps any MeshDisPart to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pM  any MeshDisPart.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, MeshDisPart& pM);
+    
+private:
+
+    // MeshDisPart can be used:
+    // 1 (KEEP_AS_IT)  : To store data read from one line of an ASCII master file (distributed MED file)
+    // 2 (WRITE_MESH)  : As a temporary structure to store all infos about a mesh corresponding to a group (before writing on disk).
+    // 3 (WRITE_PARTS) : As a temporary structure to store all infos about splitting using MEDSPLITTER.
+    
+    OnNextWrite  mToDoOnNextWrite;               /**< See enum OnNextWrite. */
+    
+    //---------------------------------------------------------------------
+    // Case 1, 2, and 3
+    //---------------------------------------------------------------------        
+    char   mMeshName[MED_TAILLE_NOM + 1];        /**< Name of the mesh. */
+    int    mId;                                  /**< Id of this part in [1..n]. */
+    char   mPartName[MED_TAILLE_NOM + 1];        /**< Name of this part. */
+    char   mPath[256];                           /**< Path of the MED file. */
+    char   mMEDFileName[256];                    /**< Name of the MED file which contain this part. */
+    
+    //---------------------------------------------------------------------
+    // Case 2: mesh of the related sequential MED file (can be NULL if not loaded)
+    //---------------------------------------------------------------------
+    Mesh*  mMesh;                                /**< Mesh associated with this part; can be NULL. */
+    
+    //---------------------------------------------------------------------
+    // Case 3 only: temporary result of MEDSPLITTER
+    //---------------------------------------------------------------------
+    int                          mSplit;         /**< For MEDSPLITTER: number of parts. Temporary. */
+    MEDSPLITTER::MESHCollection* mCollection;    /**< New data after splitting. */
+    MEDSPLITTER::MESHCollection* mOldCollection; /**< Data before splitting (we need them when we want to write new data on disk. */
+    
+private:
+
+    // do not allow copy constructor
+    MeshDisPart(const MeshDisPart&);
+    
+    // do not allow copy
+    MeshDisPart& operator=(const MeshDisPart&);
+    
+    // do not allow operator ==
+    bool operator==(const MeshDisPart&); 
+    
+    //---------------------------------------------------------------------
+    // Friends
+    //---------------------------------------------------------------------    
+    friend class MeshDis;
+    
+}; // class MeshDisPart
+
+
+//*****************************************************************************
+// Class MeshDis
+//*****************************************************************************
+
+class MeshDis
+{
+public:
+
+    /**
+     * Builds an empty mesh (default constructor).
+     */
+    MeshDis();
+     
+    /**
+     * Destructor. Removes everything.
+     */
+    ~MeshDis();
+     
+    /**
+     * Resets this object in its state by default (empty). Clean memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+
+    /**
+     * Sets the name of the associated sequential MED file (=original MED file).
+     * \param  pFilename name of the associated sequential MED file.
+     */
+    void setSequentialMEDFilename(const char* pFilename);
+    
+    /**
+     * Returns the name of this sequential MED file (=original MED file).
+     * \return the name of this sequential MED file (=original MED file).
+     */
+    const char* getSequentialMEDFilename() const { return mSequentialMEDFilename; }
+       
+    /**
+     * Returns the name of this distributed MED file (=name of the master file).
+     * \return the name of this distributed MED file (=name of the master file).
+     */
+    const char* getDistributedMEDFilename() const { return mDistributedMEDFilename; }
+     
+    /**
+     * Adds a new part to this distributed mesh.
+     * Used by the split process (extract groups).
+     * \param  pToDoOnNextWrite
+     * \param  pMeshName
+     * \param  pId
+     * \param  pPartName
+     * \param  pPath
+     * \param  pMEDFileName
+     * \param  pMesh can be NULL.
+     */
+    void addMesh(
+        MeshDisPart::OnNextWrite pToDoOnNextWrite,
+        const char* pMeshName, 
+        int         pId,
+        const char* pPartName,
+        const char* pPath,
+        const char* pMEDFileName,
+        Mesh*       pMesh);
+    
+    /**
+     * Inserts a new part to this distributed mesh.
+     * Used by the decimation process.
+     * \param  pToDoOnNextWrite
+     * \param  pMeshName
+     * \param  pId
+     * \param  pPartName
+     * \param  pPath
+     * \param  pMEDFileName
+     * \param  pMesh can be NULL.
+     * \param  pPosition insert after this position. Start at 1.
+     */
+    void insertMesh(
+        MeshDisPart::OnNextWrite pToDoOnNextWrite,
+        const char* pMeshName, 
+        int         pId,
+        const char* pPartName,
+        const char* pPath,
+        const char* pMEDFileName,
+        Mesh*       pMesh,
+        int         pPosition);
+    
+    /**
+     * Removes all the part beginning by pPrefixPartName from this distributed mesh.
+     * Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".
+     * \param  pPrefixPartName name of the part.
+     */
+    void removeParts(const char* pPrefixPartName);
+    
+    /**
+     * Returns the current number of parts in this distributed mesh.
+     * \return the current number of parts in this distributed mesh.
+     */
+    int getNumParts() const { return mParts.size(); }
+    
+    /**
+     * Returns the nth part of this distributed mesh.
+     * \param  pIndex index of the part (in 0..getNumParts()-1).
+     * \return the nth part of this distributed mesh.
+     */
+    MeshDisPart* getPart(int pIndex) const { return mParts[pIndex]; }
+    
+    /**
+     * Returns the list of meshes contained in this distributed MED file.
+     * \return the list of meshes contained in this distributed MED file.
+     */
+    std::vector<std::string> getMeshes() const; 
+    
+    /**
+     * Returns the list of fields contained in this distributed MED file.
+     * \return the list of fields contained in this distributed MED file.
+     */
+    std::vector<std::string> getFields() const; 
+    
+    /**
+     * Returns the number of iteration for a given field.
+     * \param  pFieldName field name.
+     * \return the number of iteration for a given field.
+     */
+    int getTimeStamps(const char* pFieldName) const; 
+    
+    /**
+     * Returns all information about a part.
+     * \param  pPartName name of the part.
+     * \return all information about a part.
+     */
+    std::string getPartInfo(const char* pPartName);
+     
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Finds a part of this distributed mesh by its name.
+     * Returns NULL if the part does not exist.
+     * \param  pPartName part to be found; must not be NULL.
+     * \return a pointer towards the part if it exists, NULL otherwise.
+     * \throw  NullArgumentException if pPartName is NULL.
+     */
+    MeshDisPart* findPart(const char* pPartName);
+    
+    /**
+     * Updates this distributed mesh by splitting one of its part.
+     * This splitting method leans on medsplitter, by V. Bergeaud (CEA).
+     * \param  pPartName     name of the part to be splitted.
+     * \param  pNbParts      number of sub-parts.
+     * \param  pPartitionner MULTIPR_METIS or MULTIPR_SCOTCH.
+     * \throw  RuntimeException if any error occurs.
+     */
+    void splitPart(const char* pPartName, int pNbParts, int pPartitionner);
+    
+    /**
+     * Creates 3 resolution (CURRENT = FULL, MEDIUM and LOW) of a part of this distributed mesh.
+     * Names of new meshes are <original_name>_MED and <original_name>_LOW.
+     * \param  pPartName
+     * \param  pFielName
+     * \param  pFieldIt
+     * \param  pFilterName
+     * \param  pTMed        threshold used to generate MEDIUM resolution.
+     * \param  pTLow        threshold used to generate LOW resolution (must be >= pTMed).
+     * \param  pRadius
+     * \param  pBoxing number of cells along each axis; e.g. if 100 then grid will have 100*100*100 = 10**6 cells; 100 by default.
+     * \throw  RuntimeException if any error occurs.
+     */
+    void decimatePart(
+        const char* pPartName, 
+        const char* pFieldName,
+        med_int     pFieldIt,
+        const char* pFilterName,
+        med_float   pTMed, 
+        med_float   pTLow,
+        med_float   pRadius,
+        int         pBoxing = 100);
+        
+    /**
+     * Returns useful information to configure decimation parameters.
+     * Depends on part, field and filter: generic operation.
+     * \param  pPartName     name of the part.
+     * \param  pFieldName    name of the field used for decimation.
+     * \param  pFieldIt      iteration (time step) of the field.
+     * \param  pFilterName   name of the filter to be used.
+     * \param  pFilterParams params to be used with the filter (depends on filter; this string will be parsed).
+     * \return 
+     */
+    std::string evalDecimationParams(
+        const char* pPartName, 
+        const char* pFieldName, 
+        int         pFieldIt, 
+        const char* pFilterName,
+        const char* pFilterParams);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads the master file of a distributed MED file.
+     * \param  pMEDfilename
+     * \throw  NullArgumentException if pMEDfilename is NULL.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readDistributedMED(const char* pMEDfilename);
+    
+    /**
+     * Writes this distributed MED file (including master file and sub MED files if necessary).
+     * \param  pMEDfilenamePrefix
+     * \throw  NullArgumentException if pMEDfilename is NULL.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeDistributedMED(const char* pMEDfilenamePrefix);
+    
+    /**
+     * Dumps any MeshDis to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pM  any MeshDis.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, MeshDis& pM);
+    
+private:
+
+    /**
+     * Recomputes the number of parts in this distributed mesh.
+     * This method is used by writeDistributedMED().
+     * \return the number of parts in this distributed mesh.
+     */
+    int computeNumParts();
+    
+private:
+
+    char                      mSequentialMEDFilename[256];  /**< Name of the original MED file used to build distribyuted MED. */
+    char                      mDistributedMEDFilename[256]; /**< Name of this distributed MED file (= name of the master file). */
+    std::vector<MeshDisPart*> mParts;                       /**< Table of sub-parts; a distributed mesh is composed of N sub-part, where N = mParts.size(). */
+    //MULTIPR_ProgressCallback*   mProgressCallback;
+    
+private:
+
+    // do not allow copy constructor
+    MeshDis(const MeshDis&);
+    
+    // do not allow copy
+    MeshDis& operator=(const MeshDis&);
+    
+    // do not allow operator ==
+    bool operator==(const MeshDis&); 
+    
+}; // class MeshDis
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_MESHDIS_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Nodes.cxx b/src/MULTIPR/MULTIPR_Nodes.cxx
new file mode 100755 (executable)
index 0000000..4016b51
--- /dev/null
@@ -0,0 +1,499 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Nodes.cxx
+ *
+ * \brief   see MULTIPR_Nodes.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Nodes.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Nodes implementation
+//*****************************************************************************
+
+Nodes::Nodes() 
+{
+    mId           = NULL;
+    mFamIdent     = NULL;
+    mNames        = NULL;
+    mCoo          = NULL;
+    mNamesCoo     = NULL;
+    mNamesUnitCoo = NULL;
+    
+    reset(); 
+}
+
+
+Nodes::~Nodes()  
+{ 
+    reset();  
+}
+
+
+void Nodes::reset() 
+{ 
+    mNum         = 0;
+    mDim         = 0;
+    mCoordSystem = MED_CART;
+    
+    if (mId           != NULL) { delete[] mId;           mId           = NULL; }
+    if (mFamIdent     != NULL) { delete[] mFamIdent;     mFamIdent     = NULL; }
+    if (mNames        != NULL) { delete[] mNames;        mNames        = NULL; }
+    if (mCoo          != NULL) { delete[] mCoo;          mCoo          = NULL; }
+    if (mNamesCoo     != NULL) { delete[] mNamesCoo;     mNamesCoo     = NULL; }
+    if (mNamesUnitCoo != NULL) { delete[] mNamesUnitCoo; mNamesUnitCoo = NULL; }
+    
+    mFlagPrintAll = false;
+}
+
+
+const med_float* Nodes::getCoordinates(med_int pIndexNode) const 
+{ 
+    if ((pIndexNode < 0) || (pIndexNode >= mNum)) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mCoo + pIndexNode * mDim; 
+}
+
+
+med_int Nodes::getFamIdent(med_int pIndexNode) const 
+{ 
+    if ((pIndexNode < 0) || (pIndexNode >= mNum)) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mFamIdent[pIndexNode]; 
+}
+
+
+void Nodes::getBBox(med_float pMin[3], med_float pMax[3]) const
+{
+    //---------------------------------------------------------------------
+    // Special case: no nodes => bbox = [0 ; 0] x [0 ; 0] x [0 ; 0]
+    //---------------------------------------------------------------------
+    if (mNum == 0)
+    {
+        for (int itDim = 0 ; itDim < mDim ; itDim++) 
+        { 
+            pMin[itDim] = med_float(0.0);
+            pMax[itDim] = med_float(0.0);
+        }
+        
+        return;
+    }
+    
+    //---------------------------------------------------------------------
+    // Compute axis-aligned bounding box
+    //---------------------------------------------------------------------
+    for (int itDim = 0 ; itDim < mDim ; itDim++) 
+    { 
+        pMin[itDim] = numeric_limits<med_float>::max();
+        pMax[itDim] = -pMin[itDim];
+    }
+    for (int itNode = 0 ; itNode < mNum ; itNode++)
+    {    
+        for (int itDim = 0 ; itDim < mDim ; itDim++)
+        {
+            med_float coord = mCoo[itNode * mDim + itDim];
+            if (coord < pMin[itDim]) pMin[itDim] = coord;
+            if (coord > pMax[itDim]) pMax[itDim] = coord;
+        }
+    }
+}
+
+
+set<med_int> Nodes::getSetOfFamilies() const
+{
+    set<med_int> setOfFamilies;
+    
+    // for each node, ad its family to the set
+    for (int itNode = 0 ; itNode < mNum ; itNode++)
+    {
+        setOfFamilies.insert(mFamIdent[itNode]);
+    }
+    
+    return setOfFamilies;
+}
+
+
+Nodes* Nodes::extractSubSet(const set<med_int>& pSetIndices) const
+{
+    Nodes* subset = new Nodes();
+    
+    subset->mNum         = pSetIndices.size();
+    subset->mDim         = mDim;
+    subset->mCoordSystem = mCoordSystem;
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    subset->mFamIdent     = new med_int[subset->mNum];    
+    subset->mCoo          = new med_float[subset->mDim * subset->mNum];
+    subset->mNamesCoo     = new char[subset->mDim * MED_TAILLE_PNOM + 1];
+    subset->mNamesUnitCoo = new char[subset->mDim * MED_TAILLE_PNOM + 1];
+    
+    memcpy(subset->mNamesCoo, mNamesCoo, subset->mDim * MED_TAILLE_PNOM + 1);
+    memcpy(subset->mNamesUnitCoo, mNamesUnitCoo, subset->mDim * MED_TAILLE_PNOM + 1);
+    
+    //---------------------------------------------------------------------
+    // Copy subset of familys id and coords.
+    //---------------------------------------------------------------------
+    set<med_int>::iterator itSet = pSetIndices.begin();
+    for (int i = 0 ; i < subset->mNum; i++)
+    {
+        
+        med_int srcIndex = (*itSet) - 1; // MED index start at 1
+        subset->mFamIdent[i] = mFamIdent[srcIndex];
+        
+        med_float* srcCoo = mCoo + srcIndex * mDim;
+        med_float* destCoo = subset->mCoo + i * subset->mDim;
+        for (int itDim = 0 ; itDim < mDim ; itDim++)
+        {
+            destCoo[itDim] = srcCoo[itDim];
+        }
+        
+        itSet++;
+    }
+    
+    //---------------------------------------------------------------------
+    // Copy subset of identifiers if necessary
+    //---------------------------------------------------------------------
+    if (isIdentifiers())  
+    { 
+        itSet = pSetIndices.begin();
+        subset->mId = new med_int[subset->mNum]; 
+        for (int i = 0 ; i < subset->mNum; i++)
+        {
+            med_int srcIndex = (*itSet) - 1; // MED index start at 1
+            subset->mId[i] = mId[srcIndex];
+            
+            itSet++;
+        }
+    }
+    
+    //---------------------------------------------------------------------
+    // Copy subset of names if necessary
+    //---------------------------------------------------------------------
+    if (isNames())       
+    { 
+        subset->mNames = new char[MED_TAILLE_PNOM * subset->mNum + 1]; 
+        char* destPtr = subset->mNames;
+        itSet = pSetIndices.begin();
+        for (int i = 0 ; i < subset->mNum; i++)
+        {
+            med_int srcIndex = (*itSet) - 1; // MED index start at 1
+            char* srcPtr = mNames + srcIndex * MED_TAILLE_PNOM;
+            memcpy(destPtr, srcPtr, MED_TAILLE_PNOM);
+            destPtr += MED_TAILLE_PNOM;
+            
+            itSet++;
+        }
+        subset->mNames[MED_TAILLE_PNOM * subset->mNum] = '\0';
+    }
+    
+    return subset;
+}
+
+
+Nodes* Nodes::mergePartial(Nodes* pNodes)
+{
+    Nodes* nodes = new Nodes();
+    
+    nodes->mNum          = mNum + pNodes->mNum;
+    
+    if (mDim != pNodes->mDim) throw IllegalStateException("dimension should be the same", __FILE__, __LINE__);
+    nodes->mDim          = mDim;    
+    
+    if (mCoordSystem != pNodes->mCoordSystem) throw IllegalStateException("coord. sytstem should be the same", __FILE__, __LINE__);
+    nodes->mCoordSystem  = mCoordSystem;
+    
+    nodes->mId           = NULL; // optional: ignored
+    nodes->mNames        = NULL; // optional: ignored
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    nodes->mFamIdent      = new med_int[nodes->mNum];    
+    nodes->mCoo           = new med_float[nodes->mDim * nodes->mNum];
+    nodes->mNamesCoo      = new char[nodes->mDim * MED_TAILLE_PNOM + 1];
+    nodes->mNamesUnitCoo  = new char[nodes->mDim * MED_TAILLE_PNOM + 1];
+    
+    memcpy(nodes->mNamesCoo, mNamesCoo, nodes->mDim * MED_TAILLE_PNOM + 1);
+    memcpy(nodes->mNamesUnitCoo, mNamesUnitCoo, nodes->mDim * MED_TAILLE_PNOM + 1);
+    
+    //---------------------------------------------------------------------
+    // Copy familys id and coords.
+    //---------------------------------------------------------------------    
+    memcpy(nodes->mFamIdent, mFamIdent, mNum * sizeof(med_int));
+    memcpy(nodes->mFamIdent + mNum, pNodes->mFamIdent, pNodes->mNum * sizeof(med_int));
+    
+    memcpy(nodes->mCoo, mCoo, mNum * mDim * sizeof(med_float));
+    memcpy(nodes->mCoo + (mNum * mDim), pNodes->mCoo, pNodes->mNum * pNodes->mDim * sizeof(med_float));
+        
+    return nodes;
+}
+
+
+Nodes* Nodes::mergePartial(vector<Nodes*> pNodes)
+{
+    if (pNodes.size() == 0) throw IllegalArgumentException("pNodes should contain at least 1 element", __FILE__, __LINE__);
+    
+    Nodes* nodes = new Nodes();
+    
+    // count total number of nodes and check if all set of nodes are compatible
+    nodes->mNum = mNum;
+    for (unsigned i = 0 ; i < pNodes.size() ; i++) 
+    {
+        nodes->mNum += pNodes[i]->mNum;
+        
+        if (mDim != pNodes[i]->mDim) throw IllegalStateException("dimension should be the same", __FILE__, __LINE__);
+        if (mCoordSystem != pNodes[i]->mCoordSystem) throw IllegalStateException("coord. sytstem should be the same", __FILE__, __LINE__);
+    }
+    
+    nodes->mDim = mDim;
+    nodes->mCoordSystem  = mCoordSystem;
+    
+    nodes->mId    = NULL; // optional: ignored
+    nodes->mNames = NULL; // optional: ignored
+    
+    //---------------------------------------------------------------------
+    // Allocate arrays
+    //---------------------------------------------------------------------
+    nodes->mFamIdent      = new med_int[nodes->mNum];    
+    nodes->mCoo           = new med_float[nodes->mDim * nodes->mNum];
+    nodes->mNamesCoo      = new char[nodes->mDim * MED_TAILLE_PNOM + 1];
+    nodes->mNamesUnitCoo  = new char[nodes->mDim * MED_TAILLE_PNOM + 1];
+    
+    memcpy(nodes->mNamesCoo, mNamesCoo, nodes->mDim * MED_TAILLE_PNOM + 1);
+    memcpy(nodes->mNamesUnitCoo, mNamesUnitCoo, nodes->mDim * MED_TAILLE_PNOM + 1);
+    
+    //---------------------------------------------------------------------
+    // Copy familys id and coords.
+    //---------------------------------------------------------------------    
+    memcpy(nodes->mFamIdent, mFamIdent, mNum * sizeof(med_int));
+    memcpy(nodes->mCoo, mCoo, mNum * mDim * sizeof(med_float));
+    
+    int offsetFamIdent = mNum;
+    int offsetCoo      = mNum;
+    for (unsigned i = 0 ; i < pNodes.size() ; i++)
+    {
+        memcpy(nodes->mFamIdent + offsetFamIdent, pNodes[i]->mFamIdent, pNodes[i]->mNum * sizeof(med_int));   
+        memcpy(nodes->mCoo + (offsetCoo * mDim), pNodes[i]->mCoo, pNodes[i]->mNum * mDim * sizeof(med_float));
+        
+        offsetFamIdent += pNodes[i]->mNum;
+        offsetCoo      += pNodes[i]->mNum;
+    }
+
+    return nodes;
+}
+
+
+void Nodes::readMED(med_idt pMEDfile, char* pMeshName, med_int pDim)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pDim != 3) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    
+    mDim = pDim;
+    mNum = MEDnEntMaa(
+        pMEDfile, 
+        pMeshName, 
+        MED_COOR, 
+        MED_NOEUD, 
+        med_geometrie_element(0), 
+        med_connectivite(0));
+    
+    if (mNum < 0) throw IOException("", __FILE__, __LINE__);
+    
+    if (mNum == 0)
+    {
+        // empty mesh        
+        return;
+    }
+    
+    mId           = new med_int[mNum];
+    mFamIdent     = new med_int[mNum];    
+    mNames        = new char[MED_TAILLE_PNOM * mNum + 1];
+    mCoo          = new med_float[mDim * mNum];
+    mNamesCoo     = new char[mDim * MED_TAILLE_PNOM + 1];
+    mNamesUnitCoo = new char[mDim * MED_TAILLE_PNOM + 1];
+    
+    mNames[0] = '\0';
+    mNamesCoo[0] = '\0';
+    mNamesUnitCoo[0] = '\0';
+    
+    med_booleen isIdentifiers;
+    med_booleen isNames;
+    
+    med_err ret = MEDnoeudsLire(
+        pMEDfile, 
+        pMeshName, 
+        mDim,
+        mCoo, 
+        MED_FULL_INTERLACE,
+        &mCoordSystem, 
+        mNamesCoo, 
+        mNamesUnitCoo,
+        mNames, 
+        &isNames, 
+        mId, 
+        &isIdentifiers,
+        mFamIdent,    
+        mNum);
+        
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    
+    // check if coordinates system is CARTESIAN
+    if (mCoordSystem != MED_CART) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    if (!isNames)
+    {
+        delete[] mNames;
+        mNames = NULL;
+    }
+    
+    if (!isIdentifiers)
+    {
+        delete[] mId;
+        mId = NULL;
+    }
+}
+
+
+void Nodes::writeMED(med_idt pMEDfile, char* pMeshName) const
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pMeshName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (strlen(pMeshName) > MED_TAILLE_NOM) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if ((mDim < 1) || (mDim > 3)) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mFamIdent == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mCoo == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mNamesCoo == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mNamesUnitCoo == NULL) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    // special case: if no nodes => do nothing
+    if (mNum == 0) return;
+    
+    med_err ret = MEDnoeudsEcr(
+        pMEDfile,
+        pMeshName,
+        mDim,
+        mCoo,
+        MED_FULL_INTERLACE,
+        mCoordSystem,
+        mNamesCoo,
+        mNamesUnitCoo,
+        mNames,
+        isNames()?MED_VRAI:MED_FAUX,
+        mId,
+        isIdentifiers()?MED_VRAI:MED_FAUX,
+        mFamIdent,
+        mNum);
+    
+    if (ret != 0) throw IOException("i/o error while writing nodes", __FILE__, __LINE__);
+    
+}
+
+
+ostream& operator<<(ostream& pOs, Nodes& pN)
+{
+    char strCoordSystem[16];
+    switch (pN.mCoordSystem) 
+    {
+        case MED_CART:  strcpy(strCoordSystem, "CARTESIAN"); break;
+        case MED_CYL:   strcpy(strCoordSystem, "CYLINDRIC"); break;
+        case MED_SPHER: strcpy(strCoordSystem, "SPHERIC"); break;
+        default:        strcpy(strCoordSystem, "UNKNOWN"); break;
+    }
+    
+    pOs << "Nodes: " << endl;
+    pOs << "    #number      =" << pN.mNum << endl;
+    pOs << "    Dimension    =" << pN.mDim << endl;
+    pOs << "    Coord. system=" << strCoordSystem << endl;
+    pOs << "    Has names    ?" << (pN.isNames()?"yes":"no") << endl;
+    pOs << "    Has id       ?" << (pN.isIdentifiers()?"yes":"no") << endl;
+    if (pN.mNamesCoo != NULL) pOs << "    Axis names   =" << "|" << pN.mNamesCoo << "|" << endl;
+    if (pN.mNamesUnitCoo != NULL) pOs << "    Unit axis    =" << "|" << pN.mNamesUnitCoo << "|" << endl;
+    
+    {
+        set<med_int> setOfFam = pN.getSetOfFamilies();
+        if (setOfFam.size() == 0)
+        {
+            pOs << "    Families: #fam=0" << endl;
+        }
+        else
+        {
+            set<med_int>::iterator itFam = setOfFam.end();
+            itFam--;
+            pOs << "    Families: #fam=" << setOfFam.size() << " id_min=" << (*(setOfFam.begin())) << " id_max=" << (*itFam) << endl;
+        }
+        
+        if (pN.mFlagPrintAll)
+        {
+            for (int itNode = 0 ; itNode < pN.mNum; itNode++)
+            {
+                pOs << "        Node " << (itNode+1) << ": " << pN.mFamIdent[itNode] << endl;
+            }
+        }
+    }
+    
+    med_float bboxMin[3], bboxMax[3];
+    pN.getBBox(bboxMin, bboxMax);
+    pOs << "    BBox: [" << bboxMin[0] << " ; " << bboxMax[0] << "] x [" << bboxMin[1] << " ; " << bboxMax[1] << "] x [" << bboxMin[2] << " ; " << bboxMax[2] << "]" << endl; 
+    
+    if (pN.mFlagPrintAll)
+    {
+        pOs << "    Coordinates: " << endl;
+        for (int itNode = 0 ; itNode < pN.mNum ; itNode++)
+        {
+            pOs << "        Node " << (itNode+1) << ": ";
+            for (int itDim = 0 ; itDim < pN.mDim ; itDim++)
+            {
+                pOs << pN.mCoo[itNode * pN.mDim + itDim] << " ";
+            }
+            pOs << endl;
+        }
+        
+        if (pN.isIdentifiers())
+        {
+            pOs << "    Num: " << endl;
+            for (int itNode = 0 ; itNode < pN.mNum; itNode++)
+            {
+                pOs << "        Node " << (itNode+1) << ": " << pN.mId[itNode] << endl;
+            }
+        }
+        
+        if (pN.isNames())
+        {
+            pN.mNames[MED_TAILLE_PNOM * pN.mNum] = '\0';
+            pOs << "    Names: |" << pN.mNames << "|" << endl;
+        }
+        
+    }
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Nodes.hxx b/src/MULTIPR/MULTIPR_Nodes.hxx
new file mode 100755 (executable)
index 0000000..a33ffd4
--- /dev/null
@@ -0,0 +1,201 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Nodes.hxx
+ *
+ * \brief   Class Nodes = table of nodes.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_NODES_HXX
+#define MULTIPR_NODES_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <iostream>
+#include <set>
+#include <vector>
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Nodes
+//*****************************************************************************
+
+class Nodes
+{
+public:
+
+    /** 
+     * Builds an empty set of nodes (default constructor).
+     */
+    Nodes();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Nodes();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns true if nodes have a name.
+     * \return true if nodes have a name.
+     */
+    bool isNames() const { return (mNames != NULL); }
+    
+    /**
+     * Returns true if elements have an identifier (= a number).
+     * \return true if elements have an identifier (= a number).
+     */
+    bool isIdentifiers() const { return (mId != NULL); }
+      
+    /**
+     * Returns the coordinates of one node according to its index.
+     * \param  pIndexNode index of node in [0..NUMBER_OF_NODES-1].
+     * \return the coordinates of one node.
+     * \throw  IndexOutOfBoundsException if pIndexNode is invalid.
+     */
+    const med_float* getCoordinates(med_int pIndexNode) const;
+    
+    /**
+     * Returns the family of one node.
+     * \param  pIndexNode index of node in [0..NUMBER_OF_NODES-1].
+     * \return the family of the given node.
+     * \throw  IndexOutOfBoundsException if pIndexNode is invalid.
+     */
+    med_int getFamIdent(med_int pIndexNode) const;
+    
+    /**
+     * Returns the number of nodes.
+     * \return the number of nodes.
+     */
+    int getNumberOfNodes() const { return mNum; }
+    
+    //---------------------------------------------------------------------
+    // Algorithms
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns the axis-aligned bounding box (CARTESIAN coordinates system) of this set of nodes.
+     * \param  pMin (out) coordinates of the min-corner of the bbox.
+     * \param  pMin (out) coordinates of the max-corner of the bbox.
+     */
+    void getBBox(med_float pMin[3], med_float pMax[3]) const;
+
+    /**
+     * Returns the set of families referenced by this set of nodes.
+     * Each family is described by its identifier.
+     * \return the set of families referenced by this set of nodes.
+     */
+    std::set<med_int> getSetOfFamilies() const;
+    
+    /**
+     * Constructor. Creates a subset of this set of nodes from a set of indices.
+     * \param  pSetOfIndices set of indices; each index must be >= 1.
+     * \return a subset of this set of nodes from a set of indices.
+     */
+    Nodes* extractSubSet(const std::set<med_int>& pSetIndices) const;
+    
+    /**
+     * Builds a new set of nodes by merging two set of nodes (this and pNodes) if possible.
+     * Merge is partial because Id and Names are not take into account.
+     * \param  pNodes any set of nodes to be merged with this.
+     * \return a new set of nodes.
+     * \throw  IllegalStateException if the two sets of nodes are incompatible.
+     */
+    Nodes* mergePartial(Nodes* pNodes);
+    Nodes* mergePartial(std::vector<Nodes*> pNodes);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+
+    /**
+     * Reads all nodes of a mesh from a MED file.
+     * \param  pMEDfile   any valid MED file opened for reading.
+     * \param  pMeshName  name of the mesh to be read.
+     * \param  pDim       dimension of the mesh.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void readMED(med_idt pMEDfile, char* pMeshName, med_int pDim);
+    
+    /**
+     * Writes this set of nodes to a MED file. Nodes are associated with the given mesh.
+     * WARNING: mesh must have been created and added to the MED file before.
+     * \param  pMEDfile  any valid MED file opened for writing.
+     * \param  pMeshName any mesh of the MED file. 
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile, char* pMeshName) const;
+     
+    /**
+     * Sets the flag which control the stream operator <<.
+     * \param  pFlag new flag value.
+     */
+    void setPrintAll(bool pFlag) { mFlagPrintAll = pFlag; } 
+     
+    /**
+     * Dumps any Nodes to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pN  any Nodes.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Nodes& pN);
+    
+private:
+    
+    med_int     mNum;            /**< Number of nodes in this set. */
+    med_int     mDim;            /**< Dimension of nodes. */
+    med_repere  mCoordSystem;    /**< Type of coordinates system; should be MED_CART for cartesian. */
+    
+    med_int*    mId;             /**< Optional; for each node, its identifier; NULL if undefined. */
+    med_int*    mFamIdent;       /**< For each node, its identifier of its family. */
+    char*       mNames;          /**< Optional; for each node, its name; NULL if undefined. */
+    med_float*  mCoo;            /**< For each node, coordinates of node; array is interlaced: x1 y1 z1 x2 y2 z2 ...*/
+    char*       mNamesCoo;       /**< Names of axis of the coordinates system. */     
+    char*       mNamesUnitCoo;   /**< Unit of axis of the coordinates system.  */
+    
+    bool        mFlagPrintAll;   /** Flag to control the behaviour of the stream operator <<. */
+    
+private:
+
+    // do not allow copy constructor
+    Nodes(const Nodes&);
+    
+    // do not allow copy
+    Nodes& operator=(const Nodes&);
+    
+    // do not allow operator ==
+    bool operator==(const Nodes&); 
+    
+}; // class Nodes
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_NODES_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Obj.cxx b/src/MULTIPR/MULTIPR_Obj.cxx
new file mode 100755 (executable)
index 0000000..6471f92
--- /dev/null
@@ -0,0 +1,477 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Obj.cxx
+ *
+ * \brief   see MULTIPR_Obj.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Obj.hxx"
+#include "MULTIPR_Exceptions.hxx"
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_MeshDis.hxx"
+#include "MULTIPR_Utils.hxx"
+#include "MED_Factory.hxx"
+
+#include <stdio.h>
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Obj implementation
+//*****************************************************************************
+
+Obj::Obj() 
+{
+    mMeshDis = NULL;
+    
+    reset(); 
+}
+
+
+Obj::~Obj()  
+{ 
+    reset();  
+}
+
+
+void Obj::reset() 
+{ 
+    mMEDfilename     = "";
+    mMeshName        = "";
+    mState           = MULTIPR_OBJ_STATE_RESET;
+    
+    if (mMeshDis != NULL) { delete mMeshDis; mMeshDis = NULL; }
+}
+
+
+void Obj::create(const char* pMEDfilename)
+{
+    if (pMEDfilename == NULL) throw multipr::NullArgumentException("file name must not be NULL", __FILE__, __LINE__);
+    
+    // reset everything before associating a new MED file to this object
+    reset();
+    
+    mMEDfilename = pMEDfilename;
+    mState = MULTIPR_OBJ_STATE_ERROR;
+    
+    // check if file exists
+    FILE* f = fopen(pMEDfilename, "rb");
+    if (f == 0) 
+    {
+        // file does not exist
+        mState = MULTIPR_OBJ_STATE_ERROR;
+        throw FileNotFoundException("file not found", __FILE__, __LINE__);
+    }
+    fclose(f);
+
+    // test whether it is a sequential MED file or a distributed MED file
+    MED::EVersion aVersion = MED::GetVersionId(pMEDfilename, true);
+    if (aVersion != MED::eVUnknown)
+    {
+        mState = MULTIPR_OBJ_STATE_SEQ_INIT;
+        cout << "Sequential MED file " << pMEDfilename << " has been successfuly opened" << endl;
+    }
+    else
+    {
+        // CASE 2: distributed MED file?
+        try
+        {
+            mMeshDis = new multipr::MeshDis();
+            mMeshDis->readDistributedMED(pMEDfilename);
+        
+            mState = MULTIPR_OBJ_STATE_DIS;
+            cout << "Distributed MED file " << pMEDfilename << " has been successfuly opened" << endl;
+        }
+        catch (...)
+        {
+            // neither a sequential MED file, nor a distributed MED file => error
+            mState = MULTIPR_OBJ_STATE_ERROR;
+            throw IOException("file is nor a sequential MED file, neither a distributed MED file", __FILE__, __LINE__);
+        }
+    }
+}
+
+
+std::string Obj::getSequentialMEDFilename() const
+{
+    // partitionneGrain() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS_MEM) &&
+        (mState != MULTIPR_OBJ_STATE_DIS)) throw IllegalStateException("unexpected operation", __FILE__, __LINE__);
+    
+        return mMeshDis->getSequentialMEDFilename();
+}
+
+
+void Obj::setMesh(const char* pMeshName)
+{
+    // setMesh() is only available for sequential MED file (not distributed MED file)
+    if ((mState != MULTIPR_OBJ_STATE_SEQ_INIT) &&
+        (mState != MULTIPR_OBJ_STATE_SEQ)) throw IllegalStateException("expected a sequential MED file", __FILE__, __LINE__);
+    
+    mMeshName = pMeshName;
+    
+    // change state to MULTIPR_OBJ_STATE_SEQ (in case of state=MULTIPR_OBJ_STATE_SEQ_INIT)
+    mState = MULTIPR_OBJ_STATE_SEQ;
+}
+
+
+vector<string> Obj::getMeshes() const
+{
+    // test whether it is a sequential MED file or a distributed MED file
+    if ((mState == MULTIPR_OBJ_STATE_SEQ_INIT) ||
+        (mState == MULTIPR_OBJ_STATE_SEQ))
+    {
+        // CASE 1: sequential MED file
+        return multipr::getListMeshes(mMEDfilename.c_str());
+    }
+    else
+    {
+        // CASE 2: distributed MED file
+        if (mMeshDis == NULL)
+        {
+            throw IllegalStateException("distributed MED file should not be NULL", __FILE__, __LINE__);
+        }
+        
+        return mMeshDis->getMeshes();
+    }
+}
+
+
+vector<string> Obj::getFields() const
+{
+    // test whether it is a sequential MED file or a distributed MED file
+    if ((mState == MULTIPR_OBJ_STATE_SEQ_INIT) ||
+        (mState == MULTIPR_OBJ_STATE_SEQ)) 
+    {
+        // CASE 1: sequential MED file
+        vector<pair<string, int> > tmp = multipr::getListScalarFields(mMEDfilename.c_str());
+        
+        vector<string> res;
+        for (unsigned i = 0 ; i < tmp.size() ; i++)
+        {
+            res.push_back(tmp[i].first);
+        }
+        
+        return res;
+    }
+    else
+    {
+        // CASE 2: distributed MED file
+        if (mMeshDis == NULL) throw IllegalStateException("distributed MED file should not be NULL", __FILE__, __LINE__);
+        
+        return mMeshDis->getFields();
+    }
+}
+
+
+int Obj::getTimeStamps(const char* pFieldName) const
+{
+    // test whether it is a sequential MED file or a distributed MED file
+    if ((mState == MULTIPR_OBJ_STATE_SEQ_INIT) ||
+        (mState == MULTIPR_OBJ_STATE_SEQ)) 
+    {
+        // CASE 1: sequential MED file
+        vector<pair<string, int> > tmp = multipr::getListScalarFields(mMEDfilename.c_str());
+    
+        for (unsigned i = 0 ; i < tmp.size() ; i++)
+        {
+            if (strcmp(tmp[i].first.c_str(), pFieldName) == 0)
+            {
+                return tmp[i].second;
+            }
+        }
+        
+        // pFieldName not found in the list of fields
+        return 0;
+    }
+    else
+    {
+        // CASE 2: distributed MED file
+        if (mMeshDis == NULL) throw IllegalStateException("distributed MED file should not be NULL", __FILE__, __LINE__);
+        
+        return mMeshDis->getTimeStamps(pFieldName);
+    }
+}
+
+
+vector<string> Obj::getParts() const
+{
+    // getParts() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS) &&
+        (mState != MULTIPR_OBJ_STATE_DIS_MEM)) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+    
+    return getListParts();
+}
+
+
+string Obj::getPartInfo(const char* pPartName) const
+{
+    // getParts() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS) &&
+        (mState != MULTIPR_OBJ_STATE_DIS_MEM)) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+    
+    if (mMeshDis == NULL) throw IllegalStateException("distributed MED file should not be NULL", __FILE__, __LINE__);
+    
+    return mMeshDis->getPartInfo(pPartName);
+    
+}
+
+
+void Obj::removeParts(const char* pPrefixPartName)
+{
+    // removePart() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS) &&
+        (mState != MULTIPR_OBJ_STATE_DIS_MEM)) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+        
+    if (mMeshDis == NULL) throw IllegalStateException("distributed MED file should not be NULL", __FILE__, __LINE__);
+    
+    mMeshDis->removeParts(pPrefixPartName);
+    mState = MULTIPR_OBJ_STATE_DIS_MEM;
+}
+
+
+vector<string> Obj::partitionneDomaine()
+{
+    if (mState == MULTIPR_OBJ_STATE_SEQ_INIT) throw IllegalStateException("use setMesh() before", __FILE__, __LINE__);
+    
+    // partitionneDomaine() is only available for sequential MED file (not distributed MED file)
+    if (mState != MULTIPR_OBJ_STATE_SEQ) throw IllegalStateException("unexpected operation", __FILE__, __LINE__);
+    
+    //-------------------------------------------------------------
+    // Read the sequential mesh
+    //-------------------------------------------------------------
+    cout << "Read sequential MED file: " << mMEDfilename << ": please wait... " << endl;
+    
+    Mesh mesh;
+    mesh.readSequentialMED(mMEDfilename.c_str(), mMeshName.c_str());
+    cout << mesh << endl;
+    
+    //-------------------------------------------------------------
+    // Build distributed mesh from groups
+    //-------------------------------------------------------------
+    cout << "Build distributed mesh: please wait... " << endl;
+    try
+    {
+        mMeshDis = mesh.splitGroupsOfElements();
+    }
+    catch (RuntimeException& e)
+    {
+        delete mMeshDis;
+        mMeshDis = NULL;
+        throw e;
+    }
+    
+    mState = MULTIPR_OBJ_STATE_DIS_MEM;
+    
+    return getListParts();
+}
+
+
+vector<string> Obj::partitionneGrain(
+    const char* pPartName, 
+    int         pNbParts, 
+    int         pPartitionner)
+{
+    if (mMeshDis == NULL) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+    if (pPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    if (pNbParts < 2) throw IllegalArgumentException("", __FILE__, __LINE__);
+    if ((pPartitionner != 0) && (pPartitionner != 1)) throw IllegalArgumentException("partitionner should be 0=METIS or 1=SCOTCH", __FILE__, __LINE__);
+
+    // partitionneGrain() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS_MEM) &&
+        (mState != MULTIPR_OBJ_STATE_DIS)) throw IllegalStateException("unexpected operation", __FILE__, __LINE__);
+    
+    // if distributed MED file is currently in memory, then write to disk before performing partitionneGrain()
+    // (because MEDSPLIITER starts from a file)
+    if (mState == MULTIPR_OBJ_STATE_DIS_MEM)
+    {
+        //-----------------------------------------------------
+        // Write distributed mesh
+        //-----------------------------------------------------
+        cout << "Write distributed mesh: please wait... " << endl;
+        string strPrefix = removeExtension(mMEDfilename.c_str(), ".med");
+        mMeshDis->writeDistributedMED(strPrefix.c_str());
+        
+        mMEDfilename = mMeshDis->getDistributedMEDFilename();
+        
+        delete mMeshDis;
+        
+        //---------------------------------------------------------------------
+        // Read the distributed mesh
+        //---------------------------------------------------------------------    
+        int ret = MEDformatConforme(mMEDfilename.c_str());
+        if (ret == 0) throw IOException("waiting for a distributed MED file (not a sequential one)", __FILE__, __LINE__);
+    
+        mMeshDis = new MeshDis();
+        mMeshDis->readDistributedMED(mMEDfilename.c_str());
+        
+        mState = MULTIPR_OBJ_STATE_DIS;
+    }
+
+    //---------------------------------------------------------------------
+    // Split the given part (pGroupName)
+    //---------------------------------------------------------------------
+    mMeshDis->splitPart(pPartName, pNbParts, pPartitionner);
+    cout << mMeshDis << endl;
+
+    //---------------------------------------------------------------------
+    // Write new distributed mesh
+    //---------------------------------------------------------------------
+    string strPrefix = multipr::removeExtension(mMEDfilename.c_str(), ".med");
+    mMeshDis->writeDistributedMED(strPrefix.c_str());
+    
+    //---------------------------------------------------------------------
+    // Read the distributed mesh
+    //---------------------------------------------------------------------
+    delete mMeshDis;
+    mMeshDis = new MeshDis();
+    //cout << "read dis MED file: filename=" << mMEDfilename << endl;
+    mMeshDis->readDistributedMED(mMEDfilename.c_str());
+    
+    return getListParts();
+}
+
+
+vector<string> Obj::decimePartition(
+    const char* pPartName,
+    const char* pFieldName,
+    int         pFieldIt,
+    const char* pFilterName,
+    double      pTmed,
+    double      pTlow,
+    double      pRadius,
+    int         pBoxing)
+{
+    
+    // decimePartition() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS_MEM) &&
+        (mState != MULTIPR_OBJ_STATE_DIS)) throw IllegalStateException("unexpected operation", __FILE__, __LINE__);
+        
+    if (mMeshDis == NULL) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Decimate
+    //---------------------------------------------------------------------
+    mMeshDis->decimatePart(
+        pPartName, 
+        pFieldName,
+        pFieldIt,
+        pFilterName,
+        pTmed,
+        pTlow,
+        pRadius,
+        pBoxing);
+        
+    mState = MULTIPR_OBJ_STATE_DIS_MEM;
+    
+    return getListParts();
+}
+
+
+string Obj::evalDecimationParams(
+    const char* pPartName, 
+    const char* pFieldName, 
+    int         pFieldIt, 
+    const char* pFilterName,
+    const char* pFilterParams)
+{
+    // decimePartition() is only available for distributed MED file (not sequential MED file)
+    if ((mState != MULTIPR_OBJ_STATE_DIS_MEM) &&
+        (mState != MULTIPR_OBJ_STATE_DIS)) throw IllegalStateException("unexpected operation", __FILE__, __LINE__);
+        
+    if (mMeshDis == NULL) throw IllegalStateException("expected a distributed MED file", __FILE__, __LINE__);
+    
+    string res = mMeshDis->evalDecimationParams(
+        pPartName,
+        pFieldName,
+        pFieldIt,
+        pFilterName,
+        pFilterParams);
+    
+    return res;
+}
+
+
+vector<string> Obj::getListParts() const
+{
+    if (mMeshDis == NULL) throw IllegalStateException("not a distributed mesh", __FILE__, __LINE__);
+    
+    vector<string> names;
+    
+    int numParts = mMeshDis->getNumParts();
+    for (int i = 0 ; i < numParts ; i++)
+    {
+        names.push_back( mMeshDis->getPart(i)->getPartName() );
+    }
+    
+    return names;
+}
+
+
+void Obj::save(const char* pPath)
+{
+    static string prevPath = "";
+    
+    // only save file if it is a distributed MED file currently in memory or path has changed
+    if ((mState == MULTIPR_OBJ_STATE_DIS_MEM) || (strcmp(pPath, prevPath.c_str()) != 0))
+    {
+        prevPath = pPath;
+        
+        //-------------------------------------------------------------
+        // Write new distributed mesh
+        //-------------------------------------------------------------
+        string filename;
+        if (strlen(pPath) == 0)
+        {
+            filename = multipr::removeExtension(mMEDfilename.c_str(), ".med");
+        }
+        else
+        {
+            filename = string(pPath) + string("/") + multipr::getFilenameWithoutPath(mMEDfilename.c_str());
+        }
+        string strPrefix = multipr::removeExtension(filename.c_str(), ".med");
+        mMeshDis->writeDistributedMED(strPrefix.c_str());
+        mMEDfilename = mMeshDis->getDistributedMEDFilename();
+        
+        cout << "Write MED master file: " << mMEDfilename << ": OK" << endl;
+        
+        //-------------------------------------------------------------
+        // Read the distributed mesh
+        //-------------------------------------------------------------
+        delete mMeshDis;
+        mMeshDis = new MeshDis();
+        mMeshDis->readDistributedMED(mMEDfilename.c_str());
+        
+        mState = MULTIPR_OBJ_STATE_DIS;
+    }
+}
+
+
+ostream& operator<<(ostream& pOs, Obj& pO)
+{
+    pOs << "Obj:" << endl;
+    pOs << "    Name:" << pO.mMEDfilename << endl;
+    
+    return pOs;
+}
+
+
+} // namespace multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Obj.hxx b/src/MULTIPR/MULTIPR_Obj.hxx
new file mode 100755 (executable)
index 0000000..0eed384
--- /dev/null
@@ -0,0 +1,288 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_GaussLoc.hxx
+ *
+ * \brief   Class MULTIPR_Obj. 
+ *          This class is used as an interface to implement MULTIPR services in the salome MODULE 
+ *          as described in the spec/design doc.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_OBJ_HXX
+#define MULTIPR_OBJ_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+
+namespace multipr
+{
+
+class MeshDis;
+
+
+//*****************************************************************************
+// Class Obj
+//*****************************************************************************
+
+enum ObjState
+{
+    MULTIPR_OBJ_STATE_ERROR,
+    MULTIPR_OBJ_STATE_RESET,
+    MULTIPR_OBJ_STATE_SEQ_INIT,
+    MULTIPR_OBJ_STATE_SEQ,
+    MULTIPR_OBJ_STATE_DIS,
+    MULTIPR_OBJ_STATE_DIS_MEM
+}; // enum ObjState
+
+
+class Obj
+{
+public:
+
+    /** 
+     * Builds an empty Gauss reference (default constructor).
+     */
+    Obj();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Obj();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    /**
+     * Associate a MED file (sequential or distributed) with this object.
+     * This method also:
+     * - reset everything before starting
+     * - determine if the given file is a sequential (SEQ) or a distributed (DIS) MED file
+     * - read the ASCII master file if it is a distributed MED file
+     * - set state
+     */
+    void create(const char* pMEDfilename);
+     
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //--------------------------------------------------------------------
+    
+    /**
+     * Returns true iff this obj represents a valid sequential MED file.
+     * \return true iff this obj represents a valid sequential MED file.
+     */
+    bool isValidSequentialMEDFile() const { return (mState == MULTIPR_OBJ_STATE_SEQ) || (mState == MULTIPR_OBJ_STATE_SEQ_INIT); }
+    
+    /**
+     * Returns true iff this obj represents a valid distributed MED file.
+     * \return true iff this obj represents a valid distributed  MED file.
+     */
+    bool isValidDistributedMEDFile() const { return (mState == MULTIPR_OBJ_STATE_DIS) || (mState == MULTIPR_OBJ_STATE_DIS_MEM); }
+     
+    /**
+     * Returns the name of the associated MED file.
+     * \return the name of the associated MED file.
+     */
+    std::string getMEDFilename() const { return mMEDfilename; }
+    
+    /**
+     * Returns the name of the associated sequential MED file.
+     * \return the name of the associated sequential MED file.
+     */
+    std::string getSequentialMEDFilename() const;
+    
+    /**
+     * Defines the mesh to be processed.
+     * \param  pMeshName name of the mesh to be partitionned.
+     */
+    void setMesh(const char* pMeshName);
+     
+    /**
+     * Returns the list of meshes contained in the sequential MED file.
+     * Assumes this object encapsulates a sequential MED file.
+     * \return the list of meshes contained in the sequential MED file.
+     */
+    std::vector<std::string> getMeshes() const;
+    
+    /**
+     * Returns the list of fields contained in the sequential MED file.
+     * Assumes this object encapsulates a sequential MED file.
+     * \return the list of fields contained in the sequential MED file.
+     */
+    std::vector<std::string> getFields() const;
+    
+    /**
+     * Returns the number of timestamps for a given field.
+     * Assumes this object encapsulates a sequential MED file.
+     * \param  pFieldName name of any field.
+     * \return the number of timestamps for a given field; 0 if field not found.
+     */
+    int getTimeStamps(const char* pFieldName) const;
+    
+    /**
+     * Returns the name of all partitions.
+     * Assumes this object encapsulates a distributed MED file.
+     * \return the name of all partitions.
+     */
+    std::vector<std::string> getParts() const;
+    
+    /**
+     * Returns all information about a part.
+     * \param  pPartName name of the part.
+     * \return all information about a part.
+     */
+    std::string getPartInfo(const char* pPartName) const;
+    
+    /**
+     * Removes all the part beginning by pPrefixPartName from the distributed MED file.
+     * Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".
+     * Assume this object encapsulates a distributed MED file.
+     * \param  pPrefixPartName name of the part.
+     */
+    void removeParts(const char* pPrefixPartName);
+    
+      
+    //---------------------------------------------------------------------
+    // Algorithms
+    //--------------------------------------------------------------------
+    
+    /**
+     * Creates a distributed MED file (v2.3) by extracting all the groups from the current mesh of the current MED sequential MED file.
+     *         Assumes:
+     *         - the file is in MED format and can be read using MED file v2.3.
+     *         - the file is sequential (not a distributed MED).
+     *         - the file only contains TETRA10 elements (dimension of space and mesh is 3).
+     *         - the file have no profil.
+     * \return the name of each part.
+     * \throw  RuntimeException if any error occurs.
+     */
+    std::vector<std::string> partitionneDomaine();
+    
+    /** 
+     * Creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
+     *         Assumes:
+     *         - the file is a distributed MED file, previously created by partitionneDomaine()
+     *           (=> each part only contain 1 mesh, TETRA10 elements only)
+     *         - nbPart > 1
+     * \param  pPartName     name of the part to be splitted.
+     * \param  pNbParts      number of parts; must be > 1.
+     * \param  pPartitionner use value 0=MULTIPR_METIS for Metis or 1=MULTIPR_SCOTCH for Scotch.
+     * \return the name of each part.
+     * \throw  RuntimeException if any error occurs.
+     */
+    std::vector<std::string> partitionneGrain(
+        const char* pPartName, 
+        int         pNbParts, 
+        int         pPartitionner=0);
+    
+    /**
+     * Creates 3 resolutions of the given part of a distributed MED file (V2.3).
+     *         Assumes:
+     *         - the file is a distributed MED file, previously created by partitionneDomaine() or partitionneGrain()
+     *           (=> each part only contain 1 mesh, TETRA10 elements only)
+     * \param  pPartName    name of the part to be decimated.
+     * \param  pFieldName   name of the field used for decimation.
+     * \param  pFieldIt     iteration (time step) of the field.
+     * \param  pFilterName  name of the filter to be used.
+     * \param  pTmed        threshold used for medium resolution.
+     * \param  pTlow        threshold used for low resolution; tmed must be less than tlow
+     * \param  pTadius      radius used to determine the neighbourhood.
+     * \param  pBoxing      number of cells along each axis; must be >= 1; e.g. if 100 then acceleration grid will have 100*100*100 = 10**6 cells.
+     * \return the name of each part.
+     * \throw  RuntimeException if any error occurs.
+     */
+    std::vector<std::string> decimePartition(
+        const char* pPartName,
+        const char* pFieldName,
+        int         pFieldIt,
+        const char* pFilterName,
+        double      pTmed,
+        double      pTlow,
+        double      pRadius,
+        int         pBoxing);
+    
+    /**
+     * Returns useful information to configure decimation parameters.
+     * Depends on part, field and filter: generic operation.
+     * \param  pPartName     name of the part.
+     * \param  pFieldName    name of the field used for decimation.
+     * \param  pFieldIt      iteration (time step) of the field.
+     * \param  pFilterName   name of the filter to be used.
+     * \param  pFilterParams params to be used with the filter (depends on filter; this string will be parsed).
+     */
+    std::string evalDecimationParams(
+        const char* pPartName, 
+        const char* pFieldName, 
+        int         pFieldIt, 
+        const char* pFilterName,
+        const char* pFilterParams);
+    
+        
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Saves the associated MED file if necessary.
+     * \param  pPath path where to save the file.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void save(const char* pPath);
+
+    /**
+     * Dumps any Obj to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pO  any Obj.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Obj& pO);
+    
+private:
+
+    /**
+     * Returns the list of parts contained in the current distributed mesh.
+     * \return the list of parts contained in the current distributed mesh.
+     * \throw  IllegalStateException if the distributed mesh does not still exist.
+     */
+    std::vector<std::string> getListParts() const;
+
+private:
+    
+    std::string  mMEDfilename;     /**< Name of the MED file: sequential or distributed. */
+    std::string  mMeshName;        /**< Mesh to be partitionned. */
+    ObjState     mState;           /**< State of this object. */
+    MeshDis*     mMeshDis;         /**< Distributed mesh. */
+    
+    
+private:
+    
+    // do not allow copy constructor
+    Obj(const Obj&);
+    
+    // do not allow copy
+    Obj& operator=(const Obj&);
+    
+    // do not allow operator ==
+    bool operator==(const Obj&); 
+    
+}; // class Obj
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_OBJ_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_PointOfField.hxx b/src/MULTIPR/MULTIPR_PointOfField.hxx
new file mode 100755 (executable)
index 0000000..bcf3406
--- /dev/null
@@ -0,0 +1,100 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_PointOfField.hxx
+ *
+ * \brief   Class PointOfField used for decimation. PointOfField = a point in a field = coordinates + value.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_POINTOFFIELD_HXX
+#define MULTIPR_POINTOFFIELD_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class PointOfField
+//*****************************************************************************
+
+class PointOfField
+{
+public:
+
+    /** 
+     * Builds an empty set of elements (default constructor).
+     */
+    PointOfField() { reset(); }
+    
+    /**
+     * Constructor.
+     * \param  pX   x-coordinate of the point.
+     * \param  pY   y-coordinate of the point.
+     * \param  pZ   z-coordinate of the point.
+     * \param  pVal value of the field at the given point.
+     */
+    PointOfField(med_float pX, med_float pY, med_float pZ, med_float pVal)
+    {
+        mXYZ[0] = pX;
+        mXYZ[1] = pY;
+        mXYZ[2] = pZ;
+        mVal    = pVal;
+    }
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~PointOfField() { reset(); }
+    
+    /**
+     * Resets this object in its state by default (empty).
+     */
+    void reset()
+    {
+        mXYZ[0] = std::numeric_limits<med_float>::quiet_NaN();
+        mXYZ[1] = std::numeric_limits<med_float>::quiet_NaN();
+        mXYZ[2] = std::numeric_limits<med_float>::quiet_NaN();
+        mVal    = std::numeric_limits<med_float>::quiet_NaN();
+    }
+
+    /**
+     * Dumps any PointOfField to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pP  any PointOfField.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, PointOfField& pP)
+    {
+        pOs << "[ " << pP.mXYZ[0] << " ; " << pP.mXYZ[1] << " ; " << pP.mXYZ[2] << "]: " << pP.mVal;
+        return pOs;
+    }
+
+public:
+
+    med_float  mXYZ[3];    /**< 3D-position. */
+    med_float  mVal;       /**< Value of the field at this point. */
+    
+}; // class PointOfField
+
+
+} // namespace multipr
+
+
+#endif // MULTIPR_FIELDPOINT_HXX 
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Profil.cxx b/src/MULTIPR/MULTIPR_Profil.cxx
new file mode 100755 (executable)
index 0000000..4a7f8b0
--- /dev/null
@@ -0,0 +1,160 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Profil.cxx
+ *
+ * \brief   see MULTIPR_Profil.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Profil.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Profil implementation
+//*****************************************************************************
+
+Profil::Profil() 
+{
+    reset(); 
+}
+
+
+Profil::~Profil()  
+{ 
+    reset();  
+}
+
+
+void Profil::reset() 
+{ 
+    mName[0] = '\0'; 
+    mTable.clear(); 
+}
+
+
+void Profil::create(const char* pName)
+{
+    if (pName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+    strcpy(mName, pName);
+}
+
+
+
+const char* Profil::getName() const
+{
+    return mName;
+}
+
+
+med_int Profil::get(med_int pIndex) const 
+{ 
+    if ((pIndex < 0) || (pIndex >= med_int(mTable.size()))) throw IndexOutOfBoundsException("", __FILE__, __LINE__);
+    
+    return mTable[pIndex]; 
+}
+
+
+void Profil::add(med_int pElt) 
+{
+    mTable.push_back(pElt); 
+}
+
+
+void Profil::readMED(med_idt pMEDfile, med_int pIndexProfil)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (pIndexProfil < 1) throw IllegalArgumentException("", __FILE__, __LINE__);
+    
+    reset();
+
+    med_int numData;
+    med_err ret = MEDprofilInfo(
+        pMEDfile, 
+        pIndexProfil, 
+        mName, 
+        &numData);
+        
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    
+    med_int* dataTmp = new med_int[numData];
+    
+    ret = MEDprofilLire(
+        pMEDfile, 
+        dataTmp, 
+        mName);
+    
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    
+    for (int itData = 0 ; itData < numData ; itData++)
+    {
+        mTable.push_back(dataTmp[itData]);
+    }
+    
+    delete[] dataTmp;
+}
+
+
+void Profil::writeMED(med_idt pMEDfile)
+{
+    if (pMEDfile == 0) throw IOException("", __FILE__, __LINE__);
+    if (strlen(mName) > MED_TAILLE_NOM) throw IllegalStateException("", __FILE__, __LINE__);
+    if (mTable.size() == 0) throw IllegalStateException("", __FILE__, __LINE__);
+    
+    med_int* dataTmp = new med_int[mTable.size()];
+    for (unsigned itData = 0 ; itData < mTable.size() ; itData++)
+    {
+        dataTmp[itData] = mTable[itData];
+    }
+    
+    med_err ret = MEDprofilEcr(
+        pMEDfile,
+        dataTmp,
+        mTable.size(),
+        mName);
+        
+    if (ret != 0) throw IOException("", __FILE__, __LINE__);
+    
+    delete[] dataTmp;
+}
+
+
+ostream& operator<<(ostream& pOs, Profil& pP)
+{
+    pOs << "Profil:" << endl;
+    pOs << "    Name=|" << pP.mName << "|" << endl;
+    pOs << "    Size=" << pP.mTable.size() << endl;
+    
+    pOs << "    Entities=[";
+    for (unsigned itElt = 0; itElt < pP.mTable.size() ; itElt++)
+    {
+        pOs << pP.mTable[itElt] << " ";
+    }
+    pOs << "]";
+    
+    return pOs;
+}
+
+
+} // namespace  multipr
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Profil.hxx b/src/MULTIPR/MULTIPR_Profil.hxx
new file mode 100755 (executable)
index 0000000..d070cd3
--- /dev/null
@@ -0,0 +1,140 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Profil.hxx
+ *
+ * \brief   Class Profil used to managed MED profil.
+ *          Profil is just a list of indices related to elements (NODES, CELLS).
+ *          !!! currently not used !!!
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_PROFIL_HXX
+#define MULTIPR_PROFIL_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <vector>
+
+
+namespace multipr
+{
+
+
+//*****************************************************************************
+// Class Profil
+//*****************************************************************************
+
+class Profil
+{
+public:
+
+    /** 
+     * Builds an empty profil (default constructor).
+     */
+    Profil();
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    ~Profil();
+    
+    /**
+     * Resets this object in its state by default (empty). Cleans memory.
+     */
+    void reset();
+    
+    /**
+     * Creates a profil from its name (reset before).
+     * \param  pName name of the profil to be created.
+     * \throw  NullArgumentException if pName is NULL.
+     */
+    void create(const char* pName);
+    
+    //---------------------------------------------------------------------
+    // Basic accessors/mutators
+    //---------------------------------------------------------------------
+    
+    /**
+     * Returns the name of this profil.
+     * \return the name of this profil.
+     */
+    const char* getName() const;
+    
+    /**
+     * Returns the nth elements of this profil.
+     * \param  pIndex index of the element to get; must be in [0..NUMBER_OF_ELEMENTS-1].
+     * \return the nth elements of this profil.
+     * \throw  IndexOutOfBoundsException if index is invalid.
+     */
+    med_int get(med_int pIndex) const;
+    
+    /**
+     * Adds a new element to this profil.
+     * \param  pElt element to be added; must be >= 1.
+     */
+    void add(med_int pElt);
+    
+    //---------------------------------------------------------------------
+    // I/O
+    //---------------------------------------------------------------------
+    
+    /**
+     * Reads a Profil from a MED file.
+     * \param  pMEDfile     any valid MED file opened for reading.
+     * \param  pIndexProfil index of the profil to be read; must be >= 1.
+     * \throw  IOException  if any i/o error occurs.
+     */
+    void readMED(med_idt pMEDfile, med_int pIndexProfil);
+    
+    /**
+     * Writes this profil to a MED file.
+     * \param  pMEDfile    any valid MED file opened for writing.
+     * \throw  IOException if any i/o error occurs.
+     */
+    void writeMED(med_idt pMEDfile);
+    
+    /**
+     * Dumps any Profil to the given output stream.
+     * \param  pOs any output stream.
+     * \param  pP  any Profil.
+     * \return the output stream pOs.
+     */
+    friend std::ostream& operator<<(std::ostream& pOs, Profil& pP);
+    
+private:
+    
+    char                  mName[MED_TAILLE_NOM + 1];  /**< Name of the profil. */
+    std::vector<med_int>  mTable;                     /**< Table of elements. */
+    
+private:
+
+    // do not allow copy constructor
+    Profil(const Profil&);
+    
+    // do not allow copy
+    Profil& operator=(const Profil&);
+    
+    // do not allow operator ==
+    bool operator==(const Profil&); 
+    
+}; // class Profil
+
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_PROFIL_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_ProgressCallback.hxx b/src/MULTIPR/MULTIPR_ProgressCallback.hxx
new file mode 100755 (executable)
index 0000000..22f6938
--- /dev/null
@@ -0,0 +1,110 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_ProgressCallback.hxx
+ *
+ * \brief   Class MULTIPR_ProgressCallback
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_PROGRESS_CALLBACK_HXX
+#define MULTIPR_PROGRESS_CALLBACK_HXX
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+
+//*****************************************************************************
+// Class MULTIPR_ProgressCallback
+// Used to provide feedback on the progress of a slow operation.
+//*****************************************************************************
+
+class MULTIPR_ProgressCallback
+{
+public:
+    
+    /**
+     * Builds a new MULTIPR_ProgressCallback (default constructor).
+     */
+    MULTIPR_ProgressCallback() { init(100); }
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~MULTIPR_ProgressCallback() { /* do nothing */ }
+    
+    /**
+     * Starts to provide feedback on the progress of a slow operation.
+     * \param  pTaskTitle name of the task to be monitored.
+     * \param  pNumSteps  number of steps in the task.
+     */
+    virtual void start(const char* pTaskTitle, int pNumSteps) = 0;
+
+    /**
+     * Moves on the current amount of progress made.
+     */
+    void moveOn() { mCurrentStep++; float percent = float(mCurrentStep)/float(mTotalSteps)*100.0f; progress(percent); }
+    
+    /**
+     * Termines to provide feedback.
+     */
+    virtual void done() = 0;
+    
+protected:
+    
+    /**
+     * Resets this progress callback.
+     * \param  pNumSteps number of steps in the task to be monitored.
+     */
+    void init(int pNumSteps) { mCurrentStep = 0; mTotalSteps = pNumSteps; }
+    
+    /**
+     * Callback. Called on each progress.
+     * \param  pPercent percent accomplished.
+     */
+    virtual void progress(float pPercent) = 0;
+
+private:
+
+    int mCurrentStep;
+    int mTotalSteps;
+    
+}; // class MULTIPR_ProgressCallback
+
+
+//*****************************************************************************
+// Class MULTIPR_EmptyMeshCallback
+// Used to provide feedback when an empty mesh is produced.
+//*****************************************************************************
+
+class MULTIPR_EmptyMeshCallback
+{
+public:
+    
+    /**
+     * Builds a new MULTIPR_EmptyMeshCallback (default constructor).
+     */
+    MULTIPR_EmptyMeshCallback() { /* do nothing */ }
+    
+    /**
+     * Destructor. Removes everything.
+     */
+    virtual ~MULTIPR_EmptyMeshCallback() { /* do nothing */ }
+
+    /**
+     * Callback. Called each time an empty mesh is produced.
+     * \param  pInfo information related to the empty mesh.
+     */
+    virtual void reportEmptyMesh(std::string pInfo) = 0;
+    
+}; // class MULTIPR_EmptyMeshCallback
+
+
+#endif // MULTIPR_PROGRESS_CALLBACK_HXX
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Utils.cxx b/src/MULTIPR/MULTIPR_Utils.cxx
new file mode 100755 (executable)
index 0000000..194aced
--- /dev/null
@@ -0,0 +1,309 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Utils.cxx
+ *
+ * \brief   see MULTIPR_Utils.hxx
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+//*****************************************************************************
+// Includes section
+//*****************************************************************************
+
+#include "MULTIPR_Utils.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include <iostream>
+
+using namespace std;
+
+
+//*****************************************************************************
+// Implementation
+//*****************************************************************************
+
+void multipr::trim(char* pStr, char pChar)
+{
+    int len = strlen(pStr) - 1;
+    int p = len;
+    while (pStr[p] == pChar)
+    {
+        p--;
+    }
+    if (p != len)
+    {
+        pStr[p + 1] = '\0';
+    }
+}
+
+
+bool multipr::startsWith(const char* pStr, const char* pStrPrefix)
+{
+    int i = 0;
+    while ((pStr[i] != '\0') && (pStrPrefix[i] != '\0') && (pStr[i] == pStrPrefix[i]))
+    {
+        i++;
+    }
+    return (pStrPrefix[i] == '\0');
+}
+
+
+string multipr::removeExtension(const char* pFilename, const char* pExtension)
+{
+    string strPrefix(pFilename); 
+    strPrefix.erase(strPrefix.rfind(pExtension), strlen(pExtension));
+    
+    return strPrefix;
+}
+
+
+string multipr::getFilenameWithoutPath(const char* pFilename)
+{
+    char* res = strrchr(pFilename, '/');
+    if (res == NULL)
+    {
+        return pFilename;
+    }
+    else
+    {
+        char* name = res + 1;
+        return name;
+    }
+}
+
+
+string multipr::getPath(const char* pFilename)
+{
+    // find (reverse) the first occurrence of '/' in the given string
+    char* res = strrchr(pFilename, '/');
+    
+    // if there is no '/'...
+    if (res == NULL)
+    {
+        return "";
+    }
+    else
+    {
+        int size = res - pFilename + 1;
+        char path[256];
+        memcpy(path, pFilename, size);
+        path[size] = '\0';
+        return path;
+    }
+}
+
+
+void multipr::copyFile(const char* pFilename, const char* pDestDir)
+{
+    const char* srcDir = multipr::getPath(pFilename).c_str();
+    if (strcmp(srcDir, pDestDir) == 0) return;
+    
+    const char* filenameWithoutPath = multipr::getFilenameWithoutPath(pFilename).c_str();
+    char pDstFilename[256];
+    sprintf(pDstFilename, "%s%s", pDestDir, filenameWithoutPath);
+    
+    // open binary source file
+    FILE* src = fopen(pFilename, "rb");
+    if (src == NULL) return;
+    
+    // open (create) binary destination file
+    FILE* dst = fopen(pDstFilename, "wb");
+    if (dst == NULL) return;
+    
+    const int size = 65536; // size of buffer is 64Kb
+    char* buf = new char[size];
+    int ret;
+    ret = fread(buf, 1, size, src);
+    while (ret != 0)
+    {
+        fwrite(buf, 1, ret, dst); // write to destination
+        ret = fread(buf, 1, size, src); // read from source
+    }
+    
+    delete[] buf;
+    fclose(src);
+    fclose(dst);
+}
+
+
+void multipr::printArray2D(
+     const med_float* pData, 
+    const int        pNumElt,
+    const int        pDimElt,
+    const char*      pPrefix)
+{
+    for (int itElt = 0 ; itElt < pNumElt ; itElt++)
+    {
+        cout << pPrefix << " " << (itElt + 1) << ": ";
+        for (int itDim = 0 ; itDim < pDimElt ; itDim++)
+        {
+            cout << pData[itElt * pDimElt + itDim] << " ";
+        }
+        cout << endl;
+    }
+}
+
+
+string multipr::realToString(med_float mV)
+{
+    char str[32];
+    sprintf(str, "%lf", mV);
+    trim(str, '0');
+    int len = strlen(str);
+    if (str[len - 1] == '.')
+    {
+        str[len] = '0';
+        str[len + 1] = '\0';
+    }
+    return string(str);
+}
+
+
+vector<string> multipr::getListMeshes(const char* pMEDfilename)
+{
+    if (pMEDfilename == NULL) throw multipr::NullArgumentException("", __FILE__, __LINE__);
+    
+    vector<string> res;
+    med_err ret;
+    
+    //---------------------------------------------------------------------
+    // Open MED file (READ_ONLY)
+    //---------------------------------------------------------------------
+    med_idt file = MEDouvrir(const_cast<char*>(pMEDfilename), MED_LECTURE); // open MED file for reading
+    if (file <= 0) throw multipr::IOException("MED file not found or not a sequential MED file", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Read name of meshes
+    //---------------------------------------------------------------------
+    med_int nbMeshes = MEDnMaa(file);
+    if (nbMeshes <= 0) throw multipr::IOException("i/o error while reading number of meshes in MED file", __FILE__, __LINE__);    
+    
+    // for each mesh in the file (warning: first mesh is number 1)
+    for (int itMesh = 1 ; itMesh <= nbMeshes ; itMesh++)
+    {
+        char meshName[MED_TAILLE_NOM + 1];
+        
+        int meshDim;
+        med_maillage meshType;
+        char meshDesc[MED_TAILLE_DESC + 1]; 
+        
+        ret = MEDmaaInfo(
+            file, 
+            itMesh, 
+            meshName, 
+            &meshDim, 
+            &meshType, 
+            meshDesc);
+            
+        if (ret != 0) throw multipr::IOException("i/o error while reading mesh information in MED file", __FILE__, __LINE__);
+        
+        res.push_back(meshName);
+    }
+    
+    //---------------------------------------------------------------------
+    // Close the MED file
+    //---------------------------------------------------------------------
+    ret = MEDfermer(file);
+    if (ret != 0) throw multipr::IOException("i/o error while closing MED file", __FILE__, __LINE__);
+    
+    return res;
+}
+
+
+vector<pair<string,int> > multipr::getListScalarFields(const char* pMEDfilename)
+{
+    if (pMEDfilename == NULL) throw multipr::NullArgumentException("", __FILE__, __LINE__);
+    
+    vector<pair<string, int> > res;
+    med_err ret;
+    
+    //---------------------------------------------------------------------
+    // Open MED file (READ_ONLY)
+    //---------------------------------------------------------------------
+    med_idt file = MEDouvrir(const_cast<char*>(pMEDfilename), MED_LECTURE); // open MED file for reading
+    if (file <= 0) throw multipr::IOException("MED file not found or not a sequential MED file", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // Read number of fields
+    //---------------------------------------------------------------------
+    med_int numFields = MEDnChamp(file, 0);
+    if (numFields <= 0) throw IOException("", __FILE__, __LINE__);
+    
+    //---------------------------------------------------------------------
+    // For each field, read its name
+    //---------------------------------------------------------------------
+    for (int itField = 1 ; itField <= numFields ; itField++)
+    {
+        char           name[MED_TAILLE_NOM + 1];
+        med_type_champ type;
+        
+        med_int numComponents = MEDnChamp(file, itField);
+    
+        if (numComponents < 0) throw IOException("", __FILE__, __LINE__);
+        
+        // collect scalar field only (not vectorial fields)
+        if (numComponents != 1) 
+            continue;
+        
+        // temporary buffers
+        char* strComponent = new char[numComponents * MED_TAILLE_PNOM + 1];
+        char* strUnit      = new char[numComponents * MED_TAILLE_PNOM + 1];
+        
+        strComponent[0] = '\0';
+        strUnit[0] = '\0';
+        
+        med_err ret = MEDchampInfo(
+            file, 
+            itField, 
+            name, 
+            &(type), 
+            strComponent, 
+            strUnit, 
+            numComponents);
+        
+        if (ret != 0) throw IOException("", __FILE__, __LINE__);
+        
+        delete[] strUnit;
+        delete[] strComponent;
+        
+        med_int numTimeStamps = MEDnPasdetemps(
+            file, 
+            name, 
+            MED_NOEUD, 
+            (med_geometrie_element) 0);
+        
+        if (numTimeStamps < 0) throw IOException("", __FILE__, __LINE__);
+        
+        if (numTimeStamps == 0)
+        {
+            numTimeStamps = MEDnPasdetemps(
+                file, 
+                name, 
+                MED_MAILLE, 
+                MED_TETRA10);
+        
+            if (numTimeStamps  < 0) throw IOException("", __FILE__, __LINE__);    
+            
+        }
+        
+        // add the pair(name, #time stamps) to the result
+        res.push_back( make_pair(name, numTimeStamps) );
+    }
+    
+    //---------------------------------------------------------------------
+    // Close the MED file
+    //---------------------------------------------------------------------
+    ret = MEDfermer(file);
+    if (ret != 0) throw multipr::IOException("i/o error while closing MED file", __FILE__, __LINE__);
+    
+    // return the list of fields
+    return res;
+}
+
+
+// EOF
diff --git a/src/MULTIPR/MULTIPR_Utils.hxx b/src/MULTIPR/MULTIPR_Utils.hxx
new file mode 100755 (executable)
index 0000000..46362e7
--- /dev/null
@@ -0,0 +1,130 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    MULTIPR_Utils.hxx
+ *
+ * \brief   Some useful miscellaneous tools.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#ifndef MULTIPR_UTILS_HXX
+#define MULTIPR_UTILS_HXX
+
+extern "C"
+{
+    #include "med.h"
+}
+
+#include <string>
+#include <vector>
+
+
+namespace multipr
+{
+
+
+/**
+ * Removes all the pChar at the end of the string.
+ * \param  pStr  any valid C string ending with the char '\0'.
+ * \param  pChar any char; SPACE by default.
+ * \return the same string where the ending spaces have been removed.
+ */
+void trim(char* pStr, char pChar=' ');
+
+
+/**
+ * Returns true iff the given string starts by prefix.
+ * \param  pStr       any valid C string ending with the char '\0'.
+ * \param  pStrPrefix any valid C string ending with the char '\0'.
+ * \return true iff the given string starts by prefix.
+ */
+bool startsWith(const char* pStr, const char* pStrPrefix);
+
+/**
+ * Removes the extension (suffix) of a filename.
+ * Example: removeExtension("agregat100grains_12pas.med", ".med") -> "agregat100grains_12pas"
+ * \param  pPilename  any valid C string ending with the char '\0'.
+ * \param  pExtension any valid C string ending with the char '\0'.
+ * \return the filename without extension.
+ */
+std::string removeExtension(const char* pFilename, const char* pExtension);
+
+
+/**
+ * Returns the name of the file, excluding the path.
+ * Example: getFilenameWithoutPath("/home/data/agregat100grains_12pas.med") -> "agregat100grains_12pas.med"
+ * \param  pPilename  any valid C string ending with the char '\0'.
+ * \return the name of the file, excluding the path.
+ */
+std::string getFilenameWithoutPath(const char* pFilename);
+
+
+/**
+ * Returns the path of the filename (which may be relative or absolute).
+ * Example: getPath("/home/data/agregat100grains_12pas.med") -> "/home/data/"
+ * \param  pPilename  any valid C string ending with the char '\0'.
+ * \return the path of the filename (which may be relative or absolute).
+ */
+std::string getPath(const char* pFilename);
+
+
+/**
+ * Copies the given file into a directory.
+ * \param  pFilename  name of any file to be copied.
+ * \param  pDestDir   destination directory.
+ */
+void copyFile(const char* pFilename, const char* pDestDir);
+/**
+ * Prints all the elements of a 2D array.
+ * \param  pData   all the data (should contain pNumberOfElements * pDimOfElements values)
+ * \param  pNumElt number of elements to display.
+ * \param  pDimElt Dimension of elements.
+ * \param  pPrefix string to display before each element.
+ */
+void printArray2D(
+    const med_float* pData, 
+    const int        pNumElt,
+    const int        pDimElt,
+    const char*      pPrefix);
+    
+
+/**
+ * Converts any float value to a string (remove unecessary 0).
+ * \param  mV any float value.
+ */
+std::string realToString(med_float mV);
+
+
+/**
+ * Returns the name of all meshes contained in a sequential MED file.
+ * \param  pMEDfilename name of any valid sequential MED file; must not be NULL.
+ * \return a list of mesh names.
+ * \throw  NullArgumentException if pMEDfilename is NULL.
+ * \throw  IOException if any other error occurs while reading MED file.
+ */
+ std::vector<std::string> getListMeshes(const char* pMEDfilename);
+
+ /**
+  * For each scalar field in a sequential MED file, returns its name and the related number of time stamps.
+  * Do not returns info about vectorial fields (because, currently, decimation can only be performed on scalar fields).
+  * \param  pMEDfilename name of any valid sequential MED file; must not be NULL.
+  * \return a list of (name, #time stamps).
+  * \throw  NullArgumentException if pMEDfilename is NULL.
+  * \throw  IOException if any other error occurs while reading MED file.
+  */
+ std::vector< std::pair<std::string, int> > getListScalarFields(const char* pMEDfilename);
+
+} // namespace MULTIPR
+
+
+#endif // MULTIPR_UTILS_HXX
+
+// EOF
diff --git a/src/MULTIPR/Makefile.in b/src/MULTIPR/Makefile.in
new file mode 100755 (executable)
index 0000000..13c4ef7
--- /dev/null
@@ -0,0 +1,88 @@
+#  Copyright (C) 2005  CEA/DEN, EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# Source path
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+MACHINE=PCLINUX
+
+@COMMENCE@
+
+# Libraries targets
+
+LIB = libMULTIPR_API.la
+
+LIB_SRC = \
+MULTIPR_API.cxx \
+MULTIPR_Mesh.cxx \
+MULTIPR_Profil.cxx \
+MULTIPR_GaussLoc.cxx \
+MULTIPR_Field.cxx \
+MULTIPR_Nodes.cxx \
+MULTIPR_Elements.cxx \
+MULTIPR_Family.cxx \
+MULTIPR_MeshDis.cxx \
+MULTIPR_DecimationFilter.cxx \
+MULTIPR_DecimationAccel.cxx \
+MULTIPR_Utils.cxx \
+MULTIPR_Obj.cxx
+          
+#LIB_SERVER_IDL = MULTIPR.idl 
+
+LIB_CLIENT_IDL = SALOME_Component.idl SALOME_Exception.idl SALOMEDS.idl SALOME_GenericObj.idl Logger.idl 
+
+EXPORT_HEADERS = \
+MULTIPR_API.hxx \
+MULTIPR_DecimationAccel.hxx \
+MULTIPR_DecimationFilter.hxx \
+MULTIPR_Elements.hxx \
+MULTIPR_Exceptions.hxx \
+MULTIPR_Family.hxx \
+MULTIPR_Field.hxx \
+MULTIPR_GaussLoc.hxx \
+MULTIPR_Globals.hxx \
+MULTIPR_MeshDis.hxx \
+MULTIPR_Mesh.hxx \
+MULTIPR_Nodes.hxx \
+MULTIPR_PointOfField.hxx \
+MULTIPR_Profil.hxx \
+MULTIPR_Utils.hxx \
+MULTIPR_Obj.hxx \
+MULTIPR_ProgressCallback.hxx
+
+BIN = multipr
+BIN_SRC = 
+
+# additionnal information to compile and link file
+
+CPPFLAGS += $(KERNEL_CXXFLAGS) $(MED_CXXFLAGS) $(MED2_INCLUDES) -Wall -pthread  
+
+CPPFLAGSFORBIN=$(CPPFLAGS)
+
+LDFLAGS += $(KERNEL_LDFLAGS) $(MED_LDFLAGS) $(MED2_LIBS) -lSalomeContainer -lOpUtil -lm -lmed -lmedsplitter -lmedmem -lMEDWrapper -lSALOMELocalTrace
+
+LDFLAGSFORBIN=$(LDFLAGS) -lmed_V2_1 -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase
+# Executables targets
+
+@CONCLUDE@
+
diff --git a/src/MULTIPR/multipr.cxx b/src/MULTIPR/multipr.cxx
new file mode 100755 (executable)
index 0000000..93cfad2
--- /dev/null
@@ -0,0 +1,774 @@
+// Project MULTIPR, IOLS WP1.2.1 - EDF/CS
+// Partitioning/decimation module for the SALOME v3.2 platform
+
+/**
+ * \file    multipr.cxx
+ *
+ * \brief   Standalone command line application of the MULTIPR component.
+ *          The application aims to reduce large data set to allow interactive visualization.
+ *          Its two main function are the following:
+ *          1. Splits any TETRA10 mesh contained in a MED file.
+ *             a. Builds a distributed MED file by extracting all the groups from a sequential MED file.
+ *             b. Splits a part of distributed MED file.
+ *          2. Decimates fields to produce multi-resolution data set.
+ *
+ *          Return 0 if application succeed, 1 otherwise (failure).
+ *
+ *          See http://www.salome-platform.org to learn more about Salome or MED.
+ *
+ * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
+ * 
+ * \date    01/2007
+ */
+
+#include "MULTIPR_API.hxx"
+#include "MULTIPR_Obj.hxx"
+#include "MULTIPR_Mesh.hxx"
+#include "MULTIPR_Exceptions.hxx"
+#include "MULTIPR_Utils.hxx"
+
+#include <iostream>
+#include <vector>
+#include <string>
+
+using namespace std;
+
+
+// This command line application can use 2 differents API to do the same work.
+// If MULTIPR_USE_OBJ_API is defined then this command line application used the MULTIPR_Obj API;
+// otherwise, it uses the MULTIPR_API
+//#define MULTIPR_USE_OBJ_API
+
+
+const int MULTIPR_APP_OK     = 0;
+const int MULTIPR_APP_FAILED = 1;
+
+
+/**
+ * Enumerates all the usages of this application.
+ */
+enum Usage
+{
+    MULTIPR_USAGE_UNKNOWN,
+    MULTIPR_USAGE_DISPLAY_HELP,
+    MULTIPR_USAGE_AUTOTEST,
+    MULTIPR_USAGE_PARTITION1,
+    MULTIPR_USAGE_PARTITION2,
+    MULTIPR_USAGE_DECIMATION,
+    MULTIPR_USAGE_MERGE,
+    MULTIPR_USAGE_INFO
+};
+
+
+/**
+ * Enumerates all the possible errors.
+ */
+enum Error
+{
+    MULTIPR_APP_NO_ERROR,
+    MULTIPR_APP_UNKNOWN_USAGE,
+    MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS,
+    MULTIPR_APP_ILLEGAL_ARGUMENT,
+    MULTIPR_APP_FILE_NOT_FOUND,
+    MULTIPR_APP_IO_ERROR,
+    MULTIPR_APP_UNDEFINED_ERROR
+};
+
+
+// global variables used to configure the application
+int   g_usage               = 0; 
+int   g_errorCode           = MULTIPR_APP_NO_ERROR;
+char* g_medFilename         = NULL;
+char* g_meshName            = NULL;
+char* g_partName            = NULL;
+int   g_nbParts             = 0;
+int   g_splitter            = multipr::MULTIPR_METIS;
+char* g_filterName          = NULL;
+char* g_fieldName           = NULL;
+int   g_fieldTimeStepIt     = 0;
+float g_decimThresholdMed   = 0.0f;
+float g_decimThresholdLow   = 0.0f;
+float g_decimRadius         = 0.0f;
+int   g_boxing              = 100;
+
+// merge
+std::vector<std::string> g_medFilenameSrc;
+char* g_medFilenameDst      = NULL;
+
+
+/**
+ * \fn     const char* getUsage(int usage)
+ * \brief  returns a string describing the usage of this application.
+ */
+const char* getUsage(int usage)
+{
+    switch(usage)
+    {
+        case MULTIPR_USAGE_DISPLAY_HELP:
+            return "--help: display help";
+            
+        case MULTIPR_USAGE_AUTOTEST:
+            return "--auto: perform all unit tests";
+
+        case MULTIPR_USAGE_PARTITION1:
+            return "--part1: extract all groups from a sequential MED file";
+
+        case MULTIPR_USAGE_PARTITION2:
+            return "--part2: split a part of a distributed MED file";
+
+        case MULTIPR_USAGE_DECIMATION:
+            return "--decim: generated level of details from a part of a distributed MED file";
+        
+        case MULTIPR_USAGE_MERGE:
+            return "--merge: merge two sequential MED file if possible";    
+            
+        case MULTIPR_USAGE_INFO:
+            return "--info: prints all infos about a mesh in a sequential MED file";
+
+        default:
+            return "unknown";
+    }
+}
+
+
+/**
+ * \fn     void printDescription()
+ * \brief  prints a short description of this application.
+ */
+void printDescription()
+{
+    cout << "Keywords:" << endl;          
+    cout << "    Post-processing numerical simulation, Salome platform, " << endl;
+    cout << "    Large data set visualization, 3D meshes and fields" << endl;
+    cout << "Description:" << endl;
+    cout << "    multipr is a partitionning/decimation tool of MED files." << endl;
+    cout << "    See http://www.salome-platform.org for information about MED or Salome." << endl;
+    cout << "    Note: current version only accept TETRA10 meshes." << endl;
+}
+
+
+/**
+ * \fn     void printUsage()
+ * \brief  prints "how to use" manual of this tools.2NbPart
+ */
+void printUsage()
+{
+    cout << "Usages:" << endl;
+    cout << "    --auto   Autotest: performs some unit tests on the MULTIPR API" << endl;
+    cout << "                 * Usage: --auto path (path where to find test file \"agregat100grains_12pas.med\")" << endl;
+    cout << "    --part1  Extracts all groups from a sequential MED file (V2.2 or higher)" << endl;
+    cout << "                 * Usage: --part1 file.med meshName" << endl; 
+    cout << "    --part2  Split a group of a distributed MED file (V2.3) produced with --part1" << endl;
+    cout << "                 * Usage: --part2 file.med partName nbParts [splitter (0=METIS 1=SCOTCH)]" << endl;
+    cout << "    --decim  Generates 3 level of details (full, medium and low) from a part" << endl;
+    cout << "             of a distributed MED file (V2.3)" << endl;     
+    cout << "                 * Usage: --decim file.med partName fieldName fieldIt filterName [...]" << endl;
+    cout << "                 * Only one filter is currently available: Filtre_GradientMoyen" << endl;
+    cout << "                 * Usage: --decim file.med partName fieldName fieldIt Filtre_GradientMoyen m l radius" << endl;
+    cout << "                   where m=threshold for medium res. and l=threshold for low res.; assume m < l" << endl;
+    cout << "    --info   Dumps all infos related to a mesh in a sequential MED file" << endl;
+    cout << "                 * Usage: --info file.med [meshName]" << endl;
+    cout << "    --help   Displays this help page" << endl;
+    cout << endl;
+}
+
+
+/**
+ * \fn     void printGlobals()
+ * \brief  print current state of all global variables.
+ */
+void printGlobals()
+{
+    cout << endl;
+    cout << "********************************************************************************" << endl;
+    cout << "CONFIGURATION" << endl;
+    cout << "--------------------------------------------------------------------------------" << endl;
+    cout << "Mode                        : " << getUsage(g_usage) << endl;
+    cout << "Med filename                : " << ((g_medFilename != NULL) ? g_medFilename : "UNDEFINED") << endl;
+    cout << "Mesh name                   : " << ((g_meshName != NULL) ? g_meshName : "UNDEFINED") << endl;
+    cout << "Part name                   : " << ((g_partName != NULL) ? g_partName : "UNDEFINED") << endl;
+    cout << "Nb parts                    : "  << g_nbParts << endl;
+    cout << "Decimation:" << endl;
+    cout << "    Field name              : " << ((g_fieldName != NULL) ? g_fieldName : "UNDEFINED") << endl;
+    cout << "    Time step iteration     : " << g_fieldTimeStepIt << endl;
+    cout << "    Filter name             : " << ((g_filterName != NULL) ? g_filterName : "UNDEFINED") << endl;
+    cout << "    Threshold for med. res. : " << g_decimThresholdMed << endl;
+    cout << "    Threshold for low res.  : " << g_decimThresholdLow << endl;
+    cout << "    Radius                  : " << g_decimRadius << endl;
+    cout << "    Boxing                  : " << g_boxing << endl;
+    cout << "********************************************************************************" << endl;
+    cout << endl;
+}
+
+
+/**
+ * \fn     const char* getErrorMsg()
+ * \brief  returns the error message corresponding to current error code.
+ * \return the current error message.
+ */
+const char* getErrorMsg()
+{
+    switch (g_errorCode)
+    {
+        case MULTIPR_APP_NO_ERROR:
+            return "no error";
+        
+        case MULTIPR_APP_UNKNOWN_USAGE:
+            return "unknown usage";
+            
+        case MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS:
+            return "wrong number of arguments";
+        
+        case MULTIPR_APP_ILLEGAL_ARGUMENT:
+            return "illegal argument";
+        
+        case MULTIPR_APP_FILE_NOT_FOUND:
+            return "file not found";
+            
+        case MULTIPR_APP_IO_ERROR:
+            return "i/o error";
+            
+        default:
+            return "error (undefined)";
+    }
+}
+
+
+/**
+ * \fn     void parseCommandLine(int argc, char** argv)
+ * \brief  parses the command line and configure this application.
+ * \param  argc number of arguments.
+ * \param  argv array of arguments.
+ */
+void parseCommandLine(int argc, char** argv)
+{
+    if (argc == 1)
+    {
+        g_usage = MULTIPR_USAGE_UNKNOWN; 
+        return;
+    }
+    
+    if (strcmp(argv[1],"--help") == 0)
+    {
+        g_usage = MULTIPR_USAGE_DISPLAY_HELP;
+    }
+    else if (strcmp(argv[1],"--auto") == 0)
+    {
+        if (argc != 3)
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage = MULTIPR_USAGE_AUTOTEST;
+            g_medFilename = argv[2];
+        }
+    }
+    else if (strcmp(argv[1],"--part1") == 0)
+    {
+        if (argc != 4)
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage       = MULTIPR_USAGE_PARTITION1;
+            g_medFilename = argv[2];
+            g_meshName    = argv[3];
+        }
+    }
+    else if (strcmp(argv[1],"--part2") == 0)
+    {
+        if ((argc != 5) && (argc != 6))
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage       = MULTIPR_USAGE_PARTITION2; 
+            g_medFilename = argv[2];
+            g_partName    = argv[3];
+            g_nbParts     = atoi(argv[4]);
+            
+            if (argc == 6)
+            {
+                g_splitter = atoi(argv[5]);
+            }
+        }
+    }
+    else if (strcmp(argv[1],"--decim") == 0)
+    {
+        if ((argc != 10) && (argc != 11))
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage             = MULTIPR_USAGE_DECIMATION; 
+            g_medFilename       = argv[2];
+            g_partName          = argv[3];
+            g_fieldName         = argv[4];
+            g_fieldTimeStepIt   = atoi(argv[5]);
+            g_filterName        = argv[6];
+            g_decimThresholdMed = atof(argv[7]);
+            g_decimThresholdLow = atof(argv[8]);
+            g_decimRadius       = atof(argv[9]);
+            
+            if (argc == 11)
+            {
+                g_boxing = atoi(argv[10]);
+            }
+        }
+    }
+    else if (strcmp(argv[1],"--merge") == 0)
+    {
+        if (argc < 7)
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage             = MULTIPR_USAGE_MERGE; 
+            for (int i = 2 ; i < argc-3 ; i++)
+            {
+                g_medFilenameSrc.push_back(argv[i]);
+            }
+            g_meshName          = argv[argc-3];
+            g_fieldName         = argv[argc-2];
+            if (strcmp(g_fieldName, "NULL") == 0) g_fieldName = NULL;
+            g_medFilenameDst    = argv[argc-1];
+        }
+    }
+    else if (strcmp(argv[1],"--info") == 0)
+    {
+        if ((argc != 3) && (argc != 4))
+        {
+            g_usage = MULTIPR_USAGE_UNKNOWN; 
+            g_errorCode = MULTIPR_APP_WRONG_NUMBER_OF_ARGUMENTS;
+        }
+        else
+        {
+            g_usage        = MULTIPR_USAGE_INFO; 
+            g_medFilename  = argv[2];
+            
+            if (argc == 4)
+            {
+                g_meshName = argv[3];
+            }
+        }
+    }
+    else
+    {
+        g_usage = MULTIPR_USAGE_UNKNOWN;
+        g_errorCode = MULTIPR_APP_UNKNOWN_USAGE;
+    }
+}
+
+
+/**
+ * \fn     int runAutotest()
+ * \brief  performs some unit tests on the MULTIPR API. 
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runAutotest()
+{
+    cout << "Start autotest..." << endl;
+    
+    multipr::Obj multiprObj;
+    multiprObj.create("/data/apo/agregat100grains_12pas.med");
+
+    cout << "Start autotest..." << endl;
+
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        string strMEDfilename = g_medFilename;
+        strMEDfilename += "/agregat100grains_12pas.med";
+        
+        cout << "Test file: " << strMEDfilename << endl << endl;
+        
+        //---------------------------------------------------------------------
+        // Test partionneDomaine() = extract groups from a sequential MED file
+        //---------------------------------------------------------------------
+        multipr::partitionneDomaine(strMEDfilename.c_str(), "MAIL"); 
+        
+        //---------------------------------------------------------------------
+        // Test partitionneGrain() = split a group from a distributed MED file
+        // using MEDSPLITTER (METIS)
+        //---------------------------------------------------------------------
+        string strDistributedMEDfilename = g_medFilename;
+        strDistributedMEDfilename += "/agregat100grains_12pas_grains_maitre.med";
+        
+        multipr::partitionneGrain(
+            strDistributedMEDfilename.c_str(), 
+            "MAIL_1", 
+            4, 
+            multipr::MULTIPR_SCOTCH);
+            
+        multipr::partitionneGrain(
+            strDistributedMEDfilename.c_str(), 
+            "MAIL_97", 
+            3, 
+            multipr::MULTIPR_METIS);
+
+        //---------------------------------------------------------------------
+        // Test decimePartition() = generate 2 lower resolution of a mesh
+        // using decimation based on gradient
+        //---------------------------------------------------------------------
+        multipr::decimePartition(
+            strDistributedMEDfilename.c_str(), 
+            "MAIL_98",
+            "SIG_____SIEF_ELGA_______________",
+            12,
+            "Filtre_GradientMoyen",
+            10.0,
+            25.0,
+            0.3,
+            100);
+            
+        multipr::decimePartition(
+            strDistributedMEDfilename.c_str(), 
+            "MAIL_92",
+            "SIG_____SIEF_ELGA_______________",
+            11,
+            "Filtre_GradientMoyen",
+            10.0,
+            25.0,
+            0.5,
+            10);
+        
+        multipr::decimePartition(
+            strDistributedMEDfilename.c_str(), 
+            "MAIL_97_2",
+            "SIG_____SIEF_ELGA_______________",
+            10,
+            "Filtre_GradientMoyen",
+            10.0,
+            25.0,
+            0.4,
+            20);
+            
+        //---------------------------------------------------------------------
+        // Test passed: OK!
+        //---------------------------------------------------------------------
+        cout << endl;
+        cout << "Test passed: everything seems to be OK" << endl;
+        cout << "OK" << endl << endl;
+        
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        cout << endl;
+        cout << "Test failed" << endl;
+        cout << "Failure" << endl << endl;
+        ret = MULTIPR_APP_FAILED;
+    }
+    
+    return ret;
+}
+
+
+/**
+ * \fn     void runPartition1()
+ * \brief  builds a distributed MED file (v2.3) by extracting groups from a sequential MED file. 
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runPartition1()
+{
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        multipr::partitionneDomaine(g_medFilename, g_meshName);    
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+        
+    return ret;
+}
+
+
+/**
+ * \fn     void runPartition2()
+ * \brief  builds a distributed MED file (v2.3) by splitting a part of a distributed MED file generated by runPartition1().  
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runPartition2()
+{    
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        multipr::partitionneGrain(
+            g_medFilename, 
+            g_partName, 
+            g_nbParts, 
+            g_splitter);
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+        
+    return ret;
+}
+
+
+/**
+ * \fn     int runDecimation()
+ * \brief  creates 3 resolutions of a part of a distributed MED file. 
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runDecimation()
+{    
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        multipr::decimePartition(
+            g_medFilename, 
+            g_partName,
+            g_fieldName,
+            g_fieldTimeStepIt,
+            g_filterName,
+            g_decimThresholdMed,
+            g_decimThresholdLow,
+            g_decimRadius,
+            g_boxing);
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+        
+    return ret;
+}
+
+
+/**
+ * \fn     int runMerge()
+ * \brief  merges two sequential MED file if possible.
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runMerge()
+{    
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        multipr::merge(
+            g_medFilenameSrc, 
+            g_meshName,
+            g_fieldName,
+            g_medFilenameDst);
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+        
+    return ret;
+}
+
+
+/**
+ * \fn     int runDumpMED()
+ * \brief  dumps info about a sequential MED file.
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int runDumpMED()
+{
+#ifdef MULTIPR_USE_OBJ_API
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        // if mesh is unknown, then list all the meshes in the given MED file
+        if (g_meshName == NULL)
+        {
+            multipr::Obj obj;
+            obj.create(g_medFilename);
+            
+            {
+                // display list of meshes contained in the MED file
+                vector<string> res = obj.getMeshes();
+                cout << "List of meshes in this MED file:" << endl;
+                for (unsigned i = 0 ; i < res.size() ; i++)
+                {
+                    cout << "Mesh " << (i + 1) << ": \"" << res[i] << "\"" << endl;
+                }
+            }
+            
+            cout << endl;
+            
+            {
+                // display list of fields contained in the MED file
+                vector<string> names = obj.getFields();
+                cout << "List of scalar fields in this MED file:" << endl;
+                for (unsigned i = 0 ; i < names.size() ; i++)
+                {
+                    cout << "Field " << (i + 1) << ": \"" << names[i] << "\"  #Time stamps=" << obj.getTimeStamps(names[i].c_str()) << endl;
+                }
+            }
+        }
+        else
+        {
+            // display all infos about one mesh in a MED file
+            multipr::Mesh mesh;
+            mesh.readSequentialMED(g_medFilename, g_meshName);
+            mesh.setPrintAll(true);
+            cout << mesh << endl;
+        }
+        cout << "OK" << endl;
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+    
+    return ret;
+#else
+    int ret = MULTIPR_APP_OK;
+    try
+    {
+        // if mesh is unknown, then list all the meshes in the given MED file
+        if (g_meshName == NULL)
+        {
+            {
+                // display list of meshes contained in the MED file
+                vector<string> res = multipr::getListMeshes(g_medFilename);
+                cout << "List of meshes in this MED file:" << endl;
+                for (unsigned i = 0 ; i < res.size() ; i++)
+                {
+                    cout << "Mesh " << (i + 1) << ": \"" << res[i] << "\"" << endl;
+                }
+            }
+            
+            cout << endl;
+            
+            {
+                // display list of fields contained in the MED file
+                vector<pair<string,int> > res = multipr::getListScalarFields(g_medFilename);
+                cout << "List of scalar fields in this MED file:" << endl;
+                for (unsigned i = 0 ; i < res.size() ; i++)
+                {
+                    cout << "Field " << (i + 1) << ": \"" << res[i].first << "\"  #Time stamps=" << res[i].second << endl;
+                }
+            }
+        }
+        else
+        {
+            // display all infos about one mesh in a MED file
+            multipr::Mesh mesh;
+            mesh.readSequentialMED(g_medFilename, g_meshName);
+            mesh.setPrintAll(true);
+            cout << mesh << endl;
+        }
+        cout << "OK" << endl;
+    }
+    catch (multipr::RuntimeException& e)
+    {
+        e.dump(cout);
+        ret = MULTIPR_APP_FAILED;
+    }
+    
+    return ret;
+#endif
+}
+
+
+/**
+ * \fn     int run()
+ * \brief  applies partitioning/decimation according to global parameters.
+ * \return MULTIPR_APP_OK if successful, MULTIPR_APP_FAILED if failure.
+ */
+int run()
+{
+    printGlobals();
+
+    int ret = MULTIPR_APP_OK;
+    switch (g_usage)
+    {
+        case MULTIPR_USAGE_AUTOTEST:   ret = runAutotest();   break;
+        case MULTIPR_USAGE_PARTITION1: ret = runPartition1(); break;
+        case MULTIPR_USAGE_PARTITION2: ret = runPartition2(); break;
+        case MULTIPR_USAGE_DECIMATION: ret = runDecimation(); break;
+        case MULTIPR_USAGE_MERGE:      ret = runMerge();      break;
+        case MULTIPR_USAGE_INFO:       ret = runDumpMED();    break;
+        default:
+            cout << "ERROR: unknown usage" << endl;
+            ret = MULTIPR_APP_FAILED;
+            break;
+    }
+    
+    return ret;
+}
+
+
+/**
+ * \fn     int main(int argc, char** argv)
+ * \brief  entry point of the application.
+ * \param  argc number of arguments.
+ * \param  argv list of arguments.
+ * \return 0 if OK, 1 if failed.
+ */
+int main(int argc, char** argv)
+{
+    string strTitle = string("multipr v") + string(multipr::getVersion()) + string(" - by EDF/CS - 04/2007");    
+    string strUnderline = "";
+    
+    for (int i = 0, len = strTitle.length() ; i < len ; i++) strUnderline += '=';
+    
+    cout << strTitle << endl;
+    cout << strUnderline << endl;
+    
+    #ifdef MULTIPR_USE_OBJ_API
+        cout << "Version MULTIPR_Obj" << endl;
+    #else
+        cout << "Version MULTIPR_API" << endl;
+    #endif   
+
+    parseCommandLine(argc, argv);
+
+    int ret = MULTIPR_APP_OK; // assume no error at the beginning
+    
+    if (g_usage == MULTIPR_USAGE_UNKNOWN)
+    {
+        if (argc != 1)
+        {
+            // if usage is unknown and there are some arguments, print an error message 
+            cout << "ERROR: " << getErrorMsg() << endl;
+            cout << endl;
+            ret = MULTIPR_APP_FAILED;
+        }
+        else
+        {
+            // if no argument, print a description of this application
+            printDescription();
+        }
+
+        printUsage();
+    }
+    else if (g_usage == MULTIPR_USAGE_DISPLAY_HELP)
+    {
+        printDescription();
+        printUsage();
+    }
+    else
+    {
+        // the application seems to be configured properly: it can be executed
+        ret = run();
+    }
+    
+    return ret;
+}
+
+// EOF
index 2a0e51dd8dab82402aac89700d45fb482503e3a6..339d49f875b91cfe4e4f99fa719c1181369425af 100644 (file)
@@ -32,6 +32,6 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-SUBDIRS = CONVERTOR PIPELINE OBJECT VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG ENGINE
+SUBDIRS = MULTIPR CONVERTOR PIPELINE OBJECT VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG ENGINE
 
 @MODULE@
index 92c9b0148cd463bad280b3241022451befd74b48..60cddef1308b73014e704c76ad9f006651164ced 100644 (file)
@@ -39,6 +39,7 @@ EXPORT_HEADERS = \
        VISU_GaussPtsActorFactory.h \
        VISU_Event.h \
        VISU_Actor.h \
+       VISU_DataSetActor.h \
        VISU_MeshAct.h \
        VISU_ScalarMapAct.h \
        VISU_GaussPtsAct.h \
@@ -49,6 +50,7 @@ EXPORT_HEADERS = \
 LIB = libVisuObject.la
 LIB_SRC = \
        VISU_Actor.cxx \
+       VISU_DataSetActor.cxx \
        VISU_MeshAct.cxx \
        VISU_ScalarMapAct.cxx \
        VISU_GaussPtsDeviceActor.cxx \
index e2e9be3293767f9e8d1fee0fb75ed26787a4b91e..85197aa3073120d91c071e60db342f2b895aa9d4 100644 (file)
@@ -54,7 +54,6 @@
 #include <vtkShrinkFilter.h>
 #include <vtkShrinkPolyData.h>
 
-#include <vtkDataSetMapper.h>
 #include <vtkGeometryFilter.h>
 #include <vtkObjectFactory.h>
 
 
 #include "utilities.h"
 
+#include "VISU_PipeLineUtils.hxx"
+
 using namespace std;
 
 static int MYVTKDEBUG = 0;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -75,7 +76,7 @@ static int MYDEBUG = 0;
 //#define ENABLE_ANNOTATION
 
 //----------------------------------------------------------------------------
-vtkStandardNewMacro(VISU_Actor);
+//vtkStandardNewMacro(VISU_Actor);
 
 //----------------------------------------------------------------------------
 VISU_Actor
@@ -83,7 +84,6 @@ VISU_Actor
   myIsVTKMapping(false),
   myPrs3d(NULL),
   myActorFactory(NULL),
-  myMapper(vtkDataSetMapper::New()),
   myIsShrunk(false),
   myIsShrinkable(false),
   myShrinkFilter(VTKViewer_ShrinkFilter::New()),
@@ -92,7 +92,6 @@ VISU_Actor
 {
   if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<<this);
 
-  myMapper->Delete();
   myShrinkFilter->Delete();
 
   myStoreMapping = true;
@@ -109,27 +108,28 @@ VISU_Actor
 //----------------------------------------------------------------------------
 void
 VISU_Actor
-::ShallowCopy(vtkProp *prop)
+::DeepCopy(VISU_Actor *theActor)
 {
-  VISU_Actor *anActor = VISU_Actor::SafeDownCast(prop);
-  if(anActor != NULL){
-    setName(anActor->getName());
-    if(anActor->hasIO()) setIO(anActor->getIO());
-  }
-  Superclass::ShallowCopy(prop);
+  highlight(theActor->isHighlighted());
+  SetRepresentation(theActor->GetRepresentation());
+  SetShrinkable(theActor->IsShrunkable());
+  SetShrinkFactor(theActor->GetShrinkFactor());
+  if(theActor->IsShrunk())
+    SetShrink();
+  else
+    UnShrink();
+  SetOpacity(theActor->GetOpacity());
+  SetLineWidth(theActor->GetLineWidth());
+  SetPosition(theActor->GetPosition());
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_Actor
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
-  myPipeLine->ShallowCopy(thePipeLine);
-
-  vtkDataSet* aDatsSet = myMapper->GetInput();
-  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
-
-  // To restore mapper input from pipeline
-  myMapper->SetInput(aDatsSet);
+  myPipeLine->ShallowCopy(thePipeLine, true);
 }
 
 //----------------------------------------------------------------------------
@@ -195,8 +195,11 @@ void
 VISU_Actor
 ::UpdateFromFactory()
 {
-  myActorFactory->UpdateActor(this);
-  Update();
+  if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){
+    myUpdateFromFactoryTime.Modified();
+    myActorFactory->UpdateActor(this);
+    Update();
+  }
 }
 
 void
@@ -207,14 +210,6 @@ VISU_Actor
 }
 
 //----------------------------------------------------------------------------
-void
-VISU_Actor
-::SetMapperInput(vtkDataSet* theDataSet) 
-{
-  myMapper->SetInput(theDataSet);
-  SetMapper(myMapper.GetPointer());
-}
-
 void
 VISU_Actor
 ::SetPipeLine(VISU_PipeLine* thePipeLine) 
@@ -224,7 +219,6 @@ VISU_Actor
     if(vtkMapper *aMapper = myPipeLine->GetMapper()){
       if(vtkDataSet *aDataSet = aMapper->GetInput()){
        SetShrinkable(thePipeLine->IsShrinkable());
-
        SetMapperInput(aDataSet);
       }
     }
@@ -403,6 +397,26 @@ VISU_Actor
   return GetCurrentPL()->GetOutput();
 }
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_Actor
+::GetMemorySize()
+{
+  static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
+  vtkDataSet* aDataSet = GetMapper()->GetInput();
+  unsigned long int aSize = size_t(aDataSet->GetActualMemorySize() * 1024 * ERR_SIZE_CALC);
+
+  aDataSet = myGeomFilter->GetOutput();
+  aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(IsShrunk()){
+    aDataSet = myShrinkFilter->GetOutput();
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  }
+
+  return aSize;
+}
+
 //----------------------------------------------------------------------------
 vtkIdType
 VISU_Actor
index 3651a0a2a5eba3341e43073bf304087c7e4102a5..d26cea314cae409d2dd9986310973bac1f3a7ae8 100644 (file)
 #include "VISU_BoostSignals.h"
 
 #include <string>
+#include <vtkTimeStamp.h>
 #include <vtkSmartPointer.h>
 
 class vtkProp;
 class vtkProperty;
-class vtkDataSetMapper;
 class vtkTextMapper;
 class vtkTextActor;
 class vtkInteractorStyle;
@@ -64,12 +64,14 @@ class VTKOCC_EXPORT VISU_Actor :
  public:
   vtkTypeMacro(VISU_Actor,SALOME_Actor);
 
-  static 
-  VISU_Actor* 
-  New();
+  //static 
+  //VISU_Actor* 
+  //New();
 
+  //! Copies all properties from the given actor
+  virtual
   void
-  ShallowCopy(vtkProp *prop);
+  DeepCopy(VISU_Actor *theActor);
 
   virtual
   void
@@ -193,6 +195,11 @@ class VTKOCC_EXPORT VISU_Actor :
   vtkDataSet* 
   GetInput(); 
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
   //----------------------------------------------------------------------------
   virtual
   vtkIdType
@@ -227,7 +234,7 @@ class VTKOCC_EXPORT VISU_Actor :
  
   virtual 
   void
-  SetMapperInput(vtkDataSet* theDataSet);
+  SetMapperInput(vtkDataSet* theDataSet) = 0;
 
   virtual
   VISU_PipeLine* 
@@ -237,9 +244,9 @@ class VTKOCC_EXPORT VISU_Actor :
   bool myIsVTKMapping;
   VISU::Prs3d_i* myPrs3d;
   vtkSmartPointer<VISU_PipeLine> myPipeLine;
-  vtkSmartPointer<vtkDataSetMapper> myMapper;
 
   VISU::TActorFactory* myActorFactory;
+  vtkTimeStamp myUpdateFromFactoryTime;
   boost::signal1<void,VISU_Actor*> myDestroySignal;
 
   vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
index 13bc2729a85bd9d44cf7a618363ca143b9d85c11..ec7af383883ded8345678438bf241d8fe1c8d2f6 100644 (file)
@@ -53,6 +53,16 @@ namespace VISU
     ~TActorFactory()
     {}
 
+    //! Gets know whether the factory instance can be used for actor management or not
+    virtual
+    bool 
+    GetActiveState() = 0;
+
+    //! Return modified time of the factory
+    virtual
+    unsigned long int 
+    GetMTime() = 0;
+
     //! To update the actor
     virtual 
     void
index ac8ca23961befa6ce8a222d79f576e2901a005c2..dd2e4ab9b789058ba89eb756d48849aaa5d377ec 100644 (file)
@@ -36,8 +36,6 @@
 #include "VISU_ScalarBarCtrl.hxx"
 #include "VISU_ScalarBarActor.hxx"
 
-#include "SALOME_ExtractGeometry.h"
-
 #include "VISU_Event.h" 
 #include "SVTK_Actor.h"
 
 #include <vtkTextMapper.h>
 #include <vtkTextProperty.h>
 
-#include <vtkCellData.h>
 #include <vtkPointData.h>
-
 #include <vtkDataArray.h>
-#include <vtkFloatArray.h>
 
 #include <vtkSphereSource.h>
 #include <vtkPolyDataMapper.h>
@@ -70,7 +65,7 @@
 #include <boost/bind.hpp>
 
 #include <vtkUnstructuredGrid.h>
-#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
 #include <vtkRenderWindow.h>
 #include <vtkCellArray.h>
 #include <vtkCell.h>
@@ -112,7 +107,8 @@ VISU_GaussPtsAct
   myBarVisibility(true),
   myPickingSettings(NULL),
   myInsideCursorSettings(NULL),
-  myCurrentPL(NULL)
+  myCurrentPL(NULL),
+  myMapper(vtkPolyDataMapper::New())
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
 
@@ -152,6 +148,8 @@ VISU_GaussPtsAct
   myCellActor->GetProperty()->SetDiffuse(0.0);
 
   myScalarBarCtrl->Delete();
+
+  myMapper->Delete();
 }
 
 VISU_GaussPtsAct
@@ -184,27 +182,43 @@ VISU_GaussPtsAct
   return myGaussPointsPL.GetPointer();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::DeepCopy(VISU_Actor *theActor)
+{
+  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    Superclass::DeepCopy(theActor);
+    SetBarVisibility(anActor->GetBarVisibility());
+  }
+}
+
+//----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::ShallowCopyPL - this = "<<this);
-
+  
   Superclass::ShallowCopyPL(thePipeLine);
-
+  
   UpdateInsideCursorSettings();
-
+  
   Highlight(isHighlighted());
 }
 
 
 //----------------------------------------------------------------------------
+
 vtkMapper* 
 VISU_GaussPtsAct
 ::GetMapper()
 {
+  //vtkMapper* aMapper = myCurrentPL->GetPointSpriteMapper();
+  //aMapper->Update();
+  //return aMapper;
   myMapper->Update();
-  return Superclass::GetMapper();
+  return myMapper.GetPointer();
 }
 
 vtkFloatingPointType* 
@@ -229,6 +243,19 @@ VISU_GaussPtsAct
 }
 
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct
+::GetMemorySize()
+{
+  vtkDataSet* aDataSet = myDeviceActor->GetMapper()->GetInput();
+  unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+
+  aSize += Superclass::GetMemorySize();
+
+  return aSize;
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct
@@ -352,8 +379,7 @@ namespace
   CreatePipeLine(VISU_GaussPointsPL* thePipeLine)
   {
     VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
-    aPipeLine->SetGaussPtsIDMapper(thePipeLine->GetGaussPtsIDMapper());
-    aPipeLine->ShallowCopy(thePipeLine);
+    aPipeLine->ShallowCopy(thePipeLine, true);
     aPipeLine->Update();
     return aPipeLine;
   }
@@ -368,6 +394,8 @@ VISU_GaussPtsAct
   myDeviceActor->SetPipeLine(GetGaussPointsPL());
   myCurrentPL = myDeviceActor->GetPipeLine();
 
+  //SetMapper(myCurrentPL->GetPointSpriteMapper());
+
   myMapper->SetInput(myCurrentPL->GetPickableDataSet());
   SetMapper(myMapper.GetPointer());
 }
@@ -383,7 +411,7 @@ namespace
            VISU_GaussPointsPL* theGaussPointsPL)
   {
     vtkFloatingPointType aRadius = 0.5;
-    if(theGaussPointsPL->GetPSMapper()->GetPointSpriteMode() == 1) // Geometry mode
+    if(theGaussPointsPL->GetPointSpriteMapper()->GetPointSpriteMode() == 1) // Geometry mode
       aRadius *= theGaussPointsPL->GetSize() * theGaussPointsPL->GetAverageCellSize();
     else if(theGaussPointsPL->GetBicolor()){
       vtkFloatingPointType aVal = theScalarArray->GetTuple1(theVTKID);
@@ -683,8 +711,8 @@ VISU_GaussPtsAct
        if(anIsChanged){
          vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
          vtkDataSet* aDataSet = GetInput();
-         vtkCellData* aCellData = aDataSet->GetCellData();
-         if(vtkDataArray *aScalarArray = aCellData->GetScalars()){
+         vtkPointData* aPointData = aDataSet->GetPointData();
+         if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
            vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
            aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
            //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
@@ -896,7 +924,7 @@ VISU_GaussPtsAct
     vtkFloatingPointType aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
     //
     vtkDataSet* aDataSet = GetInput();
-    vtkCellData* aDataSetAttributes = aDataSet->GetCellData();
+    vtkPointData* aDataSetAttributes = aDataSet->GetPointData();
     //
     if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
       vtkFloatingPointType aVal = aScalarArray->GetTuple1(aVtkId);
@@ -933,18 +961,19 @@ VISU_GaussPtsAct
     }
 
     if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
-      if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
-       int aNbComp = aFloatArray->GetNumberOfComponents();
-       aStr<<"\nData: {";
-       int anId = 0;
-       while(anId < aNbComp){
-         vtkFloatingPointType aComp = aFloatArray->GetComponent(aVtkId,anId++);
-         aStr<<aComp;
-         if(anId < aNbComp)
-           aStr<<"; ";
-       }
-       aStr<<"}";
+      int aNbComp = aFieldArray->GetNumberOfComponents();
+      std::vector<vtkFloatingPointType> aTuple(aNbComp);
+      aFieldArray->GetTuple(aVtkId, &aTuple[0]);
+      
+      aStr<<"\nData: {";
+      int anId = 0;
+      while(anId < aNbComp){
+       vtkFloatingPointType aComp = aTuple[anId++];
+       aStr<<aComp;
+       if(anId < aNbComp)
+         aStr<<"; ";
       }
+      aStr<<"}";
     }
     //
     // myTextActor
@@ -963,7 +992,8 @@ VISU_GaussPtsAct
       
       myCellSource->Reset();
       myCellSource->Modified(); // a VTK bug
-      myCellSource->SetPoints(aParent->GetVTKOutput()->GetPoints());
+      vtkUnstructuredGrid* aDataSet = aParent->GetUnstructuredGridOutput();
+      myCellSource->SetPoints(aDataSet->GetPoints());
       
       VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
       vtkIdType aCellID = aGaussPointID.first;
@@ -1058,10 +1088,9 @@ VISU_GaussPtsAct
 
   VISU_GaussPointsPL* aPipeline = theActor->GetPipeLine();
 
-  SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
-  vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
+  vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
 
-  aPipeline->ShallowCopy(GetGaussPointsPL());
+  aPipeline->ShallowCopy(GetGaussPointsPL(), true);
 
   aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
 
@@ -1087,6 +1116,16 @@ VISU_GaussPtsAct
   Update();
 }
 
+//----------------------------------------------------------------------------
+unsigned long int 
+VISU_GaussPtsAct
+::GetMTime()
+{
+  unsigned long int aTime = Superclass::GetMTime();
+  aTime = std::max(aTime, myGaussPointsPL->GetPointSpriteMapper()->GetMTime() );
+  return aTime;
+}
+
 //==============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct1);
 
@@ -1214,9 +1253,8 @@ VISU_GaussPtsAct1
     myOutsideDeviceActor->SetPipeLine(aPipeLine);
     aPipeLine->Delete();
 
-    SALOME_ExtractGeometry* anExtractGeometry = aPipeLine->GetExtractGeometryFilter();
-    anExtractGeometry->SetExtractBoundaryCells(true);
-    anExtractGeometry->SetExtractInside(true);
+    aPipeLine->SetExtractBoundaryCells(true);
+    aPipeLine->SetExtractInside(true);
   }
 }
 
@@ -1334,15 +1372,14 @@ VISU_GaussPtsAct1
 
   VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine();
 
-  SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
-  vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
+  vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
   vtkFloatingPointType aMagnification = aPipeline->GetMagnification();
 
-  aPipeline->ShallowCopy(GetGaussPointsPL());
+  aPipeline->ShallowCopy(GetGaussPointsPL(), true);
 
   aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
-  anExtractGeometry->SetExtractBoundaryCells(true);
-  anExtractGeometry->SetExtractInside(true);
+  aPipeline->SetExtractBoundaryCells(true);
+  aPipeline->SetExtractInside(true);
   aPipeline->SetMagnification( aMagnification );
 
   aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
@@ -1362,15 +1399,15 @@ VISU_GaussPtsAct1
 
   if( myOutsideCursorSettings->GetUniform() )
   {
-    myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOff();
-    myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 1 ); // Geometry mode
+    myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOff();
+    myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 1 ); // Geometry mode
     myOutsideDeviceActor->GetProperty()->SetColor( myOutsideCursorSettings->GetColor() );
   }
   else
   {
-    myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
-    myOutsideDeviceActor->GetPSMapper()->SetColorModeToMapScalars();
-    myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOn();
+    myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
+    myOutsideDeviceActor->GetPointSpriteMapper()->SetColorModeToMapScalars();
+    myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOn();
   }
 
   aPipeline->Update();
@@ -1424,6 +1461,20 @@ VISU_GaussPtsAct1
   Superclass::OnInteractorEvent(theEvent);
 }
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct1
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+  if(IsSegmentationEnabled()){
+    aSize += myInsideDeviceActor->GetMemorySize();
+    aSize += myOutsideDeviceActor->GetMemorySize();
+  }
+  return aSize;
+}
+
+
 
 //==============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct2);
@@ -1497,6 +1548,17 @@ VISU_GaussPtsAct2
 }
 
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct2
+::GetMemorySize()
+{
+  if(IsSegmentationEnabled())
+    return Superclass::GetMemorySize();
+  return 0;
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct2
index 2603a820a9d7597ce4abf9fe7bbcbb44a8972bae..7396f591323888e833ce2ff229678ac50693c59e 100644 (file)
@@ -53,7 +53,7 @@ class VISU_CursorPyramid;
 class VISU_FramedTextActor;
 
 class vtkUnstructuredGrid;
-class vtkDataSetMapper;
+class vtkPolyDataMapper;
 class vtkDataArray;
 
 class vtkInteractorObserver;
@@ -94,6 +94,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   VISU_GaussPointsPL*
   GetGaussPointsPL();
 
+  //! Copies all properties from the given actor
+  virtual
+  void
+  DeepCopy(VISU_Actor *theActor);
+
   virtual
   void
   ShallowCopyPL(VISU_PipeLine* thePipeLine);
@@ -114,6 +119,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   vtkDataSet* 
   GetInput(); 
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
   //----------------------------------------------------------------------------
   virtual
   void
@@ -176,7 +186,9 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   bool
   GetBarVisibility();
 
-  virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+  virtual 
+  void
+  SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
 
   //! Return the information about pipeline magnification changing.
   /*! True indicates that magnification is increased, false - decreased. */
@@ -235,6 +247,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   int
   GetPickable();
 
+  //----------------------------------------------------------------------------
+  virtual
+  unsigned long int 
+  GetMTime();
+
  protected:
   //----------------------------------------------------------------------------
   VISU_GaussPtsAct();
@@ -297,6 +314,8 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
   VISU_GaussPointsPL* myCurrentPL;
   vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
 
+  vtkSmartPointer<vtkPolyDataMapper> myMapper;
+
   vtkIdType myLastObjPointID;
 
   vtkSmartPointer<VISU_FramedTextActor> myTextActor;
@@ -376,8 +395,15 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
   void
   SetTransform(VTKViewer_Transform* theTransform);
 
-  virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+  virtual 
+  void
+  SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
  protected:
   //----------------------------------------------------------------------------
   VISU_GaussPtsAct1();
@@ -455,8 +481,15 @@ class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
   void
   SetVisibility(int theMode);
 
-  virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+  virtual 
+  void
+  SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
  protected:
   //----------------------------------------------------------------------------
   VISU_GaussPtsAct2();
index 68efe38fe013e13a759f2b0bc3771a4c48020bd2..5e44009f3e9a3e39788a0d96889aff2d419fe1a8 100644 (file)
@@ -147,11 +147,25 @@ VISU_GaussPtsDeviceActor
 
 VISU_OpenGLPointSpriteMapper*
 VISU_GaussPtsDeviceActor
-::GetPSMapper()
+::GetPointSpriteMapper()
 {
   return myMapper.GetPointer();
 }
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsDeviceActor
+::GetMemorySize()
+{
+  vtkDataSet* aDataSet = GetMapper()->GetInput();
+  unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+
+  aSize += GetPipeLine()->GetMemorySize();
+
+  return aSize;
+}
+
+//----------------------------------------------------------------------------
 int
 VISU_GaussPtsDeviceActor
 ::GetPickable()
@@ -175,7 +189,7 @@ VISU_GaussPtsDeviceActor
 ::SetPipeLine(VISU_GaussPointsPL* thePipeLine) 
 {
   myPipeLine = thePipeLine;
-  myMapper = thePipeLine->GetPSMapper();
+  myMapper = thePipeLine->GetPointSpriteMapper();
   vtkPolyData* aDataSet = myMapper->GetInput();
 
   int anId = 0;
@@ -204,7 +218,7 @@ void
 VISU_GaussPtsDeviceActor
 ::ShallowCopyPL(VISU_GaussPointsPL* thePipeLine)
 {
-  myPipeLine->ShallowCopy(thePipeLine);
+  myPipeLine->ShallowCopy(thePipeLine, true);
 }
 
 
index 24dcb7b225b90fb1b9e26010e6e46f4d6a25364d..ee5bcf661f2ede45d6c2f3431f61710d08993dc9 100644 (file)
@@ -77,8 +77,13 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor
   ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
 
   VISU_OpenGLPointSpriteMapper*
-  GetPSMapper();
+  GetPointSpriteMapper();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
   virtual
   int
   GetPickable();
index 17a8072d4f138241a696ff659704d5d6cbff10f3..e98f301957566977d8b209c645f54af174d41ff0 100644 (file)
@@ -76,6 +76,20 @@ VISU_MeshAct
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::DeepCopy(VISU_Actor *theActor)
+{
+  if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
+    Superclass::DeepCopy(theActor);
+    GetSurfaceProperty()->DeepCopy(anActor->GetSurfaceProperty());
+    GetEdgeProperty()->DeepCopy(anActor->GetEdgeProperty());
+    GetNodeProperty()->DeepCopy(anActor->GetNodeProperty());
+  }
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_MeshAct
@@ -213,6 +227,37 @@ VISU_MeshAct
     myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
 }
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_MeshAct
+::GetMemorySize()
+{
+  vtkDataSet* aDataSet;
+  unsigned long int aSize = Superclass::GetMemorySize();
+  {
+    aDataSet = mySurfaceActor->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+    aDataSet = mySurfaceActor->GetMapper()->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024 * 2;
+  }
+  {
+    aDataSet = myEdgeActor->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+    aDataSet = myEdgeActor->GetMapper()->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024 * 2;
+  }
+  {
+    aDataSet = myNodeActor->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+    aDataSet = myNodeActor->GetMapper()->GetInput();
+    aSize += aDataSet->GetActualMemorySize() * 1024 * 2;
+  }
+  return aSize;
+}
+
 //----------------------------------------------------------------------------
 int
 VISU_MeshAct
index bc358e6be37aa15e4f1d42aadbcf4d6dae9942c5..3ca1e471e946d86d0995a52fe1c0c8ea88fc8ccf 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef VISU_MeshAct_HeaderFile
 #define VISU_MeshAct_HeaderFile
 
-#include "VISU_Actor.h"
+#include "VISU_DataSetActor.h"
 #include "SVTK_DeviceActor.h"
 
 namespace SVTK
@@ -40,11 +40,18 @@ namespace SVTK
   }
 }
 
-class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor 
+class VTKOCC_EXPORT VISU_MeshAct : public VISU_DataSetActor 
 {
  public:
-  vtkTypeMacro(VISU_MeshAct,VISU_Actor);
-  static VISU_MeshAct* New();
+  vtkTypeMacro(VISU_MeshAct,VISU_DataSetActor);
+  static 
+  VISU_MeshAct* 
+  New();
+
+  //! Copies all properties from the given actor
+  virtual
+  void
+  DeepCopy(VISU_Actor *theActor);
 
   //! Apply view transformation
   virtual
@@ -99,6 +106,11 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor
   void
   UnShrink(); 
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
   virtual
   int
   RenderOpaqueGeometry(vtkViewport *ren);
index e9ce7e184fc283863a2acd8d028457c61e2fd6a8..b7c76f27d13179dabf28b01816312dfa374661c0 100644 (file)
 #include <vtkRenderer.h>
 #include <vtkProperty.h>
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_ScalarMapAct);
 
+//----------------------------------------------------------------------------
 VISU_ScalarMapAct
 ::VISU_ScalarMapAct()
 {
@@ -52,12 +54,27 @@ VISU_ScalarMapAct
   myProperty->DeepCopy(aProperty);
 }
 
+//----------------------------------------------------------------------------
 VISU_ScalarMapAct
 ::~VISU_ScalarMapAct()
 {
   myScalarBar->Delete();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapAct
+::DeepCopy(VISU_Actor *theActor)
+{
+  if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+    Superclass::DeepCopy(theActor);
+    SetBarVisibility(anActor->GetBarVisibility());
+    SetShading(anActor->IsShading());
+  }
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::AddToRender(vtkRenderer* theRenderer)
@@ -68,6 +85,7 @@ VISU_ScalarMapAct
     theRenderer->AddActor2D(myScalarBar);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::RemoveFromRender(vtkRenderer* theRenderer)
@@ -78,6 +96,7 @@ VISU_ScalarMapAct
   Superclass::RemoveFromRender(theRenderer);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::SetVisibility(int theMode)
@@ -88,6 +107,7 @@ VISU_ScalarMapAct
     myScalarBar->SetVisibility(myBarVisibility && theMode);
 }
 
+//----------------------------------------------------------------------------
 int 
 VISU_ScalarMapAct
 ::GetBarVisibility()
@@ -95,6 +115,7 @@ VISU_ScalarMapAct
   return myBarVisibility;
 }
 
+//----------------------------------------------------------------------------
 VISU_ScalarBarActor*
 VISU_ScalarMapAct
 ::GetScalarBar()
@@ -102,15 +123,18 @@ VISU_ScalarMapAct
   return myScalarBar;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::SetBarVisibility(bool theMode)
 {
   myBarVisibility = theMode;
-  if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility);
+  if(myScalarBar) 
+    myScalarBar->SetVisibility(myBarVisibility);
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::SetRepresentation(int theMode) 
@@ -121,6 +145,7 @@ VISU_ScalarMapAct
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_ScalarMapAct
 ::SetShading(bool theOn)
@@ -139,6 +164,7 @@ VISU_ScalarMapAct
     }
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU_ScalarMapAct
 ::IsShading()
@@ -147,3 +173,13 @@ VISU_ScalarMapAct
   
   return (aProperty->GetAmbient() == 0 && aProperty->GetDiffuse() == 1);
 }
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ScalarMapAct
+::GetMemorySize()
+{
+  return Superclass::GetMemorySize();
+}
+
+//----------------------------------------------------------------------------
index 0b6a4839f7cb47074275a37b2088a51195682995..9145403f22f8e76b400e52fc89552c129f1b651e 100644 (file)
 #ifndef VISU_ScalarMapAct_HeaderFile
 #define VISU_ScalarMapAct_HeaderFile
 
-#include "VISU_Actor.h"
+#include "VISU_DataSetActor.h"
 
 class VISU_ScalarBarActor;
 
-class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor 
+class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor 
 {
  public:
-  vtkTypeMacro(VISU_ScalarMapAct,VISU_Actor);
+  vtkTypeMacro(VISU_ScalarMapAct,VISU_DataSetActor);
 
   static
   VISU_ScalarMapAct* 
@@ -44,6 +44,11 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor
 
   ~VISU_ScalarMapAct();
 
+  //! Copies all properties from the given actor
+  virtual
+  void
+  DeepCopy(VISU_Actor *theActor);
+
   virtual
   void
   AddToRender(vtkRenderer* theRenderer); 
@@ -80,6 +85,11 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor
   bool
   IsShading();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
  protected:
   VISU_ScalarMapAct();
   bool myBarVisibility;
index 6fc38567287e87d8a716892c115d4ea94a70844b..3fd30ebd20806e848ca20d101fd71575d75eb9e5 100644 (file)
@@ -60,8 +60,7 @@ VISU_VectorsAct
 ::SetPipeLine(VISU_PipeLine* thePipeLine) 
 {
   myVectorsPL = dynamic_cast<VISU_VectorsPL*>(thePipeLine);
-  VISU_Actor::SetPipeLine(myVectorsPL);
-  myVectorsPL->Delete();
+  VISU_Actor::SetPipeLine(myVectorsPL.GetPointer());
 }
 
 
@@ -105,3 +104,16 @@ VISU_VectorsAct
   }
   vtkLODActor::SetMapper(theMapper);
 }
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_VectorsAct
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  aSize += GetPipeLine()->GetMemorySize();
+
+  return aSize;
+}
index c9d2d0624077cd06a7fa61b78b49ef5bec4fbc63..cc76ce4867ac088aca2d862266239c82b518f31d 100644 (file)
 
 #include "VISU_ScalarMapAct.h"
 
+#include <vtkSmartPointer.h>
+
 class VTKViewer_Transform;
 class VISU_VectorsPL;
 
-class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct {
+class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct 
+{
  public:
   vtkTypeMacro(VISU_VectorsAct,VISU_ScalarMapAct);
 
@@ -58,11 +61,16 @@ class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct {
   void
   SetMapper(vtkMapper* theMapper); 
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
  protected:
   VISU_VectorsAct();
   ~VISU_VectorsAct();
 
-  VISU_VectorsPL* myVectorsPL;
+  vtkSmartPointer<VISU_VectorsPL> myVectorsPL;
 };
 
 #endif
index 198eadded5ef6a7b3c79f9f14220b12abd97ed5a..bd742c2b314f27d0eb1f88148a872a54775d0b7e 100644 (file)
@@ -33,61 +33,74 @@ VPATH=.:@srcdir@
 @COMMENCE@
 
 EXPORT_HEADERS = \
+       VISU_MapperHolder.hxx \
+       VISU_DataSetMapperHolder.hxx \
+       VISU_PolyDataMapperHolder.hxx \
+       VISU_PointSpriteMapperHolder.hxx \
        VISU_PipeLine.hxx \
+       VISU_ColoredPL.hxx \
+       VISU_UnstructuredGridPL.hxx \
+       VISU_ScalarMapPL.hxx \
+       VISU_DeformedShapePL.hxx \
+       VISU_GaussPointsPL.hxx \
        VISU_PipeLineUtils.hxx \
        VISU_MeshPL.hxx \
-       VISU_ScalarMapPL.hxx \
        VISU_CutPlanesPL.hxx \
        VISU_CutLinesPL.hxx \
        VISU_IsoSurfacesPL.hxx \
-       VISU_DeformedShapePL.hxx \
        VISU_VectorsPL.hxx \
        VISU_StreamLinesPL.hxx \
+       VISU_Plot3DPL.hxx \
+       VISU_ScalarMapOnDeformedShapePL.hxx \
        VISU_LookupTable.hxx \
        VISU_ScalarBarActor.hxx \
        VISU_Extractor.hxx \
        VISU_FieldTransform.hxx \
        VISU_UsedPointsFilter.hxx \
-       VISU_GaussPointsPL.hxx \
-       VISU_Plot3DPL.hxx \
        VISU_OpenGLPointSpriteMapper.hxx \
        VISU_ImplicitFunctionWidget.hxx \
        SALOME_ExtractGeometry.h \
+       SALOME_ExtractPolyDataGeometry.h \
        VISU_ScalarBarCtrl.hxx \
        VISU_PlanesWidget.hxx \
        VISU_SphereWidget.hxx \
-       VISU_WidgetCtrl.hxx \
-       VISU_ScalarMapOnDeformedShapePL.hxx
+       VISU_WidgetCtrl.hxx
 
 # Libraries targets
-
 LIB = libVisuPipeLine.la
 LIB_SRC = \
+       VISU_MapperHolder.cxx \
+       VISU_DataSetMapperHolder.cxx \
+       VISU_PolyDataMapperHolder.cxx \
+       VISU_PointSpriteMapperHolder.cxx \
+       VISU_Extractor.cxx \
        VISU_PipeLine.cxx \
-       VISU_PipeLineUtils.cxx \
-       VISU_MeshPL.cxx \
+       VISU_ColoredPL.cxx \
+       VISU_UnstructuredGridPL.cxx \
        VISU_ScalarMapPL.cxx \
+       VISU_DeformedShapePL.cxx \
+       VISU_GaussPointsPL.cxx \
+       VISU_MeshPL.cxx \
        VISU_CutPlanesPL.cxx \
        VISU_CutLinesPL.cxx \
        VISU_IsoSurfacesPL.cxx \
-       VISU_DeformedShapePL.cxx \
        VISU_VectorsPL.cxx \
        VISU_StreamLinesPL.cxx \
+       VISU_Plot3DPL.cxx \
+       VISU_ScalarMapOnDeformedShapePL.cxx \
        VISU_LookupTable.cxx \
        VISU_ScalarBarActor.cxx \
-       VISU_Extractor.cxx \
        VISU_FieldTransform.cxx \
        VISU_UsedPointsFilter.cxx \
-       VISU_GaussPointsPL.cxx \
-       VISU_Plot3DPL.cxx \
        SALOME_ExtractGeometry.cxx \
+       SALOME_ExtractPolyDataGeometry.cxx \
        VISU_OpenGLPointSpriteMapper.cxx \
        VISU_ImplicitFunctionWidget.cxx \
        VISU_PlanesWidget.cxx \
        VISU_SphereWidget.cxx \
        VISU_WidgetCtrl.cxx \
        VISU_ScalarBarCtrl.cxx \
-       VISU_ScalarMapOnDeformedShapePL.cxx
+       VISU_PipeLineUtils.cxx
 
 # Executables targets
 
index 03cf524cb6eac36bec31a1eb56b99213ff7ebffa..ad5dbd60fbcd98714b8511239dbd697586824272 100755 (executable)
@@ -32,8 +32,6 @@
 #include <vtkImplicitBoolean.h>
 #include <vtkImplicitFunctionCollection.h>
 
-using namespace std;
-
 #if defined __GNUC__
   #if __GNUC__ == 2
     #define __GNUC_2__
@@ -57,16 +55,6 @@ SALOME_ExtractGeometry
 {}
 
 
-//----------------------------------------------------------------------------
-unsigned long int 
-SALOME_ExtractGeometry
-::GetMTime()
-{
-  unsigned long int aTime = vtkExtractGeometry::GetMTime();
-  return aTime;
-}
-
-
 //----------------------------------------------------------------------------
 vtkImplicitBoolean* 
 SALOME_ExtractGeometry
@@ -81,7 +69,7 @@ SALOME_ExtractGeometry
 ::SetImplicitFunction(vtkImplicitFunction* theImplicitFunction)  
 {
   myImplicitBoolean = dynamic_cast<vtkImplicitBoolean*>(theImplicitFunction);
-  vtkExtractGeometry::SetImplicitFunction(theImplicitFunction);
+  Superclass::SetImplicitFunction(theImplicitFunction);
 }
 
 
@@ -90,8 +78,10 @@ void
 SALOME_ExtractGeometry
 ::SetStoreMapping(bool theStoreMapping)
 {
-  myStoreMapping = theStoreMapping;
-  Modified();
+  if(myStoreMapping != theStoreMapping){
+    myStoreMapping = theStoreMapping;
+    Modified();
+  }
 }
 
 bool 
@@ -107,9 +97,9 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetElemVTKId(vtkIdType theID)
 {
-  if(!myStoreMapping||myIsDoneShallowCopy){
+  if(!myStoreMapping || myIsDoneShallowCopy)
     return theID;
-  }
+
   vtkIdType iEnd = myElemVTK2ObjIds.size();
   for(vtkIdType i = 0; i < iEnd; i++)
     if(myElemVTK2ObjIds[i] == theID)
@@ -122,9 +112,9 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetNodeVTKId(vtkIdType theID)
 {
-  if (!myStoreMapping||myIsDoneShallowCopy){
+  if(!myStoreMapping || myIsDoneShallowCopy)
     return theID;
-  }
+
   vtkIdType iEnd = myNodeVTK2ObjIds.size();
   for(vtkIdType i = 0; i < iEnd; i++)
     if(myNodeVTK2ObjIds[i] == theID)
@@ -139,13 +129,12 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetElemObjId(int theVtkID)
 {
-  if (!myStoreMapping||myIsDoneShallowCopy){
+  if(!myStoreMapping || myIsDoneShallowCopy)
     return theVtkID;
-  }
-  //
-  if (theVtkID<myElemVTK2ObjIds.size()){
+
+  if(theVtkID < myElemVTK2ObjIds.size())
     return myElemVTK2ObjIds[theVtkID];
-  }
+
   return -1;
 }
 
@@ -154,13 +143,12 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetNodeObjId(int theVtkID)
 {
-  if (!myStoreMapping||myIsDoneShallowCopy){
+  if(!myStoreMapping || myIsDoneShallowCopy)
     return theVtkID;
-  }
-  //
-  if (theVtkID<myNodeVTK2ObjIds.size()){
+
+  if(theVtkID < myNodeVTK2ObjIds.size())
     return myNodeVTK2ObjIds[theVtkID];
-  }
+
   return -1;
 }
 
@@ -175,21 +163,18 @@ SALOME_ExtractGeometry
   //
   myIsDoneShallowCopy = !this->ImplicitFunction;
 
-  if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
-    if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
+  if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer())
+    if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction())
       myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
-    }
-  }
-
-  if(myIsDoneShallowCopy){
+  
+  if(myIsDoneShallowCopy)
     GetOutput()->ShallowCopy(GetInput());
-    Modified();
-    return;
-  }
-
-  Execute2();
+  else
+    Execute2();
 }
 
+
+//----------------------------------------------------------------------------
 void
 SALOME_ExtractGeometry
 ::Execute2()
index 6fcb07b6ea57900dcf49ff9c7892f67d646fffd3..5fef80821c58cf526d3ac94ec862e9ece60cb312 100755 (executable)
@@ -20,8 +20,6 @@
 #ifndef SALOME_ExtractGeometry_H
 #define SALOME_ExtractGeometry_H
 
-#include "VTKViewer.h"
-
 #include <vtkExtractGeometry.h>
 #include <vtkSmartPointer.h>
 
@@ -32,23 +30,22 @@ class vtkImplicitBoolean;
 class SALOME_ExtractGeometry : public vtkExtractGeometry
 {
 public:
-  vtkTypeMacro(SALOME_ExtractGeometry,vtkExtractGeometry);
+  vtkTypeMacro(SALOME_ExtractGeometry, vtkExtractGeometry);
 
-  static SALOME_ExtractGeometry *New();
+  static 
+  SALOME_ExtractGeometry*
+  New();
 
   virtual
   void
   SetImplicitFunction(vtkImplicitFunction* theImplicitFunction); 
 
-  virtual
-  unsigned long int
-  GetMTime();
-
   vtkImplicitBoolean* 
   GetImplicitBoolean();
 
   bool 
   GetStoreMapping() const;
+
   void
   SetStoreMapping(bool theStoreMapping);
 
@@ -78,6 +75,7 @@ protected:
 private:
   bool myStoreMapping;
   bool myIsDoneShallowCopy;
+
   typedef std::vector<vtkIdType> TVectorId;
   TVectorId myElemVTK2ObjIds;
   TVectorId myNodeVTK2ObjIds;
index 2af09bb99c4423d97d9fb0f57575c8a4bd7b2d9c..e192a47e6bbc84ea0e21128feed6d6ea340a9969 100644 (file)
@@ -24,7 +24,6 @@
 // Author:  Alexey PETROV
 // Module : VISU
 
-#include "VISU_Convertor.hxx"
 #include "VISU_MeshPL.hxx"
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_IsoSurfacesPL.hxx"
@@ -35,6 +34,9 @@
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_GaussPointsPL.hxx"
 #include "VISU_Plot3DPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
+
+#include "VISU_Convertor.hxx"
 
 typedef VISU_GaussPointsPL TPresent;
 
@@ -56,7 +58,91 @@ using namespace std;
 
 static int isOnlyMesh = false;
 
-int main(int argc, char** argv){
+//#define _DEBUG_ID_MAPPING_
+
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+               const std::string& theMeshName,
+               const VISU::TEntity& theEntity,
+               const std::string& theFieldName,
+               int theTimeStampNumber);
+
+
+//----------------------------------------------------------------------------
+template<>
+VISU_ColoredPL*
+CreateColoredPL<VISU_GaussPointsPL>(VISU_Convertor* theConvertor,
+                                   const std::string& theMeshName,
+                                   const VISU::TEntity& theEntity,
+                                   const std::string& theFieldName,
+                                   int theTimeStampNumber)
+{
+  VISU_GaussPointsPL* aPresent = VISU_GaussPointsPL::New();
+  VISU::PGaussPtsIDMapper aGaussPtsIDMapper = 
+    theConvertor->GetTimeStampOnGaussPts(theMeshName,
+                                        theEntity,
+                                        theFieldName,
+                                        theTimeStampNumber);
+  aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+
+  char aMainTexture[80];
+  strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+  strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+  
+  char anAlphaTexture[80];
+  strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+  strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+  
+  vtkSmartPointer<vtkImageData> aTextureValue = 
+    VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+  aPresent->SetImageData( aTextureValue.GetPointer() );
+
+  aPresent->Update();
+
+#ifdef _DEBUG_ID_MAPPING_
+  vtkDataSet* aDataSet = aPresent->GetOutput();
+  aDataSet->Update();
+  int aNbCells = aDataSet->GetNumberOfCells();
+  cout<<"aNbCells = "<<aNbCells<<endl;
+  for(int anCellId = 0; anCellId < aNbCells; anCellId++){
+    vtkIdType anObjID = aPresent->GetNodeObjID(anCellId);
+    vtkIdType aVtkID = aPresent->GetNodeVTKID(anObjID);
+    cout<<anObjID<<"; "<<aVtkID<<"; - ";
+    vtkFloatingPointType* aCoord = aPresent->GetNodeCoord(anObjID);
+    cout<<aCoord[0]<<"; "<<aCoord[1]<<"; "<<aCoord[2]<<endl;
+  }
+#endif
+
+  return aPresent;
+}
+
+
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+               const std::string& theMeshName,
+               const VISU::TEntity& theEntity,
+               const std::string& theFieldName,
+               int theTimeStampNumber)
+{
+  TPipeLine* aPresent = TPipeLine::New();
+  VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper = 
+    theConvertor->GetTimeStampOnMesh(theMeshName,
+                                    theEntity,
+                                    theFieldName,
+                                    theTimeStampNumber);
+  aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper);
+  return aPresent;
+}
+
+
+//----------------------------------------------------------------------------
+int
+main(int argc, char** argv)
+{
   try{
     if(argc > 1){
       vtkRenderWindow *renWin = vtkRenderWindow::New();
@@ -80,13 +166,11 @@ int main(int argc, char** argv){
        const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
        aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
 
-       VISU::PIDMapper anIDMapper = 
+       VISU::PNamedIDMapper anIDMapper = 
          aConvertor->GetMeshOnEntity(aMeshName,anEntity);
-       VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
 
        VISU_MeshPL* aPresent = VISU_MeshPL::New();
-       aPresent->SetInput(aDataSet);
-       aPresent->Build();
+       aPresent->SetUnstructuredGridIDMapper(anIDMapper);
 
        vtkActor* aActor = vtkActor::New();
        aActor->SetMapper(aPresent->GetMapper());
@@ -118,35 +202,22 @@ int main(int argc, char** argv){
          if(aValFieldIter == aValField.end()) return 0;
          int aTimeStamp = aValFieldIter->first;
 
-         TPresent* aPresent = TPresent::New();
-         VISU::PIDMapper anIDMapper;
+         VISU_ColoredPL* aPresent = NULL;
          if(anEntity != VISU::NODE_ENTITY){
-           VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
-           aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+           aPresent = CreateColoredPL<TPresent>(aConvertor,
+                                                aMeshName,
+                                                anEntity,
+                                                aFieldName,
+                                                aTimeStamp);
          }else{
            continue;
-           VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-           aPresent->SetIDMapper(anIDMapper);
+           aPresent = CreateColoredPL<TPresent>(aConvertor,
+                                                aMeshName,
+                                                anEntity,
+                                                aFieldName,
+                                                aTimeStamp);
          }
 
-         aPresent->Build();
-         aPresent->Init();
-
-         char aMainTexture[80];
-         strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
-         strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
-         //cout << aMainTexture << endl;
-
-         char anAlphaTexture[80];
-         strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
-         strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
-         //cout << anAlphaTexture << endl;
-
-         vtkSmartPointer<vtkImageData> aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
-         aPresent->SetImageData( aTextureValue.GetPointer() );
-
-         aPresent->Update();
-
          vtkActor* anActor = vtkActor::New();
          anActor->SetMapper(aPresent->GetMapper());
 
index a7561e48721ccd0a10fd1927e45c0f2d6a139f18..0c81eee16c09b9a795876733b973cae716cb6cd8 100644 (file)
 
 #include <vtkAppendPolyData.h>
 
-using namespace std;
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_CutLinesPL);
 
+
+//----------------------------------------------------------------------------
 VISU_CutLinesPL
 ::VISU_CutLinesPL()
 {
@@ -41,10 +43,15 @@ VISU_CutLinesPL
   myPosition = 0;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
                   aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
@@ -54,14 +61,15 @@ VISU_CutLinesPL
     else
       SetPosition(aPipeLine->GetPosition());
   }
-  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
 ::Init()
 {
-  VISU_CutPlanesPL::Init();
+  Superclass::Init();
 
   myBasePlane[0] = XY;
   myBasePlane[1] = YZ;
@@ -74,6 +82,7 @@ VISU_CutLinesPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
 ::SetPosition(vtkFloatingPointType thePosition)
@@ -82,21 +91,35 @@ VISU_CutLinesPL
   myCondition = 0;
   Modified();
 }
+
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_CutLinesPL
 ::GetPosition()
 {
   vtkFloatingPointType aPosition = myPosition;
   if(myCondition){
-      vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetInput2()->GetBounds(aBounds);
-      GetDir(aDir,myAng[0],myBasePlane[0]);
-      GetBoundProject(aBoundPrj,aBounds,aDir);
-      aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[0];
+      vtkFloatingPointType aBounds[6];
+      GetClippedInput()->GetBounds(aBounds);
+
+      vtkFloatingPointType aDir[3];
+      GetDir(aDir,
+            myAng[0],
+            myBasePlane[0]);
+
+      vtkFloatingPointType aBoundPrj[3];
+      GetBoundProject(aBoundPrj,
+                     aBounds,
+                     aDir);
+
+      aPosition = aBoundPrj[0] + aBoundPrj[2] * myDisplacement[0];
   }
   return aPosition;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
 ::SetDefault()
@@ -104,6 +127,9 @@ VISU_CutLinesPL
   myCondition = 1;
   Modified();
 }
+
+
+//----------------------------------------------------------------------------
 int
 VISU_CutLinesPL
 ::IsDefault()
@@ -113,48 +139,82 @@ VISU_CutLinesPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
 ::Update()
 {
   ClearAppendPolyData(myAppendPolyData);
+
   SetPartPosition(1);
+
   vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
+
   //Build base plane
-  vtkFloatingPointType aDir[2][3], aBaseBounds[6];
-  GetInput2()->GetBounds(aBaseBounds);
-  GetDir(aDir[0],myAng[0],myBasePlane[0]);
-  vtkUnstructuredGrid* anUnstructuredGrid =
-    myFieldTransform->GetUnstructuredGridOutput();
-  CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
-               myPosition,myCondition,myDisplacement[0]);
+  vtkFloatingPointType aBaseBounds[6];
+  GetClippedInput()->GetBounds(aBaseBounds);
+
+  vtkFloatingPointType aDir[2][3];
+  GetDir(aDir[0],
+        myAng[0],
+        myBasePlane[0]);
+
+  vtkUnstructuredGrid* aGrid = GetFieldTransformFilter()->GetUnstructuredGridOutput();
+  CutWithPlanes(anAppendPolyData,
+               aGrid,1,
+               aDir[0],
+               aBaseBounds,
+               myPosition,
+               myCondition,
+               myDisplacement[0]);
   //Build lines
-  vtkFloatingPointType aBounds[6];
   vtkDataSet *aDataSet = anAppendPolyData->GetOutput();
   aDataSet->Update();
+
   if(aDataSet->GetNumberOfCells() == 0)
-    aDataSet = anUnstructuredGrid;
+    aDataSet = aGrid;
+
+  vtkFloatingPointType aBounds[6];
   aDataSet->GetBounds(aBounds);
-  GetDir(aDir[1],myAng[1],myBasePlane[1]);
-  VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,aDataSet,GetNbParts(),aDir[1],aBounds,
-                                 myPartPosition,myPartCondition,myDisplacement[1]);
-  anAppendPolyData->Register(myAppendPolyData);
+
+  GetDir(aDir[1],
+        myAng[1],
+        myBasePlane[1]);
+
+  VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,
+                                 aDataSet,
+                                 GetNbParts(),
+                                 aDir[1],
+                                 aBounds,
+                                 myPartPosition,
+                                 myPartCondition,
+                                 myDisplacement[1]);
   anAppendPolyData->Delete();
+
   //Calculate values for building of table
   vtkMath::Cross(aDir[0],aDir[1],myDirLn);
-  for (int i=0; i<3 ; i++) {
+  for (int i = 0; i<3 ; i++) {
     myRealDirLn[i] = myDirLn[i];
-    if(myDirLn[i]<0) myDirLn[i] = (-1)*myDirLn[i];//enk:: correction of bug Bug PAL10401
+    if(myDirLn[i] < 0.0) 
+      myDirLn[i] = -1.0*myDirLn[i];//enk:: correction of bug Bug PAL10401
   }
-  GetBoundProject(myBoundPrjLn, aBaseBounds, myDirLn);
-  VISU::Mul(myDirLn,myBoundPrjLn[0],myBasePnt);
+
+  GetBoundProject(myBoundPrjLn, 
+                 aBaseBounds, 
+                 myDirLn);
+
+  VISU::Mul(myDirLn,
+           myBoundPrjLn[0],
+           myBasePnt);
   
-  CorrectPnt(myBasePnt,aBaseBounds);
+  CorrectPnt(myBasePnt,
+            aBaseBounds);
 
   VISU_ScalarMapPL::Update();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutLinesPL
 ::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
@@ -166,8 +226,17 @@ VISU_CutLinesPL
                int thePartCondition,
                vtkFloatingPointType theDisplacement)
 {
-  vector<vtkFloatingPointType> aPartPosition(1,thePartPosition);
-  vector<int> aPartCondition(1,thePartCondition);
-  VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,theDataSet,theNbPlanes,theDir,theBounds,
-                                 aPartPosition,aPartCondition,theDisplacement);
+  std::vector<vtkFloatingPointType> aPartPosition(1,thePartPosition);
+  std::vector<int> aPartCondition(1,thePartCondition);
+  VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,
+                                 theDataSet,
+                                 theNbPlanes,
+                                 theDir,
+                                 theBounds,
+                                 aPartPosition,
+                                 aPartCondition,
+                                 theDisplacement);
 }
+
+
+//----------------------------------------------------------------------------
index ec7c8defb354048c157bc4f1a11ab86f2befb745..6332bcde4728cb5353a7c8f2aa1d470449df2d99 100644 (file)
 
 class vtkAppendPolyData;
 
-class VISU_CutLinesPL : public VISU_CutPlanesPL{
-protected:
-  VISU_CutLinesPL();
-  VISU_CutLinesPL(const VISU_CutLinesPL&);
+
+//----------------------------------------------------------------------------
+class VISU_CutLinesPL : public VISU_CutPlanesPL
+{
 public:
   vtkTypeMacro(VISU_CutLinesPL,VISU_CutPlanesPL);
 
@@ -42,10 +42,6 @@ public:
   VISU_CutLinesPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetPosition(vtkFloatingPointType thePosition);
@@ -82,31 +78,56 @@ public:
                int thePlaneCondition,
                vtkFloatingPointType theDisplacement);
 
-  const vtkFloatingPointType* 
-  GetDirLn()
-  {
-    return myDirLn;
-  }
-
+  //! Returns direction that is defined by position & orientation of the basic and tool planes
   const vtkFloatingPointType* 
   GetRealDirLn()
   {
     return myRealDirLn;
   }
 
+  /*! 
+    Returns direction that corresponds to the myRealDirLn,
+    but has the same direction as main axis.
+  */
   const vtkFloatingPointType* 
-  GetBoundPrjLn()
+  GetDirLn()
   {
-    return myBoundPrjLn;
+    return myDirLn;
   }
 
+  /*!
+    Returns coordinates of 3D point that shows 
+    where is the first intersection of the given mesh.
+    with the defined direction.
+  */
   const vtkFloatingPointType* 
   GetBasePnt()
   { 
     return myBasePnt;
   }
 
+  /*!
+    Returns three floating point numbers that defines the following values:
+    1. Distance between the initial point of intersection and origin of coordinates;
+    2. Distance between the last point of intersection and origin of coordinates;
+    3. Distance between the last point and initial points of intersection.
+    with the defined direction.
+  */
+  const vtkFloatingPointType* 
+  GetBoundPrjLn()
+  {
+    return myBoundPrjLn;
+  }
+
 protected:
+  VISU_CutLinesPL();
+  VISU_CutLinesPL(const VISU_CutLinesPL&);
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
   vtkFloatingPointType myDirLn[3];
   vtkFloatingPointType myRealDirLn[3];
   vtkFloatingPointType myBoundPrjLn[3];
index c1780194a75ac10a7406e36702feed48612b0cbe..ea2b5647047178832e679078a578a7a89f871122 100644 (file)
 #include <vtkCutter.h>
 #include <vtkPlane.h>
 
-using namespace std;
-
 static vtkFloatingPointType EPS = 1.0E-3;
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_CutPlanesPL);
 
+
+//----------------------------------------------------------------------------
 VISU_CutPlanesPL
 ::VISU_CutPlanesPL()
 {
+  SetIsShrinkable(false);
+
   myAppendPolyData = vtkAppendPolyData::New();
-  myIsShrinkable = false;
 
   myNbParts = 10;
 
@@ -56,32 +59,46 @@ VISU_CutPlanesPL
   myAng[1][0] = myAng[1][1] = myAng[1][2] = 0.0;
 }
 
+
+//----------------------------------------------------------------------------
 VISU_CutPlanesPL
 ::~VISU_CutPlanesPL()
 {
   myAppendPolyData->Delete();
+  myAppendPolyData = NULL;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
+
     SetOrientation(aPipeLine->GetPlaneOrientation(),
-                  aPipeLine->GetRotateX(),aPipeLine->GetRotateY());
+                  aPipeLine->GetRotateX(),
+                  aPipeLine->GetRotateY());
+
     SetDisplacement(aPipeLine->GetDisplacement());
+
     SetNbParts(aPipeLine->GetNbParts());
-    for (int i = 0, iend = GetNbParts(); i < iend; i++)
-      if(!aPipeLine->IsPartDefault(i))         SetPartPosition(i, aPipeLine->GetPartPosition(i));
+    for (int i = 0, iEnd = GetNbParts(); i < iEnd; i++)
+      if(!aPipeLine->IsPartDefault(i))         
+       SetPartPosition(i, aPipeLine->GetPartPosition(i));
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
 
   SetNbParts(10);
   myBasePlane[0] = YZ;
@@ -89,30 +106,67 @@ VISU_CutPlanesPL
   myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
 }
 
-VISU_ScalarMapPL::THook* 
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_CutPlanesPL
-::DoHook()
+::InsertCustomPL()
 {
   return myAppendPolyData->GetOutput();
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::Update()
 {
   ClearAppendPolyData(myAppendPolyData);
+
   SetPartPosition();
+
   vtkFloatingPointType aDir[3];
-  GetDir(aDir,myAng[0],myBasePlane[0]);
+  GetDir(aDir, 
+        myAng[0], 
+        myBasePlane[0]);
+
   vtkFloatingPointType aBounds[6];
-  GetInput2()->GetBounds(aBounds);
-  vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput();
-  CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds,
-               myPartPosition,myPartCondition,myDisplacement[0]);
+  GetClippedInput()->GetBounds(aBounds);
+
+  vtkDataSet* aDataSet = GetFieldTransformFilter()->GetUnstructuredGridOutput();
+  CutWithPlanes(myAppendPolyData,
+               aDataSet,
+               myNbParts,
+               aDir,
+               aBounds,
+               myPartPosition, 
+               myPartCondition, 
+               myDisplacement[0]);
+
+  Superclass::Update();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_CutPlanesPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
 
-  VISU_ScalarMapPL::Update();
+  if(vtkDataSet* aDataSet = myAppendPolyData->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  int anEnd = myAppendPolyData->GetNumberOfInputs();
+  for(int anId = 0; anId < anEnd; anId++)
+    if(vtkDataSet* aDataSet = myAppendPolyData->GetInput(anId))
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::SetPartPosition(int theNum)
@@ -130,6 +184,8 @@ VISU_CutPlanesPL
     theAppendPolyData->RemoveInput(theAppendPolyData->GetInput(i));
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType* 
 VISU_CutPlanesPL::
 GetRx(vtkFloatingPointType theRx[3][3], 
@@ -142,6 +198,8 @@ GetRx(vtkFloatingPointType theRx[3][3],
 }
 
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType* 
 VISU_CutPlanesPL
 ::GetRy(vtkFloatingPointType theRy[3][3], 
@@ -154,6 +212,7 @@ VISU_CutPlanesPL
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType* 
 VISU_CutPlanesPL
 ::GetRz(vtkFloatingPointType theRz[3][3], 
@@ -166,6 +225,7 @@ VISU_CutPlanesPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::CorrectPnt(vtkFloatingPointType thePnt[3], 
@@ -177,6 +237,8 @@ VISU_CutPlanesPL
   }
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::GetBoundProject(vtkFloatingPointType BoundPrj[3], 
@@ -204,6 +266,7 @@ VISU_CutPlanesPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
@@ -225,6 +288,7 @@ VISU_CutPlanesPL
 }
 
 
+//----------------------------------------------------------------------------
 const VISU_CutPlanesPL::PlaneOrientation& 
 VISU_CutPlanesPL
 ::GetPlaneOrientation(int theNum)
@@ -244,6 +308,8 @@ VISU_CutPlanesPL
   return 0;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_CutPlanesPL
 ::GetRotateY(int theNum)
@@ -257,41 +323,76 @@ VISU_CutPlanesPL
 }
 
 
+//----------------------------------------------------------------------------
+vtkFloatingPointType 
+VISU_CutPlanesPL
+::GetDisplacement(int theNum)
+{
+  return myDisplacement[theNum];
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_CutPlanesPL
+::SetDisplacement(vtkFloatingPointType theDisp, 
+                 int theNum) 
+{
+  myDisplacement[theNum] = theDisp;
+  Modified();
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::SetNbParts(int theNb) 
 {
   myNbParts = theNb;
   myPartPosition.resize(myNbParts);
-  myPartCondition.resize(myNbParts,1);
+  myPartCondition.resize(myNbParts, 1);
   Modified();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::SetPartPosition(int thePartNumber, 
                  vtkFloatingPointType thePartPosition)
 {
-  if(thePartNumber >= myNbParts) return;
+  if(thePartNumber >= myNbParts) 
+    return;
+
   myPartPosition[thePartNumber] = thePartPosition;
   myPartCondition[thePartNumber] = 0;
   Modified();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_CutPlanesPL
 ::GetPartPosition(int thePartNumber, 
                  int theNum)
 {
-  if(thePartNumber >= myNbParts) return 0;
+  if(thePartNumber >= myNbParts) 
+    return 0;
+
   vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
   if(myPartCondition[thePartNumber]){
       vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetInput2()->GetBounds(aBounds);
-      GetDir(aDir,myAng[theNum],myBasePlane[theNum]);
-      GetBoundProject(aBoundPrj,aBounds,aDir);
-      if (myNbParts > 1){
+      GetClippedInput()->GetBounds(aBounds);
+
+      GetDir(aDir,
+            myAng[theNum],
+            myBasePlane[theNum]);
+
+      GetBoundProject(aBoundPrj,
+                     aBounds,
+                     aDir);
+
+      if(myNbParts > 1){
        vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(myNbParts - 1);
        vtkFloatingPointType aDisplacement = aDBoundPrj * myDisplacement[theNum];
        vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
@@ -299,28 +400,38 @@ VISU_CutPlanesPL
       }else
        aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
   }
+
   return aPosition;
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::SetPartDefault(int thePartNumber)
 {
-  if(thePartNumber >= myNbParts) return;
+  if(thePartNumber >= myNbParts) 
+    return;
+
   myPartPosition[thePartNumber] = GetPartPosition(thePartNumber);
   myPartCondition[thePartNumber] = 1;
   Modified();
 }
+
+
+//----------------------------------------------------------------------------
 int
 VISU_CutPlanesPL
 ::IsPartDefault(int thePartNumber)
 {
-  if(thePartNumber >= myNbParts) return 1;
+  if(thePartNumber >= myNbParts) 
+    return 1;
+
   return myPartCondition[thePartNumber];
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::GetDir(vtkFloatingPointType theDir[3],
@@ -349,11 +460,13 @@ VISU_CutPlanesPL
     iPlane = 1;
     break;
   }
+
   for(int i = 0; i < 3; i++)
     theDir[i] = aRotation[i][iPlane];
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
@@ -370,11 +483,11 @@ VISU_CutPlanesPL
   aCutPlane->SetCutFunction(aPlane);
   aPlane->Delete();
   theAppendPolyData->AddInput(aCutPlane->GetOutput());
-  aCutPlane->Register(theAppendPolyData);
   aCutPlane->Delete();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
 ::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
@@ -382,8 +495,8 @@ VISU_CutPlanesPL
                int theNbPlanes, 
                vtkFloatingPointType theDir[3], 
                vtkFloatingPointType theBounds[6],
-               const vector<vtkFloatingPointType>& thePlanePosition,
-               const vector<int>& thePlaneCondition,
+               const std::vector<vtkFloatingPointType>& thePlanePosition,
+               const std::vector<int>& thePlaneCondition,
                vtkFloatingPointType theDisplacement)
 {
   vtkFloatingPointType aBoundPrj[3], aOrig[3], aPosition;
@@ -413,3 +526,6 @@ VISU_CutPlanesPL
   aPolyData->Update();
   theAppendPolyData->Update();
 }
+
+
+//----------------------------------------------------------------------------
index cea06cb220c4f9927e603eb01f4e7b70458cc99e..86736a3cdbf690906a6f69fb497a098c8291231b 100644 (file)
 
 class vtkAppendPolyData;
 
-class VISU_CutPlanesPL : public VISU_ScalarMapPL{
-protected:
-  VISU_CutPlanesPL();
-  VISU_CutPlanesPL(const VISU_CutPlanesPL&);
+
+//----------------------------------------------------------------------------
+class VISU_CutPlanesPL : public VISU_ScalarMapPL
+{
 public:
   vtkTypeMacro(VISU_CutPlanesPL,VISU_ScalarMapPL);
   static VISU_CutPlanesPL* New();
@@ -44,10 +44,6 @@ public:
   virtual
   ~VISU_CutPlanesPL();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   enum PlaneOrientation {XY, YZ, ZX};
 
   virtual 
@@ -71,18 +67,12 @@ public:
 
   virtual
   vtkFloatingPointType 
-  GetDisplacement(int theNum = 0)
-  {
-    return myDisplacement[theNum];
-  }
+  GetDisplacement(int theNum = 0);
 
   virtual
   void
   SetDisplacement(vtkFloatingPointType theDisp, 
-                 int theNum = 0)
-  { 
-    myDisplacement[theNum] = theDisp;
-  }
+                 int theNum = 0);
 
   virtual
   void
@@ -122,6 +112,11 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
   virtual
   vtkAppendPolyData* 
   GetAppendPolyData() 
@@ -184,9 +179,17 @@ public:
                const std::vector<int>& thePlaneCondition,
                vtkFloatingPointType theDisplacement);
 protected:
+  VISU_CutPlanesPL();
+  VISU_CutPlanesPL(const VISU_CutPlanesPL&);
+
   virtual 
-  THook* 
-  DoHook();
+  vtkDataSet* 
+  InsertCustomPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
 
   void
   SetPartPosition(int theNum = 0);
index 43314db9b910c8c28d50a718016feece030331d1..2c21bf189a97a259c8359c64af2294881a70f22b 100644 (file)
 
 #include <vtkWarpVector.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_DeformedShapePL);
 
+
+//----------------------------------------------------------------------------
 VISU_DeformedShapePL
-::VISU_DeformedShapePL()
+::VISU_DeformedShapePL():
+  myScaleFactor(0.0)
 {
   myWarpVector = vtkWarpVector::New();
   myCellDataToPointData = vtkCellDataToPointData::New();
 }
 
+
+//----------------------------------------------------------------------------
 VISU_DeformedShapePL
 ::~VISU_DeformedShapePL()
 {
-  myWarpVector->UnRegisterAllOutputs();
   myWarpVector->Delete();
 
-  myCellDataToPointData->UnRegisterAllOutputs();
   myCellDataToPointData->Delete();
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_DeformedShapePL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
     SetScale(aPipeLine->GetScale());
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_DeformedShapePL
 ::GetScaleFactor(vtkDataSet* theDataSet)
 {
-  if(!theDataSet) return 0.0;
+  if(!theDataSet)
+    return 0.0;
+
   theDataSet->Update();
+
   int aNbCells = theDataSet->GetNumberOfCells();
   int aNbPoints = theDataSet->GetNumberOfPoints();
   int aNbElem = aNbCells? aNbCells: aNbPoints;
+
   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
   vtkFloatingPointType aVolume = 1, aVol, idim = 0;
   for(int i = 0; i < 6; i += 2){
@@ -79,19 +94,24 @@ VISU_DeformedShapePL
     }
   }
   aVolume /= aNbElem;
-  return pow(aVolume,vtkFloatingPointType(1.0/idim));
+  return pow(aVolume, vtkFloatingPointType(1.0/idim));
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_DeformedShapePL
 ::SetScale(vtkFloatingPointType theScale) 
 {
+  if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
+    return;
+
   myWarpVector->SetScaleFactor(theScale);
   myScaleFactor = theScale;
-  Modified();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_DeformedShapePL
 ::GetScale() 
@@ -99,15 +119,18 @@ VISU_DeformedShapePL
   return myScaleFactor;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_DeformedShapePL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
+
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
 
-  vtkDataSet* aDataSet = GetInput2();
+  vtkDataSet* aDataSet = GetClippedInput();
   vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
 
   static double EPS = 1.0 / VTK_LARGE_FLOAT;
@@ -117,27 +140,48 @@ VISU_DeformedShapePL
     SetScale(0.0);
 }
 
-VISU_ScalarMapPL::THook* 
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_DeformedShapePL
-::DoHook()
+::InsertCustomPL()
 {
-  VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,GetInput2(),myFieldTransform);
+  VISU::CellDataToPoint(myWarpVector,
+                       myCellDataToPointData,
+                       GetClippedInput(),
+                       GetFieldTransformFilter());
   return myWarpVector->GetOutput();
 }
 
-void
+
+//----------------------------------------------------------------------------
+unsigned long int
 VISU_DeformedShapePL
-::Update()
+::GetMemorySize()
 {
-  VISU_ScalarMapPL::Update();
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(myWarpVector->GetInput())
+    if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_DeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
-  Modified();
 }
+
+
+//----------------------------------------------------------------------------
index 96c3d0ebe7ea62e18f21561abd8b88404930a2d5..456429f497e97a498eab7d2f16e097f2d45dfc40 100644 (file)
@@ -35,13 +35,6 @@ class vtkWarpVector;
 
 class VISU_DeformedShapePL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_DeformedShapePL();
-  VISU_DeformedShapePL(const VISU_DeformedShapePL&);
-
-  virtual
-  ~VISU_DeformedShapePL();
-
 public:
   vtkTypeMacro(VISU_DeformedShapePL,VISU_ScalarMapPL);
 
@@ -49,10 +42,6 @@ public:
   VISU_DeformedShapePL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetScale(vtkFloatingPointType theScale);
@@ -66,9 +55,10 @@ public:
   void
   Init();
 
+  //! Gets memory size used by the instance (bytes).
   virtual
-  void
-  Update();
+  unsigned long int
+  GetMemorySize();
 
   virtual
   void
@@ -79,9 +69,20 @@ public:
   GetScaleFactor(vtkDataSet* theDataSet);
 
 protected:
+  VISU_DeformedShapePL();
+  VISU_DeformedShapePL(const VISU_DeformedShapePL&);
+
+  virtual
+  ~VISU_DeformedShapePL();
+
   virtual
-  THook* 
-  DoHook();
+  vtkDataSet* 
+  InsertCustomPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
 
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
index 82eec5dc8f20800ae485bb562de52e91caafd486..3dbb7baba7d2f9f83e1092a11c29a049e64d4863 100644 (file)
 
 #include <vtkObjectFactory.h>
 #include <vtkUnstructuredGrid.h>
-#include <vtkFloatArray.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
 #include <vector>
 
-using namespace std;
-
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_Extractor);
 
-VISU_Extractor::VISU_Extractor()
+//----------------------------------------------------------------------------
+VISU_Extractor
+::VISU_Extractor()
 {
   myScalarMode = 1;
 }
 
-VISU_Extractor::~VISU_Extractor()
+
+//----------------------------------------------------------------------------
+VISU_Extractor
+::~VISU_Extractor()
 {}
 
-void VISU_Extractor::SetScalarMode(int theScalarMode)
+
+//----------------------------------------------------------------------------
+void
+VISU_Extractor
+::SetScalarMode(int theScalarMode)
 {
   if(myScalarMode != theScalarMode){
     myScalarMode = theScalarMode;
@@ -56,62 +63,125 @@ void VISU_Extractor::SetScalarMode(int theScalarMode)
   }
 }
 
-template<typename TypeData> void
-execute(int theNbElems, 
-       int theScalarMode, 
-       TypeData* theInputData, 
-       TypeData* theOutputData)
+//----------------------------------------------------------------------------
+int
+VISU_Extractor
+::GetScalarMode()
+{
+  return myScalarMode;
+}
+
+
+//----------------------------------------------------------------------------
+template<typename TValueType> 
+void
+Module2Scalars(vtkDataArray *theInputDataArray,
+              TValueType* theOutputPtr,
+              vtkIdType theNbOfTuples)
+{
+  vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
+  std::vector<vtkFloatingPointType> anArray(aNbComp < 3? 3: aNbComp);
+  for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+    theInputDataArray->GetTuple(aTupleId, &anArray[0]);
+    vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]};
+    vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + 
+                                       aVector[1]*aVector[1] + 
+                                       aVector[2]*aVector[2]);
+    *theOutputPtr = TValueType(aScalar);
+    theOutputPtr++;
+  }
+}
+
+
+//----------------------------------------------------------------------------
+template<typename TValueType> 
+void
+Component2Scalars(vtkDataArray *theInputDataArray,
+                 TValueType* theInputPtr,
+                 TValueType* theOutputPtr,
+                 vtkIdType theNbOfTuples,
+                 vtkIdType theComponentId)
+{
+  vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
+  for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+    *theOutputPtr = *(theInputPtr + theComponentId);
+    theInputPtr += aNbComp;
+    theOutputPtr++;
+  }
+}
+
+
+//----------------------------------------------------------------------------
+template<typename TDataSetAttributesType> void
+ExecuteScalars(vtkIdType theNbOfTuples, 
+              vtkIdType theScalarMode, 
+              TDataSetAttributesType* theInputData, 
+              TDataSetAttributesType* theOutputData)
 {
-  if(theNbElems < 1 )
+  if(theNbOfTuples < 1)
     return;
+
   vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
-  if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
-    int aNbComp = aFloatArray->GetNumberOfComponents();
-    std::vector<vtkFloatingPointType> anArray(aNbComp < 3? 3: aNbComp);
-    //
-    vtkFloatArray *aScalars = vtkFloatArray::New();
-    aScalars->SetNumberOfTuples(theNbElems);
-    aScalars->SetNumberOfComponents(1);
-    //
-    if(!theScalarMode){
-      for(int anId = 0; anId < theNbElems; anId++){
-       aFloatArray->GetTuple(anId,&anArray[0]);
-       vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]};
-       vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]);
-       aScalars->SetTuple1(anId,aScalar);
-      }
-    }else{
-      for(int anId = 0; anId < theNbElems; anId++){
-       aFloatArray->GetTuple(anId,&anArray[0]);
-       aScalars->SetTuple1(anId,anArray[theScalarMode - 1]);
-      }
+  vtkIdType anInputDataType = aFieldArray->GetDataType();
+  vtkDataArray *anOutputScalars = vtkDataArray::CreateDataArray(anInputDataType);
+  anOutputScalars->SetNumberOfComponents(1);
+  anOutputScalars->SetNumberOfTuples(theNbOfTuples);
+
+  void *anInputPtr = aFieldArray->GetVoidPointer(0);
+  void *anOutputPtr = anOutputScalars->GetVoidPointer(0);
+
+  if(theScalarMode == 0){
+    switch(anInputDataType){
+      vtkTemplateMacro3(Module2Scalars,
+                       aFieldArray,
+                       (VTK_TT *)(anOutputPtr), 
+                       theNbOfTuples);
+    default:
+      break;
+    }
+  }else{
+    switch(anInputDataType){
+      vtkTemplateMacro5(Component2Scalars,
+                       aFieldArray,
+                       (VTK_TT *)(anInputPtr), 
+                       (VTK_TT *)(anOutputPtr),
+                       theNbOfTuples,
+                       theScalarMode - 1);
+    default:
+      break;
     }
-    theOutputData->SetScalars(aScalars);
-    aScalars->Delete();
   }
+  
+  theOutputData->SetScalars(anOutputScalars);
+  anOutputScalars->Delete();
 }
 
-void VISU_Extractor::Execute(){
+
+//----------------------------------------------------------------------------
+void
+VISU_Extractor
+::Execute()
+{
   vtkDataSet *input = this->GetInput(), *output = this->GetOutput();
   output->CopyStructure(input);
   output->GetPointData()->CopyAllOff();
   output->GetCellData()->CopyAllOff();
   if(input->GetPointData()->GetNumberOfArrays()){
     output->GetPointData()->CopyVectorsOn();
-    int aNbElems = input->GetNumberOfPoints();
+    vtkIdType aNbOfTuples = input->GetNumberOfPoints();
     vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData();
     if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      execute(aNbElems,myScalarMode,inData,outData);
+      ExecuteScalars(aNbOfTuples, myScalarMode, inData, outData);
     else
       output->GetPointData()->CopyScalarsOn();
     outData->PassData(inData);
     outData->AddArray(inData->GetArray("VISU_FIELD"));
   }else{
     output->GetCellData()->CopyVectorsOn();
-    int aNbElems = input->GetNumberOfCells();
+    vtkIdType aNbOfTuples = input->GetNumberOfCells();
     vtkCellData *inData = input->GetCellData(), *outData = output->GetCellData();
     if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      execute(aNbElems,myScalarMode,inData,outData);
+      ExecuteScalars(aNbOfTuples, myScalarMode, inData, outData);
     else
       output->GetCellData()->CopyScalarsOn();
     outData->PassData(inData);
index 797f9af1c1478c5cc4b6243d2d23e37b15424592..22bcf9e07ffe307d6401fd94154be837c77e8d5e 100644 (file)
 #ifndef VISU_Extractor_HeaderFile
 #define VISU_Extractor_HeaderFile
 
-#include <vtkPointSetToPointSetFilter.h>
+#include <vtkDataSetToDataSetFilter.h>
 
-class VTK_EXPORT VISU_Extractor : public vtkPointSetToPointSetFilter{
+
+//----------------------------------------------------------------------------
+class VTK_EXPORT VISU_Extractor : public vtkDataSetToDataSetFilter
+{
 public:
-  vtkTypeMacro(VISU_Extractor,vtkPointSetToPointSetFilter);
-  static VISU_Extractor *New();
+  vtkTypeMacro(VISU_Extractor, vtkDataSetToDataSetFilter);
+
+  static
+  VISU_Extractor
+  *New();
 
-  virtual int GetScalarMode(){ return myScalarMode;}
-  virtual void SetScalarMode(int theScalarMode = 0);
+  virtual
+  int
+  GetScalarMode();
+
+  virtual
+  void
+  SetScalarMode(int theScalarMode = 0);
 
 protected:
   VISU_Extractor();
   VISU_Extractor(const VISU_Extractor&);
+
   ~VISU_Extractor();
 
-  virtual void Execute();
+  virtual
+  void
+  Execute();
 
   int myScalarMode;
 };
index 598a36e229be4add9444a28dad63335e11206291..04ca400598420731bb82528aac1e5fc866c4198c 100644 (file)
@@ -24,7 +24,6 @@
 #include "VTKViewer_Transform.h"
 
 #include <vtkObjectFactory.h>
-#include <vtkFloatArray.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
 #include <vtkDataSet.h>
 
 static vtkFloatingPointType Tolerance = 1.0 / VTK_LARGE_FLOAT;
 
-using namespace std;
-
 vtkStandardNewMacro(VISU_FieldTransform);
 
+//----------------------------------------------------------------------------
 double
 VISU_FieldTransform
 ::Ident(double theArg)
@@ -43,6 +41,7 @@ VISU_FieldTransform
   return theArg;
 }
 
+//----------------------------------------------------------------------------
 double
 VISU_FieldTransform
 ::Log10(double theArg)
@@ -54,6 +53,7 @@ VISU_FieldTransform
 }
 
 
+//----------------------------------------------------------------------------
 VISU_FieldTransform
 ::VISU_FieldTransform()
 {
@@ -64,6 +64,7 @@ VISU_FieldTransform
   myScalarRange[1] = -VTK_LARGE_FLOAT;
 }
 
+//----------------------------------------------------------------------------
 VISU_FieldTransform
 ::~VISU_FieldTransform() 
 {
@@ -71,24 +72,27 @@ VISU_FieldTransform
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::Update()
 {
-  vtkSource::Update();
+  Superclass::Update();
 }
 
+//----------------------------------------------------------------------------
 unsigned long 
 VISU_FieldTransform
 ::GetMTime()
 {
   unsigned long aTime = Superclass::GetMTime();
   if(myTransform)
-    aTime = max(aTime,myTransform->GetMTime());
+    aTime = std::max(aTime, myTransform->GetMTime());
 
   return aTime;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::SetScalarTransform(TTransformFun theFunction) 
@@ -104,7 +108,11 @@ VISU_FieldTransform
   Modified();
 }
 
-void VISU_FieldTransform::SetSpaceTransform(VTKViewer_Transform* theTransform){
+//----------------------------------------------------------------------------
+void 
+VISU_FieldTransform
+::SetSpaceTransform(VTKViewer_Transform* theTransform)
+{
   if(myTransform == theTransform)
     return;
 
@@ -120,6 +128,7 @@ void VISU_FieldTransform::SetSpaceTransform(VTKViewer_Transform* theTransform){
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::SetScalarRange(vtkFloatingPointType theScalarRange[2]) 
@@ -136,6 +145,7 @@ VISU_FieldTransform
   Modified();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::SetScalarMin(vtkFloatingPointType theValue)
@@ -144,6 +154,7 @@ VISU_FieldTransform
   SetScalarRange(aScalarRange);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::SetScalarMax(vtkFloatingPointType theValue)
@@ -152,84 +163,188 @@ VISU_FieldTransform
   SetScalarRange(aScalarRange);
 }
 
+//----------------------------------------------------------------------------
+template<typename TValueType> 
+void
+LinearTransformVectors(TValueType* theInputPtr,
+                      TValueType* theOutputPtr,
+                      vtkIdType theNbOfTuples,
+                      vtkFloatingPointType theScale[3])
+{
+  for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+    for(vtkIdType aComponentId = 0; aComponentId < 3; aComponentId++){
+      *theOutputPtr = TValueType(*theInputPtr * theScale[aComponentId]);
+      theOutputPtr++;
+      theInputPtr++;
+    }
+  }
+}
+
+
+//----------------------------------------------------------------------------
+template<typename TValueType> 
+void
+NonLinearTransformVectors(vtkDataArray *theInputVectors,
+                         TValueType* theInputPtr,
+                         TValueType* theOutputPtr,
+                         vtkIdType theNbOfTuples,
+                         vtkFloatingPointType theScale[3],
+                         VISU_FieldTransform::TTransformFun theFunction,
+                         vtkFloatingPointType theModifiedScalarMin,
+                         vtkFloatingPointType theModifiedScalarDelta,
+                         vtkFloatingPointType theSourceScalarMax)
+{
+  for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+    vtkFloatingPointType anInputVector[3];
+    theInputVectors->GetTuple(aTupleId, anInputVector);
+    vtkFloatingPointType aMagnification = vtkMath::Norm(anInputVector);
+    if(aMagnification > Tolerance)
+      aMagnification = 
+       ((*theFunction)(aMagnification) - theModifiedScalarMin) / 
+       theModifiedScalarDelta * theSourceScalarMax / 
+       aMagnification;
+    if(aMagnification < 0.0) 
+      aMagnification = 0.0;
+    for(vtkIdType aComponentId = 0; aComponentId < 3; aComponentId++){
+      *theOutputPtr = TValueType(*theInputPtr * aMagnification * theScale[aComponentId]);
+      theOutputPtr++;
+      theInputPtr++;
+    }
+  }
+}
+
 
-template<typename TypeData> void
-ExecVectors(VISU_FieldTransform::TTransformFun theFunction,
-           VTKViewer_Transform* theTransform,
-           vtkFloatingPointType theScalarRange[2], 
-           int theNbOfTuples,
-           TypeData* theInputData, 
-           TypeData* theOutputData)
+//----------------------------------------------------------------------------
+template<typename TDataSetAttributesType> 
+void
+ExecuteVectors(VISU_FieldTransform::TTransformFun theFunction,
+              VTKViewer_Transform* theTransform,
+              vtkFloatingPointType theScalarRange[2], 
+              vtkIdType theNbOfTuples,
+              TDataSetAttributesType* theInputData, 
+              TDataSetAttributesType* theOutputData)
 {
-  vtkDataArray *anInVectors = theInputData->GetVectors();
-  if ( !anInVectors || theNbOfTuples < 1 
+  vtkDataArray *anInputVectors = theInputData->GetVectors();
+  if(!anInputVectors || theNbOfTuples < 1
     return;
-  vtkFloatArray *aNewVectors = vtkFloatArray::New();
-  aNewVectors->SetNumberOfComponents(3);
-  aNewVectors->SetNumberOfTuples(theNbOfTuples);
-  vtkFloatingPointType aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])};
-  vtkFloatingPointType aDelta = aScalarRange[1] - aScalarRange[0];
+
+  vtkFloatingPointType aScalarRange[2];
+  aScalarRange[0] = (*theFunction)(theScalarRange[0]);
+  aScalarRange[1] = (*theFunction)(theScalarRange[1]);
+
+  vtkFloatingPointType aScalarDelta = aScalarRange[1] - aScalarRange[0];
   vtkFloatingPointType aScale[3] = {1.0, 1.0, 1.0};
-  static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
+
   if(theTransform){
     aScale[0] = theTransform->GetScale()[0];
     aScale[1] = theTransform->GetScale()[1];
     aScale[2] = theTransform->GetScale()[2];
   }
+
+  vtkIdType anInputDataType = anInputVectors->GetDataType();
+  vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputDataType);
+  anOutputVectors->SetNumberOfComponents(3);
+  anOutputVectors->SetNumberOfTuples(theNbOfTuples);
+
+  void *anInputPtr = anInputVectors->GetVoidPointer(0);
+  void *anOutputPtr = anOutputVectors->GetVoidPointer(0);
+
   if(theFunction == &(VISU_FieldTransform::Ident)){
-    for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) {
-      vtkFloatingPointType anInVec[3];
-      anInVectors->GetTuple(aTupleId,anInVec);
-      vtkFloatingPointType anNewVec[3];
-      anNewVec[0] = anInVec[0]*aScale[0];
-      anNewVec[1] = anInVec[1]*aScale[1];
-      anNewVec[2] = anInVec[2]*aScale[2];
-      aNewVectors->SetTuple(aTupleId,anNewVec);
-    }
+    switch(anInputDataType){
+      vtkTemplateMacro4(LinearTransformVectors,
+                       (VTK_TT *)(anInputPtr), 
+                       (VTK_TT *)(anOutputPtr), 
+                       theNbOfTuples,
+                       aScale);
+    default:
+      break;
+    }  
   }else{
-    for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) {
-      vtkFloatingPointType anInVec[3];
-      anInVectors->GetTuple(aTupleId,anInVec);
-      vtkFloatingPointType aMagn = vtkMath::Norm(anInVec);
-      if(aMagn > EPS)
-       aMagn = ((*theFunction)(aMagn) - aScalarRange[0]) / aDelta * theScalarRange[1] / aMagn;
-      if(aMagn < 0.0) 
-       aMagn = 0.0;
-      vtkFloatingPointType anNewVec[3];
-      anNewVec[0] = anInVec[0]*aMagn*aScale[0];
-      anNewVec[1] = anInVec[1]*aMagn*aScale[1];
-      anNewVec[2] = anInVec[2]*aMagn*aScale[2];
-      aNewVectors->SetTuple(aTupleId,anNewVec);
-    }
+    switch(anInputDataType){
+      vtkTemplateMacro9(NonLinearTransformVectors,
+                       anInputVectors,
+                       (VTK_TT *)(anInputPtr), 
+                       (VTK_TT *)(anOutputPtr), 
+                       theNbOfTuples,
+                       aScale,
+                       theFunction,
+                       aScalarRange[0],
+                       aScalarDelta,
+                       theScalarRange[1]);
+    default:
+      break;
+    }  
   }
-  theOutputData->SetVectors(aNewVectors);
-  aNewVectors->Delete();
+
+  theOutputData->SetVectors(anOutputVectors);
+  anOutputVectors->Delete();
 }
 
-template<typename TypeData> void
-ExecScalars(VISU_FieldTransform::TTransformFun theFunction, 
-           vtkFloatingPointType theScalarRange[2],
-           int theNbOfTuples, 
-           TypeData* theInputData, 
-           TypeData* theOutputData)
+
+//----------------------------------------------------------------------------
+template<typename TValueType> 
+void
+NonLinearTransformScalars(vtkDataArray *theInputScalars,
+                         TValueType* theInputPtr,
+                         TValueType* theOutputPtr,
+                         vtkIdType theNbOfTuples,
+                         VISU_FieldTransform::TTransformFun theFunction,
+                         vtkFloatingPointType theModifiedScalarMin)
 {
-  vtkDataArray *anInScalars = theInputData->GetScalars();
-  if ( !anInScalars || theNbOfTuples < 1 )
-    return;
-  vtkFloatArray *aNewScalars = vtkFloatArray::New();
-  aNewScalars->SetNumberOfComponents(1);
-  aNewScalars->SetNumberOfTuples(theNbOfTuples);
-  vtkFloatingPointType aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])};
-  for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) {
-    vtkFloatingPointType aScalar = (*theFunction)(anInScalars->GetTuple1(aTupleId));
-    if(aScalar < aScalarRange[0]) 
-      aScalar = aScalarRange[0];
-    aNewScalars->SetTuple1(aTupleId,aScalar);
+  for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+    vtkFloatingPointType aScalar = (*theFunction)(vtkFloatingPointType(*theInputPtr));
+    if(aScalar < theModifiedScalarMin) 
+      aScalar = theModifiedScalarMin;
+    *theOutputPtr = TValueType(aScalar);
+    theOutputPtr++;
+    theInputPtr++;
   }
-  theOutputData->SetScalars(aNewScalars);
-  aNewScalars->Delete();
 }
 
+
+//----------------------------------------------------------------------------
+template<typename TDataSetAttributesType> 
+void
+ExecuteScalars(VISU_FieldTransform::TTransformFun theFunction, 
+              vtkFloatingPointType theScalarRange[2],
+              vtkIdType theNbOfTuples, 
+              TDataSetAttributesType* theInputData, 
+              TDataSetAttributesType* theOutputData)
+{
+  vtkDataArray *anInputScalars = theInputData->GetScalars();
+  if(!anInputScalars || theNbOfTuples < 1)
+    return;
+
+  vtkFloatingPointType aScalarRange[2];
+  aScalarRange[0] = (*theFunction)(theScalarRange[0]);
+  aScalarRange[1] = (*theFunction)(theScalarRange[1]);
+
+  vtkIdType anInputDataType = anInputScalars->GetDataType();
+  vtkDataArray *anOutputScalars = vtkDataArray::CreateDataArray(anInputDataType);
+  anOutputScalars->SetNumberOfComponents(1);
+  anOutputScalars->SetNumberOfTuples(theNbOfTuples);
+
+  void *anInputPtr = anInputScalars->GetVoidPointer(0);
+  void *anOutputPtr = anOutputScalars->GetVoidPointer(0);
+
+  switch(anInputDataType){
+    vtkTemplateMacro6(NonLinearTransformScalars,
+                     anInputScalars,
+                     (VTK_TT *)(anInputPtr), 
+                     (VTK_TT *)(anOutputPtr), 
+                     theNbOfTuples,
+                     theFunction,
+                     aScalarRange[0]);
+  default:
+    break;
+  }  
+  
+  theOutputData->SetScalars(anOutputScalars);
+  anOutputScalars->Delete();
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_FieldTransform
 ::Execute()
@@ -240,11 +355,31 @@ VISU_FieldTransform
     output->GetPointData()->CopyAllOff();
     output->GetCellData()->CopyAllOff();
 
-    ExecScalars(myFunction,myScalarRange,input->GetNumberOfPoints(),input->GetPointData(),output->GetPointData());
-    ExecVectors(myFunction,myTransform,myScalarRange,input->GetNumberOfPoints(),input->GetPointData(),output->GetPointData());
-
-    ExecScalars(myFunction,myScalarRange,input->GetNumberOfCells(),input->GetCellData(),output->GetCellData());
-    ExecVectors(myFunction,myTransform,myScalarRange,input->GetNumberOfCells(),input->GetCellData(),output->GetCellData());
+    ExecuteScalars(myFunction,
+                  myScalarRange,
+                  input->GetNumberOfPoints(),
+                  input->GetPointData(),
+                  output->GetPointData());
+
+    ExecuteVectors(myFunction,
+                  myTransform,
+                  myScalarRange,
+                  input->GetNumberOfPoints(),
+                  input->GetPointData(),
+                  output->GetPointData());
+
+    ExecuteScalars(myFunction,
+                  myScalarRange,
+                  input->GetNumberOfCells(),
+                  input->GetCellData(),
+                  output->GetCellData());
+
+    ExecuteVectors(myFunction,
+                  myTransform,
+                  myScalarRange,
+                  input->GetNumberOfCells(),
+                  input->GetCellData(),
+                  output->GetCellData());
   }else{
     output->GetPointData()->CopyAllOn();
     output->GetCellData()->CopyAllOn();
@@ -253,3 +388,6 @@ VISU_FieldTransform
     output->GetCellData()->PassData(input->GetCellData());
   }
 }
+
+
+//----------------------------------------------------------------------------
index f84e0b4d6d977b281c121d1cb85920aa2b2f186a..d490a7ab64c35e6b4a4f0654fc4f764a2cb5c019 100644 (file)
@@ -39,29 +39,69 @@ public:
   vtkTypeMacro(VISU_FieldTransform,vtkDataSetToDataSetFilter);
   static VISU_FieldTransform *New();
 
-  virtual void Update();
-  virtual unsigned long GetMTime();
+  virtual
+  void
+  Update();
+
+  virtual
+  unsigned long 
+  GetMTime();
   
-  static double Ident(double theArg);
-  static double Log10(double theArg);
+  static
+  double
+  Ident(double theArg);
+
+  static
+  double
+  Log10(double theArg);
+
   typedef double (*TTransformFun)(double);
-  void SetScalarTransform(TTransformFun theFunction);
-  TTransformFun GetScalarTransform() { return myFunction;}
 
-  void SetSpaceTransform(VTKViewer_Transform* theTransform);
-  VTKViewer_Transform* GetSpaceTransform() { return myTransform;}
+  void
+  SetScalarTransform(TTransformFun theFunction);
+
+  TTransformFun
+  GetScalarTransform() 
+  {
+    return myFunction;
+  }
+
+  void
+  SetSpaceTransform(VTKViewer_Transform* theTransform);
+
+  VTKViewer_Transform* 
+  GetSpaceTransform() 
+  {
+    return myTransform;
+  }
 
-  vtkFloatingPointType* GetScalarRange(){ return myScalarRange; }
-  void SetScalarRange(vtkFloatingPointType theScalarRange[2]);
-  void SetScalarMin(vtkFloatingPointType theValue);
-  void SetScalarMax(vtkFloatingPointType theValue);
+  vtkFloatingPointType* 
+  GetScalarRange()
+  {
+    return myScalarRange; 
+  }
+  
+  void
+  SetScalarRange(vtkFloatingPointType theScalarRange[2]);
+
+  void
+  SetScalarMin(vtkFloatingPointType theValue);
+
+  void
+  SetScalarMax(vtkFloatingPointType theValue);
 
 protected:
   VISU_FieldTransform();
-  virtual ~VISU_FieldTransform();
+
+  virtual
+  ~VISU_FieldTransform();
+
   VISU_FieldTransform(const VISU_FieldTransform&) {};
   void operator=(const VISU_FieldTransform&) {};
-  void Execute();
+
+  virtual
+  void
+  Execute();
 
   VTKViewer_Transform *myTransform;
   TTransformFun myFunction;
index 3ffc756480d8959e83d6a04f045c343d064e6cec..9373d4973b438423999183736a2e7a736af18224 100644 (file)
 
 
 #include "VISU_GaussPointsPL.hxx"
-#include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_ExtractGeometry.h"
-#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PointSpriteMapperHolder.hxx"
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VTKViewer_PassThroughFilter.h"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
 
 #include <vtkPointSource.h>
 #include <vtkElevationFilter.h>
@@ -50,37 +51,22 @@ vtkStandardNewMacro(VISU_GaussPointsPL);
 //----------------------------------------------------------------------------
 VISU_GaussPointsPL
 ::VISU_GaussPointsPL():
-  myIsDeformed(false),
   myScaleFactor(0.0),
-  myResolution( 8 ),
   myMagnificationIncrement(2)
 {
-  myExtractGeometry->SetExtractInside(0);
-
-  myPSMapper = VISU_OpenGLPointSpriteMapper::New();
-  myPSMapper->SetColorModeToMapScalars();
-  myPSMapper->ScalarVisibilityOn();
-
-  myGeomFilter = vtkGeometryFilter::New();
-
   myWarpVector = vtkWarpVector::New();
-  myCellDataToPointData = vtkCellDataToPointData::New();
-  myCellDataToPointData->SetPassCellData(true);
 
   myGlyph = vtkGlyph3D::New();
   myGlyph->SetScaleModeToScaleByScalar();
   myGlyph->SetColorModeToColorByScalar();
   myGlyph->ClampingOn();
 
-  myExtractor->SetInput( myExtractGeometry->GetOutput() );
-  myFieldTransform->SetInput( myExtractor->GetOutput() );
-
-  myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
-
   mySphereSource = vtkSphereSource::New();
+  mySphereSource->SetThetaResolution( 8 );
+  mySphereSource->SetPhiResolution( 8 );
   myGlyph->SetSource( mySphereSource->GetOutput() );
 
-  for(int i = 0; i < 2; i++)
+  for(int i = 0; i < 3; i++)
     myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
 }
 
@@ -89,54 +75,92 @@ VISU_GaussPointsPL
 VISU_GaussPointsPL
 ::~VISU_GaussPointsPL()
 {
-  if (this->myPSMapper)
-  {
-    this->myPSMapper->Delete();
-    this->myPSMapper = NULL;
-  }
-  if (this->myGeomFilter)
-  {
-    this->myGeomFilter->Delete();
-    this->myGeomFilter = NULL;
-  }
-
   myWarpVector->Delete();
 
-  myCellDataToPointData->Delete();
-
   myGlyph->Delete();
 
   mySphereSource->Delete();
 
-  for(int i = 0; i < 2; i++)
+  for(int i = 0; i < 3; i++)
     myPassFilter[i]->Delete();
 }
 
 
+//----------------------------------------------------------------------------
+void  
+VISU_GaussPointsPL
+::OnCreateMapperHolder()
+{
+  myPointSpriteMapperHolder = VISU_PointSpriteMapperHolder::New();
+  myPointSpriteMapperHolder->Delete();
+
+  SetMapperHolder(myPointSpriteMapperHolder.GetPointer());
+}
+
+
 //----------------------------------------------------------------------------
 void
-CopyGlyph( vtkGlyph3D* source, vtkGlyph3D* dest )
+VISU_GaussPointsPL
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+  GetPointSpriteMapperHolder()->SetGaussPtsIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PGaussPtsIDMapper&  
+VISU_GaussPointsPL
+::GetGaussPtsIDMapper()
 {
-  dest->SetRange( source->GetRange() );
-  dest->SetScaling( source->GetScaling() );
-  dest->SetClamping( source->GetClamping() );
-  dest->SetScaleMode( source->GetScaleMode() );
-  dest->SetColorMode( source->GetColorMode() );
-  dest->SetScaleFactor( source->GetScaleFactor() );
+  return GetPointSpriteMapperHolder()->GetGaussPtsIDMapper();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder*  
+VISU_GaussPointsPL
+::GetPointSpriteMapperHolder()
+{
+  GetMapperHolder();
+
+  return myPointSpriteMapperHolder.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet*  
+VISU_GaussPointsPL
+::GetParentMesh()
+{
+  VISU::TNamedIDMapper* aNamedIDMapper = GetGaussPtsIDMapper()->GetParent();
+  return aNamedIDMapper->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+void
+CopyGlyph( vtkGlyph3D* theSource, vtkGlyph3D* theDestination )
+{
+  vtkFloatingPointType* aSourceRange = theSource->GetRange();
+  vtkFloatingPointType* aDestinationRange = theDestination->GetRange();
+  if(!VISU::CheckIsSameRange(aDestinationRange, aSourceRange))
+    theDestination->SetRange( aSourceRange );
+
+  theDestination->SetScaling( theSource->GetScaling() );
+  theDestination->SetClamping( theSource->GetClamping() );
+  theDestination->SetScaleMode( theSource->GetScaleMode() );
+  theDestination->SetColorMode( theSource->GetColorMode() );
+  theDestination->SetScaleFactor( theSource->GetScaleFactor() );
 }
 
 
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
-  if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
-    // To restore mapper input from pipeline
-    vtkPolyData* aDatsSet = myPSMapper->GetInput();
-    myPSMapper->ShallowCopy(aPipeLine->GetPSMapper());
-    myPSMapper->SetInput(aDatsSet);
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
 
+  if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
     SetPrimitiveType(aPipeLine->GetPrimitiveType());
     SetBicolor(aPipeLine->GetBicolor());
     SetClamp(aPipeLine->GetClamp());
@@ -151,43 +175,33 @@ VISU_GaussPointsPL
     SetIsDeformed( aPipeLine->GetIsDeformed() );
     SetScale( aPipeLine->GetScale() );
 
-    mySphereSource->SetRadius( aPipeLine->mySphereSource->GetRadius() );
+    vtkFloatingPointType aRadius = aPipeLine->mySphereSource->GetRadius();
+    if(!VISU::CheckIsSameValue(mySphereSource->GetRadius(), aRadius))
+      mySphereSource->SetRadius( aRadius );
+
     CopyGlyph( aPipeLine->myGlyph, this->myGlyph );
   }
-  Superclass::ShallowCopy(thePipeLine);
 }
 
 
 //----------------------------------------------------------------------------
-VISU_PipeLine::TMapper* 
-VISU_GaussPointsPL
-::GetMapper()
-{
-  return GetPSMapper();
-}
-
 VISU_OpenGLPointSpriteMapper* 
 VISU_GaussPointsPL
-::GetPSMapper()
+::GetPointSpriteMapper()
 {
-  if(GetInput()){
-    if(!myPSMapper->GetInput()){
-      GetInput2()->Update();
-      Build();
-      Init();
-    }
-    myPSMapper->Update();
-  }
-  return myPSMapper;
+  return GetPointSpriteMapperHolder()->GetPointSpriteMapper();
 }
 
-vtkDataSet* 
+
+//----------------------------------------------------------------------------
+vtkPolyData* 
 VISU_GaussPointsPL
 ::GetPickableDataSet()
 {
-  return myGeomFilter->GetOutput();
+  return myPassFilter[1]->GetPolyDataOutput();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
@@ -195,6 +209,8 @@ VISU_GaussPointsPL
 {
   Superclass::Init();
 
+  SetExtractInside(false);
+
   vtkDataSet* aDataSet = GetParentMesh();
   vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
 
@@ -204,164 +220,148 @@ VISU_GaussPointsPL
     SetScale( aScaleFactor / aScalarRange[1] );
   else
     SetScale(0.0);
-
-  // Deformed Shape
-  myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
-
-  myGeomFilter->SetInput( myPassFilter[0]->GetOutput() );
-
-  // Geometrical Sphere
-  myPassFilter[1]->SetInput(myGeomFilter->GetOutput());
-
-  myPSMapper->SetInput( myPassFilter[1]->GetPolyDataOutput() );
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::Build()
 {
+  Superclass::Build();
+
+  // Deformed Shape
+  myPassFilter[0]->SetInput(GetFieldTransformFilter()->GetOutput());
+
+  myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
+
+  // Geometrical Sphere
+  myPassFilter[2]->SetInput(myPassFilter[1]->GetOutput());
+
+  GetPointSpriteMapper()->SetInput( myPassFilter[2]->GetPolyDataOutput() );
+
+  // Update according the current state
+  SetIsDeformed(GetIsDeformed());
+
+  SetPrimitiveType(GetPrimitiveType());
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::Update()
 {
-  //cout << "VISU_GaussPointsPL::Update()" << endl;
-  vtkFloatingPointType* aScalarRange = GetScalarRange();
-  mySourceScalarRange[0] = aScalarRange[0];
-  mySourceScalarRange[1] = aScalarRange[1];
-  myDeltaScalarRange = aScalarRange[1] - aScalarRange[0];
-
   SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
 
-  vtkMapper* aMapper = GetMapper();
-  vtkDataSet* aDataSet = aMapper->GetInput();
-  vtkCellData* aCellData = aDataSet->GetCellData();
-  myScalarArray = aCellData->GetScalars();
+  this->UpdateGlyph();
 
-  myPSMapper->SetLookupTable( myMapperTable );
-  myPSMapper->SetScalarRange( aScalarRange );
+  Superclass::Update();
+}
 
-  this->UpdateGlyph();
 
-  VISU_ScalarMapPL::Update();
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPointsPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+  
+  if(GetIsDeformed())
+    if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere)
+    if(vtkDataSet* aDataSet = myGlyph->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::UpdateGlyph()
 {
-  //cout << "VISU_GaussPointsPL::UpdateGlyph()" << endl;
-
   vtkFloatingPointType* aScalarRange = GetScalarRange();
 
-  if( myPSMapper->GetPointSpriteMode() == 0 ) // Results
+  if( GetPointSpriteMapper()->GetPointSpriteMode() == 0 ) // Results
   {
-    //cout << "Results" << endl;
     myGlyph->ClampingOn();
     myGlyph->SetScaleModeToScaleByScalar();
     myGlyph->SetColorModeToColorByScalar();
 
-    vtkFloatingPointType aRange = 0;
+    vtkFloatingPointType aScaleFactor = 0.0;
     vtkFloatingPointType aMinSize = GetMinSize();
     vtkFloatingPointType aMaxSize = GetMaxSize();
-    if( fabs( aMaxSize - aMinSize ) > 0.0001 )
-      aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
-    vtkFloatingPointType aMinRange = aScalarRange[0] - aMinSize * aRange;
-    vtkFloatingPointType aMaxRange = aMinRange + aRange;
-
-    myGlyph->SetRange( aMinRange, aMaxRange );
-    myGlyph->SetScaleFactor( 1.0 );
+    if(!VISU::CheckIsSameValue(aMaxSize, aMinSize))
+      aScaleFactor = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
+    
+    vtkFloatingPointType aMinRange = aScalarRange[0] - aMinSize * aScaleFactor;
+    vtkFloatingPointType aMaxRange = aMinRange + aScaleFactor;
+    vtkFloatingPointType aRange[2] = {aMinRange, aMaxRange};
+
+    if(!VISU::CheckIsSameRange(myGlyph->GetRange(), aRange))
+      myGlyph->SetRange( aRange );
+
+    if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), 1.0))
+      myGlyph->SetScaleFactor( 1.0 );
   }
-  else if( myPSMapper->GetPointSpriteMode() == 1 ) // Geometry
+  else if( GetPointSpriteMapper()->GetPointSpriteMode() == 1 ) // Geometry
   {
-    //cout << "Geometry" << endl;
     myGlyph->ClampingOff();
     myGlyph->SetScaleModeToDataScalingOff();
     myGlyph->SetColorModeToColorByScale();
 
-    myGlyph->SetScaleFactor( GetSize() );
+    vtkFloatingPointType aScaleFactor = GetSize();
+    if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), aScaleFactor))
+      myGlyph->SetScaleFactor( aScaleFactor );
   }
-  else if( myPSMapper->GetPointSpriteMode() == 2 ) // Outside
+  else if( GetPointSpriteMapper()->GetPointSpriteMode() == 2 ) // Outside
   {
-    //cout << "Outside" << endl;
     myGlyph->ClampingOff();
     myGlyph->SetScaleModeToDataScalingOff();
     myGlyph->SetColorModeToColorByScalar();
 
-    myGlyph->SetScaleFactor( GetSize() );
+    vtkFloatingPointType aScaleFactor = GetSize();
+    if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), aScaleFactor))
+      myGlyph->SetScaleFactor( aScaleFactor );
   }
 
-  mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
+  vtkFloatingPointType aRadius = GetMagnification() * GetAverageCellSize() / 2.0;
+  if(!VISU::CheckIsSameValue(mySphereSource->GetRadius(), aRadius))
+    mySphereSource->SetRadius( aRadius );
 }
 
+
 //----------------------------------------------------------------------------
 VISU::TGaussPointID 
 VISU_GaussPointsPL
-::GetObjID(vtkIdType theID) const
-{
-  return myGaussPtsIDMapper->GetObjID(theID);
-}
-
-vtkFloatingPointType* 
-VISU_GaussPointsPL
-::GetNodeCoord(int theObjID)
-{
-  vtkIdType anID = GetNodeVTKID(theObjID);
-  vtkDataSet* aDataSet = myGeomFilter->GetInput();
-  return aDataSet->GetPoint(anID);
-}
-
-void
-VISU_GaussPointsPL
-::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper)
-{
-  myGaussPtsIDMapper = theGaussPtsIDMapper;
-  SetIDMapper(myGaussPtsIDMapper);
-}
-
-const VISU::PGaussPtsIDMapper&  
-VISU_GaussPointsPL
-::GetGaussPtsIDMapper() const
+::GetObjID(vtkIdType theID)
 {
-  return myGaussPtsIDMapper;
+  return GetGaussPtsIDMapper()->GetObjID(theID);
 }
 
-VISU::TVTKOutput*  
-VISU_GaussPointsPL
-::GetParentMesh() const
-{
-  VISU::TNamedIDMapper* aNamedIDMapper = myGaussPtsIDMapper->GetParent();
-  return aNamedIDMapper->GetVTKOutput();
-}
 
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetIsDeformed( bool theIsDeformed )
 {
-  if( theIsDeformed )
-  {
-    myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
-    myPassFilter[0]->SetInput(myWarpVector->GetOutput());
-  }
-  else
-    myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
-
-  myIsDeformed = theIsDeformed;
-
-  Modified();
+  if(theIsDeformed){
+    myWarpVector->SetInput( myPassFilter[0]->GetPolyDataOutput() );
+    myPassFilter[1]->SetInput(myWarpVector->GetOutput());
+  }else
+    myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
 }
 
 //----------------------------------------------------------------------------
 bool
 VISU_GaussPointsPL
-::GetIsDeformed() const
+::GetIsDeformed()
 {
-  return myIsDeformed;
+  return myPassFilter[1]->GetInput() != myPassFilter[0]->GetOutput();
 }
 
 //----------------------------------------------------------------------------
@@ -372,10 +372,8 @@ VISU_GaussPointsPL
   if(GetBicolor() == theBicolor)
     return;
 
-  myMapperTable->SetBicolor( theBicolor );
-  myBarTable->SetBicolor( theBicolor );
-
-  Modified();
+  GetMapperTable()->SetBicolor( theBicolor );
+  GetBarTable()->SetBicolor( theBicolor );
 }
 
 //----------------------------------------------------------------------------
@@ -383,7 +381,7 @@ bool
 VISU_GaussPointsPL
 ::GetBicolor()
 {
-  return myMapperTable->GetBicolor();
+  return GetMapperTable()->GetBicolor();
 }
 
 //----------------------------------------------------------------------------
@@ -391,8 +389,15 @@ void
 VISU_GaussPointsPL
 ::SetIsColored(bool theIsColored)
 {
-  myPSMapper->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU_GaussPointsPL
+::GetIsColored()
+{
+  return GetPointSpriteMapper()->GetPointSpriteMode() == 0;
 }
 
 //----------------------------------------------------------------------------
@@ -402,48 +407,52 @@ VISU_GaussPointsPL
 {
   if( thePrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
   {
-    myGlyph->SetInput( myGeomFilter->GetOutput() );
-    myPassFilter[1]->SetInput(myGlyph->GetOutput());
+    myGlyph->SetInput( myPassFilter[1]->GetOutput() );
+    myPassFilter[2]->SetInput(myGlyph->GetOutput());
   }
   else
-    myPassFilter[1]->SetInput(myGeomFilter->GetOutput());
-
-  myPSMapper->SetPrimitiveType( thePrimitiveType );
+    myPassFilter[2]->SetInput(myPassFilter[1]->GetOutput());
 
-  Modified();
+  GetPointSpriteMapper()->SetPrimitiveType( thePrimitiveType );
 }
 
+
 //----------------------------------------------------------------------------
 int
 VISU_GaussPointsPL
 ::GetPrimitiveType()
 {
-  return myPSMapper->GetPrimitiveType();
+  if( myPassFilter[2]->GetInput() != myPassFilter[1]->GetOutput() )
+    return VISU_OpenGLPointSpriteMapper::GeomSphere;
+
+  return GetPointSpriteMapper()->GetPrimitiveType();
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetMaximumSupportedSize()
 {
-  return myPSMapper->GetMaximumSupportedSize();
+  return GetPointSpriteMapper()->GetMaximumSupportedSize();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetClamp(vtkFloatingPointType theClamp)
 {
-  myPSMapper->SetPointSpriteClamp( theClamp );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteClamp( theClamp );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetClamp()
 {
-  return myPSMapper->GetPointSpriteClamp();
+  return GetPointSpriteMapper()->GetPointSpriteClamp();
 }
 
 //----------------------------------------------------------------------------
@@ -451,104 +460,123 @@ void
 VISU_GaussPointsPL
 ::SetSize(vtkFloatingPointType theSize)
 {
-  myPSMapper->SetPointSpriteSize( theSize );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteSize( theSize );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetSize()
 {
-  return myPSMapper->GetPointSpriteSize();
+  return GetPointSpriteMapper()->GetPointSpriteSize();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetMinSize(vtkFloatingPointType theMinSize)
 {
-  myPSMapper->SetPointSpriteMinSize( theMinSize );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteMinSize( theMinSize );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetMinSize()
 {
-  return myPSMapper->GetPointSpriteMinSize();
+  return GetPointSpriteMapper()->GetPointSpriteMinSize();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetMaxSize(vtkFloatingPointType theMaxSize)
 {
-  myPSMapper->SetPointSpriteMaxSize( theMaxSize );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteMaxSize( theMaxSize );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetMaxSize()
 {
-  return myPSMapper->GetPointSpriteMaxSize();
+  return GetPointSpriteMapper()->GetPointSpriteMaxSize();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetMagnification(vtkFloatingPointType theMagnification)
 {
-  myPSMapper->SetPointSpriteMagnification( theMagnification );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteMagnification( theMagnification );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetMagnification()
 {
-  return myPSMapper->GetPointSpriteMagnification();
+  return GetPointSpriteMapper()->GetPointSpriteMagnification();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetMagnificationIncrement(vtkFloatingPointType theIncrement)
 {
+  if(VISU::CheckIsSameValue(myMagnificationIncrement, theIncrement))
+    return;
+
   myMagnificationIncrement = theIncrement;
+  Modified();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold)
 {
-  myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
-  Modified();
+  GetPointSpriteMapper()->SetPointSpriteAlphaThreshold( theAlphaThreshold );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetAlphaThreshold()
 {
-  return myPSMapper->GetPointSpriteAlphaThreshold();
+  return GetPointSpriteMapper()->GetPointSpriteAlphaThreshold();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetResolution(int theResolution)
 {
-  myResolution = theResolution;
-  mySphereSource->SetThetaResolution( myResolution );
-  mySphereSource->SetPhiResolution( myResolution );
+  mySphereSource->SetThetaResolution( theResolution );
+  mySphereSource->SetPhiResolution( theResolution );
 }
 
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussPointsPL
+::GetResolution()
+{
+  return mySphereSource->GetThetaResolution();
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
@@ -558,6 +586,7 @@ VISU_GaussPointsPL
   SetMagnification( GetMagnification() * anIncrement );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
@@ -568,9 +597,13 @@ VISU_GaussPointsPL
   vtkFloatingPointType aDelta = aMaxSize - aMinSize;
   vtkFloatingPointType aVal = theScalarArray->GetTuple1(theID);
 
-  return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange;
+  vtkFloatingPointType* aScalarRange = GetScalarRange();
+  vtkFloatingPointType aDeltaScalarRange = aScalarRange[1] - aScalarRange[0];
+
+  return aMinSize + aDelta*(aVal - aScalarRange[0]) / aDeltaScalarRange;
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
@@ -579,6 +612,7 @@ VISU_GaussPointsPL
   return GetAverageCellSize() * GetMaxSize();
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
@@ -586,36 +620,39 @@ VISU_GaussPointsPL
 {
   vtkMapper* aMapper = GetMapper();
   vtkDataSet* aDataSet = aMapper->GetInput();
-  vtkCellData* aCellData = aDataSet->GetCellData();
-  vtkDataArray* aScalarArray = aCellData->GetScalars();
-  return GetPointSize(theID,aScalarArray);
+  vtkPointData* aPointData = aDataSet->GetPointData();
+  vtkDataArray* aScalarArray = aPointData->GetScalars();
+  return GetPointSize(theID, aScalarArray);
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetAverageCellSize(vtkFloatingPointType theAverageCellSize)
 {
-  myPSMapper->SetAverageCellSize( theAverageCellSize );
-  Modified();
+  GetPointSpriteMapper()->SetAverageCellSize( theAverageCellSize );
 }
 
+
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_GaussPointsPL
 ::GetAverageCellSize()
 {
-  return myPSMapper->GetAverageCellSize();
+  return GetPointSpriteMapper()->GetAverageCellSize();
 }
 
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
 ::SetImageData(vtkImageData* theImageData)
 {
-  myPSMapper->SetImageData( theImageData );
+  GetPointSpriteMapper()->SetImageData( theImageData );
 }
 
+
 //----------------------------------------------------------------------------
 vtkSmartPointer<vtkImageData>
 VISU_GaussPointsPL
@@ -678,22 +715,36 @@ VISU_GaussPointsPL
   return aCompositeImageData;
 }
 
-void VISU_GaussPointsPL::SetScale( vtkFloatingPointType theScale )
+
+void
+VISU_GaussPointsPL
+::SetScale( vtkFloatingPointType theScale )
 {
+  if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
+    return;
+
   myWarpVector->SetScaleFactor( theScale );
-  myScaleFactor = GetScale();
-  Modified();
+  myScaleFactor = theScale;
 }
 
-vtkFloatingPointType VISU_GaussPointsPL::GetScale()
+
+vtkFloatingPointType 
+VISU_GaussPointsPL
+::GetScale()
 {
   return myWarpVector->GetScaleFactor();
 }
 
-void VISU_GaussPointsPL::SetMapScale( vtkFloatingPointType theMapScale )
+
+void
+VISU_GaussPointsPL
+::SetMapScale( vtkFloatingPointType theMapScale )
 {
-  VISU_ScalarMapPL::SetMapScale( theMapScale );
+  Superclass::SetMapScale( theMapScale );
 
-  myWarpVector->SetScaleFactor( myScaleFactor * theMapScale );
-  Modified();
+  vtkFloatingPointType aMapScale = myScaleFactor * theMapScale;
+  if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), aMapScale))
+    return;
+
+  myWarpVector->SetScaleFactor( aMapScale );
 }
index 4acd793f6214ab69dfa52ca95ce17036879b7a06..a1a3913b19c8f69c20f5fbafae648da225b61fa7 100644 (file)
 #ifndef VISU_GaussPointsPL_HeaderFile
 #define VISU_GaussPointsPL_HeaderFile
 
-#include "VISU_ScalarMapPL.hxx"
-#include "VISU_Convertor.hxx"
+#include "VISU_ColoredPL.hxx"
 
 #include <vector>
 
 class VTKViewer_PassThroughFilter;
 class VISU_OpenGLPointSpriteMapper;
+class VISU_PointSpriteMapperHolder;
 
 class vtkGeometryFilter;
 class vtkGlyph3D;
@@ -43,81 +43,71 @@ class vtkDataArray;
 class vtkImageData;
 class vtkPointSet;
 
-class vtkCellDataToPointData;
 class vtkWarpVector;
 class SALOME_Transform;
 
+
+//----------------------------------------------------------------------------
 //! Pipeline for the Gauss Points presentation.
 /*!
  * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
  * for rendering the Gauss Points as Point Sprites.
  */
-class VISU_GaussPointsPL : public VISU_ScalarMapPL
+class VISU_GaussPointsPL : public VISU_ColoredPL
 {
-protected:
-  VISU_GaussPointsPL();
-
-  virtual
-  ~VISU_GaussPointsPL();
-
 public:
-  vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
+  //----------------------------------------------------------------------------
+  vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
 
   static 
-  VISU_GaussPointsPL* New();
+  VISU_GaussPointsPL* 
+  New();
   
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
+  //----------------------------------------------------------------------------
+  void 
+  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
 
-  //! Get the native mapper.
-  virtual
-  TMapper* 
-  GetMapper();
+  const VISU::PGaussPtsIDMapper&  
+  GetGaussPtsIDMapper();
+
+  VISU_PointSpriteMapperHolder*
+  GetPointSpriteMapperHolder();
 
   //! Get the internal #VISU_OpenGLPointSpriteMapper.
   VISU_OpenGLPointSpriteMapper*
-  GetPSMapper();
+  GetPointSpriteMapper();
+
+  vtkDataSet*  
+  GetParentMesh();
 
   //! Get an intermediate dataset that can be picked  
-  vtkDataSet*
+  vtkPolyData*
   GetPickableDataSet();
 
+  //----------------------------------------------------------------------------
   //! Redefined method for initialization of the pipeline.
   virtual
   void
   Init();
 
-  //! Redefined method for building the pipeline.
-  virtual
-  void
-  Build();
-
   //! Redefined method for updating the pipeline.
   virtual
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
+  //----------------------------------------------------------------------------
   //! Update glyph.
   void
   UpdateGlyph();
 
   virtual 
   VISU::TGaussPointID 
-  GetObjID(vtkIdType theID) const;
-
-  virtual
-  vtkFloatingPointType* 
-  GetNodeCoord(vtkIdType theObjID);
-
-  void 
-  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
-
-  const VISU::PGaussPtsIDMapper&  
-  GetGaussPtsIDMapper() const;
-
-  VISU::TVTKOutput*  
-  GetParentMesh() const;
+  GetObjID(vtkIdType theID);
 
   //! Set the Bicolor mode.
   /*!
@@ -141,6 +131,9 @@ public:
   void
   SetIsColored(bool theIsColored);
 
+  bool 
+  GetIsColored();
+
   //! Set type of the primitives.
   void
   SetPrimitiveType(int thePrimitiveType);
@@ -215,7 +208,7 @@ public:
 
   //! Get resolution of the Geometrical Sphere.
   int
-  GetResolution() { return myResolution; }
+  GetResolution();
 
   //! Method for changing the Magnification parameter.
   void
@@ -256,35 +249,57 @@ public:
               const char* theAlphaTexture );
 
 public:
-  virtual void  SetIsDeformed( bool theIsDeformed );
-  virtual bool  GetIsDeformed() const;
+  //----------------------------------------------------------------------------
+  virtual 
+  void
+  SetIsDeformed( bool theIsDeformed );
+
+  virtual
+  bool
+  GetIsDeformed();
+
+  virtual
+  void
+  SetScale( vtkFloatingPointType theScale );
+
+  virtual
+  vtkFloatingPointType 
+  GetScale();
 
-  virtual void  SetScale( vtkFloatingPointType theScale );
-  virtual vtkFloatingPointType GetScale();
-  virtual void  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
+  virtual
+  void
+  SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
 
 protected:
-  bool myIsDeformed;
+  //----------------------------------------------------------------------------
+  VISU_GaussPointsPL();
+
+  virtual
+  ~VISU_GaussPointsPL();
+
+  virtual
+  void
+  OnCreateMapperHolder();
+
+  virtual
+  void
+  Build();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
+private:
+  //----------------------------------------------------------------------------
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
-  vtkCellDataToPointData* myCellDataToPointData;
   std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+  vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
   
   vtkGlyph3D* myGlyph;
   vtkSphereSource* mySphereSource;
-  int myResolution;
-
-protected:
-  VISU_OpenGLPointSpriteMapper* myPSMapper;
-  VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
-
-  vtkGeometryFilter* myGeomFilter;
-
-  vtkDataArray *myScalarArray;
-  vtkFloatingPointType mySourceScalarRange[2];
-  vtkFloatingPointType myDeltaScalarRange;
 
-  int   myPrimitiveType;
   vtkFloatingPointType myMagnificationIncrement;
 };
   
index 2d0be6cc83452081ab4c9762f4c50bee04728b05..950330c2330465140f3667c32dc3c3cd1ade7976 100644 (file)
 
 
 #include "VISU_IsoSurfacesPL.hxx"
+#include "VISU_LookupTable.hxx"
+
 #include "VISU_PipeLineUtils.hxx"
 
 #include <vtkContourFilter.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_IsoSurfacesPL);
 
+
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::VISU_IsoSurfacesPL()
 {
+  SetIsShrinkable(false);
+
   myContourFilter = vtkContourFilter::New();
+
   myCellDataToPointData = vtkCellDataToPointData::New();
-  myIsShrinkable = false;
 }
 
+
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::~VISU_IsoSurfacesPL()
 {
-  myContourFilter->UnRegisterAllOutputs();
   myContourFilter->Delete();
+  myContourFilter = NULL;
 
-  myCellDataToPointData->UnRegisterAllOutputs();
   myCellDataToPointData->Delete();
+  myCellDataToPointData = NULL;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
     SetNbParts(aPipeLine->GetNbParts());
     vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
     SetRange(aRange);
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 int
 VISU_IsoSurfacesPL
 ::GetNbParts() 
 {
   return myContourFilter->GetNumberOfContours();
 }
+
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetNbParts(int theNb) 
@@ -78,27 +97,33 @@ VISU_IsoSurfacesPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
-::SetScaling(int theScaling
+::SetScalarRange(vtkFloatingPointType theRange[2]
 {
-  VISU_ScalarMapPL::SetScaling(theScaling);
+  Superclass::SetScalarRange(theRange);
   SetRange(myRange);
 }
+
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetRange(vtkFloatingPointType theRange[2])
 {
   if(theRange[0] <= theRange[1]){
-    myRange[0] = theRange[0];  myRange[1] = theRange[1];
-    vtkFloatingPointType aRange[2] = {myRange[0], myRange[1]};
+    myRange[0] = theRange[0];  
+    myRange[1] = theRange[1];
+    vtkFloatingPointType aRange[2] = {theRange[0], theRange[1]};
     if(GetScaling() == VTK_SCALE_LOG10)
-      VISU_LookupTable::ComputeLogRange(theRange,aRange);
-    myContourFilter->GenerateValues(GetNbParts(),aRange);
-    Modified();
+      VISU_LookupTable::ComputeLogRange(theRange, aRange);
+    myContourFilter->GenerateValues(GetNbParts(), aRange);
   }
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_IsoSurfacesPL
 ::GetMin() 
@@ -106,6 +131,8 @@ VISU_IsoSurfacesPL
   return myRange[0];
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_IsoSurfacesPL
 ::GetMax() 
@@ -115,43 +142,73 @@ VISU_IsoSurfacesPL
 
 
 void
+//----------------------------------------------------------------------------
 VISU_IsoSurfacesPL
 ::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
 
   SetNbParts(10);
+
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
   SetRange(aScalarRange);
 }
 
-VISU_ScalarMapPL::THook* 
+//----------------------------------------------------------------------------
+
+vtkDataSet* 
 VISU_IsoSurfacesPL
-::DoHook()
+::InsertCustomPL()
 {
-  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
+  VISU::CellDataToPoint(myContourFilter,
+                       myCellDataToPointData,
+                       GetClippedInput(),
+                       GetFieldTransformFilter());
   return myContourFilter->GetOutput();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::Update()
 {
-  VISU_ScalarMapPL::Update();
+  Superclass::Update();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_IsoSurfacesPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myContourFilter->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_IsoSurfacesPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()};
   vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]};
   if(GetScaling() == VTK_SCALE_LOG10)
     VISU_LookupTable::ComputeLogRange(aRange,aNewRange);
-  myContourFilter->GenerateValues(GetNbParts(),aNewRange);
-  Modified();
+  myContourFilter->GenerateValues(GetNbParts(), aNewRange);
 }
+
+
+//----------------------------------------------------------------------------
index 2049a761a832a6fd97594048077f6b02fb19e798..207dee8bfd5ecad3999482faa6cb14a39366c152 100644 (file)
 class vtkContourFilter;
 class vtkCellDataToPointData;
 
+
+//----------------------------------------------------------------------------
 class VISU_IsoSurfacesPL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_IsoSurfacesPL();
-  VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
-
-  virtual
-  ~VISU_IsoSurfacesPL();
-
 public:
-  vtkTypeMacro(VISU_IsoSurfacesPL,VISU_ScalarMapPL);
+  vtkTypeMacro(VISU_IsoSurfacesPL, VISU_ScalarMapPL);
 
   static
   VISU_IsoSurfacesPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   int
   GetNbParts();
@@ -62,7 +53,7 @@ public:
 
   virtual
   void
-  SetScaling(int theScaling = VTK_SCALE_LINEAR);
+  SetScalarRange(vtkFloatingPointType theRange[2]);
 
   virtual
   void
@@ -85,15 +76,31 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
   virtual
-  THook* 
-  DoHook();
+  unsigned long int
+  GetMemorySize();
+
+  virtual
+  vtkDataSet* 
+  InsertCustomPL();
 
   virtual
   void
   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
 
 protected:
+  VISU_IsoSurfacesPL();
+  VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
+
+  virtual
+  ~VISU_IsoSurfacesPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
   int myNbParts;
   vtkFloatingPointType myRange[2];
   vtkCellDataToPointData* myCellDataToPointData;
index b4730bc3066e6e3ed25882343e2d1c83a0d905f9..dd9ea354cccd44d041ba113cf616cd98fc136235 100644 (file)
 //
 //
 //
-// File:    VISU_PipeLine.cxx
+// File:    VISU_MeshPL.cxx
 // Author:  Alexey PETROV
 // Module : VISU
 
 
 #include "VISU_MeshPL.hxx"
-#include "VTKViewer_GeometryFilter.h"
 
-#include <vtkProperty.h>
-#include <vtkObjectFactory.h>
+#include "VISU_DataSetMapperHolder.hxx"
+
 #include <vtkDataSetMapper.h>
-#include <vtkUnstructuredGrid.h>
+#include <vtkObjectFactory.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_MeshPL);
 
-VISU_MeshPL::VISU_MeshPL()
+
+//----------------------------------------------------------------------------
+VISU_MeshPL
+::VISU_MeshPL():
+  VISU_UnstructuredGridPL(this)
 {
-  myIsShrinkable = true;
+  SetIsShrinkable(true);
 }
 
-void VISU_MeshPL::Build()
+
+//----------------------------------------------------------------------------
+void  
+VISU_MeshPL
+::OnCreateMapperHolder()
 {
-  myMapper->SetInput(GetInput2());
+  VISU_UnstructuredGridPL::OnCreateMapperHolder();
 }
 
-void VISU_MeshPL::Init()
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshPL
+::Build()
 {
+  GetDataSetMapperHolder()->GetDataSetMapper()->SetInput(GetInput());
 }
+
+
+//----------------------------------------------------------------------------
index 6ada3e680ed0967776ce455025b2b205ce6a5730..8221a0f060efa2cefa963163f8f482d054e159d0 100644 (file)
@@ -20,7 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
-// File:    VISU_PipeLine.hxx
+// File:    VISU_MeshPL.hxx
 // Author:  Alexey PETROV
 // Module : VISU
 
 #define VISU_MeshPL_HeaderFile
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_UnstructuredGridPL.hxx"
 
-class VISU_MeshPL : public VISU_PipeLine{
+
+//----------------------------------------------------------------------------
+class VISU_MeshPL : public VISU_PipeLine,
+                   public VISU_UnstructuredGridPL
+{
+public:
+  vtkTypeMacro(VISU_MeshPL, VISU_PipeLine);
+
+  //----------------------------------------------------------------------------
+  static 
+  VISU_MeshPL* 
+  New();
+  
 protected:
+  //----------------------------------------------------------------------------
   VISU_MeshPL();
   VISU_MeshPL(const VISU_MeshPL&);
-public:
-  vtkTypeMacro(VISU_MeshPL,VISU_PipeLine);
-  static VISU_MeshPL* New();
-  
-public:
-  virtual void Build();
-  virtual void Init();
+
+  virtual
+  void
+  OnCreateMapperHolder();
+
+  virtual
+  void
+  Build();
 };
 
 #endif
index 680a21ab3055d56c51dc51cb6d91b454dc8cc14c..fba3a746b79a77ebdd4921608121853df8b9bde4 100755 (executable)
 #include <vtkCellArray.h>
 #include <vtkCellData.h>
 #include <vtkCommand.h>
-#include <vtkDataArray.h>
-#include <vtkFloatArray.h>
 #include <vtkImageData.h>
 #include <vtkMatrix4x4.h>
 #include <vtkObjectFactory.h>
-#include <vtkOpenGLRenderer.h>
-#include <vtkOpenGLRenderWindow.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
 #include <vtkPointData.h>
 #include <vtkPolyData.h>
 #include <vtkPolygon.h>
@@ -51,6 +49,8 @@
 #include <cmath>
 #include <string>
 
+//#define _DEBUG_RENDERING_PERFORMANCE_
+
 #ifndef GLX_GLXEXT_LEGACY
 #define GLX_GLXEXT_LEGACY
 #endif
@@ -205,7 +205,7 @@ bool InitializeARB()
 };
 
 static bool IsARBInitialized = InitializeARB();
-static float Tolerance = 1.0 / VTK_LARGE_FLOAT;
+static vtkFloatingPointType Tolerance = 1.0 / VTK_LARGE_FLOAT;
 
 //-----------------------------------------------------------------------------
 // Construct empty object.
@@ -237,8 +237,6 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
   this->PointSpriteTexture       = 0;
 
   this->UseOpenGLMapper          = false;
-
-  this->TempMapper               = vtkPolyDataMapper::New();
 }
 //-----------------------------------------------------------------------------
 VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper()
@@ -248,35 +246,8 @@ VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper()
 
   if( this->LastWindow )
     this->ReleaseGraphicsResources(this->LastWindow);
-
-  if( this->TempMapper )
-    this->TempMapper->Delete();
 }
-//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
-{
-  VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper);
-  if( m != NULL )
-  {
-    this->SetPrimitiveType( m->GetPrimitiveType() );
-
-    this->SetPointSpriteMode( m->GetPointSpriteMode() );
 
-    this->SetPointSpriteClamp( m->GetPointSpriteClamp() );
-    this->SetPointSpriteSize( m->GetPointSpriteSize() );
-    this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() );
-    this->SetPointSpriteMaxSize( m->GetPointSpriteMaxSize() );
-    this->SetPointSpriteMagnification( m->GetPointSpriteMagnification() );
-
-    this->SetImageData( m->GetImageData() );
-    this->SetPointSpriteAlphaThreshold( m->GetPointSpriteAlphaThreshold() );
-  }
-
-  this->TempMapper->ShallowCopy( m );
-  this->TempMapper->SetInput( this->GetInput() );
-  Superclass::ShallowCopy( this->TempMapper );
-
-}
 //-----------------------------------------------------------------------------
 char* readFromFile( std::string fileName )
 {
@@ -352,6 +323,7 @@ void VISU_OpenGLPointSpriteMapper::InitShader()
   */
   free( shader );
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value )
 {
@@ -361,6 +333,7 @@ void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, floa
 
   vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value );
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPrimitiveType( int thePrimitiveType )
 {
@@ -369,6 +342,7 @@ void VISU_OpenGLPointSpriteMapper::SetPrimitiveType( int thePrimitiveType )
 
   this->PrimitiveType = thePrimitiveType;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
 {
@@ -378,6 +352,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
   this->PointSpriteMode = theMode;
   this->Modified();
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp )
 {
@@ -386,6 +361,16 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp )
 
   this->PointSpriteClamp = theClamp;
 }
+
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetAverageCellSize(float theSize)
+{
+  if( fabs( this->AverageCellSize - theSize ) < Tolerance )
+    return;
+
+  this->AverageCellSize = theSize;
+}
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize )
 {
@@ -394,6 +379,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize )
 
   this->PointSpriteSize = theSize;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize )
 {
@@ -402,6 +388,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize )
 
   this->PointSpriteMinSize = theMinSize;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize )
 {
@@ -410,6 +397,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize )
 
   this->PointSpriteMaxSize = theMaxSize;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnification )
 {
@@ -418,6 +406,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnifi
 
   this->PointSpriteMagnification = theMagnification;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaThreshold )
 {
@@ -426,6 +415,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaT
 
   this->PointSpriteAlphaThreshold = theAlphaThreshold;
 }
+
 //-----------------------------------------------------------------------------
 bool VISU_OpenGLPointSpriteMapper::InitExtensions()
 {
@@ -554,6 +544,14 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
        act->GetProperty()->GetMTime() > this->BuildTime ||
        ren->GetRenderWindow() != this->LastWindow)
   {
+#ifdef _DEBUG_RENDERING_PERFORMANCE_
+    // To control when the mapper is recalculated
+    cout<<"VISU_OpenGLPointSpriteMapper::RenderPiece - "
+       <<(this->GetMTime() > this->BuildTime)<<"; "
+       <<(input->GetMTime() > this->BuildTime)<<"; "
+       <<(act->GetProperty()->GetMTime() > this->BuildTime)<<"; "
+       <<endl;
+#endif
     // sets this->Colors as side effect
     this->MapScalars( act->GetProperty()->GetOpacity() );
 
@@ -622,6 +620,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
   if( this->UsePointSprites ) //&& this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite )
     this->CleanupPointSprites();
 }
+
 //-----------------------------------------------------------------------------
 float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
 {
@@ -630,6 +629,7 @@ float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
 
   return maximumSupportedSize;
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::InitPointSprites()
 {
@@ -673,6 +673,7 @@ void VISU_OpenGLPointSpriteMapper::InitPointSprites()
   // Disable material properties
   glDisable( GL_COLOR_MATERIAL );
 }
+
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
 {
@@ -695,8 +696,10 @@ void
 VISU_OpenGLPointSpriteMapper
 ::SetImageData( vtkImageData* theImageData )
 {
-  //cout << "VISU_OpenGLPointSpriteMapper::SetImageData " << theImageData << endl;
+  if(GetImageData() == theImageData)
+    return;
   this->ImageData = theImageData;
+  this->Modified();
 }
 
 vtkImageData*
@@ -785,11 +788,7 @@ struct TVertex
 //-----------------------------------------------------------------------------
 void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints,
                                              vtkUnsignedCharArray *theColors,
-                                             vtkFloatArray *theAlpha,
-                                             vtkIdType &theCellNum,
-                                             int &theNoAbort,
                                              vtkCellArray *theCells,
-                                             vtkRenderer *theRenderer,
                                              vtkActor* theActor)
 {
   //cout << "VISU_OpenGLPointSpriteMapper::DrawPoints" << endl;
@@ -865,25 +864,22 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints,
 }
 
 //-----------------------------------------------------------------------------
-int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act)
+int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *theRenderer, vtkActor *theActor)
 {
 
   if( this->UseOpenGLMapper ||
       this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
-    return MAPPER_SUPERCLASS::Draw( aren, act );
+    return MAPPER_SUPERCLASS::Draw( theRenderer, theActor );
 
-  vtkOpenGLRenderer    *ren    = (vtkOpenGLRenderer *)aren;
   vtkUnsignedCharArray *colors = NULL;
-  vtkFloatArray        *alpha  = NULL;
   vtkPolyData          *input  = this->GetInput();
   vtkPoints            *points;
   int noAbort = 1;
   int cellScalars = 0;
-  vtkIdType cellNum = 0;
   float  tran;
 
   // get the transparency
-  tran = act->GetProperty()->GetOpacity();
+  tran = theActor->GetProperty()->GetOpacity();
 
   // if the primitives are invisable then get out of here
   if (tran <= 0.0)
@@ -910,7 +906,7 @@ int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act)
   // we need to know the total number of cells so that we can report progress
   this->TotalCells = input->GetVerts()->GetNumberOfCells();
 
-  this->DrawPoints(points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
+  this->DrawPoints(points, colors, input->GetVerts(), theActor);
 
   this->UpdateProgress(1.0);
   return noAbort;
index 7af9a27a3f821950455809abe2b1088729a46617..981d40a623ff1366a1947efe391f16517bc4080d 100755 (executable)
 class vtkCellArray;
 class vtkPoints;
 class vtkProperty;
-class vtkRenderWindow;
-class vtkOpenGLRenderer;
-class vtkOpenGLTexture;
-class vtkBMPReader;
 class vtkImageData;
-class vtkFloatArray;
 class vtkXMLImageDataReader;
 
 #ifndef VTK_IMPLEMENT_MESA_CXX
@@ -90,8 +85,6 @@ public:
   static VISU_OpenGLPointSpriteMapper *New();
   vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
 
-  void ShallowCopy(vtkAbstractMapper*);
-
   //! Set the initial point size to be used.
   /*!
    * This value forms the base upon which the distance attenuation acts.
@@ -99,13 +92,12 @@ public:
    * card for sprite display, then the quadratic factors are adjusted to
    * bring the size down.
    */
-  vtkSetMacro(DefaultPointSize, float);
-
   //! Get the initial point size to be used.
   vtkGetMacro(DefaultPointSize, float);
 
   //! Set Average Cell Size.
-  vtkSetMacro(AverageCellSize, float);
+  void
+  SetAverageCellSize(float theSize);
 
   //! Get Average Cell Size.
   vtkGetMacro(AverageCellSize, float);
@@ -220,14 +212,10 @@ protected:
   ~VISU_OpenGLPointSpriteMapper();
 
   //! Internal method of the Point Sprites drawing.
-  void              DrawPoints(vtkPoints *p,
-                              vtkUnsignedCharArray *c,
-                              vtkFloatArray *alpha,
-                              vtkIdType &cellNum,
-                              int &noAbort,
-                              vtkCellArray *ca,
-                              vtkRenderer *ren,
-                              vtkActor *act);
+  void              DrawPoints(vtkPoints *thePoints,
+                              vtkUnsignedCharArray *theColors,
+                              vtkCellArray *theCells,
+                              vtkActor* theActor);
 
   //! Initializing OpenGL extensions.
   bool              InitExtensions();
@@ -281,7 +269,6 @@ private:
   float             AverageCellSize;
 
   vtkSmartPointer<vtkImageData> ImageData;
-  vtkPolyDataMapper* TempMapper;
 };
 
 #endif
index 91e05edb700fa084d2928f26cd63e259ea494f59..cf976dce909c1c7845a79c1b916e54da12548e10 100644 (file)
 
 
 #include "VISU_PipeLine.hxx"
-#include "VISU_PipeLineUtils.hxx"
-
-#include "SALOME_ExtractGeometry.h"
+#include "VISU_MapperHolder.hxx"
 
-#include <float.h>
+#include "VISU_PipeLineUtils.hxx"
 
 #include <vtkObjectFactory.h>
-#include <vtkDataSetMapper.h>
-#include <vtkUnstructuredGrid.h>
-
 #include <vtkPlane.h>
-#include <vtkExtractGeometry.h>
-#include <vtkImplicitBoolean.h>
-#include <vtkImplicitFunction.h>
-#include <vtkImplicitFunctionCollection.h>
-#include <vtkMath.h>
 
-static int MYVTKDEBUG = 0;
+#include <float.h>
+#include <algorithm>
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -52,431 +43,393 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
+
+//----------------------------------------------------------------------------
 VISU_PipeLine
 ::VISU_PipeLine():
-  myMapper(vtkDataSetMapper::New()),
-  myExtractGeometry(SALOME_ExtractGeometry::New())
+  myIsShrinkable(false)
 {
   if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
-  SetDebug(MYVTKDEBUG);
-
-  myMapper->Delete();
-
-  // Clipping planes
-  myExtractGeometry->Delete();
-  myExtractGeometry->SetStoreMapping(true);
-
-  vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
-  myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
-  anImplicitBoolean->SetOperationTypeToIntersection();
-  anImplicitBoolean->Delete();
-
-  myIsShrinkable = false;
-
 }
 
+
+//----------------------------------------------------------------------------
 VISU_PipeLine
 ::~VISU_PipeLine()
 {
   if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<<this);
 }
 
-// Turn debugging output on.
-void
+
+//----------------------------------------------------------------------------
+unsigned long int 
 VISU_PipeLine
-::DebugOn()
+::GetMTime()
 {
-  myExtractGeometry->DebugOn();
-  Superclass::DebugOn();
+  unsigned long int aTime = Superclass::GetMTime();
+
+  if(myMapperHolder.GetPointer())
+    aTime = std::max(aTime, myMapperHolder->GetMTime());
+
+  return aTime;
 }
 
-// Turn debugging output off.
-void
+
+//----------------------------------------------------------------------------
+unsigned long int
 VISU_PipeLine
-::DebugOff()
+::GetMemorySize()
 {
-  myExtractGeometry->DebugOff();
-  Superclass::DebugOff();
+  unsigned long int aSize = 0;
+
+  if(myMapperHolder.GetPointer())
+    aSize += myMapperHolder->GetMemorySize();
+  
+  return aSize;
 }
 
+
+//----------------------------------------------------------------------------
 void 
 VISU_PipeLine
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::ShallowCopy(VISU_PipeLine *thePipeLine,
+             bool theIsCopyInput)
 {
   SetImplicitFunction(thePipeLine->GetImplicitFunction());
+  DoShallowCopy(thePipeLine, theIsCopyInput);
+  Update();
+}
 
-  // To restore mapper input from pipeline
-  vtkDataSet* aDatsSet = myMapper->GetInput();
-  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
-  myMapper->SetInput(aDatsSet);
 
-  Build();
+//----------------------------------------------------------------------------
+void 
+VISU_PipeLine
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
+{
+  GetMapperHolder()->ShallowCopy(thePipeLine->GetMapperHolder(),
+                                theIsCopyInput);
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_PipeLine
 ::SameAs(VISU_PipeLine *thePipeLine)
 {
-  ShallowCopy(thePipeLine);
-  SetImplicitFunction(vtkImplicitBoolean::New());
-  GetImplicitFunction()->Delete();
+  DoShallowCopy(thePipeLine, false);
+  Update();
 }
 
-TInput* 
+
+//----------------------------------------------------------------------------
+VISU_MapperHolder* 
 VISU_PipeLine
-::GetInput() const
+::GetMapperHolder()
 {
-  return myInput.GetPointer();
+  if(!myMapperHolder.GetPointer())
+    OnCreateMapperHolder();
+
+  return myMapperHolder.GetPointer();
 }
 
-vtkDataSet* 
+
+//----------------------------------------------------------------------------
+const VISU::PIDMapper&  
 VISU_PipeLine
-::GetOutput()
+::GetIDMapper()
 {
-  return GetMapper()->GetInput();
+  return GetMapperHolder()->GetIDMapper();
 }
 
-TInput* 
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_PipeLine
-::GetInput2() const
+::GetInput()
 {
-  vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
-  aDataSet->Update();
-  return aDataSet;
+  return GetMapperHolder()->GetInput();
 }
 
-void
+
+//----------------------------------------------------------------------------
+vtkMapper* 
 VISU_PipeLine
-::SetInput(TInput* theInput)
+::GetMapper()
 {
-  if(theInput)
-    theInput->Update();
+  return GetMapperHolder()->GetMapper();
+}
 
-  myExtractGeometry->SetInput(theInput);
-  myInput = theInput;
 
-  Modified();
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_PipeLine
+::GetOutput()
+{
+  return GetMapperHolder()->GetOutput();
 }
 
-VISU_PipeLine::TMapper* 
+
+//----------------------------------------------------------------------------
+bool
 VISU_PipeLine
-::GetMapper()
+::IsPlanarInput()
 {
-  if(GetInput()){
-    if(!myMapper->GetInput()){
-      GetInput2()->Update();
-      Build();
-    }
-    myMapper->Update();
-  }
-  return myMapper.GetPointer();
+  vtkFloatingPointType aBounds[6];
+  GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
+  if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
+      fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
+      fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN )
+    return true;
+
+  return false;
 }
 
+
+//----------------------------------------------------------------------------
 void 
 VISU_PipeLine
-::Update()
+::SetMapperHolder(VISU_MapperHolder* theHolder)
 {
-  myMapper->Update();
+  myMapperHolder = theHolder;
+  theHolder->SetPipeLine(this);
 }
 
-int
+
+//----------------------------------------------------------------------------
+void 
+VISU_PipeLine
+::Init()
+{}
+
+
+//----------------------------------------------------------------------------
+void 
 VISU_PipeLine
-::CheckAvailableMemory(const vtkFloatingPointType& theSize)
+::Update()
 {
-  try{
-    if(theSize > ULONG_MAX) return 0;
-    size_t aSize = size_t(theSize);
-    char *aCheck = new char[aSize];
-    if(aCheck) delete [] aCheck;
-    if(MYDEBUG && aCheck == NULL)
-      MESSAGE("CheckAvailableMemory("<<theSize<<") - cannot alloacate such amount of memory!!!");
-    return aCheck != NULL;
-    //return theSize < 1000*1024*1024;
-  }catch(std::bad_alloc& exc){
-    if(MYDEBUG)
-      MESSAGE("CheckAvailableMemory("<<theSize<<") " << exc.what());
-  } catch(...) {
-    if(MYDEBUG)
-      MESSAGE("CheckAvailableMemory("<<theSize<<") - unexpected exception was caught!!!");
-  }
-  return 0;
+  GetMapperHolder()->Update();
 }
 
-vtkFloatingPointType
+
+//----------------------------------------------------------------------------
+vtkIdType 
 VISU_PipeLine
-::GetAvailableMemory(vtkFloatingPointType theSize, 
-                    vtkFloatingPointType theMinSize)
+::GetNodeObjID(vtkIdType theID)
 {
-  while(!CheckAvailableMemory(theSize))
-    if(theSize > theMinSize)
-      theSize /= 2;
-    else
-      return 0;
-  return theSize;
+  return GetMapperHolder()->GetNodeObjID(theID);
 }
 
-//------------------------ Clipping planes -----------------------------------
-bool 
+//----------------------------------------------------------------------------
+vtkIdType 
 VISU_PipeLine
-::AddClippingPlane(vtkPlane* thePlane)
+::GetNodeVTKID(vtkIdType theID)
 {
-  if (thePlane) {
-    if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
-      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
-      aFunction->AddItem(thePlane);
-
-      // Check, that at least one cell present after clipping.
-      // This check was introduced because of bug IPAL8849.
-      vtkUnstructuredGrid* aClippedGrid = GetInput2();
-      if (aClippedGrid->GetNumberOfCells() < 1) {
-        return false;
-      }
-    }
-  }
-  return true;
+  return GetMapperHolder()->GetNodeVTKID(theID);
 }
 
-vtkPlane* 
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
 VISU_PipeLine
-::GetClippingPlane(vtkIdType theID) const
-{
-  vtkPlane* aPlane = NULL;
-  if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
-    if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
-      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
-      vtkImplicitFunction* aFun = NULL;
-      aFunction->InitTraversal();
-      for(vtkIdType anID = 0; anID <= theID; anID++)
-       aFun = aFunction->GetNextItem();
-      aPlane = dynamic_cast<vtkPlane*>(aFun);
-    }
-  }
-  return aPlane;
+::GetNodeCoord(int theObjID)
+{
+  return GetMapperHolder()->GetNodeCoord(theObjID);
 }
 
-void
+
+//----------------------------------------------------------------------------
+vtkIdType 
 VISU_PipeLine
-::RemoveAllClippingPlanes()
+::GetElemObjID(vtkIdType theID)
 {
-  if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
-    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
-    aFunction->RemoveAllItems();
-    aBoolean->Modified(); // VTK bug
-  }
+  return GetMapperHolder()->GetElemObjID(theID);
 }
 
+//----------------------------------------------------------------------------
 vtkIdType
 VISU_PipeLine
-::GetNumberOfClippingPlanes() const
+::GetElemVTKID(vtkIdType theID)
 {
-  if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
-    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
-    return aFunction->GetNumberOfItems();
-  }
-  return 0;
+  return GetMapperHolder()->GetElemVTKID(theID);
 }
 
-static
-void
-ComputeBoundsParam (vtkDataSet* theDataSet,
-                   vtkFloatingPointType theDirection[3], 
-                   vtkFloatingPointType theMinPnt[3],
-                   vtkFloatingPointType& theMaxBoundPrj, 
-                   vtkFloatingPointType& theMinBoundPrj)
+//----------------------------------------------------------------------------
+vtkCell* 
+VISU_PipeLine
+::GetElemCell(vtkIdType  theObjID)
 {
-  vtkFloatingPointType aBounds[6];
-  theDataSet->GetBounds(aBounds);
-
-  //Enlarge bounds in order to avoid conflicts of precision
-  for(int i = 0; i < 6; i += 2){
-    static double EPS = 1.0E-3;
-    vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
-    aBounds[i] -= aDelta;
-    aBounds[i+1] += aDelta;
-  }
-
-  vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
-                                             {aBounds[1],aBounds[2],aBounds[4]},
-                                             {aBounds[0],aBounds[3],aBounds[4]},
-                                             {aBounds[1],aBounds[3],aBounds[4]},
-                                             {aBounds[0],aBounds[2],aBounds[5]},
-                                             {aBounds[1],aBounds[2],aBounds[5]},
-                                             {aBounds[0],aBounds[3],aBounds[5]},
-                                             {aBounds[1],aBounds[3],aBounds[5]}};
-
-  int aMaxId = 0, aMinId = aMaxId;
-  theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
-  theMinBoundPrj = theMaxBoundPrj;
-  for(int i = 1; i < 8; i++){
-    vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
-    if(theMaxBoundPrj < aTmp){
-      theMaxBoundPrj = aTmp;
-      aMaxId = i;
-    }
-    if(theMinBoundPrj > aTmp){
-      theMinBoundPrj = aTmp;
-      aMinId = i;
-    }
-  }
-  vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
-  theMinPnt[0] = aMinPnt[0];
-  theMinPnt[1] = aMinPnt[1];
-  theMinPnt[2] = aMinPnt[2];
+  return GetMapperHolder()->GetElemCell(theObjID);
 }
 
-static
-void
-DistanceToPosition(vtkDataSet* theDataSet,
-                  vtkFloatingPointType theDirection[3], 
-                  vtkFloatingPointType theDist, 
-                  vtkFloatingPointType thePos[3])
-{
-  vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
-  ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
-  vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
-  thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
-  thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
-  thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
-}
 
-static
-void
-PositionToDistance (vtkDataSet* theDataSet,
-                   vtkFloatingPointType theDirection[3], 
-                   vtkFloatingPointType thePos[3], 
-                   vtkFloatingPointType& theDist)
+//----------------------------------------------------------------------------
+bool 
+VISU_PipeLine
+::IsShrinkable()
 {
-  vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
-  ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
-  vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
-  theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+  return myIsShrinkable;
 }
 
-void
+void 
 VISU_PipeLine
-::SetPlaneParam(vtkFloatingPointType theDir[3], 
-               vtkFloatingPointType theDist, 
-               vtkPlane* thePlane)
+::SetIsShrinkable(bool theIsShrinkable)
 {
-  thePlane->SetNormal(theDir);
-  vtkFloatingPointType anOrigin[3];
-  ::DistanceToPosition(GetInput(),theDir,theDist,anOrigin);
-  thePlane->SetOrigin(anOrigin);
+  myIsShrinkable = theIsShrinkable;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_PipeLine
-::GetPlaneParam(vtkFloatingPointType theDir[3], 
-               vtkFloatingPointType& theDist, 
-               vtkPlane* thePlane)
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
 {
-  thePlane->GetNormal(theDir);
-
-  vtkFloatingPointType anOrigin[3];
-  thePlane->GetOrigin(anOrigin);
-  ::PositionToDistance(GetInput(),theDir,anOrigin,theDist);
-}
+  GetMapperHolder()->SetImplicitFunction(theFunction);
+} 
 
-//=======================================================================
-//function : IsPlanarInput
-//purpose  :
-//=======================================================================
-bool
+//----------------------------------------------------------------------------
+vtkImplicitFunction * 
 VISU_PipeLine
-::IsPlanarInput() const
+::GetImplicitFunction()
 {
-  vtkFloatingPointType aBounds[6];
-  GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
-  if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
-      fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
-      fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN )
-    return true;
-
-  return false;
+  return GetMapperHolder()->GetImplicitFunction();
 }
 
-//=======================================================================
-vtkIdType 
+//----------------------------------------------------------------------------
+void
 VISU_PipeLine
-::GetNodeObjID(vtkIdType theID)
+::SetExtractInside(bool theMode)
 {
-  vtkIdType anID = myExtractGeometry->GetNodeObjId(theID);
-  return myIDMapper->GetNodeObjID(anID);
+  GetMapperHolder()->SetExtractInside(theMode);
 }
 
-vtkIdType 
+//----------------------------------------------------------------------------
+void
 VISU_PipeLine
-::GetNodeVTKID(vtkIdType theID)
+::SetExtractBoundaryCells(bool theMode)
 {
-  vtkIdType anID = myIDMapper->GetNodeVTKID(theID);
-  return myExtractGeometry->GetNodeVTKId(anID);
+  GetMapperHolder()->SetExtractBoundaryCells(theMode);
 }
 
-vtkFloatingPointType* 
+
+//----------------------------------------------------------------------------
+void
 VISU_PipeLine
-::GetNodeCoord(int theObjID)
+::RemoveAllClippingPlanes()
 {
-  return myIDMapper->GetNodeCoord(theObjID);
+  GetMapperHolder()->RemoveAllClippingPlanes();
 }
 
-//=======================================================================
-vtkIdType 
+//----------------------------------------------------------------------------
+vtkIdType
 VISU_PipeLine
-::GetElemObjID(vtkIdType theID)
+::GetNumberOfClippingPlanes()
 {
-  vtkIdType anID = myExtractGeometry->GetElemObjId(theID);
-  return myIDMapper->GetElemObjID(anID);
+  return GetMapperHolder()->GetNumberOfClippingPlanes();
 }
 
-vtkIdType
+//----------------------------------------------------------------------------
+bool 
 VISU_PipeLine
-::GetElemVTKID(vtkIdType theID)
+::AddClippingPlane(vtkPlane* thePlane)
 {
-  vtkIdType anID = myIDMapper->GetElemVTKID(theID);
-  return myExtractGeometry->GetElemVTKId(anID);
+  return GetMapperHolder()->AddClippingPlane(thePlane);
 }
 
-vtkCell* 
+//----------------------------------------------------------------------------
+vtkPlane* 
 VISU_PipeLine
-::GetElemCell(vtkIdType  theObjID)
+::GetClippingPlane(vtkIdType theID)
 {
-  return myIDMapper->GetElemCell(theObjID);
+  return GetMapperHolder()->GetClippingPlane(theID);
 }
 
-//=======================================================================
-void
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_PipeLine
-::SetIDMapper(const VISU::PIDMapper& theIDMapper)
+::GetClippedInput()
 {
-  myIDMapper = theIDMapper;
-  SetInput(myIDMapper->GetVTKOutput());
+  return GetMapperHolder()->GetClippedInput();
 }
 
-const VISU::PIDMapper&  
+
+//----------------------------------------------------------------------------
+void
 VISU_PipeLine
-::GetIDMapper() const
+::SetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType theDist, 
+               vtkPlane* thePlane)
 {
-  return myIDMapper;
+  thePlane->SetNormal(theDir);
+
+  vtkFloatingPointType anOrigin[3];
+  VISU::DistanceToPosition(GetInput(),
+                          theDir,
+                          theDist,
+                          anOrigin);
+
+  thePlane->SetOrigin(anOrigin);
 }
 
-//=======================================================================
+
+//----------------------------------------------------------------------------
 void
 VISU_PipeLine
-::SetImplicitFunction(vtkImplicitFunction *theFunction)
+::GetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType& theDist, 
+               vtkPlane* thePlane)
 {
-  myExtractGeometry->SetImplicitFunction(theFunction);
-} 
+  thePlane->GetNormal(theDir);
 
-vtkImplicitFunction * 
+  vtkFloatingPointType anOrigin[3];
+  thePlane->GetOrigin(anOrigin);
+
+  VISU::PositionToDistance(GetInput(),
+                            theDir,
+                            anOrigin,
+                            theDist);
+}
+
+
+//----------------------------------------------------------------------------
+size_t
 VISU_PipeLine
-::GetImplicitFunction()
+::CheckAvailableMemory(size_t theSize)
 {
-  return myExtractGeometry->GetImplicitFunction();
+  if(theSize < ULONG_MAX){
+    try{
+      if(char *aCheck = new char[theSize]){
+       delete [] aCheck;
+       return theSize;
+      }
+    }catch(std::bad_alloc& exc){
+    }catch(...){
+    }
+  }
+  return 0;
 }
 
-SALOME_ExtractGeometry*
+
+//----------------------------------------------------------------------------
+size_t
 VISU_PipeLine
-::GetExtractGeometryFilter()
+::GetAvailableMemory(size_t theSize, 
+                    size_t theMinSize)
 {
-  return myExtractGeometry.GetPointer();
-} 
+  // Finds acceptable memory size by half-deflection methods
+  static size_t EPSILON = 2 * 1024;
+  size_t aMax = std::max(theSize, theMinSize);
+  size_t aMin = std::min(theSize, theMinSize);
+  //cout<<"GetAvailableMemory - "<<aMax<<"; "<<aMin;
+  while(CheckAvailableMemory(aMax) == 0 && CheckAvailableMemory(aMin) > 0 && (aMax - aMin) > EPSILON){
+    size_t aRoot = (aMax + aMin) / 2;
+    if(CheckAvailableMemory(aRoot))
+      aMin = aRoot;
+    else
+      aMax = aRoot;
+  }
+  //cout<<"; "<<aMax<<endl;
+  return aMax;
+}
+
+
+//----------------------------------------------------------------------------
index c90080cef9e3497cb4252a2279bc8ff24518621c..c318be45b194927acc43f1ca7e8798087c3166b7 100644 (file)
 #ifndef VISU_PipeLine_HeaderFile
 #define VISU_PipeLine_HeaderFile
 
-#include <vector>
+#include "VISU_IDMapper.hxx"
+
 #include <vtkObject.h>
 #include <vtkSmartPointer.h>
 
-#include "VISU_IDMapper.hxx"
-
 class vtkCell;
+class vtkPlane;
+class vtkMapper;
 class vtkDataSet;
+class vtkPointSet;
 class vtkImplicitFunction;
 
-template <class T>
-class TVTKSmartPtr: public vtkSmartPointer<T>
-{
-public:
-  TVTKSmartPtr()
-  {}
-
-  TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) 
-  {
-    if(r && theIsOwner)
-      r->Delete();
-  }
-
-  TVTKSmartPtr& operator()(T* r, bool theIsOwner = false)
-  {
-    vtkSmartPointer<T>::operator=(r);
-    if(r && theIsOwner)
-      r->Delete();
-    return *this;
-  }
-
-  TVTKSmartPtr& operator=(T* r)
-  {
-    vtkSmartPointer<T>::operator=(r);
-    return *this;
-  }
-
-  operator T* () const 
-  {
-    return vtkSmartPointer<T>::GetPointer();
-  }
-};
-
-class vtkMapper;
-class vtkDataSetMapper;
-class vtkUnstructuredGrid;
-class vtkExtractGeometry;
-class vtkImplicitBoolean;
-class vtkPlane;
-
-class SALOME_ExtractGeometry;
+class VISU_MapperHolder;
 
-typedef VISU::TVTKOutput TInput;
+//----------------------------------------------------------------------------
+class VISU_PipeLine : public vtkObject
+{
+  friend class VISU_MapperHolder;
 
-class VISU_PipeLine : public vtkObject{
 public:
-  vtkTypeMacro(VISU_PipeLine,vtkObject);
-  virtual
-  ~VISU_PipeLine();
+  vtkTypeMacro(VISU_PipeLine, vtkObject);
 
+  //! Gets memory size used by the instance (bytes).
   virtual
-  void
-  DebugOn();
+  unsigned long int
+  GetMemorySize();
 
   virtual
-  void
-  DebugOff();
+  unsigned long int 
+  GetMTime();
 
+  //----------------------------------------------------------------------------
   virtual
   void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
+  ShallowCopy(VISU_PipeLine *thePipeLine,
+             bool theIsCopyInput);
 
   virtual
   void
   SameAs(VISU_PipeLine *thePipeLine);
 
-public:
-  virtual
-  void
-  SetInput(TInput* theInput);
+  //----------------------------------------------------------------------------
+  void 
+  SetMapperHolder(VISU_MapperHolder* theHolder);
 
-  virtual
-  TInput* 
-  GetInput() const;
+  VISU_MapperHolder* 
+  GetMapperHolder();
+
+  const VISU::PIDMapper&  
+  GetIDMapper();
 
   virtual
   vtkDataSet* 
-  GetOutput();
-
-  bool
-  IsPlanarInput() const;
-
-  typedef vtkMapper TMapper;
+  GetInput();
 
   virtual 
-  TMapper* 
+  vtkMapper* 
   GetMapper();
 
   virtual
-  void
-  Init() = 0;
+  vtkDataSet* 
+  GetOutput();
 
+  //----------------------------------------------------------------------------
   virtual
   void
-  Update();
-
-  static
-  int
-  CheckAvailableMemory(const vtkFloatingPointType& theSize);
-  
-  static
-  vtkFloatingPointType
-  GetAvailableMemory(vtkFloatingPointType theSize = 16*1024*1024.0,
-                    vtkFloatingPointType theMinSize = 1024*1024.0);
-
-  // Clipping planes
-  void 
-  RemoveAllClippingPlanes();
-
-  vtkIdType
-  GetNumberOfClippingPlanes() const;
-
-  bool
-  AddClippingPlane(vtkPlane* thePlane);
-
-  vtkPlane* 
-  GetClippingPlane(vtkIdType theID) const;
-
-  void
-  SetPlaneParam(vtkFloatingPointType theDir[3], 
-               vtkFloatingPointType theDist, 
-               vtkPlane* thePlane);
+  Init();
 
+  virtual
   void
-  GetPlaneParam(vtkFloatingPointType theDir[3], 
-               vtkFloatingPointType& theDist, 
-               vtkPlane* thePlane);
-
-  bool 
-  IsShrinkable() { return myIsShrinkable; }
+  Update();
 
+  //----------------------------------------------------------------------------
   virtual
   vtkIdType
   GetNodeObjID(vtkIdType theID);
@@ -192,41 +124,95 @@ public:
   vtkCell*
   GetElemCell(vtkIdType theObjID);
 
-  void 
-  SetIDMapper(const VISU::PIDMapper& theIDMapper);
+  //----------------------------------------------------------------------------
+  bool
+  IsPlanarInput();
 
-  const VISU::PIDMapper&  
-  GetIDMapper()const;
+  bool 
+  IsShrinkable();
 
+  //----------------------------------------------------------------------------
   void
   SetImplicitFunction(vtkImplicitFunction *theFunction);
 
   vtkImplicitFunction* 
   GetImplicitFunction();
 
-  SALOME_ExtractGeometry*
-  GetExtractGeometryFilter();
+  void
+  SetExtractInside(bool theMode);
+
+  void
+  SetExtractBoundaryCells(bool theMode);
+
+  //----------------------------------------------------------------------------
+  void 
+  RemoveAllClippingPlanes();
+
+  vtkIdType
+  GetNumberOfClippingPlanes();
+
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  virtual
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID);
+
+  virtual
+  void
+  SetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType theDist, 
+               vtkPlane* thePlane);
+
+  virtual
+  void
+  GetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType& theDist, 
+               vtkPlane* thePlane);
+
+  //----------------------------------------------------------------------------
+  static
+  size_t
+  CheckAvailableMemory(size_t theSize);
+  
+  static
+  size_t
+  GetAvailableMemory(size_t theSize,
+                    size_t theMinSize = 1024*1024);
 
 protected:
+  //----------------------------------------------------------------------------
   VISU_PipeLine();
   VISU_PipeLine(const VISU_PipeLine&);
 
-  virtual 
-  TInput* 
-  GetInput2() const;
+  virtual
+  ~VISU_PipeLine();
 
+  //----------------------------------------------------------------------------
   virtual
   void
   Build() = 0;
 
-  bool myIsShrinkable;
+  virtual
+  void
+  OnCreateMapperHolder() = 0;
 
-  TVTKSmartPtr<TInput> myInput;
-  VISU::PIDMapper myIDMapper;
-  TVTKSmartPtr<vtkDataSetMapper> myMapper;
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
+  //----------------------------------------------------------------------------
+  vtkDataSet* 
+  GetClippedInput();
 
-  // Clipping planes
-  TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
+  void 
+  SetIsShrinkable(bool theIsShrinkable);
+
+private:
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
+  bool myIsShrinkable;
 };
 
 #endif
index 9becc0c296e03b6e6db8df000be4565af9fcece9..33a97adcd9b4b4f626075e1408de3b120a376ca5 100644 (file)
 
 #include "VISU_PipeLineUtils.hxx"
 
-void
-VISU::Mul(const vtkFloatingPointType A[3], 
-         vtkFloatingPointType b, 
-         vtkFloatingPointType C[3])
-{ // A*b;
-  for(int i = 0; i < 3; i++)  C[i] = A[i]*b;
-}
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
+
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  void
+  Mul(const vtkFloatingPointType A[3], 
+      vtkFloatingPointType b, 
+      vtkFloatingPointType C[3])
+  { // A*b;
+    for(int i = 0; i < 3; i++)  
+      C[i] = A[i]*b;
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  Sub(const vtkFloatingPointType A[3], 
+           const vtkFloatingPointType B[3], 
+           vtkFloatingPointType C[3])
+  { //A-B
+    for(int i = 0; i < 3; i++)  
+      C[i] = A[i] - B[i];
+  }
+
+
+  //----------------------------------------------------------------------------
+  bool
+  CheckIsSameValue(vtkFloatingPointType theTarget,
+                  vtkFloatingPointType theSource)
+  {
+    static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
+    if(fabs(theTarget - theSource)  < TOL)
+      return true;
+    return false;
+  }
+  
+
+  //----------------------------------------------------------------------------
+  bool
+  CheckIsSameRange(vtkFloatingPointType* theTarget,
+                  vtkFloatingPointType* theSource)
+  {
+    return CheckIsSameValue(theTarget[0], theSource[0]) &&
+      CheckIsSameValue(theTarget[1], theSource[1]);
+  }
+  
+
+  //----------------------------------------------------------------------------
+  void
+  CopyMapper(vtkMapper* theTarget, 
+            vtkMapper* theSource,
+            bool theIsCopyInput)
+  {
+    // To customize vtkMapper::ShallowCopy ...
+    theTarget->SetScalarVisibility(theSource->GetScalarVisibility());
+    if(theIsCopyInput){
+      vtkFloatingPointType* aScalarRange = theSource->GetScalarRange();
+      if(!CheckIsSameRange(theTarget->GetScalarRange(), aScalarRange))
+       theTarget->SetScalarRange(aScalarRange);
+    }
+    theTarget->SetColorMode(theSource->GetColorMode());
+    theTarget->SetScalarMode(theSource->GetScalarMode());
+    theTarget->SetImmediateModeRendering(theSource->GetImmediateModeRendering());
+    theTarget->SetUseLookupTableScalarRange(theSource->GetUseLookupTableScalarRange());
+    if(theSource->GetArrayAccessMode() == VTK_GET_ARRAY_BY_ID)
+      theTarget->ColorByArrayComponent(theSource->GetArrayId(), theSource->GetArrayComponent());
+    else
+      theTarget->ColorByArrayComponent(theSource->GetArrayName(), theSource->GetArrayComponent());
+    
+    // To customize vtkAbstractMapper3D::ShallowCopy ...
+    theTarget->SetClippingPlanes(theSource->GetClippingPlanes());
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  CopyDataSetMapper(vtkDataSetMapper* theTarget, 
+                   vtkDataSetMapper* theSource,
+                   bool theIsCopyInput)
+  {
+    // To customize vtkDataSetMapper::ShallowCopy ...
+    //theTarget->SetInput(theSource->GetInput());
+    CopyMapper(theTarget, theSource, theIsCopyInput);
+  }
 
-void
-VISU::Sub(const vtkFloatingPointType A[3], 
-         const vtkFloatingPointType B[3], 
-         vtkFloatingPointType C[3])
-{ //A-B
-  for(int i = 0; i < 3; i++)  C[i] = A[i] - B[i];
-}
 
+  //----------------------------------------------------------------------------
+  void
+  CopyPolyDataMapper(vtkPolyDataMapper* theTarget, 
+                    vtkPolyDataMapper* theSource,
+                    bool theIsCopyInput)
+  {
+    // To customize vtkPolyDataMapper::ShallowCopy ...
+    //theTarget->SetInput(theSource->GetInput());
+    theTarget->SetGhostLevel(theSource->GetGhostLevel());
+    theTarget->SetNumberOfPieces(theSource->GetNumberOfPieces());
+    theTarget->SetNumberOfSubPieces(theSource->GetNumberOfSubPieces());
+
+    CopyMapper(theTarget, theSource, theIsCopyInput);
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, 
+                           VISU_OpenGLPointSpriteMapper* theSource,
+                           bool theIsCopyInput)
+  {
+    // To customize VISU_OpenGLPointSpriteMapper::ShallowCopy ...
+    theTarget->SetPrimitiveType( theSource->GetPrimitiveType() );
+    
+    theTarget->SetPointSpriteMode( theSource->GetPointSpriteMode() );
+    
+    theTarget->SetPointSpriteClamp( theSource->GetPointSpriteClamp() );
+    theTarget->SetPointSpriteSize( theSource->GetPointSpriteSize() );
+    theTarget->SetPointSpriteMinSize( theSource->GetPointSpriteMinSize() );
+    theTarget->SetPointSpriteMaxSize( theSource->GetPointSpriteMaxSize() );
+    theTarget->SetPointSpriteMagnification( theSource->GetPointSpriteMagnification() );
+    
+    theTarget->SetImageData( theSource->GetImageData() );
+    theTarget->SetPointSpriteAlphaThreshold( theSource->GetPointSpriteAlphaThreshold() );
+
+    CopyPolyDataMapper(theTarget, theSource, theIsCopyInput);
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  ComputeBoundsParam(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType theMinPnt[3],
+                    vtkFloatingPointType& theMaxBoundPrj, 
+                    vtkFloatingPointType& theMinBoundPrj)
+  {
+    vtkFloatingPointType aBounds[6];
+    theDataSet->GetBounds(aBounds);
+    
+    //Enlarge bounds in order to avoid conflicts of precision
+    for(int i = 0; i < 6; i += 2){
+      static double EPS = 1.0E-3;
+      vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
+      aBounds[i] -= aDelta;
+      aBounds[i+1] += aDelta;
+    }
+    
+    vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
+                                               {aBounds[1],aBounds[2],aBounds[4]},
+                                               {aBounds[0],aBounds[3],aBounds[4]},
+                                               {aBounds[1],aBounds[3],aBounds[4]},
+                                               {aBounds[0],aBounds[2],aBounds[5]},
+                                               {aBounds[1],aBounds[2],aBounds[5]},
+                                               {aBounds[0],aBounds[3],aBounds[5]},
+                                               {aBounds[1],aBounds[3],aBounds[5]}};
+    
+    int aMaxId = 0, aMinId = aMaxId;
+    theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
+    theMinBoundPrj = theMaxBoundPrj;
+    for(int i = 1; i < 8; i++){
+      vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
+      if(theMaxBoundPrj < aTmp){
+       theMaxBoundPrj = aTmp;
+       aMaxId = i;
+      }
+      if(theMinBoundPrj > aTmp){
+       theMinBoundPrj = aTmp;
+       aMinId = i;
+      }
+    }
+    vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
+    theMinPnt[0] = aMinPnt[0];
+    theMinPnt[1] = aMinPnt[1];
+    theMinPnt[2] = aMinPnt[2];
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  DistanceToPosition(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType theDist, 
+                    vtkFloatingPointType thePos[3])
+  {
+    vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+    ComputeBoundsParam(theDataSet,
+                      theDirection,
+                      aMinPnt,
+                      aMaxBoundPrj,
+                      aMinBoundPrj);
+    vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
+    thePos[0] = aMinPnt[0] - theDirection[0] * aLength;
+    thePos[1] = aMinPnt[1] - theDirection[1] * aLength;
+    thePos[2] = aMinPnt[2] - theDirection[2] * aLength;
+  }
+  
+
+  //----------------------------------------------------------------------------
+  void
+  PositionToDistance(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType thePos[3], 
+                    vtkFloatingPointType& theDist)
+  {
+    vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+    ComputeBoundsParam(theDataSet,
+                      theDirection,
+                      aMinPnt,
+                      aMaxBoundPrj,
+                      aMinBoundPrj);
+    vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
+    theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+  }
+
+
+  //----------------------------------------------------------------------------
+}
index 57e6347bed04467dc1168ed46b3bbee13c00c7ed..db6570a85af10e35afed63cb1d1f3ee0fa8616dd 100644 (file)
@@ -28,8 +28,6 @@
 #define VISU_PipeLineUtils_HeaderFile
 
 #include "VISU_FieldTransform.hxx"
-#include "VISU_LookupTable.hxx"
-#include "VISU_Extractor.hxx"
 
 #include <vtkProperty.h>
 #include <vtkObjectFactory.h>
 
 #endif
 
+class VISU_OpenGLPointSpriteMapper;
+
 namespace VISU
 {
+  //----------------------------------------------------------------------------
   void
   Mul(const vtkFloatingPointType A[3], 
       vtkFloatingPointType b, 
       vtkFloatingPointType C[3]); // C = A * b
   
+
+  //----------------------------------------------------------------------------
   void
   Sub(const vtkFloatingPointType A[3], 
       const vtkFloatingPointType B[3], 
       vtkFloatingPointType C[3]); // C = A - B
 
-  template<class TItem> 
+
+  //----------------------------------------------------------------------------
+  template<class TEndFilter> 
   void
-  CellDataToPoint(TItem* theTItem
+  CellDataToPoint(TEndFilter* theEndFilter
                  vtkCellDataToPointData *theFilter,
                  vtkDataSet* theDataSet,
                  VISU_FieldTransform *theFieldTransform)
@@ -77,14 +82,16 @@ namespace VISU
     if(theDataSet->GetCellData()->GetNumberOfArrays()){
       theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
       theFilter->PassCellDataOn();
-      theTItem->SetInput(theFilter->GetUnstructuredGridOutput());
+      theEndFilter->SetInput(theFilter->GetUnstructuredGridOutput());
     }else
-      theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
   }
 
-  template<class TItem> 
+
+  //----------------------------------------------------------------------------
+  template<class TEndFilter> 
   void
-  ToCellCenters(TItem* theTItem
+  ToCellCenters(TEndFilter* theEndFilter
                vtkCellCenters *theFilter,
                vtkDataSet* theDataSet,
                VISU_FieldTransform *theFieldTransform)
@@ -92,10 +99,71 @@ namespace VISU
     if(theDataSet->GetCellData()->GetNumberOfArrays()){
       theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
       theFilter->VertexCellsOn();
-      theTItem->SetInput(theFilter->GetOutput());
+      theEndFilter->SetInput(theFilter->GetOutput());
     }else
-      theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
   }
+
+
+  //----------------------------------------------------------------------------
+  //! Checks whether the float values are the same or not
+  bool
+  CheckIsSameValue(vtkFloatingPointType theTarget,
+                  vtkFloatingPointType theSource);
+
+  //! Checks whether the scalar range is the same or not
+  bool
+  CheckIsSameRange(vtkFloatingPointType* theTarget,
+                  vtkFloatingPointType* theSource);
+
+  //! Customizes vtkMapper::ShallowCopy
+  void
+  CopyMapper(vtkMapper* theTarget, 
+            vtkMapper* theSource,
+            bool theIsCopyInput);
+
+  //! Customizes vtkDataSetMapper::ShallowCopy
+  void
+  CopyDataSetMapper(vtkDataSetMapper* theTarget, 
+                   vtkDataSetMapper* theSource,
+                   bool theIsCopyInput);
+
+  //! Customizes vtkPolyDataMapper::ShallowCopy
+  void
+  CopyPolyDataMapper(vtkPolyDataMapper* theTarget, 
+                    vtkPolyDataMapper* theSource,
+                    bool theIsCopyInput);
+
+  //! Customizes VISU_OpenGLPointSpriteMapper::ShallowCopy
+  void
+  CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, 
+                           VISU_OpenGLPointSpriteMapper* theSource,
+                           bool theIsCopyInput);
+
+
+  //----------------------------------------------------------------------------
+  void
+  ComputeBoundsParam(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType theMinPnt[3],
+                    vtkFloatingPointType& theMaxBoundPrj, 
+                    vtkFloatingPointType& theMinBoundPrj);
+
+
+  //----------------------------------------------------------------------------
+  void
+  DistanceToPosition(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType theDist, 
+                    vtkFloatingPointType thePos[3]);
+
+
+  //----------------------------------------------------------------------------
+  void
+  PositionToDistance(vtkDataSet* theDataSet,
+                    vtkFloatingPointType theDirection[3], 
+                    vtkFloatingPointType thePos[3], 
+                    vtkFloatingPointType& theDist);
 }
 
 #endif
index 2b87e56f32ba96130af4c7a0868ce2f8f0164a7b..f1b9c6ffb8d22bca02e1d99dfa20bb64c1f7567b 100644 (file)
 #include <vtkWarpScalar.h>
 #include <vtkOutlineFilter.h>
 
-using namespace std;
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_Plot3DPL);
 
-VISU_Plot3DPL::VISU_Plot3DPL():
-  myCellDataToPointData(vtkCellDataToPointData::New(),true),
-  myAppendPolyData(vtkAppendPolyData::New(),true),
-  myGeometryFilter(vtkGeometryFilter::New(),true),
-  myContourFilter(vtkContourFilter::New(),true),
-  myWarpScalar(vtkWarpScalar::New(),true),
+
+//----------------------------------------------------------------------------
+VISU_Plot3DPL
+::VISU_Plot3DPL():
+  myCellDataToPointData(vtkCellDataToPointData::New()),
+  myAppendPolyData(vtkAppendPolyData::New()),
+  myGeometryFilter(vtkGeometryFilter::New()),
+  myContourFilter(vtkContourFilter::New()),
+  myWarpScalar(vtkWarpScalar::New()),
   myOrientation(VISU_CutPlanesPL::YZ),
   myIsRelative(true),
   myIsContour(false),
   myPosition(0.5),
-  myScaleFactor(1.)
+  myScaleFactor(1.0)
 {
-  myAngle[0] = myAngle[1] = myAngle[2] = 0.;
+  SetIsShrinkable(false);
+
+  myCellDataToPointData->Delete();
+  myAppendPolyData->Delete();
+  myGeometryFilter->Delete();
+  myContourFilter->Delete();
+  myWarpScalar->Delete();
+
+  myAngle[0] = myAngle[1] = myAngle[2] = 0.0;
+
   SetNumberOfContours(32);
-  myIsShrinkable = false;
 }
 
-VISU_Plot3DPL::~VISU_Plot3DPL()
+
+//----------------------------------------------------------------------------
+VISU_Plot3DPL
+::~VISU_Plot3DPL()
 {
 }
 
+
+//----------------------------------------------------------------------------
 void
-VISU_Plot3DPL::
-ShallowCopy(VISU_PipeLine *thePipeLine)
+VISU_Plot3DPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
     SetOrientation (aPipeLine->GetPlaneOrientation(),
                     aPipeLine->GetRotateX(), aPipeLine->GetRotateY());
@@ -77,12 +96,13 @@ ShallowCopy(VISU_PipeLine *thePipeLine)
     SetContourPrs( aPipeLine->GetIsContourPrs() );
     SetNumberOfContours( aPipeLine->GetNumberOfContours() );
   }
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
+
+//----------------------------------------------------------------------------
 VISU_CutPlanesPL::PlaneOrientation
-VISU_Plot3DPL::
-GetOrientation(vtkDataSet* theDataSet)
+VISU_Plot3DPL
+::GetOrientation(vtkDataSet* theDataSet)
 {
   theDataSet->Update();
 
@@ -111,9 +131,11 @@ GetOrientation(vtkDataSet* theDataSet)
   return VISU_CutPlanesPL::XY;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
-VISU_Plot3DPL::
-GetScaleFactor(vtkDataSet* theDataSet)
+VISU_Plot3DPL
+::GetScaleFactor(vtkDataSet* theDataSet)
 {
   theDataSet->Update();
   vtkFloatingPointType aLength = theDataSet->GetLength(); // diagonal length
@@ -129,26 +151,32 @@ GetScaleFactor(vtkDataSet* theDataSet)
   return 0.0;
 }
 
+
+//----------------------------------------------------------------------------
 void
-VISU_Plot3DPL::
-Init()
+VISU_Plot3DPL
+::Init()
 {
-  VISU_ScalarMapPL::Init();
+  Superclass::Init();
 
-  myOrientation = GetOrientation(GetInput2());
-  SetScaleFactor(GetScaleFactor(GetInput2()));
+  myOrientation = GetOrientation(GetClippedInput());
+  SetScaleFactor(GetScaleFactor(GetClippedInput()));
 }
 
-VISU_ScalarMapPL::THook*
-VISU_Plot3DPL::
-DoHook()
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_Plot3DPL
+::InsertCustomPL()
 {
   return myAppendPolyData->GetOutput();
 }
 
+
+//----------------------------------------------------------------------------
 void
-VISU_Plot3DPL::
-Update()
+VISU_Plot3DPL
+::Update()
 {
   vtkFloatingPointType aPlaneNormal[3];
   vtkFloatingPointType anOrigin[3];
@@ -157,7 +185,7 @@ Update()
   vtkPolyData* aPolyData = 0;
   vtkCutter *aCutPlane = 0;
   vtkUnstructuredGrid* anUnstructuredGrid =
-    myFieldTransform->GetUnstructuredGridOutput();
+    GetFieldTransformFilter()->GetUnstructuredGridOutput();
 
   if ( !IsPlanarInput() )
   {
@@ -205,7 +233,7 @@ Update()
     myWarpScalar->SetInput(myContourFilter->GetOutput());
   }
 
-  VISU_CutPlanesPL::ClearAppendPolyData(myAppendPolyData);
+  VISU_CutPlanesPL::ClearAppendPolyData(myAppendPolyData.GetPointer());
   myAppendPolyData->AddInput(myWarpScalar->GetPolyDataOutput());
 
   if ( aCutPlane )
@@ -213,62 +241,127 @@ Update()
 
   myWarpScalar->SetNormal(aPlaneNormal);
 
-  VISU_ScalarMapPL::Update();
+  Superclass::Update();
 }
 
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_Plot3DPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myGeometryFilter->GetInput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(vtkDataSet* aDataSet = myContourFilter->GetInput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(vtkDataSet* aDataSet = myWarpScalar->GetInput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  int anEnd = myAppendPolyData->GetNumberOfInputs();
+  for(int anId = 0; anId < anEnd; anId++){
+    if(vtkDataSet* aDataSet = myAppendPolyData->GetInput(anId))
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+  }
+
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
 void
-VISU_Plot3DPL::
-SetNumberOfContours(int theNumber)
+VISU_Plot3DPL
+::SetNumberOfContours(int theNumber)
 {
   myContourFilter->SetNumberOfContours(theNumber);
 }
 
+
+//----------------------------------------------------------------------------
 int
-VISU_Plot3DPL::
-GetNumberOfContours() const
+VISU_Plot3DPL
+::GetNumberOfContours()
 {
   return myContourFilter->GetNumberOfContours();
 }
 
+
+//----------------------------------------------------------------------------
 void
-VISU_Plot3DPL::
-SetScaleFactor(vtkFloatingPointType theScaleFactor)
+VISU_Plot3DPL
+::SetScaleFactor(vtkFloatingPointType theScaleFactor)
 {
   myScaleFactor = theScaleFactor;
   myWarpScalar->SetScaleFactor(theScaleFactor);
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
-VISU_Plot3DPL::
-GetScaleFactor() const
+VISU_Plot3DPL
+::GetScaleFactor()
 {
   return myScaleFactor;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_Plot3DPL::
-SetPlanePosition(vtkFloatingPointType thePosition,
-                bool theIsRelative)
+SetContourPrs(bool theIsContourPrs )
+{
+  myIsContour = theIsContourPrs;
+  Modified();
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU_Plot3DPL
+::GetIsContourPrs()
+{
+  return myIsContour;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_Plot3DPL
+::SetPlanePosition(vtkFloatingPointType thePosition,
+                  bool theIsRelative)
 {
   myIsRelative = theIsRelative;
   myPosition = thePosition;
+  Modified();
 }
 
+
+//----------------------------------------------------------------------------
 bool
-VISU_Plot3DPL::
-IsPositionRelative() const
+VISU_Plot3DPL
+::IsPositionRelative()
 {
   return myIsRelative;
 }
 
+
+//----------------------------------------------------------------------------
 VISU_CutPlanesPL::PlaneOrientation
-VISU_Plot3DPL::
-GetPlaneOrientation() const
+VISU_Plot3DPL
+::GetPlaneOrientation()
 {
   return myOrientation;
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_Plot3DPL::
 GetRotateX()
@@ -281,6 +374,8 @@ GetRotateX()
   return 0;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_Plot3DPL::
 GetRotateY(){
@@ -292,6 +387,8 @@ GetRotateY(){
   return 0;
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_Plot3DPL::
 SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation,
@@ -309,11 +406,14 @@ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation,
   case VISU_CutPlanesPL::ZX: myAngle[0] = theYAngle; break;
   }
   myOrientation = theOrientation;
+  Modified();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
-VISU_Plot3DPL::
-GetPlanePosition() const
+VISU_Plot3DPL
+::GetPlanePosition()
 {
   return myPosition;
 }
@@ -322,10 +422,11 @@ GetPlanePosition() const
 //function : GetBasePlane
 //purpose  :
 //=======================================================================
-
-void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3],
-                                 vtkFloatingPointType theNormal[3],
-                                 bool  theCenterOrigine ) const
+void
+VISU_Plot3DPL
+::GetBasePlane(vtkFloatingPointType theOrigin[3],
+              vtkFloatingPointType theNormal[3],
+              bool  theCenterOrigine )
 {
   VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation);
 
@@ -341,7 +442,7 @@ void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3],
 
   if ( theCenterOrigine ) {
     // move theOrigin to the center of aBounds projections to the plane
-    GetInput2()->GetBounds(aBounds);
+    GetClippedInput()->GetBounds(aBounds);
     vtkFloatingPointType boundPoints[8][3] = {
       {aBounds[0],aBounds[2],aBounds[4]},
       {aBounds[1],aBounds[2],aBounds[4]},
@@ -369,9 +470,10 @@ void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3],
 //function : GetMinMaxPosition
 //purpose  : return absolute position range
 //=======================================================================
-
-void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, 
-                                      vtkFloatingPointType& maxPos ) const
+void
+VISU_Plot3DPL
+::GetMinMaxPosition( vtkFloatingPointType& minPos, 
+                    vtkFloatingPointType& maxPos )
 {
   vtkFloatingPointType aBounds[6], aBoundPrj[3], aNormal[3];
   VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation);
@@ -386,9 +488,11 @@ void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos,
 //purpose  :
 //=======================================================================
 
-void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale)
+void 
+VISU_Plot3DPL
+::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  VISU_ScalarMapPL::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   if ( myIsContour ) {
     vtkFloatingPointType aRange[2];
index cb237fa78a8261c6d4e6ff57e7bde9ea1efa2738..ec2c408d68fd7cc9d23666686f4c89a9bee7b11a 100644 (file)
@@ -35,22 +35,17 @@ class vtkContourFilter;
 class vtkGeometryFilter;
 class vtkCellDataToPointData;
 
-class VISU_Plot3DPL : public VISU_ScalarMapPL{
-protected:
-  VISU_Plot3DPL();
-  VISU_Plot3DPL(const VISU_Plot3DPL&);
 
+//----------------------------------------------------------------------------
+class VISU_Plot3DPL : public VISU_ScalarMapPL
+{
 public:
   vtkTypeMacro(VISU_Plot3DPL,VISU_ScalarMapPL);
   static VISU_Plot3DPL* New();
   virtual ~VISU_Plot3DPL();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   VISU_CutPlanesPL::PlaneOrientation
-  GetPlaneOrientation() const;
+  GetPlaneOrientation();
 
   vtkFloatingPointType
   GetRotateX();
@@ -64,10 +59,10 @@ public:
                 vtkFloatingPointType theYAngle = 0.0);
 
   vtkFloatingPointType
-  GetPlanePosition() const;
+  GetPlanePosition();
 
   bool
-  IsPositionRelative() const;
+  IsPositionRelative();
 
   void
   SetPlanePosition(vtkFloatingPointType thePosition,
@@ -77,30 +72,42 @@ public:
   SetScaleFactor(vtkFloatingPointType theScaleFactor);
 
   vtkFloatingPointType
-  GetScaleFactor() const;
+  GetScaleFactor();
 
   void
-  SetContourPrs (bool theIsContourPrs ) { myIsContour = theIsContourPrs; }
+  SetContourPrs(bool theIsContourPrs );
 
   bool
-  GetIsContourPrs() { return myIsContour; }
+  GetIsContourPrs();
 
   void
   SetNumberOfContours(int theNumber);
 
   int
-  GetNumberOfContours() const;
+  GetNumberOfContours();
 
-  void GetBasePlane (vtkFloatingPointType theOrigin[3],
-                     vtkFloatingPointType theNormal[3],
-                     bool  theCenterOrigine = false ) const;
+  void
+  GetBasePlane (vtkFloatingPointType theOrigin[3],
+               vtkFloatingPointType theNormal[3],
+               bool  theCenterOrigine = false );
+  
+  void
+  GetMinMaxPosition( vtkFloatingPointType& minPos, 
+                    vtkFloatingPointType& maxPos );
+  
+public:
+  virtual
+  void
+  Init();
 
-  void GetMinMaxPosition( vtkFloatingPointType& minPos, 
-                         vtkFloatingPointType& maxPos ) const;
+  virtual
+  void
+  Update();
 
-public:
-  virtual void Init();
-  virtual void Update();
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
 
   static
   VISU_CutPlanesPL::PlaneOrientation
@@ -112,18 +119,28 @@ public:
   void SetMapScale(vtkFloatingPointType theMapScale);
 
 protected:
-  virtual THook* DoHook();
+  VISU_Plot3DPL();
+  VISU_Plot3DPL(const VISU_Plot3DPL&);
+
+  virtual
+  vtkDataSet* 
+  InsertCustomPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
 
   vtkFloatingPointType myAngle[3];
   bool myIsRelative, myIsContour;
   vtkFloatingPointType myPosition, myScaleFactor;
   VISU_CutPlanesPL::PlaneOrientation myOrientation;
 
-  TVTKSmartPtr<vtkCellDataToPointData> myCellDataToPointData;
-  TVTKSmartPtr<vtkAppendPolyData> myAppendPolyData;
-  TVTKSmartPtr<vtkGeometryFilter> myGeometryFilter;
-  TVTKSmartPtr<vtkContourFilter> myContourFilter;
-  TVTKSmartPtr<vtkWarpScalar> myWarpScalar;
+  vtkSmartPointer<vtkCellDataToPointData> myCellDataToPointData;
+  vtkSmartPointer<vtkAppendPolyData> myAppendPolyData;
+  vtkSmartPointer<vtkGeometryFilter> myGeometryFilter;
+  vtkSmartPointer<vtkContourFilter> myContourFilter;
+  vtkSmartPointer<vtkWarpScalar> myWarpScalar;
 };
 
 #endif
index 16759ec68e6c385467bbb2310d33cc38461d4213..dad8e54798ecbbab4754f112dde6165976176240 100644 (file)
 // Module : VISU
 
 #include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_Extractor.hxx"
+#include "VISU_LookupTable.hxx"
 #include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
 #include "VTKViewer_TransformFilter.h"
 #include "VTKViewer_Transform.h"
 
+#include "VISU_PipeLineUtils.hxx"
+
 #include <vtkWarpVector.h>
 #include <vtkMergeFilter.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkCellDataToPointData.h>
 #include <vtkPointDataToCellData.h>
 
-#include <VISU_Convertor.hxx>
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
 
+//----------------------------------------------------------------------------
 /*!
  * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid
  * Where:
@@ -57,6 +61,7 @@ VISU_ScalarMapOnDeformedShapePL
   myCellDataToPointData = vtkCellDataToPointData::New();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Destructor.
  * Delete all fields.
@@ -77,6 +82,7 @@ VISU_ScalarMapOnDeformedShapePL
   myCellDataToPointData->Delete();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Initial method
  */
@@ -84,26 +90,25 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::Init()
 {
-  if (GetScalars() == NULL) SetScalars(GetInput2());
+  if(GetScalars() == NULL) 
+    SetScalars(GetClippedInput());
   
   Superclass::Init();
   
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
+
   static double EPS = 1.0 / VTK_LARGE_FLOAT;
   if(aScalarRange[1] > EPS)
-    SetScale(VISU_DeformedShapePL::GetScaleFactor(GetInput2())/aScalarRange[1]);
+    SetScale(VISU_DeformedShapePL::GetScaleFactor(GetClippedInput()) / aScalarRange[1]);
   else
     SetScale(0.0);
 
-  myMapper->SetColorModeToMapScalars();
-  myMapper->ScalarVisibilityOn();
-
-  // Sets input for field transformation filter
-  myFieldTransform->SetInput(myExtractor->GetOutput());
-
+  GetMapper()->SetColorModeToMapScalars();
+  GetMapper()->ScalarVisibilityOn();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Build method
  * Building of deformation and puts result to merge filter.
@@ -112,19 +117,20 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::Build()
 {
-  // Set input for extractor
-  myExtractor->SetInput(GetInput2());
-  
-  VISU::CellDataToPoint(myDeformVectors,myCellDataToPointData,
-                       GetInput2(),myFieldTransform);
+  VISU::CellDataToPoint(myDeformVectors,
+                       myCellDataToPointData,
+                       GetClippedInput(),
+                       GetFieldTransformFilter());
   
   // Sets geometry for merge filter
   myMergeFilter->SetGeometry(myDeformVectors->GetOutput());
   myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
+
   // Sets data to mapper
-  myMapper->SetInput(myMergeFilter->GetOutput());
+  GetDataSetMapper()->SetInput(myMergeFilter->GetOutput());
 }
 
+//----------------------------------------------------------------------------
 /*!
  *  Update method
  */
@@ -138,19 +144,43 @@ VISU_ScalarMapOnDeformedShapePL
   GetSourceRange(aRange);
   vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
   
-  if(myBarTable->GetScale() == VTK_SCALE_LOG10)
+  if(GetBarTable()->GetScale() == VTK_SCALE_LOG10)
     VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
-  myMapperTable->SetRange(aScalarRange);
+  GetMapperTable()->SetRange(aScalarRange);
 
-  myMapperTable->Build();
-  myBarTable->Build();
+  GetMapperTable()->Build();
+  GetBarTable()->Build();
 
-  myMapper->SetLookupTable(myMapperTable);
-  myMapper->SetScalarRange(aScalarRange);
+  GetMapper()->SetLookupTable(GetMapperTable());
+  GetMapper()->SetScalarRange(aScalarRange);
   
   VISU_PipeLine::Update();
 }
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ScalarMapOnDeformedShapePL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myDeformVectors->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(vtkDataSet* aDataSet = myExtractorScalars->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(vtkDataSet* aDataSet = myMergeFilter->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
+}
+
+//----------------------------------------------------------------------------
 /*!
  * Update scalars method.
  * Put scalars to merge filter.
@@ -162,25 +192,28 @@ VISU_ScalarMapOnDeformedShapePL
   myExtractorScalars->Update();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Copy information about pipline.
  * Copy scale and scalars.
  */
 void
 VISU_ScalarMapOnDeformedShapePL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
-  VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
-  if(aPipeLine){
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+  if(VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine)){
      SetScale(aPipeLine->GetScale());
      SetScalars(aPipeLine->GetScalars());
      vtkFloatingPointType aRange[2];
      aPipeLine->GetSourceRange(aRange);
      SetScalarRange(aRange);
   }
-  Superclass::ShallowCopy(thePipeLine);
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Set scalars.
  * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction.
@@ -210,6 +243,7 @@ VISU_ScalarMapOnDeformedShapePL
   Modified();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Get pointer to input scalars.
  */
@@ -220,6 +254,7 @@ VISU_ScalarMapOnDeformedShapePL
   return myScalars.GetPointer();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Sets scale for deformed shape
  */
@@ -227,12 +262,14 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::SetScale(vtkFloatingPointType theScale) 
 {
-  if(myScaleFactor == theScale) return;
-  myScaleFactor = theScale;
+  if(VISU::CheckIsSameValue(myScaleFactor, theScale))
+    return;
+
   myDeformVectors->SetScaleFactor(myScaleFactor);
-  Modified();
+  myScaleFactor = theScale;
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Gets scale of deformed shape.
  */
@@ -240,10 +277,10 @@ vtkFloatingPointType
 VISU_ScalarMapOnDeformedShapePL
 ::GetScale() 
 {
-  vtkFloatingPointType aScale=myDeformVectors->GetScaleFactor();
-  return aScale;
+  return myDeformVectors->GetScaleFactor();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Set scale factor of deformation.
  */
@@ -251,10 +288,10 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale);
-  Modified();
+  myDeformVectors->SetScaleFactor(myScaleFactor * theMapScale);
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Gets scalar mode.
  */
@@ -262,10 +299,10 @@ int
 VISU_ScalarMapOnDeformedShapePL
 ::GetScalarMode()
 {
-  int aMode=myExtractorScalars->GetScalarMode();
-  return aMode;
+  return myExtractorScalars->GetScalarMode();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Sets scalar mode.
  */
@@ -277,6 +314,7 @@ VISU_ScalarMapOnDeformedShapePL
   Modified();
 }
 
+//----------------------------------------------------------------------------
 /*!
  * Gets ranges of extracted scalars
  * \param theRange[2] - output values
index 66553b302f784eff7437cb32db54b8e31ce4dfd3..f4284b0654c93967f78d8c2b1e0968342599dbb9 100644 (file)
@@ -35,31 +35,44 @@ class vtkUnstructuredGrid;
 class vtkCellDataToPointData;
 class vtkPointDataToCellData;
 
+
+//----------------------------------------------------------------------------
 class VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL
 {
-protected:
-  VISU_ScalarMapOnDeformedShapePL();
-  
-  virtual ~VISU_ScalarMapOnDeformedShapePL();
-  
-  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
 public:
-  vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL);
+  vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL, VISU_ScalarMapPL);
+
+  static 
+  VISU_ScalarMapOnDeformedShapePL* 
+  New();
+
+  virtual
+  void
+  SetScale(vtkFloatingPointType theScale);
 
-  static VISU_ScalarMapOnDeformedShapePL* New();
+  virtual
+  vtkFloatingPointType
+  GetScale();
 
-  virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
+  virtual
+  int
+  GetScalarMode();
 
-  virtual void SetScale(vtkFloatingPointType theScale);
-  virtual vtkFloatingPointType GetScale();
+  virtual
+  void
+  SetScalarMode(int theScalarMode = 0);
 
-  virtual int GetScalarMode();
-  virtual void SetScalarMode(int theScalarMode = 0);
+  virtual
+  void
+  GetSourceRange(vtkFloatingPointType theRange[2]);
 
-  virtual void GetSourceRange(vtkFloatingPointType theRange[2]);
+  virtual
+  void
+  SetScalars(vtkDataSet *theScalars);
 
-  virtual void SetScalars(vtkDataSet *theScalars);
-  virtual vtkUnstructuredGrid* GetScalars();
+  virtual
+  vtkUnstructuredGrid* 
+  GetScalars();
 
 public:
   //! Redefined method for initialization of the pipeline.
@@ -77,13 +90,32 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
   //! Update scalars.
   void
   UpdateScalars();
   
-  virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+  virtual
+  void
+  SetMapScale(vtkFloatingPointType theMapScale = 1.0);
   
 protected:
+  VISU_ScalarMapOnDeformedShapePL();
+  
+  virtual
+  ~VISU_ScalarMapOnDeformedShapePL();
+  
+  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector  *myDeformVectors;
   vtkMergeFilter *myMergeFilter;
index 0c6b990328b57d3bff5dabf721b35ae914757bd5..1153b5d325ad4915f2a4993a20b74502a059c70a 100644 (file)
 //
 //
 //
-// File:    VISU_PipeLine.cxx
+// File:    VISU_ScalarMapPL.cxx
 // Author:  Alexey PETROV
 // Module : VISU
 
 
 #include "VISU_ScalarMapPL.hxx"
-#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_ExtractGeometry.h"
+#include "VISU_DataSetMapperHolder.hxx"
 
-
-//============================================================================
-vtkStandardNewMacro(VISU_ScalarMapPL);
+#include <vtkDataSetMapper.h>
+#include <vtkObjectFactory.h>
 
 
 //----------------------------------------------------------------------------
-VISU_ScalarMapPL
-::VISU_ScalarMapPL()
-{
-  myMapperTable = VISU_LookupTable::New();
-  myMapperTable->SetScale(VTK_SCALE_LINEAR);
-  myMapperTable->SetHueRange(0.667,0.0);
-
-  myBarTable = VISU_LookupTable::New();
-  myBarTable->SetScale(VTK_SCALE_LINEAR);
-  myBarTable->SetHueRange(0.667,0.0);
-
-  myExtractor = VISU_Extractor::New();
-  myExtractor->SetInput(myExtractGeometry->GetOutput());
-
-  myFieldTransform = VISU_FieldTransform::New();
-  myFieldTransform->SetInput(myExtractor->GetOutput());
-
-  myIsShrinkable = true;
-}
-
-
-VISU_ScalarMapPL
-::~VISU_ScalarMapPL()
-{
-  myFieldTransform->Delete();
-  myMapperTable->Delete();
-  myBarTable->Delete();
-  myExtractor->Delete();
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
-{
-  if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
-    SetScalarRange(aPipeLine->GetScalarRange());
-    SetScalarMode(aPipeLine->GetScalarMode());
-    SetNbColors(aPipeLine->GetNbColors());
-    SetScaling(aPipeLine->GetScaling());
-    SetMapScale(aPipeLine->GetMapScale());
-  }
-  Superclass::ShallowCopy(thePipeLine);
-}
-
-
-//----------------------------------------------------------------------------
-int
-VISU_ScalarMapPL
-::GetScalarMode()
-{
-  return myExtractor->GetScalarMode();
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarMode(int theScalarMode)
-{
-  vtkDataSet *input = GetInput();
-  if (input){
-    if(input->GetPointData()->GetNumberOfArrays()){
-      vtkPointData *inData = input->GetPointData();
-      if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)) {
-       if (theScalarMode==0){
-         return;
-       }
-      }
-    }
-    else {
-      vtkCellData *inData = input->GetCellData();
-      if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)){
-       if (theScalarMode==0){
-         return;
-       }
-      }
-    }
-  }
-  //
-  myExtractor->SetScalarMode(theScalarMode);
-  Modified();
-}
+vtkStandardNewMacro(VISU_ScalarMapPL);
 
 
 //----------------------------------------------------------------------------
-int
 VISU_ScalarMapPL
-::GetScaling() 
-{
-  return myBarTable->GetScale();
-}
-
-void
-VISU_ScalarMapPL
-::SetScaling(int theScaling) 
-{
-  myBarTable->SetScale(theScaling);
-  if(theScaling == VTK_SCALE_LOG10)
-    myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
-  else
-    myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
-  Modified();
-}
+::VISU_ScalarMapPL():
+  VISU_UnstructuredGridPL(this)
+{}
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointType* 
-VISU_ScalarMapPL
-::GetScalarRange() 
-{
-  return myFieldTransform->GetScalarRange();
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarRange(vtkFloatingPointType theRange[2])
-{
-  myFieldTransform->SetScalarRange(theRange);
-  myBarTable->SetRange(theRange);
-  Modified();
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarMin(vtkFloatingPointType theValue)
-{
-  vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]};
-  SetScalarRange(aScalarRange);
-}
-
-void
 VISU_ScalarMapPL
-::SetScalarMax(vtkFloatingPointType theValue)
-{
-  vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue};
-  SetScalarRange(aScalarRange);
-}
+::~VISU_ScalarMapPL()
+{}
 
 
 //----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::SetNbColors(int theNbColors) 
-{
-  myMapperTable->SetNumberOfColors(theNbColors);
-  myBarTable->SetNumberOfColors(theNbColors);
-  Modified();
-}
-
-int
+void  
 VISU_ScalarMapPL
-::GetNbColors() 
+::OnCreateMapperHolder()
 {
-  return myMapperTable->GetNumberOfColors();
+  VISU_UnstructuredGridPL::OnCreateMapperHolder();
 }
 
 
 //----------------------------------------------------------------------------
-VISU_ScalarMapPL::THook* 
-VISU_ScalarMapPL
-::DoHook()
-{
-  myMapper->SetColorModeToMapScalars();
-  myMapper->ScalarVisibilityOn();
-  return myFieldTransform->GetUnstructuredGridOutput();
-}
-
-
-void
-VISU_ScalarMapPL
-::Init()
-{
-  SetScalarMode(0);
-  SetSourceRange();
-}
-
 void
 VISU_ScalarMapPL
 ::Build() 
 {
-  myMapper->SetInput(DoHook());
-}
-
-
-void
-VISU_ScalarMapPL
-::Update() 
-{ 
-  vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange();
-  vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
-  if(myBarTable->GetScale() == VTK_SCALE_LOG10)
-    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
-  myMapperTable->SetRange(aScalarRange);
-
-  myMapperTable->Build();
-  myBarTable->Build();
-
-  myMapper->SetLookupTable(myMapperTable);
-  myMapper->SetScalarRange(aScalarRange);
-
-  VISU_PipeLine::Update();
-}
-
-
-//----------------------------------------------------------------------------
-VISU_LookupTable *
-VISU_ScalarMapPL
-::GetMapperTable()
-{ 
-  return myMapperTable;
-}
-
-VISU_LookupTable*
-VISU_ScalarMapPL
-::GetBarTable()
-{
-  return myBarTable;
-}
+  Superclass::Build();
 
-
-//----------------------------------------------------------------------------
-void 
-VISU_ScalarMapPL
-::SetMapScale(vtkFloatingPointType theMapScale)
-{
-  myMapperTable->SetMapScale(theMapScale);
-  myMapperTable->Build();
-}
-
-vtkFloatingPointType
-VISU_ScalarMapPL::GetMapScale()
-{
-  return myMapperTable->GetMapScale();
+  GetDataSetMapper()->SetInput(InsertCustomPL());
 }
 
 
 //----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::GetSourceRange(vtkFloatingPointType theRange[2])
-{
-  myExtractor->Update();
-  myExtractor->GetOutput()->GetScalarRange(theRange);
-}
-
-void
-VISU_ScalarMapPL
-::SetSourceRange()
-{
-  vtkFloatingPointType aRange[2];
-  GetSourceRange(aRange);
-  SetScalarRange(aRange);
-}
index de07ce2a7953a61ebd02466fe26b6ce3bca324de..55295f5fdff9b841c9ef74d064a966c721c1b4bb 100644 (file)
 //
 //
 //
-// File:    VISU_PipeLine.hxx
+// File:    VISU_ScalarMapPL.hxx
 // Author:  Alexey PETROV
 // Module : VISU
 
-#ifndef VISU_ScalrMapPL_HeaderFile
-#define VISU_ScalrMapPL_HeaderFile
+#ifndef VISU_ScalarMapPL_HeaderFile
+#define VISU_ScalarMapPL_HeaderFile
 
-#include "VISU_PipeLine.hxx"
-#include "VISU_ScalarBarActor.hxx"
+#include "VISU_ColoredPL.hxx"
+#include "VISU_UnstructuredGridPL.hxx"
 
-class vtkCell;
-class vtkDataSet;
+class VISU_DataSetMapperHolder;
 
-class VISU_Extractor;
-class VISU_FieldTransform;
 
-
-//============================================================================
-class VISU_ScalarMapPL : public VISU_PipeLine
+//----------------------------------------------------------------------------
+class VISU_ScalarMapPL : public VISU_ColoredPL,
+                        public VISU_UnstructuredGridPL
 {
-protected:
-  VISU_ScalarMapPL();
-  VISU_ScalarMapPL(const VISU_ScalarMapPL&);
-
-  virtual
-  ~VISU_ScalarMapPL();
-
 public:
-  //----------------------------------------------------------------------------
-  vtkTypeMacro(VISU_ScalarMapPL,VISU_PipeLine);
+  vtkTypeMacro(VISU_ScalarMapPL, VISU_ColoredPL);
 
-  static
+  static 
   VISU_ScalarMapPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
+protected:
   //----------------------------------------------------------------------------
-  virtual
-  int
-  GetScalarMode();
-
-  virtual
-  void
-  SetScalarMode(int theScalarMode = 0);
-  
-  virtual
-  int
-  GetScaling();
-  virtual
-  void
-  SetScaling(int theScaling = VTK_SCALE_LINEAR);
-  
-  virtual
-  vtkFloatingPointType* 
-  GetScalarRange();
-
-  virtual
-  void
-  SetScalarRange(vtkFloatingPointType theRange[2]);
-
-  virtual
-  void
-  SetScalarMin(vtkFloatingPointType theValue);
-
-  virtual
-  void
-  SetScalarMax(vtkFloatingPointType theValue);
+  VISU_ScalarMapPL();
+  VISU_ScalarMapPL(const VISU_ScalarMapPL&);
   
   virtual
-  void
-  SetNbColors(int theNbColors = 16);
+  ~VISU_ScalarMapPL();
 
-  virtual
-  int
-  GetNbColors();
-  
-  //----------------------------------------------------------------------------
-public:
   virtual
   void
-  Init();
+  OnCreateMapperHolder();
 
   virtual
   void
   Build();
-
-  virtual
-  void
-  Update();
-  
-  virtual
-  VISU_LookupTable*
-  GetMapperTable();
-
-  virtual 
-  VISU_LookupTable*
-  GetBarTable();
-
-  virtual 
-  void
-  SetMapScale(vtkFloatingPointType theMapScale = 1.0);
-
-  virtual
-  vtkFloatingPointType
-  GetMapScale();
-
-  virtual
-  void
-  GetSourceRange(vtkFloatingPointType theRange[2]);
-
-  virtual
-  void
-  SetSourceRange();
-
-  //----------------------------------------------------------------------------
-protected:
-  typedef vtkDataSet THook;
-  virtual THook* DoHook();
-
-  VISU_LookupTable* myMapperTable;
-  VISU_LookupTable* myBarTable;
-  VISU_FieldTransform* myFieldTransform;
-  VISU_Extractor* myExtractor;
 };
   
 #endif
index b1f7471c04b8d540d5f190538a026d99222f5164..cd46cdb8051ed8f6addf40fd52b8a8b3c2dcaeb1 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
-// File:    VISU_PipeLine.cxx
+// File:    VISU_StreamLinesPL.cxx
 // Author:  Alexey PETROV
 // Module : VISU
 
 
 #include "VISU_StreamLinesPL.hxx"
-#include "VISU_PipeLineUtils.hxx"
+#include "VISU_Extractor.hxx"
 #include "VISU_UsedPointsFilter.hxx"
 #include "VTKViewer_GeometryFilter.h"
 
+#include "VISU_PipeLineUtils.hxx"
+
 #include <algo.h>
 
 #include <vtkCell.h>
-#include <vtkPointSet.h>
+#include <vtkDataSet.h>
 #include <vtkStreamLine.h>
 
 #ifdef _DEBUG_
@@ -48,9 +50,14 @@ static vtkFloatingPointType aMinNbOfSteps = 1.0E+2;
 static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1;
 
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_StreamLinesPL);
 
-VISU_StreamLinesPL::VISU_StreamLinesPL(){
+
+//----------------------------------------------------------------------------
+VISU_StreamLinesPL
+::VISU_StreamLinesPL()
+{
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
   myGeomFilter = VTKViewer_GeometryFilter::New();
@@ -59,21 +66,33 @@ VISU_StreamLinesPL::VISU_StreamLinesPL(){
   mySource = NULL;
 }
 
-VISU_StreamLinesPL::~VISU_StreamLinesPL(){
-  myPointsFilter->UnRegisterAllOutputs();
+
+//----------------------------------------------------------------------------
+VISU_StreamLinesPL
+::~VISU_StreamLinesPL()
+{
   myPointsFilter->Delete();
+  myPointsFilter = NULL;
 
   myCenters->UnRegisterAllOutputs();
-  myCenters->Delete();
+  myCenters = NULL;
 
   myGeomFilter->UnRegisterAllOutputs();
-  myGeomFilter->Delete();
+  myGeomFilter = NULL;
 
   myStream->UnRegisterAllOutputs();
-  myStream->Delete();
+  myStream = NULL;
 }
 
-void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
+
+//----------------------------------------------------------------------------
+void
+VISU_StreamLinesPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
+{
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
     SetParams(aPipeLine->GetIntegrationStep(),
              aPipeLine->GetPropagationTime(),
@@ -82,11 +101,11 @@ void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
              aPipeLine->GetUsedPoints(),
              aPipeLine->GetDirection());
   }
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
 }
 
 
-vtkFloatingPointType
+//----------------------------------------------------------------------------
+size_t
 VISU_StreamLinesPL
 ::GetNecasseryMemorySize(vtkIdType theNbOfPoints, 
                         vtkFloatingPointType theStepLength,
@@ -110,22 +129,24 @@ VISU_StreamLinesPL
   vtkFloatingPointType anAssignedDataSize = aCellsSize*4.0*sizeof(vtkFloatingPointType);
   vtkFloatingPointType anOutputDataSetSize = aMeshSize + anAssignedDataSize;
 
-  vtkFloatingPointType aResult = aStreamArraySize*aNbCells + anOutputDataSetSize;
+  size_t aResult = size_t(aStreamArraySize*aNbCells + anOutputDataSetSize);
   return aResult;
 }
 
-int
+
+//----------------------------------------------------------------------------
+size_t
 VISU_StreamLinesPL
-::FindPossibleParams(vtkPointSet* theDataSet, 
+::FindPossibleParams(vtkDataSet* theDataSet, 
                     vtkFloatingPointType& theStepLength,
                     vtkFloatingPointType& thePropogationTime, 
                     vtkFloatingPointType& thePercents)
 {
   static vtkFloatingPointType aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
   vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
-  vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
-  int isPoss = CheckAvailableMemory(aSize);
-  if(!isPoss){
+  size_t aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
+  size_t anIsPossible = CheckAvailableMemory(aSize);
+  if(!anIsPossible){
     vtkFloatingPointType aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime);
     vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet);
     vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
@@ -144,39 +165,55 @@ VISU_StreamLinesPL
       }
       aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
       if(CheckAvailableMemory(aSize)){
-       isPoss = i;
+       anIsPossible = i;
        break;
       }
     }
   }
-  if(MYDEBUG) MESSAGE("FindPossibleParams - aSize = "<<aSize<<"; isPoss = "<<isPoss);
-  return isPoss;
+  if(MYDEBUG) MESSAGE("FindPossibleParams - aSize = "<<aSize<<"; anIsPossible = "<<anIsPossible);
+  return anIsPossible;
 }
 
 
-int
+//----------------------------------------------------------------------------
+size_t
 VISU_StreamLinesPL
 ::SetParams(vtkFloatingPointType theIntStep,
            vtkFloatingPointType thePropogationTime,
            vtkFloatingPointType theStepLength,
-           vtkPointSet* theSource,
+           vtkDataSet* theSource,
            vtkFloatingPointType thePercents,
            int theDirection,
            int isOnlyTry)
 {
-  vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput();
+  vtkDataSet* aDataSet = theSource? theSource: 
+    GetFieldTransformFilter()->GetUnstructuredGridOutput();
   aDataSet->Update();
+
   vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
-  vtkPointSet* aPointSet = myExtractor->GetOutput();
-  if(thePercents*aNbOfPoints < 1) thePercents = 2.0/aNbOfPoints;
-  theIntStep = CorrectIntegrationStep(theIntStep,aPointSet,thePercents);
-  thePropogationTime = CorrectPropagationTime(thePropogationTime,aPointSet);
-  theStepLength = CorrectStepLength(theStepLength,aPointSet);
-  int isAccepted = FindPossibleParams(aPointSet,theStepLength,thePropogationTime,thePercents);
+  vtkDataSet* aPointSet = GetExtractorFilter()->GetOutput();
+  if(thePercents * aNbOfPoints < 1) 
+    thePercents = 2.0 / aNbOfPoints;
+
+  theIntStep = CorrectIntegrationStep(theIntStep,
+                                     aPointSet,
+                                     thePercents);
+
+  thePropogationTime = CorrectPropagationTime(thePropogationTime, 
+                                             aPointSet);
+
+  theStepLength = CorrectStepLength(theStepLength,
+                                   aPointSet);
+
+  size_t isAccepted = FindPossibleParams(aPointSet,
+                                        theStepLength,
+                                        thePropogationTime,
+                                        thePercents);
+
   if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
     mySource = theSource;
     myPercents = thePercents;
-    if(GetInput2()->GetCellData()->GetNumberOfArrays()){
+    if(GetClippedInput()->GetCellData()->GetNumberOfArrays()){
       myCenters->SetInput(aDataSet);
       myCenters->VertexCellsOn();
       aDataSet = myCenters->GetOutput();
@@ -197,13 +234,16 @@ VISU_StreamLinesPL
 }
 
 
-vtkPointSet* 
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_StreamLinesPL
 ::GetSource() 
 {
   return mySource;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetUsedPoints() 
@@ -211,6 +251,8 @@ VISU_StreamLinesPL
   return myPercents;
 }
 
+
+//----------------------------------------------------------------------------
 vtkDataSet* 
 VISU_StreamLinesPL
 ::GetStreamerSource()
@@ -218,40 +260,48 @@ VISU_StreamLinesPL
   return myStream->GetSource();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
 ::GetVelocityCoeff()
 {
-  return GetVelocityCoeff(myExtractor->GetOutput());
+  return GetVelocityCoeff(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
-::GetVelocityCoeff(vtkPointSet* theDataSet)
+::GetVelocityCoeff(vtkDataSet* theDataSet)
 {
   vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange();
   return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
 }
 
 
-int
+//----------------------------------------------------------------------------
+size_t
 VISU_StreamLinesPL
-::IsPossible(vtkPointSet* theDataSet, 
+::IsPossible(vtkDataSet* theDataSet, 
             vtkFloatingPointType thePercents)
 {
   vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
   VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
   aPointsFilter->SetInput(theDataSet);
-  vtkPointSet* aDataSet = aPointsFilter->GetOutput();
+  vtkDataSet* aDataSet = aPointsFilter->GetOutput();
   aDataSet->Update();
-  int aRes = FindPossibleParams(aDataSet,aStepLength,aBasePropTime,thePercents);
-  aPointsFilter->UnRegisterAllOutputs();
+  size_t aRes = FindPossibleParams(aDataSet,
+                                  aStepLength,
+                                  aBasePropTime,
+                                  thePercents);
   aPointsFilter->Delete();
   return aRes;
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetIntegrationStep()
@@ -259,6 +309,8 @@ VISU_StreamLinesPL
   return myStream->GetIntegrationStepLength();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetStepLength() 
@@ -266,6 +318,8 @@ VISU_StreamLinesPL
   return myStream->GetStepLength();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetPropagationTime() 
@@ -273,6 +327,8 @@ VISU_StreamLinesPL
   return myStream->GetMaximumPropagationTime();
 }
 
+
+//----------------------------------------------------------------------------
 int
 VISU_StreamLinesPL
 ::GetDirection()
@@ -281,15 +337,19 @@ VISU_StreamLinesPL
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMinIntegrationStep(vtkPointSet* theDataSet, 
+::GetMinIntegrationStep(vtkDataSet* theDataSet, 
                        vtkFloatingPointType thePercents) 
 {
-  if(!theDataSet) return -1.0;
-  vtkFloatingPointType aVolume = 1.0;
-  int degree = 0;
+  if(!theDataSet) 
+    return -1.0;
+
   theDataSet->Update();
+
+  int degree = 0;
+  vtkFloatingPointType aVolume = 1.0;
   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
   for(int i = 0, j = 0; i < 3; ++i, j = 2*i){
     vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j];
@@ -298,223 +358,301 @@ VISU_StreamLinesPL
       degree += 1;
     }
   }
-  if (degree < 1) return 0.0; // absolutely empty object
+
+  if (degree < 1) 
+    return 0.0; // absolutely empty object
+
   vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
   thePercents = 1.0;
   vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
-  vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
-  vtkFloatingPointType aRealSize = GetAvailableMemory(aSize);
+  size_t aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
+  size_t aRealSize = GetAvailableMemory(aSize);
   vtkFloatingPointType anAverageVolume = aVolume / aRealSize;
   vtkFloatingPointType aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
   return aStep;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMinIntegrationStep()
 {
-  return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
+  return GetMinIntegrationStep(GetExtractorFilter()->GetOutput(), GetUsedPoints());
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMaxIntegrationStep(vtkPointSet* theDataSet) 
+::GetMaxIntegrationStep(vtkDataSet* theDataSet) 
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet) 
+    return -1.0;
+
   theDataSet->Update();
+
   vtkFloatingPointType aLength = theDataSet->GetLength();
   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
   vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
   vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
   vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength;
-  if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
-  if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
+  if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) 
+    aMinMax = aMaxSizeY;
+  if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) 
+    aMinMax = aMaxSizeZ;
   return aMinMax*aLength/2.0;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMaxIntegrationStep()
 {
-  return GetMaxIntegrationStep(myExtractor->GetOutput());
+  return GetMaxIntegrationStep(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetBaseIntegrationStep(vtkPointSet* theDataSet, 
+::GetBaseIntegrationStep(vtkDataSet* theDataSet, 
                         vtkFloatingPointType thePercents)
 {
   theDataSet->Update();
-  vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+
   vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
   vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
-  vtkFloatingPointType aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
+  vtkFloatingPointType aMinMax = theDataSet->GetLength() / theDataSet->GetNumberOfPoints();
   if(aMinMax > anIntegrationStep)
     anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
+
+  vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
   if(aMinIntegrationStep > anIntegrationStep)
     anIntegrationStep = aMinIntegrationStep;
+
   return anIntegrationStep;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::CorrectIntegrationStep(vtkFloatingPointType theStep, 
-                        vtkPointSet* theDataSet, 
+                        vtkDataSet* theDataSet, 
                         vtkFloatingPointType thePercents)
 {
   theDataSet->Update();
-  vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
-  vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+
+  vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
   if(aMinIntegrationStep > theStep)
     theStep = aMinIntegrationStep;
+
+  vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
   if(aMaxIntegrationStep < theStep)
     theStep = aMaxIntegrationStep;
+
   return theStep;
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMinPropagationTime(vtkPointSet* theDataSet)
+::GetMinPropagationTime(vtkDataSet* theDataSet)
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet) 
+    return -1.0;
+
   return GetMinStepLength(theDataSet);
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMinPropagationTime()
 {
-  return GetMinPropagationTime(myExtractor->GetOutput());
+  return GetMinPropagationTime(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMaxPropagationTime(vtkPointSet* theDataSet)
+::GetMaxPropagationTime(vtkDataSet* theDataSet)
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet) 
+    return -1.0;
+
   return GetBasePropagationTime(theDataSet)*aMinNbOfSteps;
 }
 
-vtkFloatingPointType VISU_StreamLinesPL::GetMaxPropagationTime(){
-  return GetMaxPropagationTime(myExtractor->GetOutput());
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxPropagationTime()
+{
+  return GetMaxPropagationTime(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::CorrectPropagationTime(vtkFloatingPointType thePropagationTime, 
-                        vtkPointSet* theDataSet)
+                        vtkDataSet* theDataSet)
 {
   vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet);
-  vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
   if(aMinPropagationTime > thePropagationTime)
     thePropagationTime = aMinPropagationTime;
+
+  vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
   if(aMaxPropagationTime < thePropagationTime)
     thePropagationTime = aMaxPropagationTime;
+
   return thePropagationTime;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
-::GetBasePropagationTime(vtkPointSet* theDataSet)
+::GetBasePropagationTime(vtkDataSet* theDataSet)
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet) 
+    return -1.0;
+
   theDataSet->Update();
-  vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
+  vtkFloatingPointType aPropagationTime = theDataSet->GetLength() / GetVelocityCoeff(theDataSet);
+
   return aPropagationTime;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
 ::GetBasePropagationTime()
 {
-  return GetBasePropagationTime(myExtractor->GetOutput());
+  return GetBasePropagationTime(GetExtractorFilter()->GetOutput());
 }
 
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
-::GetMinStepLength(vtkPointSet* theDataSet)
+::GetMinStepLength(vtkDataSet* theDataSet)
 {
   static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1;
   vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet);
-  vtkFloatingPointType aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet);
+  vtkFloatingPointType aStepLength = anIntStep * aNbOfStepsOfIntStep / GetVelocityCoeff(theDataSet);
   return aStepLength;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMinStepLength()
 {
-  return GetMinStepLength(myExtractor->GetOutput());
+  return GetMinStepLength(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMaxStepLength(vtkPointSet* theDataSet)
+::GetMaxStepLength(vtkDataSet* theDataSet)
 {
   vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet);
   return aStepLength;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMaxStepLength()
 {
-  return GetMaxStepLength(myExtractor->GetOutput());
+  return GetMaxStepLength(GetExtractorFilter()->GetOutput());
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::CorrectStepLength(vtkFloatingPointType theStep, 
-                   vtkPointSet* theDataSet)
+                   vtkDataSet* theDataSet)
 {
   vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet);
-  if(theStep < aMinStep) theStep = aMinStep;
+  if(theStep < aMinStep) 
+    theStep = aMinStep;
+
   vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet);
-  if(theStep > aMaxStep) theStep = aMaxStep;
+  if(theStep > aMaxStep) 
+    theStep = aMaxStep;
+
   return theStep;
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetBaseStepLength(vtkPointSet* theDataSet)
+::GetBaseStepLength(vtkDataSet* theDataSet)
 {
   static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2;
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet);
   vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps;
   aStepLength = CorrectStepLength(aStepLength,theDataSet);
+
   return aStepLength;
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_StreamLinesPL
 ::Init()
 {
   VISU_ScalarMapPL::Init();
-  vtkPointSet* aDataSet = myExtractor->GetOutput();
+
+  vtkDataSet* aDataSet = GetExtractorFilter()->GetOutput();
   vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
   vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
-  SetParams(anIntStep,aPropagationTime,aStepLength);
+  SetParams(anIntStep,
+           aPropagationTime,
+           aStepLength);
 }
 
-VISU_ScalarMapPL::THook* 
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_StreamLinesPL
-::DoHook()
+::InsertCustomPL()
 {
-  GetInput2()->Update();
-  VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
-  vtkFloatingPointType *aBounds = GetInput2()->GetBounds();
+  GetClippedInput()->Update();
+
+  VISU::CellDataToPoint(myStream,
+                       myCellDataToPointData,
+                       GetClippedInput(),
+                       GetFieldTransformFilter());
+
+  vtkFloatingPointType *aBounds = GetClippedInput()->GetBounds();
   myGeomFilter->SetExtent(aBounds);
   myGeomFilter->ExtentClippingOn();
   myGeomFilter->SetInput(myStream->GetOutput());
+
   return myGeomFilter->GetOutput();
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_StreamLinesPL
 ::Update()
@@ -522,9 +660,35 @@ VISU_StreamLinesPL
   VISU_ScalarMapPL::Update();
 }
 
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_StreamLinesPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myStream->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(vtkDataSet* aDataSet = myGeomFilter->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_StreamLinesPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
   VISU_ScalarMapPL::SetMapScale(theMapScale);
 }
+
+
+//----------------------------------------------------------------------------
index 7c020dac23dda544bef424e12aa004051b156cb1..b203df89069ad7371e7c806a6122c413fac83f4d 100644 (file)
@@ -20,7 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
-// File:    VISU_PipeLine.hxx
+// File:    VISU_StreamLinesPL.hxx
 // Author:  Alexey PETROV
 // Module : VISU
 
 #include "VISU_DeformedShapePL.hxx"
 #include <vtkStreamLine.h>
 
-using namespace std;
-
-class vtkPointSet;
+class vtkDataSet;
 class vtkCellCenters;
 class VTKViewer_GeometryFilter;
 class VISU_UsedPointsFilter;
 
+
+//----------------------------------------------------------------------------
 class VISU_StreamLinesPL : public VISU_DeformedShapePL
 {
-protected:
-  VISU_StreamLinesPL();
-  VISU_StreamLinesPL(const VISU_StreamLinesPL&);
-
-  virtual
-  ~VISU_StreamLinesPL();
-
 public:
-  vtkTypeMacro(VISU_StreamLinesPL,VISU_DeformedShapePL);
+  vtkTypeMacro(VISU_StreamLinesPL, VISU_DeformedShapePL);
 
   static
   VISU_StreamLinesPL* 
   New();
 
   virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
-  virtual
-  int 
+  size_t 
   SetParams(vtkFloatingPointType theIntStep, 
            vtkFloatingPointType thePropogationTime,
            vtkFloatingPointType theStepLength,
-           vtkPointSet* theSource = NULL, 
+           vtkDataSet* theSource = NULL, 
            vtkFloatingPointType thePercents = 0.3,
            int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS,
            int isOnlyTry = false);
 
   virtual
-  vtkPointSet*
+  vtkDataSet*
   GetSource();
 
   virtual
@@ -129,8 +118,8 @@ public:
 
 public:
   virtual
-  THook
-  DoHook();
+  vtkDataSet
+  InsertCustomPL();
 
   virtual
   void
@@ -140,6 +129,11 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
   virtual
   void
   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
@@ -147,61 +141,72 @@ public:
 public:
   static
   vtkFloatingPointType
-  GetMaxIntegrationStep(vtkPointSet* theDataSet);
+  GetMaxIntegrationStep(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetMinIntegrationStep(vtkPointSet* theDataSet, 
+  GetMinIntegrationStep(vtkDataSet* theDataSet, 
                        vtkFloatingPointType thePercents = 0.3);
   static
   vtkFloatingPointType
-  GetBaseIntegrationStep(vtkPointSet* theDataSet, 
+  GetBaseIntegrationStep(vtkDataSet* theDataSet, 
                         vtkFloatingPointType thePercents = 0.3);
   
   static 
   vtkFloatingPointType
-  GetMinPropagationTime(vtkPointSet* theDataSet);
+  GetMinPropagationTime(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetMaxPropagationTime(vtkPointSet* theDataSet);
+  GetMaxPropagationTime(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetBasePropagationTime(vtkPointSet* theDataSet);
+  GetBasePropagationTime(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetMinStepLength(vtkPointSet* theDataSet);
+  GetMinStepLength(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetMaxStepLength(vtkPointSet* theDataSet);
+  GetMaxStepLength(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetBaseStepLength(vtkPointSet* theDataSet);
+  GetBaseStepLength(vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
-  GetVelocityCoeff(vtkPointSet* theDataSet);
+  GetVelocityCoeff(vtkDataSet* theDataSet);
 
   static
-  int
-  IsPossible(vtkPointSet* theDataSet, 
+  size_t
+  IsPossible(vtkDataSet* theDataSet, 
             vtkFloatingPointType thePercents = 0.3);
 
 protected:
+  VISU_StreamLinesPL();
+  VISU_StreamLinesPL(const VISU_StreamLinesPL&);
+
+  virtual
+  ~VISU_StreamLinesPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
+
   static 
-  vtkFloatingPointType
+  size_t
   GetNecasseryMemorySize(vtkIdType theNbOfPoints, 
                         vtkFloatingPointType theStepLength, 
                         vtkFloatingPointType thePropogationTime, 
                         vtkFloatingPointType thePercents = 0.3);
 
   static
-  int
-  FindPossibleParams(vtkPointSet* theDataSet, 
+  size_t
+  FindPossibleParams(vtkDataSet* theDataSet, 
                     vtkFloatingPointType& theStepLength, 
                     vtkFloatingPointType& thePropogationTime, 
                     vtkFloatingPointType& thePercents);
@@ -209,21 +214,21 @@ protected:
   static 
   vtkFloatingPointType
   CorrectIntegrationStep(vtkFloatingPointType theStep, 
-                        vtkPointSet* theDataSet, 
+                        vtkDataSet* theDataSet, 
                         vtkFloatingPointType thePercents = 0.3);
 
   static 
   vtkFloatingPointType
   CorrectPropagationTime(vtkFloatingPointType thePropagationTime, 
-                        vtkPointSet* theDataSet);
+                        vtkDataSet* theDataSet);
 
   static
   vtkFloatingPointType
   CorrectStepLength(vtkFloatingPointType theStep, 
-                   vtkPointSet* theDataSet);
+                   vtkDataSet* theDataSet);
 
   vtkStreamLine* myStream;
-  vtkPointSet* mySource;
+  vtkDataSet* mySource;
   vtkCellCenters* myCenters;
   VTKViewer_GeometryFilter *myGeomFilter;
   VISU_UsedPointsFilter *myPointsFilter;
index 9c49ea25cc6ac49138ded13680438468058b9293..6fb0ffda5ea9222a61fe1bd3c01fb699f660468e 100644 (file)
 #include "VISU_UsedPointsFilter.hxx"
 
 #include <vtkObjectFactory.h>
-#include <vtkPointSet.h>
+#include <vtkUnstructuredGrid.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
 #include <vtkPoints.h>
 #include <vtkIdList.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_UsedPointsFilter);
 
-VISU_UsedPointsFilter::VISU_UsedPointsFilter(){
+
+//----------------------------------------------------------------------------
+VISU_UsedPointsFilter
+::VISU_UsedPointsFilter()
+{
   PercentsOfUsedPoints = 1.0;
 }
 
-VISU_UsedPointsFilter::~VISU_UsedPointsFilter(){}
 
-void VISU_UsedPointsFilter::Execute(){
-  vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
+//----------------------------------------------------------------------------
+VISU_UsedPointsFilter
+::~VISU_UsedPointsFilter()
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_UsedPointsFilter
+::Execute()
+{
+  vtkDataSet *anInput = this->GetInput();
+  vtkPointSet *anOutput = this->GetOutput();
   anOutput->GetPointData()->CopyAllOff();
   anOutput->GetCellData()->CopyAllOff();
   anOutput->CopyStructure(anInput);
@@ -68,3 +84,6 @@ void VISU_UsedPointsFilter::Execute(){
   aNewPoints->Delete();
   aPoints->Delete();
 }
+
+
+//----------------------------------------------------------------------------
index dd20877ad4ffe857f1e686e56db370cde537f4c3..3795da85a2f450a25a64fd54864f0f5ce1f64736 100644 (file)
 #ifndef VISU_UsedPointsFilter_HeaderFile
 #define VISU_UsedPointsFilter_HeaderFile
 
-#include <vtkPointSetToPointSetFilter.h>
+#include <vtkDataSetToUnstructuredGridFilter.h>
+
+
+//----------------------------------------------------------------------------
+class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+{
+public:
+  vtkTypeMacro(VISU_UsedPointsFilter, vtkDataSetToUnstructuredGridFilter);
+
+  static 
+  VISU_UsedPointsFilter* 
+  New();
+
+  vtkSetMacro(PercentsOfUsedPoints,float);
+  vtkGetMacro(PercentsOfUsedPoints,float);
 
-class VISU_UsedPointsFilter : public vtkPointSetToPointSetFilter{
 protected:
   VISU_UsedPointsFilter();
   VISU_UsedPointsFilter(const VISU_UsedPointsFilter&);
 
-  virtual void Execute();
-  float PercentsOfUsedPoints;
+  virtual
+  ~VISU_UsedPointsFilter();
 
-public:
-  vtkTypeMacro(VISU_UsedPointsFilter,vtkPointSetToPointSetFilter);
-  static VISU_UsedPointsFilter* New();
-  virtual ~VISU_UsedPointsFilter();
+  virtual
+  void
+  Execute();
 
-  vtkSetMacro(PercentsOfUsedPoints,float);
-  vtkGetMacro(PercentsOfUsedPoints,float);
+  float PercentsOfUsedPoints;
 };
 
 #endif
index 3fa4bd6654f27e2da0eabc70a57075e9111950a6..66ad29faa82fbfbd29b4271eeffaaea4ba0cee61 100644 (file)
 #include <vtkGlyphSource2D.h>
 #include <vtkPolyData.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_VectorsPL);
 
+
+//----------------------------------------------------------------------------
 VISU_VectorsPL
 ::VISU_VectorsPL()
 {
+  SetIsShrinkable(false);
+
   myBaseGlyph = vtkGlyph3D::New();
   myTransformedGlyph = vtkGlyph3D::New();
 
@@ -50,9 +56,10 @@ VISU_VectorsPL
 
   myCenters = vtkCellCenters::New();
   myTransformFilter = VTKViewer_TransformFilter::New();
-  myIsShrinkable = false;
 }
 
+
+//----------------------------------------------------------------------------
 VISU_VectorsPL
 ::~VISU_VectorsPL()
 {
@@ -70,35 +77,43 @@ VISU_VectorsPL
   myTransformFilter->Delete();
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput)
 {
+  Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
   if(VISU_VectorsPL *aPipeLine = dynamic_cast<VISU_VectorsPL*>(thePipeLine)){
     SetGlyphType(aPipeLine->GetGlyphType());
     SetGlyphPos(aPipeLine->GetGlyphPos());
   }
-  Superclass::ShallowCopy(thePipeLine);
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
 ::SetTransform(VTKViewer_Transform* theTransform)
 {
-  myFieldTransform->SetSpaceTransform(theTransform);
+  GetFieldTransformFilter()->SetSpaceTransform(theTransform);
   myTransformFilter->SetTransform(theTransform);
   myTransformFilter->Modified();
 }
 
+
+//----------------------------------------------------------------------------
 VTKViewer_Transform* 
 VISU_VectorsPL
 ::GetTransform()
 {
-  return myFieldTransform->GetSpaceTransform();
+  return GetFieldTransformFilter()->GetSpaceTransform();
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
 ::SetScale(vtkFloatingPointType theScale) 
@@ -114,6 +129,8 @@ VISU_VectorsPL
   Modified();
 }
 
+
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_VectorsPL
 ::GetScale() 
@@ -122,6 +139,45 @@ VISU_VectorsPL
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_VectorsPL
+::SetGlyphType(VISU_VectorsPL::GlyphType theType) 
+{
+  myTypeGlyph = theType;
+  Modified();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_VectorsPL::GlyphType
+VISU_VectorsPL
+::GetGlyphType() const
+{
+  return myTypeGlyph;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_VectorsPL
+::SetGlyphPos(VISU_VectorsPL::GlyphPos thePos) 
+{
+  myPosGlyph = thePos;
+  Modified();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_VectorsPL::GlyphPos
+VISU_VectorsPL
+::GetGlyphPos() const
+{
+  return myPosGlyph;
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
 ::Init()
@@ -133,6 +189,7 @@ VISU_VectorsPL
 }
 
 
+//----------------------------------------------------------------------------
 vtkDataSet* 
 VISU_VectorsPL
 ::GetOutput()
@@ -142,16 +199,25 @@ VISU_VectorsPL
 }
 
 
-VISU_ScalarMapPL::THook* 
+//----------------------------------------------------------------------------
+vtkDataSet* 
 VISU_VectorsPL
-::DoHook()
+::InsertCustomPL()
 {
-  VISU::ToCellCenters(myBaseGlyph,myCenters,GetInput2(),myFieldTransform);
+  VISU::ToCellCenters(myBaseGlyph,
+                     myCenters,
+                     GetClippedInput(),
+                     GetFieldTransformFilter());
+
   myBaseGlyph->SetVectorModeToUseVector();
   myBaseGlyph->SetScaleModeToScaleByVector();
   myBaseGlyph->SetColorModeToColorByScalar();
 
-  VISU::ToCellCenters(myTransformFilter,myCenters,GetInput2(),myFieldTransform);
+  VISU::ToCellCenters(myTransformFilter,
+                     myCenters,
+                     GetClippedInput(),
+                     GetFieldTransformFilter());
+
   myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
   myTransformedGlyph->SetVectorModeToUseVector();
   myTransformedGlyph->SetScaleModeToScaleByVector();
@@ -161,6 +227,7 @@ VISU_VectorsPL
 }
 
 
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
 ::Update()
@@ -217,6 +284,31 @@ VISU_VectorsPL
 }
 
 
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_VectorsPL
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  if(vtkDataSet* aDataSet = myBaseGlyph->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(vtkDataSet* aDataSet = myTransformedGlyph->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+  
+  if(vtkDataSet* aDataSet = myCenters->GetOutput())
+    aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  if(myCellDataToPointData->GetInput())
+    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
+      aSize += aDataSet->GetActualMemorySize() * 1024;
+
+  return aSize;
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_VectorsPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
@@ -228,3 +320,6 @@ VISU_VectorsPL
 
   Modified();
 }
+
+
+//----------------------------------------------------------------------------
index fd83f0225301df8a8efbc4b77854eb95e12bb8c5..dd75e135110bfc20f3ecbd25a005c31013ac7f54 100644 (file)
@@ -39,15 +39,10 @@ class vtkLineSource;
 
 class vtkGlyph3D;
 
+
+//----------------------------------------------------------------------------
 class VISU_VectorsPL : public VISU_DeformedShapePL
 {
-protected:
-  VISU_VectorsPL();
-  VISU_VectorsPL(const VISU_VectorsPL&);
-
-  virtual
-  ~VISU_VectorsPL();
-
 public:
   vtkTypeMacro(VISU_VectorsPL,VISU_DeformedShapePL);
 
@@ -55,10 +50,6 @@ public:
   VISU_VectorsPL* 
   New();
 
-  virtual
-  void
-  ShallowCopy(VISU_PipeLine *thePipeLine);
-
   virtual
   void
   SetScale(vtkFloatingPointType theScale);
@@ -71,33 +62,21 @@ public:
 
   virtual
   void
-  SetGlyphType(GlyphType theType) 
-  {
-    myTypeGlyph = theType;
-  }
+  SetGlyphType(GlyphType theType);
 
   virtual
   GlyphType
-  GetGlyphType() 
-  {
-    return myTypeGlyph;
-  }
+  GetGlyphType() const;
     
   enum GlyphPos{ CENTER, TAIL,HEAD};
 
   virtual
   void
-  SetGlyphPos(GlyphPos thePos) 
-  { 
-    myPosGlyph = thePos;
-  }
+  SetGlyphPos(GlyphPos thePos);
 
   virtual
   GlyphPos
-  GetGlyphPos() 
-  {
-    return myPosGlyph;
-  }
+  GetGlyphPos() const;
 
 public:
   virtual
@@ -108,6 +87,11 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
   vtkDataSet* 
   GetOutput();
 
@@ -124,9 +108,20 @@ public:
   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
 
 protected:
+  VISU_VectorsPL();
+  VISU_VectorsPL(const VISU_VectorsPL&);
+
   virtual
-  THook* 
-  DoHook();
+  ~VISU_VectorsPL();
+
+  virtual
+  vtkDataSet* 
+  InsertCustomPL();
+
+  virtual
+  void
+  DoShallowCopy(VISU_PipeLine *thePipeLine,
+               bool theIsCopyInput);
 
   GlyphType myTypeGlyph;
   GlyphPos myPosGlyph;
index b3eaeb69b5f368fcb6ee53c1f6ffdae978796f10..51f876d770f6f1631d5f633a319899b7016432ae 100644 (file)
@@ -61,8 +61,9 @@ LIB_SRC =     VisuGUI.cxx \
                VisuGUI_ClippingDlg.cxx \
                VisuGUI_DialogRunner.cxx \
                VisuGUI_OffsetDlg.cxx \
-               VisuGUI_Plot3DDlg.cxx \
+               VisuGUI_Prs3dDlg.cxx \
                VisuGUI_ScalarBarDlg.cxx \
+               VisuGUI_Plot3DDlg.cxx \
                VisuGUI_GaussPointsDlg.cxx \
                VisuGUI_DeformedShapeDlg.cxx \
                VisuGUI_IsoSurfacesDlg.cxx \
@@ -75,7 +76,11 @@ LIB_SRC =    VisuGUI.cxx \
                VisuGUI_SetupPlot2dDlg.cxx \
                VisuGUI_BuildProgressDlg.cxx \
                VisuGUI_TransparencyDlg.cxx \
-               VisuGUI_Timer.cxx
+               VisuGUI_Timer.cxx \
+               VisuGUI_Slider.cxx \
+               VisuGUI_InputPane.cxx \
+               VisuGUI_CacheDlg.cxx \
+               VisuGUI_FieldFilter.cxx
 
 LIB_MOC =      VisuGUI.h \
                VisuGUI_Module.h \
@@ -88,8 +93,9 @@ LIB_MOC =     VisuGUI.h \
                VisuGUI_ClippingDlg.h \
                VisuGUI_DialogRunner.h \
                VisuGUI_OffsetDlg.h \
-               VisuGUI_Plot3DDlg.h \
+               VisuGUI_Prs3dDlg.h \
                VisuGUI_ScalarBarDlg.h \
+               VisuGUI_Plot3DDlg.h \
                VisuGUI_GaussPointsDlg.h \
                VisuGUI_DeformedShapeDlg.h \
                VisuGUI_IsoSurfacesDlg.h \
@@ -100,7 +106,10 @@ LIB_MOC =  VisuGUI.h \
                VisuGUI_ScalarMapOnDeformedShapeDlg.h \
                VisuGUI_SetupPlot2dDlg.h \
                VisuGUI_BuildProgressDlg.h \
-               VisuGUI_TransparencyDlg.h
+               VisuGUI_TransparencyDlg.h \
+               VisuGUI_Slider.h \
+               VisuGUI_InputPane.h \
+               VisuGUI_CacheDlg.h
 
 LIB_CLIENT_IDL = SALOME_Exception.idl \
                 VISU_Gen.idl \
index afee2ba532d05975ed8447d23cce6030d4d9c833..9a8e4e2336d350a2e271f4ff2e563b42fee375f2 100644 (file)
@@ -38,6 +38,21 @@ msgstr "Visu_import_med.png"
 msgid "ICON_OBJBROWSER_Visu"
 msgstr "Visu_tree_visu.png"
 
+msgid "ICON_MULTIPR_VIEW_FULL"
+msgstr "Visu_tree_multipr_full.png"
+
+msgid "ICON_MULTIPR_VIEW_MEDIUM"
+msgstr "Visu_tree_multipr_medium.png"
+
+msgid "ICON_MULTIPR_VIEW_LOW"
+msgstr "Visu_tree_multipr_low.png"
+
+msgid "ICON_MULTIPR_VIEW_HIDE"
+msgstr "Visu_tree_multipr_hide.png"
+
+msgid "ICON_HOLO_RENDER"
+msgstr "Visu_holo_render.png"
+
 msgid "ICON_SCALAR_MAP"
 msgstr "Visu_scalars.png"
 
@@ -132,3 +147,27 @@ msgstr "Visu_recording_stop.png"
 
 msgid "ICON_LOAD_TEXTURE"
 msgstr "Visu_load_texture.png"
+
+msgid "ICON_SLIDER_MORE"
+msgstr "Visu_slider_more.png"
+
+msgid "ICON_SLIDER_AVI"
+msgstr "Visu_slider_avi.png"
+
+msgid "ICON_SLIDER_FIRST"
+msgstr "Visu_slider_first.png"
+
+msgid "ICON_SLIDER_PREVIOUS"
+msgstr "Visu_slider_previous.png"
+
+msgid "ICON_SLIDER_PLAY"
+msgstr "Visu_slider_play.png"
+
+msgid "ICON_SLIDER_PAUSE"
+msgstr "Visu_slider_pause.png"
+
+msgid "ICON_SLIDER_NEXT"
+msgstr "Visu_slider_next.png"
+
+msgid "ICON_SLIDER_LAST"
+msgstr "Visu_slider_last.png"
index eebc49c8fbd7aea26381c270127bbed0542a0668..3a9530eb4fcd26cf39a941561517198ca84eb8a7 100644 (file)
@@ -40,6 +40,12 @@ msgstr "Current Study is locked"
 msgid "WRN_NO_AVAILABLE_DATA"
 msgstr "No Available data in selection"
 
+msgid "WRN_EXTRA_MEMORY_REQUIRED"
+msgstr "Cache need more memory to build the presentation (%1 Mb).\nDo you want to enlarge the cache?"
+
+msgid "ERR_NO_MEMORY_TO_BUILD"
+msgstr "Please, free %1 Mb to make the cache enlarging possible\n(for example, try to delete some holders)"
+
 msgid "ERR_CANT_FIND_VISU_COMPONENT"
 msgstr "Failed to activate VISU engine!"
 
@@ -171,6 +177,21 @@ msgstr "Use Shading"
 msgid "VISU_SHRINK"
 msgstr "Shrink"
 
+msgid "VISU_3DCACHE_PROPS"
+msgstr "3D Cache properties"
+
+msgid "VISU_MEMORY_MODE"
+msgstr "Memory mode"
+
+msgid "VISU_MINIMAL"
+msgstr "Minimal"
+
+msgid "VISU_LIMITED"
+msgstr "Limited"
+
+msgid "VISU_MEMORY_LIMIT"
+msgstr "Memory limit (Mb)"
+
 #: VisuGUI.cxx
 
 msgid "VisuGUI::MEN_IMPORT"
@@ -401,6 +422,9 @@ msgstr "Arrange Actors"
 msgid "VisuGUI::MEN_PLOT3D_FROM_CUTPLANE"
 msgstr "Plot3d"
 
+msgid "VisuGUI::MEN_CACHE_PROPERTIES"
+msgstr "Properties"
+
 
 msgid "VisuGUI::ERR_ERROR_DURING_EXPORT"
 msgstr "Error has been occured during exporting to file"
@@ -572,6 +596,9 @@ msgstr "Deformed Shape"
 msgid "VisuGUI_DeformedShapeDlg::SCALAR_BAR_TAB"
 msgstr "Scalar Bar"
 
+msgid "VisuGUI_DeformedShapeDlg::INPUT_TAB"
+msgstr "Input"
+
 msgid "VisuGUI_DeformedShapeDlg::MAGNITUDE_COLORING"
 msgstr "Magnitude coloring"
 
@@ -596,6 +623,9 @@ msgstr "Scalar Map on Deformed Shape"
 msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALAR_BAR_TAB"
 msgstr "Scalar Bar"
 
+msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::INPUT_TAB"
+msgstr "Input"
+
 msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALE_FACTOR"
 msgstr "Scale Factor:"
 
@@ -683,6 +713,28 @@ msgid "VisuGUI_NonIsometricDlg::LBL_Z"
 msgstr "Z :"
 
 
+#: VisuGUI_InputPane.cxx
+
+msgid "VisuGUI_InputPane::MED_FILE"
+msgstr "Med File :"
+
+msgid "VisuGUI_InputPane::MESH"
+msgstr "Mesh :"
+
+msgid "VisuGUI_InputPane::ENTITY"
+msgstr "Entity :"
+
+msgid "VisuGUI_InputPane::FIELD"
+msgstr "Field :"
+
+msgid "VisuGUI_InputPane::TIME_STAMP"
+msgstr "Time Stamp :"
+
+msgid "VisuGUI_InputPane::REINITIALIZE"
+msgstr "Reinitialize"
+
+
+
 #: VisuGUI_ScalarBarDlg.cxx
 
 msgid "VisuGUI_ScalarBarDlg::&OK"
@@ -1073,6 +1125,9 @@ msgstr "Plot 3D"
 msgid "VisuGUI_Plot3DDlg::SCALAR_BAR_TAB_TITLE"
 msgstr "Scalar Bar"
 
+msgid "VisuGUI_Plot3DDlg::INPUT_TAB_TITLE"
+msgstr "Input"
+
 msgid "VisuGUI_Plot3DPane::ORIENTATION"
 msgstr "Orientation"
 
@@ -1594,6 +1649,21 @@ msgstr "Quality"
 msgid "VisuGUI_Module::VISU_RECORDER_PREF_PROGRESSIVE"
 msgstr "Progressive"
 
+msgid "VisuGUI_Slider::MORE"
+msgstr "More..."
+
+msgid "VisuGUI_Slider::CACHE_MEMORY"
+msgstr "Cache:"
+
+msgid "VisuGUI_Slider::FREE_MEMORY"
+msgstr "Free:"
+
+msgid "VisuGUI_Slider::SPEED"
+msgstr "Speed:"
+
+msgid "VisuGUI_Slider::AVI"
+msgstr "AVI"
+
 msgid "VisuGUI_GaussPointsDlg::DLG_PREF_TITLE"
 msgstr "Gauss Points Preferences"
 
@@ -1711,6 +1781,27 @@ msgstr "Opaque"
 msgid "VisuGUI_TransparencyDlg::BUT_CLOSE"
 msgstr "Close"
 
+msgid "VisuGUI_CacheDlg::CACHE_TITLE"
+msgstr "Cache properties"
+
+msgid "VisuGUI_CacheDlg::MEMORY_MODE"
+msgstr "Memory mode"
+
+msgid "VisuGUI_CacheDlg::MINIMAL_MEMORY"
+msgstr "Minimal memory"
+
+msgid "VisuGUI_CacheDlg::LIMITED_MEMORY"
+msgstr "Limited memory"
+
+msgid "VisuGUI_CacheDlg::MEMORY STATE"
+msgstr "Memory state"
+
+msgid "VisuGUI_CacheDlg::USED_BY_CACHE"
+msgstr "Used by cache"
+
+msgid "VisuGUI_CacheDlg::FREE"
+msgstr "Free"
+
 msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "Gauss scene:%1 - viewer:%2"
 
@@ -1849,6 +1940,9 @@ msgstr "Gauss Points"
 msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB"
 msgstr "Scalar Bar"
 
+msgid "VisuGUI_GaussPointsDlg::INPUT_TAB"
+msgstr "Input"
+
 msgid "VisuGUI_GaussPointsDlg::PRS_TITLE"
 msgstr "Presentation"
 
@@ -2099,4 +2193,20 @@ msgid "VISU_PLOT3D"
 msgstr "Plot3D"
 
 msgid "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE"
-msgstr "Scalar Map on Def. Shape"
\ No newline at end of file
+msgstr "Scalar Map on Def. Shape"
+
+# MULTIPR
+msgid "VisuGUI::MEN_MULTIPR_VIEW_FULL_RES"
+msgstr "Display at full resolution"
+
+msgid "VisuGUI::MEN_MULTIPR_VIEW_MEDIUM_RES"
+msgstr "Display at medium resolution"
+
+msgid "VisuGUI::MEN_MULTIPR_VIEW_LOW_RES"
+msgstr "Display at low resolution"
+
+msgid "VisuGUI::MEN_MULTIPR_VIEW_HIDE"
+msgstr "Hide"
+
+msgid "VisuGUI::MEN_HOLO_RENDER"
+msgstr "Holo render"
index 8266ce946340111e04c392d9c4a006a855177532..d25d6b9863afd256ea7b00642ab8a79bd2aaa3b4 100644 (file)
@@ -67,7 +67,6 @@
 
 #include "OB_Browser.h"
 
-#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "SalomeApp_Application.h"
 #include "VisuGUI_Displayer.h"
 #include "VisuGUI_BuildProgressDlg.h"
 #include "VisuGUI_TransparencyDlg.h"
+#include "VisuGUI_CacheDlg.h"
 
 #include "VISU_ScalarMap_i.hh"
 #include "VisuGUI_ScalarBarDlg.h"
 using namespace VISU;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -156,20 +156,22 @@ static int MYDEBUG = 0;
 // Class: VisuGUI
 //////////////////////////////////////////////////
 
-VisuGUI::VisuGUI():
+VisuGUI
+::VisuGUI():
   SalomeApp_Module( "VISU" ),
   myDisplayer( 0 )
 {
 }
 
 
-VisuGUI::~VisuGUI()
+VisuGUI
+::~VisuGUI()
 {
 }
 
 void
-VisuGUI::
-OnImportFromFile()
+VisuGUI
+::OnImportFromFile()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
@@ -209,6 +211,7 @@ OnImportFromFile()
       application()->putInfo( anInfo );
 
       QApplication::setOverrideCursor(Qt::waitCursor);
+      // MULTIPR: CreateResult
       VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() );
 
       if (CORBA::is_nil(aResult.in())) {
@@ -237,8 +240,8 @@ OnImportFromFile()
 }
 
 void
-VisuGUI::
-OnImportTableFromFile()
+VisuGUI
+::OnImportTableFromFile()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
@@ -272,8 +275,8 @@ OnImportTableFromFile()
 }
 
 void
-VisuGUI::
-OnExportTableToFile()
+VisuGUI
+::OnExportTableToFile()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
 
@@ -375,8 +378,8 @@ OnExportTableToFile()
 }
 
 void
-VisuGUI::
-OnImportMedField()
+VisuGUI
+::OnImportMedField()
 {
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
@@ -429,7 +432,7 @@ CreateCurves( SalomeApp_Module* theModule,
     return;
 
   _PTR(Study)   aStudy = GetCStudy( GetAppStudy( theModule ) );
-  _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
+  _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
 
   if ( !theCreate && aSObject ) {
     // Remove old Table
@@ -471,7 +474,7 @@ CreateCurves( SalomeApp_Module* theModule,
   }
 
   if ( aCutDlg->isGenerateTable() ) {
-    GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
+    GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
     if ( aCutDlg->isGenerateCurves() ) {
       if ( aSObject ) {
         _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
@@ -495,16 +498,23 @@ CreateCurves( SalomeApp_Module* theModule,
 }
 
 void
-VisuGUI::
-OnCreateMesh()
+VisuGUI
+::OnCreateMesh()
 {
+
+       cout << "MULTIPR: file=" << __FILE__<< " line=" << __LINE__ << " func=OnCreateMesh()" << endl;
+       
   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aStudy,GetDesktop(this)))
     return;
 
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
   // Get selected SObject
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
   if (anIO.IsNull() || !anIO->hasEntry())
     return;
 
@@ -516,8 +526,8 @@ OnCreateMesh()
 }
 
 void
-VisuGUI::
-OnCreateManyMesh()
+VisuGUI
+::OnCreateManyMesh()
 {
   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aStudy,GetDesktop(this)))
@@ -542,72 +552,72 @@ OnCreateManyMesh()
 }
 
 void
-VisuGUI::
-OnCreateScalarMap()
+VisuGUI
+::OnCreateScalarMap()
 {
   CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
 }
 
 
 void
-VisuGUI::
-OnCreateDeformedShape()
+VisuGUI
+::OnCreateDeformedShape()
 {
   CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
 }
 
 void
-VisuGUI::
-OnCreateScalarMapOnDeformedShape()
+VisuGUI
+::OnCreateScalarMapOnDeformedShape()
 {
   CreatePrs3d<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this);
 }
 
 void
-VisuGUI::
-OnCreateVectors()
+VisuGUI
+::OnCreateVectors()
 {
   CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
 }
 
 void
-VisuGUI::
-OnCreateIsoSurfaces()
+VisuGUI
+::OnCreateIsoSurfaces()
 {
   CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
 }
 
 void
-VisuGUI::
-OnCreateCutPlanes()
+VisuGUI
+::OnCreateCutPlanes()
 {
   CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
 }
 
 void
-VisuGUI::
-OnCreateCutLines()
+VisuGUI
+::OnCreateCutLines()
 {
   CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
 }
 
 void
-VisuGUI::
-OnCreateStreamLines()
+VisuGUI
+::OnCreateStreamLines()
 {
   CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
 }
 
 void
-VisuGUI::
-OnCreatePlot3D()
+VisuGUI
+::OnCreatePlot3D()
 {
   CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
 }
 
 void
-VisuGUI::
-OnCreatePlot2dView()
+VisuGUI
+::OnCreatePlot2dView()
 {
   CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
   GetVisuGen( this )->CreateContainer();
@@ -615,114 +625,85 @@ OnCreatePlot2dView()
 }
 
 void
-VisuGUI::
-OnDisplayPrs()
+VisuGUI
+::OnDisplayPrs()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
 
-  LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  if (!mgr) return;
+  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  if (!aSelectionMgr)
+    return;
 
   QApplication::setOverrideCursor(Qt::waitCursor);
 
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-
   SALOME_ListIO aSel, aList;
-  mgr->selectedObjects(aSel);
+  aSelectionMgr->selectedObjects(aSel);
   extractContainers(aSel, aList);
 
   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
     Handle(SALOME_InteractiveObject) anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-
-    if (!CORBA::is_nil(anObject)) {
-      // is it Prs3d object ?
-      VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-      if (aPrsObject) {
-        if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
-        //UpdateViewer( this, aPrsObject );
-        if (vw) {
+    TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+    VISU::Base_i* aBase = anObjectInfo.myBase;
+    if(!aBase) 
+      continue;
+
+    VISU::VISUType aType = aBase->GetType();
+    switch (aType) {
+    case VISU::TCURVE: 
+    case VISU::TCONTAINER: 
+    case VISU::TTABLE: 
+      displayer()->Display(anIO->getEntry());
+      break;
+    default: {
+      VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
+      if(aPrs3d){
+       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
          displayer()->Display(anIO->getEntry());
-         vw->highlight(anIO, 1);
-        }
-        continue;
-      }
-      // is it Curve ?
-      VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
-      if (aCurve) {
-        if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
-        //PlotCurve( this, aCurve, VISU::eDisplay );
-       displayer()->Display(anIO->getEntry());
-        continue;
-      }
-      // is it Container ?
-      VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
-      if (aContainer) {
-        if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
-        //PlotContainer( this, aContainer, VISU::eDisplay );
-       displayer()->Display(anIO->getEntry());
-        continue;
-      }
-      // is it Table ?
-      VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
-      if (aTable) {
-        if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
-        //PlotTable( this, aTable, VISU::eDisplay );
-       displayer()->Display(anIO->getEntry());
-        continue;
-      }
+         aViewWindow->highlight(anIO, 1);
+         aViewWindow->getRenderer()->ResetCameraClippingRange();
+         aViewWindow->Repaint();
+       }
+      }}
     }
   }
 
-  if (vw) {
-    vw->getRenderer()->ResetCameraClippingRange();
-    vw->Repaint();
-  }
-
   QApplication::restoreOverrideCursor();
 }
 
 void
-VisuGUI::
-OnDisplayOnlyPrs()
+VisuGUI
+::OnDisplayOnlyPrs()
 {
   OnEraseAll();
   OnDisplayPrs();
 }
 
 void
-VisuGUI::
-OnErasePrs()
+VisuGUI
+::OnErasePrs()
 {
   if(MYDEBUG) MESSAGE("OnErasePrs");
-
   QApplication::setOverrideCursor(Qt::waitCursor);
 
-  //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  //if (vw)
-  //  vw->unHighlightAll();
-
   SALOME_ListIO aList, aSel;
-  LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  mgr->selectedObjects(aSel);
+  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  aSelectionMgr->selectedObjects(aSel);
   extractContainers(aSel, aList);
 
   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
     Handle(SALOME_InteractiveObject) anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-    //ErasePrs(this, anObject, /*repaint_view_window = */false);
-    ErasePrs(this, anObject, /*repaint_view_window = */true);
+    TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+    VISU::Base_i* aBase = anObjectInfo.myBase;
+    ErasePrs(this, aBase, /*repaint_view_window = */true);
   }
 
-  //if (vw)
-  //  vw->Repaint();
-
   QApplication::restoreOverrideCursor();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEraseAll()
+VisuGUI
+::OnEraseAll()
 {
   startOperation( myEraseAll );
   if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
@@ -745,165 +726,223 @@ OnEraseAll()
 }
 
 
+namespace
+{
+  //----------------------------------------------------------------------------
+  VISU::Prs3d_i*
+  GetPrsToModify(const SalomeApp_Module* theModule,
+                Handle(SALOME_InteractiveObject)& theIO)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return NULL;
+
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    theIO = aSelectionItem.myIO;
+    return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
+  }
+}
+
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditScalarMap()
+VisuGUI
+::OnEditScalarMap()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditDeformedShape()
+VisuGUI
+::OnEditDeformedShape()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditScalarMapOnDeformedShape()
+VisuGUI
+::OnEditScalarMapOnDeformedShape()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditCutPlanes()
+VisuGUI
+::OnEditCutPlanes()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditCutLines()
+VisuGUI
+::OnEditCutLines()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditIsoSurfaces()
+VisuGUI
+::OnEditIsoSurfaces()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditVectors()
+VisuGUI
+::OnEditVectors()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditStreamLines()
+VisuGUI
+::OnEditStreamLines()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditPlot3D()
+VisuGUI
+::OnEditPlot3D()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
 }
 
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakeSurfaceframe()
+VisuGUI
+::OnMakeSurfaceframe()
 {
   ChangeRepresentation(this, VISU::SURFACEFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakeInsideframe()
+VisuGUI
+::OnMakeInsideframe()
 {
   ChangeRepresentation(this, VISU::INSIDEFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakeWireframe()
+VisuGUI
+::OnMakeWireframe()
 {
   ChangeRepresentation(this, VISU::WIREFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakeSurface()
+VisuGUI
+::OnMakeSurface()
 {
   ChangeRepresentation(this, VISU::SHADED);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakePoints()
+VisuGUI
+::OnMakePoints()
 {
   ChangeRepresentation(this, VISU::POINT);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMakeShrink()
+VisuGUI
+::OnMakeShrink()
 {
   ChangeRepresentation(this, VISU::SHRINK);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnSetShadingOn()
+VisuGUI
+::OnSetShadingOn()
 {
   SetShading(this, true);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnSetShadingOff()
+VisuGUI
+::OnSetShadingOff()
 {
   SetShading(this, false);
 }
 
-void
-VisuGUI::
-OnChangeColor()
-{
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-
-  VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (!vw) return;
-
-  VISU_Actor* anActor = GetActor(aPrs3d, vw);
-  if (!anActor) return;
+namespace
+{
+  //----------------------------------------------------------------------------
+  bool
+  GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                       VISU::Prs3d_i*& thePrs3d,
+                       SVTK_ViewWindow*& theViewWindow,
+                       VISU_Actor*& thenActor)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return false;
+  
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!thePrs3d)
+      return false;
+  
+    theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!theViewWindow)
+      return false;
+  
+    thenActor = FindActor(theViewWindow, thePrs3d);
+    if(!thenActor)
+      return false;
+    
+    return true;
+  }
+}
 
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeColor()
+{
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+    return;
+    
   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
   VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
+
   SALOMEDS::Color anOldColor, aNewColor;
   int aRepresent = anActor->GetRepresentation();
   if (aMesh) {
@@ -955,83 +994,61 @@ OnChangeColor()
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnChangeWireframeColor()
+VisuGUI
+::OnChangeWireframeColor()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-
-  VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrs3d) return;
-
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (!vw) return;
-
-  VISU_Actor* anActor = GetActor(aPrs3d, vw);
-  if (!anActor) return;
-
-  if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
-    SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
-    QColor aColor (int(255*anOldColor.R),
-                   int(255*anOldColor.G),
-                   int(255*anOldColor.B));
-    QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
-    if (aColorNew.isValid()) {
-      aNewColor.R = aColorNew.red()/255.;
-      aNewColor.G = aColorNew.green()/255.;
-      aNewColor.B = aColorNew.blue()/255.;
-      aMesh->SetLinkColor(aNewColor);
-      RecreateActor(this, aMesh);
-    }
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+    return;
+    
+  VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
+  if(!aMesh)
+    return;
+
+  SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
+  QColor aColor (int(255*anOldColor.R),
+                int(255*anOldColor.G),
+                int(255*anOldColor.B));
+  QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+  if (aColorNew.isValid()) {
+    aNewColor.R = aColorNew.red()/255.;
+    aNewColor.G = aColorNew.green()/255.;
+    aNewColor.B = aColorNew.blue()/255.;
+    aMesh->SetLinkColor(aNewColor);
+    RecreateActor(this, aMesh);
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnChangeOpacity()
+VisuGUI
+::OnChangeOpacity()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-
-  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrsObject) return;
-
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (!vw) return;
-
-  VISU_Actor* anActor = GetActor(aPrsObject, vw);
-  if (!anActor) return;
-
-  VisuGUI_TransparencyDlg* aTransparencyDlg = new VisuGUI_TransparencyDlg( this );
-  aTransparencyDlg->show();
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+    return;
+  
+  VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
+  aDialog->show();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnChangeLines()
+VisuGUI
+::OnChangeLines()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-
-  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrsObject) return;
-
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (!vw) return;
-
-  VISU_Actor* anActor = GetActor(aPrsObject, vw);
-  if (!anActor) return;
-
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+    return;
+  
   VisuGUI_CursorDlg* CursorDlg =
     new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
 
@@ -1053,34 +1070,27 @@ OnChangeLines()
   delete CursorDlg;
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnShowTable()
+VisuGUI
+::OnShowTable()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(SObject) SO;
-  if ( !CORBA::is_nil( anObject ) ) {
-    VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
-    if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
-      CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
-      if( !CORBA::is_nil( aTable ) ) {
-        VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
-        if ( table ) {
-          SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
-        }
-      }
-    }
-  } else {
-    // possibly this is Table SObject
-    SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
-  }
-
-  if( !IsSObjectTable( SO ) )
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+    aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
+  
+  if( !IsSObjectTable( aSObject ) )
     return;
 
   VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
-                                               SO,
+                                               aSObject,
                                                false,
                                                //SAL2670 Orientation of show tables
                                                VisuGUI_TableDlg::ttAuto,
@@ -1088,24 +1098,29 @@ OnShowTable()
   dlg->show();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnCreateTable()
+VisuGUI
+::OnCreateTable()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
-  _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
-  VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
-  if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+
+  if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
     GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
     UpdateObjBrowser(this);
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnDeleteObjects()
+VisuGUI
+::OnDeleteObjects()
 {
   SalomeApp_Study* anAppStudy = GetAppStudy(this);
   _PTR(Study) aCStudy = GetCStudy(anAppStudy);
@@ -1133,45 +1148,35 @@ OnDeleteObjects()
   aStudyBuilder->NewCommand();
 
   for (i = 0; i < nbSelected; i++) {
-    _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
-    if (aSObject) {
-      _PTR(SObject) aRefObj;
-      if (aSObject->ReferencedObject(aRefObj)) {
-        // It can be a reference on curve, published under a container.
-        // In this case the curve should be removed from the container.
-        // See bug 10441.
-        CORBA::Object_var aCorbaObj = VISU::GetSelectedObj(anAppStudy, aRefObj->GetID().c_str());
-        if (!CORBA::is_nil(aCorbaObj)) {
-          VISU::Base_var aVisuObj = VISU::Base::_narrow(aCorbaObj);
-          if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TMESH)
-         {
-           DeleteSObject(this, aCStudy, aRefObj);
-           UpdateObjBrowser(this, true, aRefObj);
+    VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), entries[i]);
+    if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+      _PTR(SObject) aRefSObject;
+      if (aSObject->ReferencedObject(aRefSObject)) {
+       // It can be a reference on curve, published under a container.
+       // In this case the curve should be removed from the container.
+       // See bug 10441.
+       VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
+       VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
+       if(aRefBase && aRefBase->GetType() == VISU::TMESH){
+         DeleteSObject(this, aCStudy, aRefSObject);
+         UpdateObjBrowser(this, true, aRefSObject);
+       }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
+         CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
+         VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
+         _PTR(SObject) aParentSO = aSObject->GetFather();
+         VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
+         if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
+           if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
+             if(aContainer->GetNbCurves() > 0){
+               aContainer->RemoveCurve(aCurve);
+               UpdateObjBrowser(this, true, aParentSO);
+             }
+           }
          }
-          else if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
-            VISU::Curve_ptr aCurve = VISU::Curve::_narrow(aVisuObj);
-            _PTR(SObject) aParentSO = aSObject->GetFather();
-            aCorbaObj = VISU::GetSelectedObj(anAppStudy, aParentSO->GetID().c_str());
-            if (!CORBA::is_nil(aCorbaObj) && !CORBA::is_nil(aCurve)) {
-              aVisuObj = VISU::Base::_narrow(aCorbaObj);
-              if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
-                // Container object
-                CORBA::Object_ptr aCnt = VISU::Container::_narrow(aVisuObj);
-                if (!CORBA::is_nil(aCnt)) {
-                  VISU::Container_i* aContainer =
-                    dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-                  if (aContainer && aContainer->GetNbCurves() > 0) {
-                    aContainer->RemoveCurve(aCurve);
-                    UpdateObjBrowser(this, true, aParentSO);
-                  }
-                }
-              }
-            }
-          }
-        }
-      } else {
-        DeleteSObject(this, aCStudy, aSObject);
-        UpdateObjBrowser(this, true, aSObject);
+       }
+      }else{
+       DeleteSObject(this, aCStudy, aSObject);
+       UpdateObjBrowser(this, true, aSObject);
       }
     }
   }
@@ -1181,242 +1186,231 @@ OnDeleteObjects()
   mgr->clearSelected();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnPlotData()
+VisuGUI
+::OnPlotData()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(SObject) SO;
-  _PTR(GenericAttribute) anAttr;
-  _PTR(AttributeName)    aName;
-  QString SOName;
-  _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
-
-  if ( !CORBA::is_nil( anObject ) ) {
-    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-    if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
-      // Table (VISU object) is selected
-      CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
-      if( !CORBA::is_nil( aTbl ) ) {
-        VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
-        if ( table ) {
-          _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
-          if ( IsSObjectTable(SO) ) {
-            // get name of SObject
-            if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
-              aName = anAttr;
-              SOName = QString( aName->Value().c_str() );
-            }
-            VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
-            if ( dlg->exec() == QDialog::Accepted ) {
-              if ( !IsStudyLocked( aStudy ) ) {
-                // if study is not locked - create new container, create curves and insert them
-                // into container, then plot container if current viewer is of VIEW_PLOT2D type
-                int horIndex;
-                QValueList<int> verIndices, zIndices;
-                dlg->getCurvesSource( horIndex, verIndices, zIndices );
-                if ( horIndex >= 0 && verIndices.count() > 0 ) {
-                  CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
-                  if( !CORBA::is_nil( aContainer ) ) {
-                    VISU::Container_i* pContainer =
-                      dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-                    if ( pContainer ) {
-                      for ( int i = 0; i < verIndices.count(); i++ ) {
-                        CORBA::Object_var aNewCurve =
-                          GetVisuGen(this)->CreateCurveWithZ( table->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
-                        if( !CORBA::is_nil( aNewCurve ) ) {
-                          VISU::Curve_i* pCrv =
-                            dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
-                          if ( pCrv ) {
-                            bool isAuto;
-                            int  marker, line, lineWidth;
-                            QColor color;
-                            if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
-                                                         line, lineWidth, color) && !isAuto ) {
-                              SALOMEDS::Color c;
-                              c.R = color.red()  /255.;
-                              c.G = color.green()/255.;
-                              c.B = color.blue() /255.;
-                              pCrv->SetColor( c );
-                              pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
-                              pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
-                            }
-                            pContainer->AddCurve( pCrv->_this() );
-                          }
-                        }
-                      }
-                      UpdateObjBrowser(this);
-                      PlotContainer( this, pContainer, VISU::eDisplay );
-                    }
-                  }
-                }
-              }
-              else {
-                // if study is locked just get curves info and plot them
-                // if current viewer is of VIEW_PLOT2D type
-                QPtrList<Plot2d_Curve> container;
-                dlg->getCurves( container );
-                if ( !container.isEmpty() ) {
-                  GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
-                  GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
-                }
-              }
-            }
-            delete dlg;
-          }
-        }
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+    if(aBase->GetType() == VISU::TTABLE) {
+      if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
+       _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+       _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
+       if(IsSObjectTable(aSObject)){
+         VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+         if(aDlg->exec() == QDialog::Accepted){
+           if(!IsStudyLocked(aStudy)){
+             // if study is not locked - create new container, create curves and insert them
+             // into container, then plot container if current viewer is of VIEW_PLOT2D type
+             int horIndex;
+             QValueList<int> verIndices, zIndices;
+             aDlg->getCurvesSource( horIndex, verIndices, zIndices );
+             if( horIndex >= 0 && verIndices.count() > 0 ){
+               CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
+               if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
+                 for( int i = 0; i < verIndices.count(); i++ ){
+                   VISU::Curve_var aCurveObject =
+                     GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+                   if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+                     bool isAuto;
+                     int  marker, line, lineWidth;
+                     QColor color;
+                     if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+                                                   line, lineWidth, color) && !isAuto ) 
+                     {
+                       SALOMEDS::Color c;
+                       c.R = color.red()  /255.;
+                       c.G = color.green()/255.;
+                       c.B = color.blue() /255.;
+                       aCurve->SetColor( c );
+                       aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+                       aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+                     }
+                     aContainer->AddCurve(aCurveObject);
+                   }
+                 }
+                 UpdateObjBrowser(this);
+                 PlotContainer( this, aContainer, VISU::eDisplay );
+               }
+             }
+           } else {
+             // get name of SObject
+             QString aSObjectName;
+             _PTR(GenericAttribute) anAttr;
+             if(aSObject->FindAttribute( anAttr, "AttributeName" )){
+               _PTR(AttributeName) aName = anAttr;
+               aSObjectName = QString( aName->Value().c_str() );
+             }
+             // if study is locked just get curves info and plot them
+             // if current viewer is of VIEW_PLOT2D type
+             QPtrList<Plot2d_Curve> container;
+             aDlg->getCurves( container );
+             if ( !container.isEmpty() ) {
+               GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+               GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
+             }
+           }
+         }
+         delete aDlg;
+       }
       }
     }
-  }
-  else if ( !anIO.IsNull() ) {
+  }else if(!aSelectionItem.myIO.IsNull()){
     // check if Table SObject is selected
-    SO = aStudy->FindObjectID( anIO->getEntry() );
-    if ( IsSObjectTable(SO) ) {
-      // get name of SObject
-      if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
-        aName = anAttr;
-        SOName = QString( aName->Value().c_str() );
-      }
-      VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
-      if ( dlg->exec() == QDialog::Accepted ) {
-        if ( !IsStudyLocked( aStudy ) ) {
+    _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+    if(IsSObjectTable(aSObject)){
+      VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+      if(aDlg->exec() == QDialog::Accepted){
+       _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+        if(!IsStudyLocked(aStudy)){
           // if study is not locked - create new table and container objects, create curves
           // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
           int horIndex;
           QValueList<int> verIndices, zIndices;
-          dlg->getCurvesSource( horIndex, verIndices, zIndices );
+          aDlg->getCurvesSource( horIndex, verIndices, zIndices );
           if ( horIndex >= 0 && verIndices.count() > 0 ) {
-            CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
-            CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
-            if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
-              VISU::Table_i*     pTable     = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
-              VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-
-              if ( pContainer && pTable ) {
-                for ( int i = 0; i < verIndices.count(); i++ ) {
-                  CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurveWithZ
-                    ( pTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
-                  if( !CORBA::is_nil( aNewCurve ) ) {
-                    VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
-                    if ( pCrv ) {
-                      bool isAuto;
-                      int  marker, line, lineWidth;
-                      QColor color;
-                      if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
-                                                   line, lineWidth, color) && !isAuto ) {
-                        SALOMEDS::Color c;
-                        c.R = color.red()/255.;
-                        c.G = color.green()/255.;
-                        c.B = color.blue()/255.;
-                        pCrv->SetColor( c );
-                        pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
-                        pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
-                      }
-                      pContainer->AddCurve( pCrv->_this() );
-                    }
-                  }
-                }
-                UpdateObjBrowser(this);
-                PlotContainer( this, pContainer, VISU::eDisplay );
-              }
-            }
-          }
+            VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
+            if(!CORBA::is_nil(aTableObject)){
+             VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
+              VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
+             for ( int i = 0; i < verIndices.count(); i++ ) {
+               VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
+                 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+               if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+                 bool isAuto;
+                 int  marker, line, lineWidth;
+                 QColor color;
+                 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+                                               line, lineWidth, color) && !isAuto ) 
+                 {
+                   SALOMEDS::Color c;
+                   c.R = color.red()/255.;
+                   c.G = color.green()/255.;
+                   c.B = color.blue()/255.;
+                   aCurve->SetColor( c );
+                   aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+                   aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+                 }
+                 aContainerObject->AddCurve(aCurveObject);
+               }
+             }
+             UpdateObjBrowser(this);
+             PlotContainer( this, aContainer, VISU::eDisplay );
+           }
+         }
         } else {
+         // get name of SObject
+         QString aSObjectName;
+         _PTR(GenericAttribute) anAttr;
+         if(aSObject->FindAttribute(anAttr, "AttributeName")){
+           _PTR(AttributeName) aName = anAttr;
+           aSObjectName = QString( aName->Value().c_str() );
+         }
           // if study is locked just get curves info and plot them
           QPtrList<Plot2d_Curve> container;
-          dlg->getCurves( container );
+          aDlg->getCurves( container );
           if ( !container.isEmpty() ) {
             GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
-            GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
+            GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
           }
         }
       }
-      delete dlg;
+      delete aDlg;
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnCurveProperties()
+VisuGUI
+::OnCurveProperties()
 {
-  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
-  SALOME_ListIO aListIO;
-  aSelectionMgr->selectedObjects(aListIO);
-  if (aListIO.Extent() != 1) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.size() != 1)
+    return;
 
-  SalomeApp_Study* aAppStudy = GetAppStudy(this);
-  const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
-  CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
-  if (CORBA::is_nil( anObject )) return;
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase) 
+    return;
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-  if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
+  if(aBase->GetType() == VISU::TCURVE) {
     // Curve object
-    CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
-    if( !CORBA::is_nil( aCurve ) ) {
-      VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
-      if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
+    if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
+      if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
         Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
 
-        aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
-        aDlg.setMarker( (int)aDSCurve->GetMarker() );
-        SALOMEDS::Color aColor = aDSCurve->GetColor();
+        aDlg.setLine( (int)aCurve->GetLine(), aCurve->GetLineWidth() );
+        aDlg.setMarker( (int)aCurve->GetMarker() );
+        SALOMEDS::Color aColor = aCurve->GetColor();
         aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
         if( aDlg.exec() == QDialog::Accepted ) {
-          aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
-          aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
+          aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
+          aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
           SALOMEDS::Color newColor;
           newColor.R = aDlg.getColor().red()/255.;
           newColor.G = aDlg.getColor().green()/255.;
           newColor.B = aDlg.getColor().blue()/255.;
-          aDSCurve->SetColor( newColor );
-          PlotCurve(this, aDSCurve, VISU::eDisplay);
+          aCurve->SetColor( newColor );
+          PlotCurve(this, aCurve, VISU::eDisplay);
         }
       }
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnClearContainer()
+VisuGUI
+::OnClearContainer()
 {
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (anIO.IsNull() || CORBA::is_nil(anObject))
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
     return;
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-  if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+  if(aBase->GetType() == VISU::TCONTAINER){
     // Container object
-    CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
-    if (!CORBA::is_nil(aCnt)) {
-      VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-      if (container && container->GetNbCurves() > 0) {
-        container->Clear();
+    if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
+      if(aContainer && aContainer->GetNbCurves() > 0){
+        aContainer->Clear();
         UpdateObjBrowser(this);
       }
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnEditContainer()
+VisuGUI
+::OnEditContainer()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
+    return;
 
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-  VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
-  if (!aContainer) return;
+  VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
+  if(!aContainer) 
+    return;
 
   VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
   aDlg->initFromPrsObject(aContainer);
@@ -1427,9 +1421,10 @@ OnEditContainer()
   delete aDlg;
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnSaveViewParams()
+VisuGUI
+::OnSaveViewParams()
 {
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
@@ -1454,9 +1449,10 @@ OnSaveViewParams()
   UpdateObjBrowser(this);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnRestoreViewParams()
+VisuGUI
+::OnRestoreViewParams()
 {
   SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
   if (aViewMgr->getType() != SVTK_Viewer::Type())
@@ -1476,23 +1472,27 @@ OnRestoreViewParams()
     VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnRename()
+VisuGUI
+::OnRename()
 {
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
 
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-
-  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
-  if (!aSObj) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  if(!aSObject)
+    return;
 
   //TEST DU PARENT == VISU
   _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
-  _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
+  _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObject, "AttributeName");
   if (anAttr) {
     _PTR(AttributeName) aName (anAttr);
     QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
@@ -1500,104 +1500,76 @@ OnRename()
       QApplication::setOverrideCursor(Qt::waitCursor);
 
       // rename specific objects
-      if (!CORBA::is_nil(anObject)) {
-        VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-        if (!CORBA::is_nil(aVisuObj)) {
-          switch (aVisuObj->GetType()) {
-            case VISU::TCURVE: // Curve object
-            {
-              CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
-              if (!CORBA::is_nil(aCurve)) {
-                VISU::Curve_i* curve =
-                  dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
-                if (curve)
-                  curve->SetName(Name.latin1());
-              }
-              break;
-            }
-            case VISU::TTABLE: // Table object
-            {
-              CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
-              if (!CORBA::is_nil(aTable)) {
-                VISU::Table_i* table =
-                  dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
-                if (table)
-                  table->SetName(Name.latin1());
-              }
-              break;
-            }
-            case VISU::TCONTAINER: // Container object
-            {
-              CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
-              if (!CORBA::is_nil(aContainer)) {
-                VISU::Container_i* container =
-                  dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-                if (container)
-                  container->SetName(Name.latin1());
-              }
-              break;
-            }
-            default:
-            {
-            }
-          }
-        }
+      if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+       switch(aBase->GetType()){
+       case VISU::TCURVE: { // Curve object
+         if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
+           aCurve->SetName(Name.latin1(), true);
+         break;
+       }
+       case VISU::TTABLE: { // Table object
+         if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+           aTable->SetName(Name.latin1(), true);
+         break;
+       }
+       case VISU::TCONTAINER: { // Container object
+         if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
+           aContainer->SetName(Name.latin1(), true);
+         break;
+       }
+       default: {
+       }}
       }
+    }
 
+    if (!Name.isEmpty()) {
       // rename the study object
+      Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
       aName->SetValue(Name.latin1()); // rename the SObject
       anIO->setName(Name.latin1()); // rename the InteractiveObject
       
-      ViewManagerList pvm_list;
-      getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
-      for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
-      {
-       Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
-       if( pvm )
-       {
-         SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
-         if( pv )
-           pv->renameAll( anIO, Name.latin1() );
+      ViewManagerList aViewManagerList;
+      getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+      SUIT_ViewManager* aViewManager = aViewManagerList.first();
+      for(; aViewManager; aViewManager = aViewManagerList.next()){
+       if(Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)){
+         if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+           aViewer->renameAll( anIO, Name.latin1() );
        }
       }
 
       UpdateObjBrowser(this, false);
-
-      QApplication::restoreOverrideCursor();
     }
+
+    QApplication::restoreOverrideCursor();
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnClippingPlanes()
+VisuGUI
+::OnClippingPlanes()
 {
   new VisuGUI_ClippingDlg (this, "", false);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnSweep()
+VisuGUI
+::OnSweep()
 {
-  // GetSelectedPrs3d
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-
-  VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
-  if (!aPrsObject) return;
-
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (!vw) return;
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+    return;
 
-  VISU_Actor* aActor = GetActor(aPrsObject, vw);
-  if (!aActor) return;
+  VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
+  if(!aScalarMap)
+    return;
 
-  if (!aActor->GetVisibility()) {
-    aActor->VisibilityOn();
-  }
+  if(!anActor->GetVisibility())
+    anActor->VisibilityOn();
 
   // Get sweep parameters
   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
@@ -1614,9 +1586,9 @@ OnSweep()
     for (int i = 0; i <= aSteps; i++) {
       try {
         float aPercents = float(i)/aSteps;
-        aPrsObject->SetMapScale(aPercents);
-        aPrsObject->UpdateActor(aActor);
-        vw->getRenderWindow()->Render();
+        aScalarMap->SetMapScale(aPercents);
+        aScalarMap->UpdateActor(anActor);
+        aViewWindow->getRenderWindow()->Render();
         usleep(aTemp);
       } catch (std::exception& exc) {
         INFOS("Follow exception was occured :\n" << exc.what());
@@ -1628,9 +1600,10 @@ OnSweep()
   QApplication::restoreOverrideCursor();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnTimeAnimation()
+VisuGUI
+::OnTimeAnimation()
 {
   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
     return;
@@ -1666,10 +1639,10 @@ OnTimeAnimation()
   else delete aAnimationDlg;
 }
 
-//************************************************************************
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnShowAnimation()
+VisuGUI
+::OnShowAnimation()
 {
   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
     return;
@@ -1706,103 +1679,67 @@ OnShowAnimation()
   aAnimationDlg->show();
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnCopyPresentation()
+VisuGUI
+::OnCopyPresentation()
 {
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
 
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
+    return;
 
-  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrsObject) return;
+  VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
+  if(!aPrs3d)
+    return;
 
-  switch (aPrsObject->GetType()) {
-  case VISU::TMESH:
-    {
-      VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
-      VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
-      aSameMesh->SameAs(aMeshPrs);
-    }
-    break;
-  case VISU::TSCALARMAP:
-    {
-      VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
-      VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
-      aSameScalar->SameAs(aScalarPrs);
-    }
-    break;
-  case VISU::TDEFORMEDSHAPE:
-    {
-      VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
-      VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
-      aSameDeformed->SameAs(aDefPrs);
-    }
-    break;
-  case VISU::TSCALARMAPONDEFORMEDSHAPE:
-    {
-      VISU::ScalarMapOnDeformedShape_i* aDefPrs =
-        dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
-      VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed =
-        new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
-      aSameScalarMapOnDeformed->SameAs(aDefPrs);
-    }
-    break;
-  case VISU::TCUTPLANES:
-    {
-      VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-      VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
-      aSameCut->SameAs(aCutPrs);
+  if(aBase->GetType() != VISU::TMESH){
+    VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
+    switch (aBase->GetType()) {
+    case VISU::TSCALARMAP:
+      TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TDEFORMEDSHAPE:
+      TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TSCALARMAPONDEFORMEDSHAPE:
+      TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TCUTPLANES:
+      TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TCUTLINES:
+      TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TISOSURFACE:
+      TSameAsFactory<VISU::TISOSURFACE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TSTREAMLINES:
+      TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TVECTORS:
+      TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TPLOT3D:
+      TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
     }
-    break;
-  case VISU::TCUTLINES:
-    {
-      VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
-      VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
-      aSameCut->SameAs(aCutPrs);
-    }
-    break;
-  case VISU::TISOSURFACE:
-    {
-      VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
-      VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
-      aSameIso->SameAs(aIsoPrs);
-    }
-    break;
-  case VISU::TSTREAMLINES:
-    {
-      VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
-      VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
-      aSameLines->SameAs(aLinesPrs);
-    }
-    break;
-  case VISU::TVECTORS:
-    {
-      VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
-      VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
-      aSameVectors->SameAs(aVectorsPrs);
-    }
-    break;
-  case VISU::TPLOT3D:
-    {
-      VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
-      VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
-      aSamePlot3D->SameAs(aPlot3DPrs);
-    }
-    break;
+    UpdateObjBrowser(this);
   }
-  UpdateObjBrowser(this);
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnSelectionInfo()
+VisuGUI
+::OnSelectionInfo()
 {
   if (GetActiveViewWindow<SVTK_ViewWindow>(this))
     (new VisuGUI_SelectionDlg(this))->show();
@@ -1813,9 +1750,10 @@ OnSelectionInfo()
                            tr("BUT_OK") );
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnMergeScalarBars()
+VisuGUI
+::OnMergeScalarBars()
 {
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
@@ -1874,9 +1812,10 @@ OnMergeScalarBars()
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnFreeScalarBars()
+VisuGUI
+::OnFreeScalarBars()
 {
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
@@ -1911,33 +1850,27 @@ OnFreeScalarBars()
   }
 }
 
+//----------------------------------------------------------------------------
 void
-VisuGUI::
-OnTranslatePrs()
+VisuGUI
+::OnTranslatePrs()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
   VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
 
-  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
-
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
 
-  SALOME_ListIteratorOfListIO It (aListIO);
-  for (; It.More(); It.Next()) {
-    Handle(SALOME_InteractiveObject)& anIO = It.Value();
+  SalomeApp_Study* aStudy = GetAppStudy(this);
+  SALOME_ListIteratorOfListIO anIter(aListIO);
+  for (; anIter.More(); anIter.Next()) {
+    Handle(SALOME_InteractiveObject) anIO = anIter.Value();
     if (anIO->hasEntry()) {
-      _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
-      if (aSObject) {
-        CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
-        if (!CORBA::is_nil(aCORBAObject)) {
-          PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
-          if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
-            aDlg->addPresentation(aPrsObject);
-          }
-        }
-      }
+      QString anEntry(anIO->getEntry());
+      VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry);
+      if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
+       aDlg->addPresentation(aPrsObject);
     }
   }
   if (aDlg->getPrsCount() > 0)
@@ -1947,12 +1880,11 @@ OnTranslatePrs()
 }
 
 void
-VisuGUI::
-OnArrangeActors()
+VisuGUI
+::OnArrangeActors()
 {
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (vw) {
-    ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
+  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+    ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
     aDlg->exec();
     delete aDlg;
   }
@@ -1960,8 +1892,8 @@ OnArrangeActors()
 
 
 void
-VisuGUI::
-initialize( CAM_Application* theApp )
+VisuGUI
+::initialize( CAM_Application* theApp )
 {
   SalomeApp_Module::initialize( theApp );
 
@@ -1972,8 +1904,8 @@ initialize( CAM_Application* theApp )
 }
 
 void
-VisuGUI::
-createActions()
+VisuGUI
+::createActions()
 {
   QPixmap aPixmap;
   QWidget* aParent = application()->desktop();
@@ -2283,11 +2215,36 @@ createActions()
   createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIconSet(aPixmap),
                 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
                 this, SLOT(OnPlot3dFromCutPlane()));
+
+  createAction( VISU_CACHE_PROPERTIES, tr("MEN_CACHE_PROPERTIES"), QIconSet(),
+                tr("MEN_CACHE_PROPERTIES"), "", 0, aParent, false,
+                this, SLOT(OnCacheProperties()));
+
+       // MULTIPR
+       aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
+       createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIconSet(aPixmap),
+                tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
+                this, SLOT(OnMultiprViewFullRes()));
+       
+       aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
+       createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIconSet(aPixmap),
+                tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
+                this, SLOT(OnMultiprViewMediumRes()));
+       
+       aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
+       createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIconSet(aPixmap),
+                tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
+                this, SLOT(OnMultiprViewLowRes()));
+       
+       aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
+       createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIconSet(aPixmap),
+                tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
+                this, SLOT(OnMultiprViewHide()));
 }
 
 void
-VisuGUI::
-createMenus()
+VisuGUI
+::createMenus()
 {
   // Add actions to menus
   int aMenuId;
@@ -2324,8 +2281,8 @@ createMenus()
 }
 
 void
-VisuGUI::
-createToolBars()
+VisuGUI
+::createToolBars()
 {
   int aToolId = createTool( tr("TOOL_IMPORT") );
   createTool( VISU_IMPORT_FROM_FILE, aToolId );
@@ -2351,8 +2308,8 @@ createToolBars()
 }
 
 void
-VisuGUI::
-createPopupMenus()
+VisuGUI
+::createPopupMenus()
 {
   // Prepare popup menus
   QtxPopupMgr* mgr = popupMgr();
@@ -2459,10 +2416,18 @@ createPopupMenus()
 
   mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
 
+  // MULTIPR
+  mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
+  mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
+  mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
+  mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
+  
+  
   // Rules
 
   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
-                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
+                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+                  "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TCOLOREDPRS3DHOLDER'");
 
   // VISU root commands
   QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
@@ -2471,7 +2436,7 @@ createPopupMenus()
   mgr->setRule( action( VISU_PLOT2D ), aRule, true );
 
   // timestamp commands
-  aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
+  aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
   mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
   mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
   mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
@@ -2520,7 +2485,7 @@ createPopupMenus()
   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
   //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
 
-  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
+  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0", true );
 
   // 3D presentations commands
   QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
@@ -2624,6 +2589,13 @@ createPopupMenus()
 
   //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
   //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
+  
+  // MULTIPR
+  aRule = "client='ObjectBrowser' and $type in {'VISU::TPART'}";
+  mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aRule + " and selcount>=1", true );
+  mgr->setRule( action( VISU_MULTIPR_MED_RES ), aRule + " and selcount>=1", true );
+  mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aRule + " and selcount>=1", true );
+  mgr->setRule( action( VISU_MULTIPR_HIDE), aRule + " and selcount>=1", true );
 }
 
 //***************************************************************************
@@ -2637,6 +2609,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
+  mySelectedObjects = aListIO;
 
   if (aListIO.Extent() < 1) return;
 
@@ -2706,17 +2679,14 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
        if (isExist && aType == VISU::TCURVE) {
           isCurves = true;
         }  else {
-         CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-         if (!CORBA::is_nil(anObject)) {
-          VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-          if (aPrsObject) {
-            if (aPrsObject->GetType() == VISU::TCUTPLANES) {
-              VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-              if (aCutPrs) {
-                isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
-              }
-            }
-          }
+         VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+         if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+           if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+             VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+             if (aCutPrs) {
+               isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
+             }
+           }
          }
        }
       }
@@ -2726,6 +2696,21 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   if (isOneCutPlane)
     action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu);
 
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(aSObject);
+  CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+
+  if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+    if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
+      action( VISU_CACHE_PROPERTIES )->addTo(theMenu);
+  }
+
   theMenu->insertSeparator();
 
   // Check if some (nb > 0) removable objects selected
@@ -2740,15 +2725,9 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   }
 
   // Check single selection
-  if (aListIO.Extent() != 1) return;
-
-  Handle(SALOME_InteractiveObject) anIO;
-  VISU::Storable::TRestoringMap aMap;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
-
-  _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
-  if ( !SO )
+  if (aListIO.Extent() != 1) 
     return;
+
   bool isExist;
   VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
 
@@ -2756,7 +2735,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
     action( VISU_SHOW_ANIMATION )->addTo(theMenu);
 
   } else if (isOBClient) {
-    if (IsSObjectTable(SO)) {
+    if (IsSObjectTable(aSObject)) {
       action( VISU_SHOW_TABLE )->addTo(theMenu);
       action( VISU_CREATE_CURVES )->addTo(theMenu);
       action( VISU_EXPORT_TABLE )->addTo(theMenu);
@@ -2773,7 +2752,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
           action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
         }
       } else {
-        _PTR(SObject) aSFather = SO->GetFather();
+        _PTR(SObject) aSFather = aSObject->GetFather();
         if (aSFather) {
           _PTR(GenericAttribute) anAttr;
           aSFather->FindAttribute(anAttr, "AttributeName");
@@ -2793,8 +2772,8 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
 
 //***************************************************************************
 void
-VisuGUI::
-windows( QMap<int, int>& theMap ) const
+VisuGUI
+::windows( QMap<int, int>& theMap ) const
 {
   theMap.clear();
   theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
@@ -2803,8 +2782,8 @@ windows( QMap<int, int>& theMap ) const
 
 
 void
-VisuGUI::
-viewManagers( QStringList& theList ) const
+VisuGUI
+::viewManagers( QStringList& theList ) const
 {
   theList.clear();
   // append SVTK viewer only if there is no opened VVTK
@@ -2817,8 +2796,8 @@ viewManagers( QStringList& theList ) const
 
 
 QString
-VisuGUI::
-engineIOR() const
+VisuGUI
+::engineIOR() const
 {
   CORBA::String_var anIOR = GetVisuGen(this)->GetID();
   return QString(anIOR.in());
@@ -2826,8 +2805,8 @@ engineIOR() const
 
 
 bool
-VisuGUI::
-activateModule( SUIT_Study* theStudy )
+VisuGUI
+::activateModule( SUIT_Study* theStudy )
 {
   SalomeApp_Module::activateModule( theStudy );
   studyActivated();
@@ -2842,8 +2821,8 @@ activateModule( SUIT_Study* theStudy )
 
 
 bool
-VisuGUI::
-deactivateModule( SUIT_Study* theStudy )
+VisuGUI
+::deactivateModule( SUIT_Study* theStudy )
 {
   setMenuShown( false );
   setToolShown( false );
@@ -2856,8 +2835,8 @@ deactivateModule( SUIT_Study* theStudy )
 }
 
 LightApp_Selection*
-VisuGUI::
-createSelection() const
+VisuGUI
+::createSelection() const
 {
   return new VisuGUI_Selection( (SalomeApp_Module*)this );
 }
@@ -3136,6 +3115,33 @@ void VisuGUI::createPreferences()
   
   addPreference( tr( "VISU_USE_SHADING" ), representGr,
                  LightApp_Preferences::Bool, "VISU", "represent_shading" );
+
+
+  // TAB: 3D Cache ; group: "Cache properties"
+  int cacheTab = addPreference( tr( "3D Cache" ) );
+  
+  int cacheGr = addPreference( tr( "VISU_3DCACHE_PROPS" ), cacheTab );
+  setPreferenceProperty( cacheGr, "columns", 1 );
+
+  modes.clear();
+  modes.append( tr( "VISU_MINIMAL" ) );
+  modes.append( tr( "VISU_LIMITED" ) );
+  indices.clear();
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( mode, "strings", modes );
+  setPreferenceProperty( mode, "indexes", indices );
+  
+  int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGr,
+                                  LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
+  setPreferenceProperty( memory_mode, "strings", modes );
+  setPreferenceProperty( memory_mode, "indexes", indices );
+
+  int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGr,
+                                   LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
+  setPreferenceProperty( memory_limit, "min", 1 );
+  setPreferenceProperty( memory_limit, "max", 5000 );
+  setPreferenceProperty( memory_limit, "step", 10 );
 }
 
 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
@@ -3213,6 +3219,14 @@ VisuGUI
 {
   return myScalarBarsMap;
 }
+
+void
+VisuGUI
+::selectedObjects( SALOME_ListIO& theList ) const
+{
+  theList = mySelectedObjects;
+}
+
 LightApp_Displayer* VisuGUI::displayer()
 {
   if( !myDisplayer )
@@ -3246,14 +3260,13 @@ void VisuGUI::OnPlot3dFromCutPlane()
      aSObject = aCStudy->FindObjectID(anIO->getEntry());
      if ( !aSObject )
        continue;
-     CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-     if (!CORBA::is_nil(anObject)) {
-       VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-       if (aPrsObject->GetType() == VISU::TCUTPLANES) {
-         aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-         if (aCutPrs) 
-           break;
-       }
+     VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+     if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+       if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+        aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+        if (aCutPrs) 
+          break;
+       }
      }
    }
  }
@@ -3286,8 +3299,14 @@ void VisuGUI::OnPlot3dFromCutPlane()
      }
      GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
      
-     VISU::Plot3D_i* aPrs3d = CreatePrs3d<VISU::Plot3D_i>(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(),
-                                                          aFieldName.latin1(), aTimeStampId.toInt());
+     VISU::Plot3D_i* aPrs3d = 
+       CreatePrs3dFromFactory<VISU::Plot3D_i>(this, 
+                                             aTimeStampSObj, 
+                                             aMeshName.latin1(), 
+                                             (Entity)anEntity.toInt(),
+                                             aFieldName.latin1(), 
+                                             aTimeStampId.toInt(),
+                                             ColoredPrs3d_i::EPublishUnderTimeStamp);
      if (aPrs3d) {
        SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
        int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
@@ -3301,7 +3320,7 @@ void VisuGUI::OnPlot3dFromCutPlane()
          aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
            
          if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
-           DeletePrs3d(this, aPrs3d, anIO);
+           DeletePrs3d(this, aPrs3d);
            delete aDlg;
            return;
          }
@@ -3320,3 +3339,121 @@ void VisuGUI::OnPlot3dFromCutPlane()
    application()->putInfo(QObject::tr("INF_DONE"));
  }
 }
+
+void VisuGUI::OnCacheProperties()
+{
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+
+  CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+  if( CORBA::is_nil( anObject ) )
+    return;
+
+  VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface<VISU::ColoredPrs3dCache>(anObject);
+  if( CORBA::is_nil( aCache ) )
+    return;
+
+  VisuGUI_CacheDlg* aDlg = new VisuGUI_CacheDlg( aCache, this );
+  aDlg->exec();
+}
+
+
+// MULTIPR
+void VisuGUI::OnMultiprViewFullRes()
+{
+       OnMultiprChangeRes('F');
+}
+
+
+// MULTIPR
+void VisuGUI::OnMultiprViewMediumRes()
+{
+       OnMultiprChangeRes('M');
+}
+
+
+// MULTIPR
+void VisuGUI::OnMultiprViewLowRes()
+{
+       OnMultiprChangeRes('L');
+}
+
+
+// MULTIPR
+void VisuGUI::OnMultiprViewHide()
+{
+       OnMultiprChangeRes('H');
+}
+
+
+// MULTIPR
+void VisuGUI::OnMultiprChangeRes(char resolution)
+{
+       _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+       if (CheckLock(aCStudy,GetDesktop(this)))
+               return;
+       
+       VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+       if(aSelectionInfo.empty())
+               return;
+       
+       //cout << "selection: #=" << aSelectionInfo.size() << endl;
+       
+       for (int i=0; i<aSelectionInfo.size(); i++)
+       {
+               VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
+               
+               _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+               if (!aSObject)
+                       continue;
+               
+               VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
+               VISU::Result_i* result = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
+               
+               _PTR(GenericAttribute) anAttr;
+               if (aSObject->FindAttribute(anAttr, "AttributePixMap"))
+               {
+                       _PTR(AttributePixMap) aPixMap(anAttr);
+                       if ( aPixMap->HasPixMap() )
+                       {
+                               const char* oldIcon = aPixMap->GetPixMap().c_str();
+                               if ( (strcmp(oldIcon, "ICON_MULTIPR_VIEW_FULL")   == 0) ||
+                                        (strcmp(oldIcon, "ICON_MULTIPR_VIEW_MEDIUM") == 0) ||
+                                        (strcmp(oldIcon, "ICON_MULTIPR_VIEW_LOW")    == 0) ||
+                                        (strcmp(oldIcon, "ICON_MULTIPR_VIEW_HIDE")   == 0) )
+                               {
+                                       bool hasMediumOrLow = (strstr(aSObject->GetComment().c_str(), "res=FML") != NULL);
+                                       
+                                       if (resolution == 'F') 
+                                       {
+                                               if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'F');
+                                               aPixMap->SetPixMap("ICON_MULTIPR_VIEW_FULL");
+                                       } 
+                                       else if ((resolution == 'M') && hasMediumOrLow) 
+                                       {
+                                               if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'M');
+                                               aPixMap->SetPixMap("ICON_MULTIPR_VIEW_MEDIUM");
+                                       } 
+                                       else if ((resolution == 'L') && hasMediumOrLow) 
+                                       {
+                                               if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'L');
+                                               aPixMap->SetPixMap("ICON_MULTIPR_VIEW_LOW"); 
+                                       }
+                                       else if (resolution == 'H') 
+                                       {
+                                               if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'H');
+                                               aPixMap->SetPixMap("ICON_MULTIPR_VIEW_HIDE");
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       UpdateObjBrowser(this, false);
+}
+
+
index 93c912eb5d5661b00c5f4143ca5ba7b80b910a36..3648129c6b7fe9bf9a81179acd9ab4530ee62091 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "SalomeApp_Module.h"
 
+#include "SALOME_ListIO.hxx"
+
 #include <map>
 #include <set>
 
@@ -74,6 +76,8 @@ public:
 
   VISU::TViewToPrs3d getScalarBarsMap();
   VISU::TViewToPrs3d myScalarBarsMap;
+
+  void selectedObjects( SALOME_ListIO& theList ) const;
   
 public slots:
   virtual bool deactivateModule( SUIT_Study* );
@@ -156,6 +160,15 @@ protected slots:
   void OnArrangeActors();
   void OnPlot3dFromCutPlane();
 
+  void OnCacheProperties();
+  
+  // MULTIPR
+  void OnMultiprViewFullRes();
+  void OnMultiprViewMediumRes();
+  void OnMultiprViewLowRes();
+  void OnMultiprViewHide();
+  void OnMultiprChangeRes(char resolution);
+
 protected:
   virtual LightApp_Selection* createSelection() const;
 
@@ -167,6 +180,7 @@ private:
 
 private:
   LightApp_Displayer*  myDisplayer;
+  SALOME_ListIO        mySelectedObjects;
 };
 
 #endif
index 0eaa8676cf8ef30994cac14f492ebf8a4cd6e5a6..d8372c8151267eee098607581d8ad10bec9460d0 100644 (file)
 
 #define VISU_PLOT3D_FROM_CUTPLANE   4085
 
+#define VISU_CACHE_PROPERTIES       4090
+
+// MULTIPR
+#define VISU_MULTIPR_FULL_RES       4095
+#define VISU_MULTIPR_MED_RES        4096
+#define VISU_MULTIPR_LOW_RES        4097
+#define VISU_MULTIPR_HIDE           4098
+
 #endif
index 87195d3193366917fb153598090a4f82d9b36d89..2637de410716b325b9366fb99ca23ac0075e9300 100644 (file)
@@ -518,9 +518,9 @@ void VisuGUI_ClippingDlg::ClickOnApply()
 
     // Check contents of the resulting (clipped) presentation data
     if (!isFailed) {
-      VISU_PipeLine* aPL = myPrs3d->GetPL();
-      VISU_PipeLine::TMapper* aM = aPL->GetMapper();
-      vtkDataSet* aPrsData = aM->GetInput();
+      VISU_PipeLine* aPL = myPrs3d->GetPipeLine();
+      vtkMapper* aMapper = aPL->GetMapper();
+      vtkDataSet* aPrsData = aMapper->GetInput();
       aPrsData->Update();
       if (aPrsData->GetNumberOfCells() < 1) {
         isFailed = true;
@@ -596,18 +596,22 @@ void VisuGUI_ClippingDlg::ClickOnHelp()
 //=================================================================================
 void VisuGUI_ClippingDlg::onSelectionChanged()
 {
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
-    if (CORBA::is_nil(anObject)) return;
-    
+  if(SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)){
+
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myVisuGUI);
+    if(aSelectionInfo.empty())
+      return;
+
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+    if(!aBase) 
+      return;
+  
+    Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
     if (!anIO.IsNull()) 
       myIO = anIO;
     
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in()) return;
-
-    myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+    myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBase);
     if (myPrs3d) {
       std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
       myPlanes.clear();
@@ -950,7 +954,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
   if (myPlanes.empty() || myIsSelectPlane || !WidgetIJKTab->isEnabled())
     return;
 
-  VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+  VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0;
   if (!result)
     return;
 
@@ -958,8 +962,9 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
   int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->selected());
   VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axId;
   gp_Dir dir;
+  CORBA::String_var aMeshName = myPrs3d->GetMeshName();
   const vector<vtkFloatingPointType> * values =
-    result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir);
+    result->GetAxisInfo(aMeshName.in(), axis, dir);
   if (!values)
     return;
 
@@ -1019,7 +1024,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
 //=================================================================================
 void VisuGUI_ClippingDlg::setIJKByNonStructured()
 {
-  if (!myPrs3d || myPlanes.empty() || !myPrs3d->GetResult())
+  if (!myPrs3d || myPlanes.empty() || !myPrs3d->GetCResult())
     return;
 
   // get plane normal
@@ -1035,10 +1040,11 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured()
   gp_Dir dir, gridDir;
   double maxDot = 0;
   const vector<vtkFloatingPointType> *curValues, *values = 0;
-  VISU::Result_i* result = myPrs3d->GetResult();
+  VISU::Result_i* result = myPrs3d->GetCResult();
   for (i = 0; i < 3; ++i) {
     VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i;
-    curValues = result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir);
+    CORBA::String_var aMeshName = myPrs3d->GetMeshName();
+    curValues = result->GetAxisInfo(aMeshName.in(), axis, dir);
     if (curValues) {
       double dot = normal * dir;
       if (Abs(dot) > Abs(maxDot)) {
@@ -1087,10 +1093,11 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured()
 //=================================================================================
 bool VisuGUI_ClippingDlg::isStructured() const
 {
-  VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+  VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0;
   if (result) {
     gp_Dir dir;
-    return result->GetAxisInfo(myPrs3d->GetMeshName(),
+    CORBA::String_var aMeshName = myPrs3d->GetMeshName();
+    return result->GetAxisInfo(aMeshName.in(),
                                VISU::Result_i::AXIS_X,
                                dir);
   }
@@ -1105,11 +1112,12 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId)
 {
   // set index range
   int maxIndex = 0;
-  VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0;
+  VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0;
   if (result) {
     VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axisId;
     gp_Dir dir;
-    const vector<vtkFloatingPointType> * indices = result->GetAxisInfo(myPrs3d->GetMeshName(),
+    CORBA::String_var aMeshName = myPrs3d->GetMeshName();
+    const vector<vtkFloatingPointType> * indices = result->GetAxisInfo(aMeshName.in(),
                                                                       axis, dir);
     if (indices)
       maxIndex = indices->size() - 1;
index d189683ffedef1ed5f16db779633026331f91bb8..38794bdc7ae05232e0e4ca1a5563722261cdba30 100644 (file)
 
 #include "VisuGUI_CutLinesDlg.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
+
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
 
 #include "VISU_Gen_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
 
 #include "VISU_PipeLine.hxx"
 #include "VISU_PipeLineUtils.hxx"
@@ -50,6 +54,7 @@
 #include <qhbox.h>
 #include <qtabwidget.h>
 #include <qhgroupbox.h>
+#include <qlineedit.h>
 
 #include <vtkRenderer.h>
 #include <vtkPolyData.h>
@@ -66,9 +71,8 @@ bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
 
 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
-     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-       myPreviewActor(0),myPreviewActorGlyphs(0)
+  : VisuGUI_Prs3dDlg(theModule),
+    myPreviewActor(0),myPreviewActorGlyphs(0)
 {
   setCaption("Cut Lines Definition");
   setSizeGripEnabled(true);
@@ -79,7 +83,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
   hasInit = false;
 
   // Tab pane
-  QTabWidget* aTabPane = new QTabWidget(this);
+  myTabBox = new QTabWidget(this);
 
   // Plane of lines
   QFrame* aPlanePane = new QFrame(this);
@@ -153,7 +157,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
   aPlaneLayout->addStretch();
 
 
-  aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
+  myTabBox->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
 
   // Number of lines
   QFrame* aLinesPane = new QFrame(this);
@@ -209,13 +213,15 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
   aLinesLayout->addWidget( aPosBox2 );
   aLinesLayout->addStretch();
 
-  aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
+  myTabBox->addTab( aLinesPane, tr("LBL_LINES_CUT") );
 
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
   myScalarPane->setMargin( 5 );
-  aTabPane->addTab(myScalarPane, "Scalar Bar");
+  myInputPane = new VisuGUI_InputPane(VISU::TCUTLINES, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
 
-  aMainLayout->addWidget(aTabPane);
+  aMainLayout->addWidget(myTabBox);
 
   // Dialog buttons
   QHBox* aBtnBox = new QHBox(this);
@@ -284,64 +290,87 @@ VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
+void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  myPrs = thePrs;
-  myScalarPane->initFromPrsObject(thePrs);
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject(myPrsCopy);
 
-  myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
-  myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
-  myPosSpn->setValue(thePrs->GetDisplacement());
-  setOrientation(thePrs->GetOrientationType());
+  myRotXSpn->setValue(myPrsCopy->GetRotateX()*180./PI);
+  myRotYSpn->setValue(myPrsCopy->GetRotateY()*180./PI);
+  myPosSpn->setValue(myPrsCopy->GetDisplacement());
+  setOrientation(myPrsCopy->GetOrientationType());
 
-  myNbSpn->setValue( (int)thePrs->GetNbLines() );
-  myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
-  myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
-  myPosSpn2->setValue(thePrs->GetDisplacement2());
-  setOrientation2(thePrs->GetOrientationType2());
+  myNbSpn->setValue( (int)myPrsCopy->GetNbLines() );
+  myRotXSpn2->setValue(myPrsCopy->GetRotateX2()*180./PI);
+  myRotYSpn2->setValue(myPrsCopy->GetRotateY2()*180./PI);
+  myPosSpn2->setValue(myPrsCopy->GetDisplacement2());
+  setOrientation2(myPrsCopy->GetOrientationType2());
 
   hasInit = true;
-  myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
-  myCutLines->SameAs(thePrs);
-  myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted());
+  myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(myPrsCopy, VISU::ColoredPrs3d_i::EDoNotPublish);
+  myCutLines->CopyCurvesInverted(myPrsCopy->GetCurvesInverted());
   if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
   myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
-  myCBSetDef->setChecked(thePrs->IsDefault());
+  myCBSetDef->setChecked(myPrsCopy->IsDefault());
   DrawTable();
 
   // Draw Preview
   if (myPreviewCheck->isChecked()) {
     createPlanes();
   }
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
 //------------------------------------------------------------------------------
-int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
+int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  myScalarPane->storeToPrsObject(thePrs);
+  myScalarPane->storeToPrsObject(myPrsCopy);
+
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+    myInputPane->storeToPrsObject( myPrsCopy );
+  }
 
-  thePrs->SetOrientation(getOrientaion(),
-                         myRotXSpn->value()*PI/180.,
-                         myRotYSpn->value()*PI/180.);
-  thePrs->SetDisplacement(myPosSpn->value());
-  thePrs->SetNbLines((int)myNbSpn->value());
+  myPrsCopy->SetOrientation(getOrientaion(),
+                           myRotXSpn->value()*PI/180.,
+                           myRotYSpn->value()*PI/180.);
+  myPrsCopy->SetDisplacement(myPosSpn->value());
+  myPrsCopy->SetNbLines((int)myNbSpn->value());
 
-  thePrs->SetOrientation2(getOrientaion(false),
-                          myRotXSpn2->value()*PI/180.,
-                          myRotYSpn2->value()*PI/180.);
-  thePrs->SetDisplacement2(myPosSpn2->value());
+  myPrsCopy->SetOrientation2(getOrientaion(false),
+                            myRotXSpn2->value()*PI/180.,
+                            myRotYSpn2->value()*PI/180.);
+  myPrsCopy->SetDisplacement2(myPosSpn2->value());
 
   if (!myCBSetDef->isChecked())
-    thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
-  else thePrs->SetDefault();
+    myPrsCopy->SetBasePlanePosition(myBasePlanePos->text().toDouble());
+  else myPrsCopy->SetDefault();
 
   for (int i = 0; i < (int)myNbSpn->value(); ++i) {
     if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
-      thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
-    else thePrs->SetDefaultPosition(i);
+      myPrsCopy->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
+    else myPrsCopy->SetDefaultPosition(i);
   }
   if (myAllCurvesInvertedCheck->isChecked())
-    thePrs->SetAllCurvesInverted(true);
+    myPrsCopy->SetAllCurvesInverted(true);
+
+  VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(thePrs, myPrsCopy);
+
   return 1;
 }
 
@@ -354,8 +383,8 @@ void VisuGUI_CutLinesDlg::createPlanes()
   if (myPreviewActor != 0) return;
 
   storeToPrsObject(myCutLines);
-  myCutLines->GetPL()->Update();
-  vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
+  myCutLines->GetPipeLine()->Update();
+  vtkAppendPolyData* aPolyData = myCutLines->GetSpecificPL()->GetAppendPolyData();
   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
   aPlaneMapper->SetInput(aPolyData->GetOutput());
   aPlaneMapper->ScalarVisibilityOff();
@@ -455,7 +484,7 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
                                   myRotXSpn2->value()*PI/180.,
                                   myRotYSpn2->value()*PI/180.);
                                  myCutLines->SetDisplacement2(myPosSpn2->value());*/
-      //myCutLines->GetPL()->Update();
+      //myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       //aView->Repaint();
@@ -481,7 +510,7 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
     if (aView) {
       if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
         //myCutLines->SetBasePlanePosition(aPos);
-       //        myCutLines->GetPL()->Update();
+       //        myCutLines->GetPipeLine()->Update();
         deletePlanes();
         createPlanes();
         //aView->Repaint();
@@ -552,7 +581,7 @@ void VisuGUI_CutLinesDlg::DrawTable()
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
-      //      myCutLines->GetPL()->Update();
+      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       //aView->Repaint();
@@ -562,12 +591,12 @@ void VisuGUI_CutLinesDlg::DrawTable()
 
 void VisuGUI_CutLinesDlg::updateGlyphs(bool update){
   if (myPreviewActorGlyphs == 0 ) return;
-  const vtkFloatingPointType *aDirLn = myCutLines->GetCutLinesPL()->GetRealDirLn();
-  const vtkFloatingPointType *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt();
+  const vtkFloatingPointType *aDirLn = myCutLines->GetSpecificPL()->GetRealDirLn();
+  const vtkFloatingPointType *aBasePnt = myCutLines->GetSpecificPL()->GetBasePnt();
   vtkFloatingPointType aSecondPnt[3];
   vtkFloatingPointType aBoundCenter[3];
 
-  vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
+  vtkAppendPolyData* aPolyData = myCutLines->GetSpecificPL()->GetAppendPolyData();
   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
   aPlaneMapper->SetInput(aPolyData->GetOutput());
   vtkFloatingPointType bounds[6];
@@ -600,7 +629,7 @@ void VisuGUI_CutLinesDlg::updateGlyphs(bool update){
   
   aFloatArray->SetNumberOfComponents(3);
   for(int i=0; i<3 ;i++)
-      aFloatArray->InsertNextValue(aSecondPnt[i]);
+    aFloatArray->InsertNextValue(aSecondPnt[i]);
   
   vtkDataSetAttributes* aDataSetAttributes;
   aDataSetAttributes = profile->GetPointData();
@@ -722,7 +751,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
       if (myPreviewCheck->isChecked()) {
        //Update Preview
        //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
-       //      myCutLines->GetPL()->Update();
+       //      myCutLines->GetPipeLine()->Update();
        deletePlanes();
        createPlanes();
        //aView->Repaint();
@@ -737,7 +766,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
       if (aView) {
        if (myPreviewCheck->isChecked()) {
          //Update Preview
-         //      myCutLines->GetPL()->Update();
+         //      myCutLines->GetPipeLine()->Update();
          deletePlanes();
          createPlanes();
          //aView->Repaint();
@@ -759,13 +788,13 @@ void VisuGUI_CutLinesDlg::accept()
   MYGenerateCurve = myCurvesCheck->isChecked();
   //  if (myScalarPane->check()) {
     /*jfa tmp:((QWidget*)sender())->setDisabled(true);
-    storeToPrsObject(myPrs);
+    storeToPrsObject(myPrsCopy);
     if (myIsCreation) {
       if (isGenerateTable()) {
-       visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
+       visuGUI->GetVisuGen()->CreateTable(myPrsCopy->GetEntry());
        if (isGenerateCurves()) {
          SALOMEDSClient_Study* aStudy = study()->studyDS();
-         SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+         SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
          if( aSObject ) {
            SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
            SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
@@ -783,7 +812,7 @@ void VisuGUI_CutLinesDlg::accept()
       }
       if (GET_VTK_VIEWWINDOW(myMgr)) {
        try {
-         visuGUI->CreateActor(myPrs);
+         visuGUI->CreateActor(myPrsCopy);
        } catch (...) {
          reject();
          return;
@@ -791,7 +820,7 @@ void VisuGUI_CutLinesDlg::accept()
        GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
       }
     } else {
-      visuGUI->RecreateActor(myPrs);
+      visuGUI->RecreateActor(myPrsCopy);
       if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
        if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
          vf->getRenderer()->ResetCameraClippingRange();
@@ -800,7 +829,7 @@ void VisuGUI_CutLinesDlg::accept()
       }
       // Remove old Table
       SALOMEDSClient_Study* aStudy = study()->studyDS();
-      SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+      SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
       if( aSObject ) {
        SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
        SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
@@ -843,7 +872,7 @@ void VisuGUI_CutLinesDlg::accept()
 void VisuGUI_CutLinesDlg::reject()
 {
   /*jfa tmp:if (myIsCreation) {
-    myPrs->RemoveFromStudy();
+    myPrsCopy->RemoveFromStudy();
     VisuGUI::application()->objectBrowser()->updateTree();
   }*/
   myScalarPane->deletePreview();
@@ -856,7 +885,7 @@ void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
       //storeToPrsObject(myCutLines);
-      //      myCutLines->GetPL()->Update();
+      //      myCutLines->GetPipeLine()->Update();
       createPlanes();
       //vf->onFitAll();
     } else {
@@ -872,11 +901,11 @@ void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert)
 {
   if (myAllCurvesInvertedCheck->isChecked()){
     myCutLines->SetAllCurvesInverted(true);
-    myPrs->SetAllCurvesInverted(true);
+    myPrsCopy->SetAllCurvesInverted(true);
   }
   else {
     myCutLines->SetAllCurvesInverted(false);
-    myPrs->SetAllCurvesInverted(false);
+    myPrsCopy->SetAllCurvesInverted(false);
   }
   updateGlyphs(true);
 }
@@ -894,7 +923,7 @@ void VisuGUI_CutLinesDlg::onRotation (double theValue)
       myCutLines->SetOrientation2(getOrientaion(false),
                                   myRotXSpn2->value()*PI/180.,
                                   myRotYSpn2->value()*PI/180.);*/
-      //      myCutLines->GetPL()->Update();
+      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       //aView->Repaint();
@@ -909,7 +938,7 @@ void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
   if (aView) {
     if (myPreviewCheck->isChecked()) {
       //myCutLines->SetBasePlanePosition(theValue.toDouble());
-      //      myCutLines->GetPL()->Update();
+      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       //aView->Repaint();
index 8b0e1da4b3cab9fac9aa897d4984c24223de7606..dfbc28dc0166e4d0325103f013ee15d8752278d0 100644 (file)
 
 #include <qhbuttongroup.h>
 #include <qvalidator.h>
+#include <qtabwidget.h>
+#include <qcheckbox.h>
+
+class QLineEdit;
 
 class SUIT_ViewManager;
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 
-namespace VISU{
+namespace VISU
+{
   class CutLines_i;
 }
 
-class VisuGUI_CutLinesDlg: public QDialog
+class VisuGUI_CutLinesDlg: public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 
@@ -44,8 +50,8 @@ public:
     VisuGUI_CutLinesDlg (SalomeApp_Module* theModule);
     ~VisuGUI_CutLinesDlg();
 
-    void initFromPrsObject (VISU::CutLines_i* thePrs);
-    int  storeToPrsObject (VISU::CutLines_i* thePrs);
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
     bool isGenerateTable() { return myCreateTable->isChecked(); }
     bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
@@ -100,7 +106,9 @@ private:
   QDoubleValidator *mydvalidator;
   VISU::CutLines_i* myCutLines;
 
+  QTabWidget*            myTabBox;
   VisuGUI_ScalarBarPane* myScalarPane;
+  VisuGUI_InputPane*     myInputPane;
 
   VISU::CutPlanes::Orientation getOrientaion (bool IsBasePlane = true);
   void setOrientation (const VISU::CutPlanes::Orientation orient);
@@ -111,7 +119,7 @@ private:
   QCheckBox* myPreviewCheck;
   QCheckBox* myAllCurvesInvertedCheck;
 
-  VISU::CutLines_i* myPrs;
+  SALOME::GenericObjPtr<VISU::CutLines_i> myPrsCopy;
 
   //jfa tmp:SUIT_ViewManager *myMgr;
   //jfa tmp:SUIT_ViewWindow *myStudyWnd;
index 2666f0cf775a7ca455ef6532a9d3cd3feec73072..804c545e2a5174d2158f12289b3781e4356ccf04 100644 (file)
 
 #include "VisuGUI_CutPlanesDlg.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
+
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_CutPlanesPL.hxx"
 
@@ -50,6 +54,7 @@
 #include "SUIT_ResourceMgr.h"
 
 #include <qlayout.h>
+#include <qbuttongroup.h>
 #include <qcheckbox.h>
 #include <qstyle.h>
 #include <qstring.h>
@@ -185,7 +190,7 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
   myPosSpn->setValue(thePrs->GetDisplacement());
   hasInit = true;
   // init table
-  myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
+  myCutPlanes = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
   myCutPlanes->SameAs(thePrs);
   DrawTable();
 
@@ -201,7 +206,7 @@ void VisuGUI_CutPlanesPane::createPlanes()
   if (myCutPlanes == NULL) return;
   if (myPreviewActor != 0) return;
 
-  vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
+  vtkAppendPolyData* aPolyData = myCutPlanes->GetSpecificPL()->GetAppendPolyData();
   if (!aPolyData->GetOutput()->GetNumberOfCells()) {
     onPreviewCheck(false);
     return;
@@ -353,7 +358,7 @@ void VisuGUI_CutPlanesPane::DrawTable()
   // Update preview
   if (myPreviewCheck->isChecked()) {
     if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
-      myCutPlanes->GetPL()->Update();
+      myCutPlanes->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       vf->Repaint();
@@ -391,7 +396,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
       //Update Preview
       if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
        myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
-       myCutPlanes->GetPL()->Update();
+       myCutPlanes->GetPipeLine()->Update();
        deletePlanes();
        createPlanes();
        vf->Repaint();
@@ -406,7 +411,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
       if (myPreviewCheck->isChecked()) {
        if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
          //Update Preview
-         myCutPlanes->GetPL()->Update();
+         myCutPlanes->GetPipeLine()->Update();
          deletePlanes();
          createPlanes();
          vf->Repaint();
@@ -438,7 +443,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue)
   if (myPreviewCheck->isChecked()) {
     if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
       myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
-      myCutPlanes->GetPL()->Update();
+      myCutPlanes->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
       vf->Repaint();
@@ -451,7 +456,7 @@ void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
       storeToPrsObject(myCutPlanes);
-      myCutPlanes->GetPL()->Update();
+      myCutPlanes->GetPipeLine()->Update();
       createPlanes();
       vf->onFitAll();
     } else {
@@ -468,8 +473,7 @@ void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
   Constructor
 */
 VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
-     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutPlanesDlg", false,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setCaption("Cut Planes Definition");
   setSizeGripEnabled(true);
@@ -479,14 +483,16 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
   TopLayout->setMargin(11);
 
   // Tab pane
-  QTabWidget* aTabBox = new QTabWidget(this);
+  myTabBox = new QTabWidget(this);
   myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/);
-  aTabBox->addTab(myCutPane, "Cut Planes");
+  myTabBox->addTab(myCutPane, "Cut Planes");
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
   myScalarPane->setMargin(5);
-  aTabBox->addTab(myScalarPane, "Scalar Bar");
+  myInputPane = new VisuGUI_InputPane(VISU::TCUTPLANES, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
 
-  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(myTabBox);
 
   QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
@@ -524,17 +530,48 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
   //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
 }
 
-void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::CutPlanes_i* thePrs)
+VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
+{}
+
+void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  myPrs = thePrs;
-  myScalarPane->initFromPrsObject(thePrs);
-  myCutPane->initFromPrsObject(thePrs);
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject( myPrsCopy );
+
+  if( !theInit )
+    return;
+
+  myScalarPane->initFromPrsObject(myPrsCopy);
+  myCutPane->initFromPrsObject(myPrsCopy);
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
-int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::CutPlanes_i* thePrs)
+int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  return (myScalarPane->storeToPrsObject(thePrs) &&
-          myCutPane->storeToPrsObject(thePrs));
+  int ok = 1;
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+
+    ok = myInputPane->storeToPrsObject(myPrsCopy);
+  }
+
+  ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myCutPane->storeToPrsObject(myPrsCopy);
+
+  VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(thePrs, myPrsCopy);
+
+  return ok;
 }
 
 void VisuGUI_CutPlanesDlg::accept()
index b7f9e4cf129b1b668c801de2437bc84220ce418a..e94a7bf61630bff30c629b71a165ef46c4afd279 100644 (file)
 #ifndef VISUGUI_CUTPLANESDLG_H
 #define VISUGUI_CUTPLANESDLG_H
 
-#include "VisuGUI_ScalarBarDlg.h"
-#include "VISU_CutPlanes_i.hh"
+#include "VisuGUI_Prs3dDlg.h"
 
 #include <SALOME_Actor.h>
 
+#include <qspinbox.h>
 #include <qradiobutton.h>
 #include <qtable.h>
+#include <qtabwidget.h>
+
+#include <QtxDblSpinBox.h>
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(VISU_Gen)
 
-class QtxDblSpinBox;
+namespace VISU 
+{
+  class CutPlanes_i;
+};
+
 class SUIT_ViewWindow;
 class SUIT_ViewManager;
 class SalomeApp_Module;
-
+class VisuGUI_InputPane;
 
 class VisuGUI_CutPlanesPane : public QFrame
 {
@@ -100,16 +107,16 @@ private slots:
 };
 
 
-class VisuGUI_CutPlanesDlg : public QDialog
+class VisuGUI_CutPlanesDlg : public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 
 public:
     VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
-    ~VisuGUI_CutPlanesDlg() {};
+    ~VisuGUI_CutPlanesDlg();
 
-    void initFromPrsObject (VISU::CutPlanes_i* thePrs);
-    int  storeToPrsObject  (VISU::CutPlanes_i* thePrs);
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
 private:
     void keyPressEvent( QKeyEvent* e );
@@ -121,9 +128,12 @@ protected slots:
     void onHelp();
 
 private:
+    QTabWidget*            myTabBox;
     VisuGUI_CutPlanesPane* myCutPane;
     VisuGUI_ScalarBarPane* myScalarPane;
+    VisuGUI_InputPane*     myInputPane;
     VISU::CutPlanes_i*     myPrs;
+    SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
 };
 
 
index 2a092922b7575c931ebbb7794d2d96822d81b1a9..e60b0943d664d2f315e456e2596ed7db31b0cd0b 100644 (file)
@@ -30,7 +30,9 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_DeformedShape_i.hh"
 
 #include "SalomeApp_Module.h"
@@ -49,8 +51,7 @@ using namespace std;
  * Constructor
  */
 VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
-    : QDialog(VISU::GetDesktop(theModule), "VisuGUI_DeformedShapeDlg", true,
-              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
@@ -59,7 +60,7 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   TopLayout->setSpacing(6);
   TopLayout->setMargin(11);
 
-  QTabWidget* aTabBox = new QTabWidget (this);
+  myTabBox = new QTabWidget (this);
 
   // Deformed shape pane
   QVBox* aBox = new QVBox (this);
@@ -87,13 +88,15 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   UseMagn->setChecked(true);
   TopGroupLayout->addMultiCellWidget(UseMagn, 1, 1, 0, 1);
 
-  aTabBox->addTab(aBox, tr("DEFORMED_SHAPE_TAB"));
+  myTabBox->addTab(aBox, tr("DEFORMED_SHAPE_TAB"));
 
   // Scalar bar pane
   myScalarPane = new VisuGUI_ScalarBarPane (this, false);
   myScalarPane->setMargin(5);
+  myInputPane = new VisuGUI_InputPane(VISU::TDEFORMEDSHAPE, theModule, this);
 
-  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
 
   // Buttons
   QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
@@ -123,7 +126,7 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
 
   // Add Tab box and Buttons to the top layout
-  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(myTabBox);
   TopLayout->addWidget(GroupButtons);
 
   // signals and slots connections
@@ -132,17 +135,47 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
 }
 
-void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::DeformedShape_i* thePrs)
+VisuGUI_DeformedShapeDlg::~VisuGUI_DeformedShapeDlg()
+{}
+
+void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  myScalarPane->initFromPrsObject(thePrs);
-  setFactor(thePrs->GetScale());
-  UseMagn->setChecked(thePrs->IsColored());
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject( myPrsCopy );
+
+  setFactor(myPrsCopy->GetScale());
+  UseMagn->setChecked(myPrsCopy->IsColored());
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
-int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
-  myScalarPane->storeToPrsObject(thePrs);
-  thePrs->SetScale(getFactor());
-  thePrs->ShowColored(isColored());
+int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+  myScalarPane->storeToPrsObject(myPrsCopy);
+
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+    myInputPane->storeToPrsObject( myPrsCopy );
+  }
+
+  myPrsCopy->SetScale(getFactor());
+  myPrsCopy->ShowColored(isColored());
+
+  VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+
   return 1;
 }
 
index 32c10f4cc79ccc77ad7c30439f09dda8b4f8588d..a832a9db59cc1b3307aa02dc1189fcc3885826af 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef VISUGUI_DEFORMEDSHAPEDLS_H
 #define VISUGUI_DEFORMEDSHAPEDLS_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
 
 #include "QtxDblSpinBox.h"
 
 #include <qcheckbox.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
+#include <qtabwidget.h>
 
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 
-namespace VISU{
+namespace VISU
+{
   class DeformedShape_i;
 }
 
-class VisuGUI_DeformedShapeDlg : public QDialog
+class VisuGUI_DeformedShapeDlg : public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 
 public:
     VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule);
-    ~VisuGUI_DeformedShapeDlg() {};
+    ~VisuGUI_DeformedShapeDlg();
 
     double getFactor()
       { return ScalFact->value(); }
@@ -61,8 +64,8 @@ public:
     bool isColored()
       { return UseMagn->isChecked(); }
 
-    void initFromPrsObject(VISU::DeformedShape_i* thePrs);
-    int storeToPrsObject(VISU::DeformedShape_i* thePrs);
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
 private:
     void keyPressEvent( QKeyEvent* e );
@@ -75,7 +78,10 @@ protected slots:
  private:
     QtxDblSpinBox* ScalFact;
     QCheckBox* UseMagn;
+    QTabWidget*            myTabBox;
     VisuGUI_ScalarBarPane* myScalarPane;
+    VisuGUI_InputPane*     myInputPane;
+    SALOME::GenericObjPtr<VISU::DeformedShape_i> myPrsCopy;
 };
 
 #endif // VISUGUI_DEFORMEDSHAPEDLS_H
index 46fd092202d4a2675ad1c0bd6f2e9bfd5251cdd6..49df36c63ef334a1bad82cc441a2fc455938a542 100644 (file)
@@ -56,77 +56,98 @@ VisuGUI_Displayer::~VisuGUI_Displayer()
 {
 }
 
-SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
+SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOME_View* theView )
 {
-  SALOME_Prs* prs = 0;
+  SALOME_Prs* aPrs = 0;
 
-  SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView();
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+  SALOME_View* aView = theView ? theView : GetActiveView();
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
 
-  if ( study && aViewFrame )
-  {
-    _PTR(SObject) obj = study->studyDS()->FindObjectID( entry.latin1() );
-    CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj );
-    if( CORBA::is_nil( anObj ) )
+  if(aStudy && aView){
+    _PTR(SObject) aSObject = aStudy->studyDS()->FindObjectID( theEntry.latin1() );
+    CORBA::Object_var anObject = VISU::ClientSObjectToObject( aSObject );
+    if( CORBA::is_nil( anObject ) )
       return 0;
 
-    SVTK_Viewer* vtk_viewer = dynamic_cast<VVTK_Viewer*>( aViewFrame );
-    if (!vtk_viewer)
-      vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
-    if( vtk_viewer )
-    {
-      SVTK_ViewWindow* wnd =
-        dynamic_cast<SVTK_ViewWindow*>( vtk_viewer->getViewManager()->getActiveView() );
-      if( wnd )
-      {
-       VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
-       if( thePrs )
-       {
-         buildPrs3d( wnd, thePrs );
-         prs = LightApp_Displayer::buildPresentation( entry, aViewFrame );
+    VISU::Base_var aBase = VISU::Base::_narrow(anObject);
+    if (CORBA::is_nil(aBase)) 
+      return 0;
+
+    VISU::Base_i* aBaseServant = dynamic_cast<VISU::Base_i*>(VISU::GetServant(aBase).in());
+
+    VISU::VISUType aType = aBase->GetType();
+    VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aBase);
+    if(!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER){
+      SVTK_Viewer* aViewer = dynamic_cast<VVTK_Viewer*>( aView );
+      if (!aViewer)
+       aViewer = dynamic_cast<SVTK_Viewer*>( aView );
+      if( aViewer ){
+       SUIT_ViewManager* aViewManager = aViewer->getViewManager();
+       SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
+       if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( aWindow )){
+         VISU::Prs3d_i* aPrs3d = NULL;
+         if(aType == VISU::TCOLOREDPRS3DHOLDER){
+           VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(aBase);
+           VISU::ColoredPrs3d_var aColoredPrs3d = aHolder->GetDevice();
+           aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aColoredPrs3d).in());
+         }else
+           aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBaseServant);
+
+         if(aPrs3d){
+           buildPrs3d( aViewWindow, aPrs3d );
+           Handle(SALOME_InteractiveObject) anIO = aPrs3d->GetIO();
+           if(anIO->hasEntry()){
+             std::string anEntry = anIO->getEntry();
+             aPrs = LightApp_Displayer::buildPresentation( anEntry, aView );
+           }
+         }
        }
       }
     }
 
-    SPlot2d_Viewer* plot_viewer = dynamic_cast<SPlot2d_Viewer*>( aViewFrame );
-    if( plot_viewer )
-    {
-      Plot2d_ViewWindow* wnd =
-        dynamic_cast<Plot2d_ViewWindow*>( plot_viewer->getViewManager()->getActiveView() );
-      if( !wnd )
+    if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aView)){
+      SUIT_ViewManager* aViewManager = aViewer->getViewManager();
+      SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
+      Plot2d_ViewWindow* aViewWindow = dynamic_cast<Plot2d_ViewWindow*>( aWindow );
+      if( !aViewWindow )
        return 0;
+      
+      SPlot2d_Prs* aPlot2dPrs = 0;
+      switch (aType) {
+      case VISU::TCURVE: {
+       VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBaseServant);
+       aPlot2dPrs = buildCurve( aViewWindow, aCurve );
+       break;
+      }
+      case VISU::TCONTAINER: {
+       VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBaseServant);
+       aPlot2dPrs = buildContainer( aViewWindow, aContainer );
+       break;
+      }
+      case VISU::TTABLE: {
+       VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBaseServant);
+       aPlot2dPrs = buildTable( aViewWindow, aTable );
+       break;
+      }}
 
-      VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in() );
-      SPlot2d_Prs* iprs = 0;
-      if( aCurve )
-       iprs = buildCurve( wnd, aCurve );
-
-      VISU::Container_i* aCont = dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in() );
-      if( aCont )
-       iprs = buildContainer( wnd, aCont );
-
-      VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant( anObj ).in() );
-      if( aTable )
-       iprs = buildTable( wnd, aTable );
-
-      if( iprs )
-       prs = new SPlot2d_Prs( iprs );
+      if( aPlot2dPrs )
+       aPrs = new SPlot2d_Prs( aPlot2dPrs );
 
-      if( prs )
-       UpdatePrs( prs );
+      if( aPrs )
+       UpdatePrs( aPrs );
     }
   }
-  return prs;
+  return aPrs;
 }
 
-void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* wnd, VISU::Prs3d_i* thePrs ) const
+void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d ) const
 {
-  VISU_Actor* newAct = VISU::FindActor(wnd, thePrs);
-  if (!newAct) {
+  VISU_Actor* anActor = VISU::FindActor(theViewWindow, thePrs3d);
+  if (!anActor) {
     try {
-      newAct = thePrs->CreateActor();
+      anActor = thePrs3d->CreateActor();
     } catch (std::runtime_error& exc) {
-      thePrs->RemoveActors();
+      thePrs3d->RemoveActors();
 
       INFOS(exc.what());
       SUIT_MessageBox::warn1
@@ -134,11 +155,12 @@ void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* wnd, VISU::Prs3d_i* thePrs
          QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
          QObject::tr("BUT_OK"));
     }
-  }
-  if (newAct) {
-    wnd->AddActor(newAct);
-    wnd->Repaint();
-  }
+    if (anActor)
+      theViewWindow->AddActor(anActor);
+  } else 
+    anActor->SetVisibility(true);
+
+  theViewWindow->Repaint();
 }
 
 bool VisuGUI_Displayer::addCurve( SPlot2d_Prs* prs, Plot2d_ViewWindow* wnd, VISU::Curve_i* c ) const
@@ -200,7 +222,7 @@ SPlot2d_Prs* VisuGUI_Displayer::buildTable( Plot2d_ViewWindow* wnd, VISU::Table_
   if( !study )
     return prs;
 
-  _PTR(SObject) TableSO = study->studyDS()->FindObjectID( t->GetEntry().latin1() );
+  _PTR(SObject) TableSO = study->studyDS()->FindObjectID( t->GetEntry() );
 
   if( !TableSO )
     return prs;
@@ -243,8 +265,11 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie
 
   if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type())
   {
-    VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
-    return thePrs;
+    VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObj).in());
+    if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
+      return true;
+
+    return dynamic_cast<VISU::Prs3d_i*>(aBase);
   }
   else if( viewer_type==SPlot2d_Viewer::Type() )
   {
index 2c0e864d6e7ce0907df5447c54235438fa29906c..11688a78b6e9db091f35144a195e877f9a8b48ca 100644 (file)
@@ -30,7 +30,9 @@
 #include "VISUConfig.hh"
 
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_GaussPoints_i.hh"
 #include "VISU_GaussPointsPL.hxx"
 #include "VISU_OpenGLPointSpriteMapper.hxx"
@@ -47,6 +49,8 @@
 #include "SUIT_MessageBox.h"
 #include "SVTK_FontWidget.h"
 
+#include "QtxDblSpinBox.h"
+
 #include <qlayout.h>
 #include <qtabwidget.h>
 #include <qbuttongroup.h>
 #include <qfiledialog.h>
 #include <qvalidator.h>
 #include <qcolordialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qtoolbutton.h>
+#include <qtabwidget.h>
 
 #include <vtkPolyData.h>
 #include <vtkDataSet.h>
@@ -295,7 +308,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs)
   myCBDisplayed->setEnabled( activeLocal );
   myCBDisplayed->setChecked( thePrs->GetIsDispGlobalScalarBar() );
 
-  bool bicolor = thePrs->GetGaussPointsPL()->GetBicolor();
+  bool bicolor = thePrs->GetSpecificPL()->GetBicolor();
   BicolorButton->setChecked( bicolor );
   RainbowButton->setChecked( !bicolor );
   ColorLabel->setEnabled( !bicolor );
@@ -373,7 +386,7 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
   thePrs->SetNbColors(ColorSpin->value());
   thePrs->SetLabels(LabelSpin->value());
 
-  thePrs->GetGaussPointsPL()->SetBicolor(BicolorButton->isChecked());
+  thePrs->GetSpecificPL()->SetBicolor(BicolorButton->isChecked());
 
   //if (isToSave()) storeToResources();
 
@@ -487,7 +500,7 @@ void VisuGUI_GaussScalarBarPane::setScalarBarData( int colors, int labels )
 /*!
   Gets orientation
 */
-int  VisuGUI_GaussScalarBarPane::getOrientation()
+int VisuGUI_GaussScalarBarPane::getOrientation()
 {
   if (RBvert->isChecked() )
     return  1;
@@ -495,6 +508,36 @@ int  VisuGUI_GaussScalarBarPane::getOrientation()
     return 0;
 }
 
+/*!
+  Sets and gets parameters
+*/
+double VisuGUI_GaussScalarBarPane::getX() {
+  return XSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getY() {
+  return YSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getWidth() {
+  return WidthSpin->value();
+}
+
+double VisuGUI_GaussScalarBarPane::getHeight() {
+  return HeightSpin->value();
+}
+
+int VisuGUI_GaussScalarBarPane::getNbColors() {
+  return ColorSpin->value();
+}
+
+int VisuGUI_GaussScalarBarPane::getNbLabels() {
+  return LabelSpin->value();
+}
+
+bool VisuGUI_GaussScalarBarPane::isToSave() {
+  return CBSave ? CBSave->isChecked() : false;
+}
 
 void VisuGUI_GaussScalarBarPane::onTextPref()
 {
@@ -506,10 +549,7 @@ void VisuGUI_GaussScalarBarPane::onTextPref()
  * Constructor
  */
 VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool SetPref):
-  QDialog(VISU::GetDesktop(theModule), 
-         "VisuGUI_GaussPointsDlg", true,
-         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-  myPrs(NULL)
+  VisuGUI_Prs3dDlg(theModule)
 {
   setName("VisuGUI_ScalarBarDlg");
   setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
@@ -530,7 +570,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   myGeometryButton = new QRadioButton( tr( "GEOMETRY" ), PrsGroup );
   myDefShapeButton = new QRadioButton( tr( "DEFORMED_SHAPE" ), PrsGroup );
 
-  QTabWidget* aTabBox = new QTabWidget (this);
+  myTabBox = new QTabWidget (this);
 
   // Gauss points pane
   QVBox* aBox = new QVBox (this);
@@ -564,6 +604,8 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref);
   myScalarPane->setMargin(5);
 
+  // Input pane
+  myInputPane = new VisuGUI_InputPane(VISU::TGAUSSPOINTS, theModule, this);
 
   connect( myResultsButton,  SIGNAL( clicked() ),       mySizeBox,    SLOT( onToggleResults() ) );
   connect( myResultsButton,  SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
@@ -571,8 +613,9 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   connect( myDefShapeButton, SIGNAL( toggled( bool ) ), this,         SLOT( onToggleDefShape( bool ) ) );
   connect( myDefShapeButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
 
-  aTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB"));
-  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB"));
+  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
 
   // Common buttons ===========================================================
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
@@ -599,7 +642,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
 
   TopLayout->addWidget( PrsGroup );
-  TopLayout->addWidget( aTabBox );
+  TopLayout->addWidget( myTabBox );
   TopLayout->addWidget( GroupButtons );
 
   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
@@ -607,80 +650,108 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
 }
 
-void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs )
+VisuGUI_GaussPointsDlg::~VisuGUI_GaussPointsDlg()
+{}
+
+void VisuGUI_GaussPointsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  bool isDeformed = thePrs->GetIsDeformed();
-  myScaleSpinBox->setValue( thePrs->GetScaleFactor() );
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject( myPrsCopy );
+
+  bool isDeformed = myPrsCopy->GetIsDeformed();
+  myScaleSpinBox->setValue( myPrsCopy->GetScaleFactor() );
   myDefShapeButton->setChecked( isDeformed );
-  myDefShapeButton->setEnabled( thePrs->GetField()->myNbComp > 1 );
+  myDefShapeButton->setEnabled( myPrsCopy->GetField()->myNbComp > 1 );
   onToggleDefShape( isDeformed );
 
-  bool isResults = thePrs->GetIsColored();
+  bool isResults = myPrsCopy->GetIsColored();
   myResultsButton->setChecked( isResults && !isDeformed );
   myGeometryButton->setChecked( !isResults && !isDeformed );
 
-  myPrimitiveBox->setPrimitiveType( thePrs->GetPrimitiveType() );
-  myPrimitiveBox->setClampMaximum( thePrs->GetMaximumSupportedSize() );
-  myPrimitiveBox->setClamp( thePrs->GetClamp() );
-  myPrimitiveBox->setMainTexture( thePrs->GetMainTexture() );
-  myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() );
-  myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() );
-  myPrimitiveBox->setResolution( thePrs->GetResolution() );
-  myPrimitiveBox->setFaceLimit( thePrs->GetFaceLimit() );
+  myPrimitiveBox->setPrimitiveType( myPrsCopy->GetPrimitiveType() );
+  myPrimitiveBox->setClampMaximum( myPrsCopy->GetMaximumSupportedSize() );
+  myPrimitiveBox->setClamp( myPrsCopy->GetClamp() );
+  myPrimitiveBox->setMainTexture( myPrsCopy->GetMainTexture() );
+  myPrimitiveBox->setAlphaTexture( myPrsCopy->GetAlphaTexture() );
+  myPrimitiveBox->setAlphaThreshold( myPrsCopy->GetAlphaThreshold() );
+  myPrimitiveBox->setResolution( myPrsCopy->GetResolution() );
+  myPrimitiveBox->setFaceLimit( myPrsCopy->GetFaceLimit() );
 
   mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
-  mySizeBox->setGeomSize( thePrs->GetGeomSize() );
-  mySizeBox->setMinSize( thePrs->GetMinSize() );
-  mySizeBox->setMaxSize( thePrs->GetMaxSize() );
-  mySizeBox->setMagnification( thePrs->GetMagnification() );
-  mySizeBox->setIncrement( thePrs->GetMagnificationIncrement() );
-  mySizeBox->setColor( thePrs->GetColor() );
-
-  myScalarPane->initFromPrsObject(thePrs);
+  mySizeBox->setGeomSize( myPrsCopy->GetGeomSize() );
+  mySizeBox->setMinSize( myPrsCopy->GetMinSize() );
+  mySizeBox->setMaxSize( myPrsCopy->GetMaxSize() );
+  mySizeBox->setMagnification( myPrsCopy->GetMagnification() );
+  mySizeBox->setIncrement( myPrsCopy->GetMagnificationIncrement() );
+  mySizeBox->setColor( myPrsCopy->GetColor() );
+
+  if( !theInit )
+    return;
 
-  myPrs = thePrs;
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
-int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs )
+int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
 {
-  thePrs->SetIsDeformed( myDefShapeButton->isChecked() );
-  thePrs->SetScaleFactor( myScaleSpinBox->value() );
+  myPrsCopy->SetIsDeformed( myDefShapeButton->isChecked() );
+  myPrsCopy->SetScaleFactor( myScaleSpinBox->value() );
 
-  thePrs->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
+  myPrsCopy->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
 
-  thePrs->SetClamp( myPrimitiveBox->getClamp() );
+  myPrsCopy->SetClamp( myPrimitiveBox->getClamp() );
 
   QString aMainTexture = myPrimitiveBox->getMainTexture();
   QString anAlphaTexture = myPrimitiveBox->getAlphaTexture();
 
-  aMainTexture = aMainTexture.isNull() ? thePrs->GetMainTexture() : aMainTexture;
-  anAlphaTexture = anAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : anAlphaTexture;
+  aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetMainTexture() : aMainTexture;
+  anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetAlphaTexture() : anAlphaTexture;
   
-  thePrs->SetTextures( aMainTexture, anAlphaTexture );
+  myPrsCopy->SetTextures( aMainTexture, anAlphaTexture );
 
-  thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
+  myPrsCopy->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
 
-  thePrs->SetResolution( myPrimitiveBox->getResolution() );
-  thePrs->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
+  myPrsCopy->SetResolution( myPrimitiveBox->getResolution() );
+  myPrsCopy->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
 
   bool isColored = !myGeometryButton->isChecked();
   if( isColored )
   {
-    thePrs->SetIsColored( true );
-    thePrs->SetMinSize( mySizeBox->getMinSize() );
-    thePrs->SetMaxSize( mySizeBox->getMaxSize() );
+    myPrsCopy->SetIsColored( true );
+    myPrsCopy->SetMinSize( mySizeBox->getMinSize() );
+    myPrsCopy->SetMaxSize( mySizeBox->getMaxSize() );
   }
   else
   {
-    thePrs->SetIsColored( false );
-    thePrs->SetColor( mySizeBox->getColor() );
-    thePrs->SetGeomSize( mySizeBox->getGeomSize() );
+    myPrsCopy->SetIsColored( false );
+    myPrsCopy->SetColor( mySizeBox->getColor() );
+    myPrsCopy->SetGeomSize( mySizeBox->getGeomSize() );
+  }
+
+  myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
+  myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
+
+  int ok = 1;
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+
+    ok = myInputPane->storeToPrsObject( myPrsCopy );
   }
+  ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
 
-  thePrs->SetMagnification( mySizeBox->getMagnification() );
-  thePrs->SetMagnificationIncrement( mySizeBox->getIncrement() );
+  VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(thePrs, myPrsCopy);
 
-  return myScalarPane->storeToPrsObject(thePrs);
+  return ok;
 }
 
 void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
@@ -696,10 +767,10 @@ void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
 
 void VisuGUI_GaussPointsDlg::accept()
 {
-  if( myPrs && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
+  if( myPrsCopy && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
   {
     int aNumberOfFaces = myPrimitiveBox->getFaceNumber();
-    int aNumberOfPoints = ( (vtkPolyData*)myPrs->GetGaussPointsPL()->GetInput() )->GetNumberOfCells();
+    int aNumberOfPoints = ( (vtkPolyData*)myPrsCopy->GetSpecificPL()->GetInput() )->GetNumberOfCells();
 
     if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() )
     {
index 1ce86e4303529931c281471990d6fd3d34669db8..bf117d7c75c7df3fcdf528ffcd2d1a83b70b7493 100644 (file)
 #ifndef VISUGUI_GAUSSPOINTSDLS_H
 #define VISUGUI_GAUSSPOINTSDLS_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
 
 #include <qvbox.h>
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlineedit.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
-#include <qspinbox.h>
-#include <qcombobox.h>
-#include <qtoolbutton.h>
+
+class QtxDblSpinBox;
 
 class SalomeApp_Module;
 class VVTK_PrimitiveBox;
 class VVTK_SizeBox;
 class VisuGUI_TextPrefDlg;
+class VisuGUI_InputPane;
 
 namespace VISU
 {
@@ -65,14 +57,14 @@ class VisuGUI_GaussScalarBarPane : public QVBox
 
   int     getOrientation();
   void    setPosAndSize( double x, double y, double w, double h, bool vert );
-  double  getX() {return XSpin->value();}
-  double  getY() {return YSpin->value();}
-  double  getWidth() {return WidthSpin->value();}
-  double  getHeight() {return HeightSpin->value();}
   void    setScalarBarData( int colors, int labels );
-  int     getNbColors() {return ColorSpin->value();}
-  int     getNbLabels() {return LabelSpin->value();}
-  bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
+  double  getX();
+  double  getY();
+  double  getWidth();
+  double  getHeight();
+  int     getNbColors();
+  int     getNbLabels();
+  bool    isToSave();
 
   void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
   int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
@@ -125,19 +117,19 @@ class VisuGUI_GaussScalarBarPane : public QVBox
  * Uses for set up initial parameters of the Gauss Points
  * presentation and edit them interactively.
  */
-class VisuGUI_GaussPointsDlg : public QDialog
+class VisuGUI_GaussPointsDlg : public VisuGUI_Prs3dDlg
 {
   Q_OBJECT
 
 public:
   VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
-  ~VisuGUI_GaussPointsDlg() {}
+  ~VisuGUI_GaussPointsDlg();
 
   //! Initializing dialog from the Gauss Points presentation.
-  void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
+  virtual void    initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
 
   //! Update Gauss Points presentation using parameters from the dialog.
-  int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
+  virtual int     storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
 private:
   void keyPressEvent( QKeyEvent* e );
@@ -149,8 +141,9 @@ protected slots:
   void    accept();
 
 private:
-  VISU::GaussPoints_i*     myPrs;
+  QTabWidget*              myTabBox;
   VisuGUI_GaussScalarBarPane* myScalarPane;
+  VisuGUI_InputPane*       myInputPane;
 
   QRadioButton*            myResultsButton;
   QRadioButton*            myGeometryButton;
@@ -161,6 +154,8 @@ private:
 
   QGroupBox*               myDefShapeBox;
   QtxDblSpinBox*           myScaleSpinBox;
+
+  SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
 };
 
 #endif // VISUGUI_GAUSSPOINTSDLS_H
index 909c730df5e6dd48e38b57dcad960b606954f6aa..c24f76a99e7b573f912eaf6d61fc448a499131f3 100644 (file)
@@ -30,6 +30,9 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "VISU_ColoredPrs3dFactory.hh"
 
 #include "LightApp_Application.h"
 
@@ -164,8 +167,7 @@ bool VisuGUI_IsoSurfPane::check()
   Constructor
 */
 VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
-     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_IsoSurfacesDlg", true,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setCaption(tr("DEFINE_ISOSURFACES"));
   setSizeGripEnabled( TRUE );
@@ -174,16 +176,18 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin(11);
 
-  QTabWidget* aTabBox = new QTabWidget(this);
+  myTabBox = new QTabWidget(this);
   myIsoPane = new  VisuGUI_IsoSurfPane(this);
   myIsoPane->setMargin( 5 );
-  aTabBox->addTab(myIsoPane, "Iso Surface");
+  myTabBox->addTab(myIsoPane, "Iso Surface");
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
   myIsoPane->setScalarBarPane(myScalarPane);
   myScalarPane->setMargin( 5 );
-  aTabBox->addTab(myScalarPane, "Scalar Bar");
+  myInputPane = new VisuGUI_InputPane(VISU::TISOSURFACE, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
 
-  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(myTabBox);
 
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
@@ -215,6 +219,9 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
 }
 
+VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
+{}
+
 void VisuGUI_IsoSurfacesDlg::accept()
 {
   if (myIsoPane->check() && myScalarPane->check())
@@ -230,6 +237,45 @@ void VisuGUI_IsoSurfacesDlg::reject()
   QDialog::reject();
 }
 
+void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+{
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TISOSURFACE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject(myPrsCopy);
+  myIsoPane->initFromPrsObject(myPrsCopy);
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
+}
+
+int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
+{
+  int ok = 1;
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+
+    ok = myInputPane->storeToPrsObject( myPrsCopy );
+  }
+
+  ok = ok && myScalarPane->storeToPrsObject( myPrsCopy ) && myIsoPane->storeToPrsObject(myPrsCopy);
+
+  VISU::TSameAsFactory<VISU::TISOSURFACE>().Copy(thePrs, myPrsCopy);
+
+  return ok;
+}
+
 void VisuGUI_IsoSurfacesDlg::onHelp()
 {
   QString aHelpFileName = "/files/iso_surfaces_presentation.htm";
index 385fa64668810116542701e2ace9cf0d09f97229..efea4c1e9785b56b0904eb6f829d51bb0691b87e 100644 (file)
@@ -29,8 +29,7 @@
 #ifndef VISUGUI_ISOSURFACESDLG_H
 #define VISUGUI_ISOSURFACESDLG_H
 
-#include "VisuGUI_ScalarBarDlg.h"
-#include "VISU_IsoSurfaces_i.hh"
+#include "VisuGUI_Prs3dDlg.h"
 
 #include <qdialog.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qcheckbox.h>
 #include <qlineedit.h>
+#include <qtabwidget.h>
+
+namespace VISU 
+{
+  class IsoSurfaces_i;
+};
 
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 
 class VisuGUI_IsoSurfPane : public QVBox
 {
@@ -69,19 +75,16 @@ class VisuGUI_IsoSurfPane : public QVBox
 };
 
 
-class VisuGUI_IsoSurfacesDlg : public QDialog
+class VisuGUI_IsoSurfacesDlg : public VisuGUI_Prs3dDlg
 {
   Q_OBJECT;
 
  public:
   VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule);
-  ~VisuGUI_IsoSurfacesDlg() {};
+  ~VisuGUI_IsoSurfacesDlg();
 
-  void initFromPrsObject(VISU::IsoSurfaces_i* thePrs)
-    {myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs);}
-
-  int storeToPrsObject(VISU::IsoSurfaces_i* thePrs)
-    {return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);}
+  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
  private:
   void keyPressEvent( QKeyEvent* e );
@@ -92,8 +95,12 @@ class VisuGUI_IsoSurfacesDlg : public QDialog
   void onHelp();
 
  private:
+  QTabWidget*            myTabBox;
   VisuGUI_IsoSurfPane*   myIsoPane;
   VisuGUI_ScalarBarPane* myScalarPane;
+  VisuGUI_InputPane*     myInputPane;
+
+  SALOME::GenericObjPtr<VISU::IsoSurfaces_i> myPrsCopy;
 };
 
 #endif // VISUGUI_ISOSURFACESDLG_H
index 3cab58e224a742fe5619f2fdb435a6901702865d..0406c812f764d7c2d8e284380f2c60299e38d275 100644 (file)
@@ -65,6 +65,8 @@
 #include "VISU_GaussPtsAct.h"
 #include "VisuGUI_GaussPointsDlg.h"
 
+#include "VisuGUI_Slider.h"
+
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_CutLines_i.hh"
@@ -258,7 +260,7 @@ initialize( CAM_Application* theApp )
   mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
   mgr->setRule( action( GAUSS_CREATE_PRS ), 
                "client='ObjectBrowser' and selcount=1 "
-               "and type='VISU::TTIMESTAMP' "
+               "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} "
                "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
                "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ",
                true );
@@ -418,7 +420,11 @@ onCreateViewManager()
   new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
   anApp->addViewManager( aViewManager );
      
-  aViewManager->createViewWindow();
+  VVTK_ViewWindow* aViewWindow = ( VVTK_ViewWindow* )aViewManager->createViewWindow();
+  if( aViewWindow )
+  {
+    new VisuGUI_Slider( this, aViewWindow, anApp->selectionMgr() );
+  }
 
   return aViewer->getViewManager();
 }
@@ -928,7 +934,7 @@ VisuGUI_Module::
 OnCreateGaussPoints()
 {
   double initialTime = vtkTimerLog::GetCPUTime();
-  CreatePrs3d<VISU::GaussPoints_i, VVTK_Viewer, VisuGUI_GaussPointsDlg, 1>(this);
+  CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
   INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
         vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
@@ -1044,8 +1050,14 @@ void
 VisuGUI_Module::
 OnEditGaussPoints()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) {
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+      return;
+
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+
+  if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
     // Create VVTK_ViewWindow, if it does not exist
     if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
       EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
@@ -1806,25 +1818,6 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
   }
 }
 
-// returns VISU_Actor with IO with given entry
-VISU_Actor* getActor( const QString& entry, SVTK_ViewWindow* vtkView )
-{
-  if ( vtkView && !entry.isEmpty() ) {
-    vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
-    allActors->InitTraversal();
-    while ( vtkActor* actor = allActors->GetNextActor() ) {
-      if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
-       if ( vActor->hasIO() ) { // actor corresponds to existing obj
-         Handle(SALOME_InteractiveObject) io = vActor->getIO();
-         if ( entry == io->getEntry() )
-           return vActor;
-       }
-      }
-    }
-  }
-  return 0;
-}
-
 const int ViewerType = 0;
 const int ViewIndex = 1;
 const int ParamName = 2;
@@ -1929,7 +1922,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
            QMap<QString, VISU_Actor*> viewActorMap;
            if ( vtkActors.contains( entry ) )
              viewActorMap = vtkActors[ entry ];
-           viewActorMap[ viewerTypeIndex ] = getActor( entry, vtkView );
+           viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
            vtkActors[ entry ] = viewActorMap;
          }
        }
index 7e535ac60f28d36e7d096f599d0c904a7b2cb481..eb86611ac8e133af45a09d656e5d91466fdbb517 100644 (file)
@@ -179,9 +179,11 @@ bool VisuGUI_OffsetDlg::isToSave() const
 
 void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset)
 {
-  if (myPrsList.count() == 0) return;
+  if (myPrsList.count() == 0) 
+    return;
 
-  if (isToSave()) thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
+  if (isToSave()) 
+    thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
 
   ViewManagerList aViewManagerList;
   SalomeApp_Application* anApp = myModule->getApp();
@@ -195,15 +197,11 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp
         if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
          vw->onAdjustTrihedron();
 
-          if (VISU_Actor* anActor = VISU::GetActor(thePrs, vw)) {
+          if (VISU_Actor* anActor = VISU::FindActor(vw, thePrs)) {
             anActor->SetPosition(theOffset);
+           vw->highlight(thePrs->GetIO(), 1);
             vw->getRenderer()->ResetCameraClippingRange();
             vw->Repaint();
-
-            Handle(SALOME_InteractiveObject) anIO;
-            CORBA::Object_var anObject = VISU::GetSelectedObj(myModule, &anIO);
-            if (!CORBA::is_nil(anObject))
-             vw->highlight(anIO, 1);
           }
         }
       }
index 79564c950d1578a485fa1f1736f30694f09978ca..700991079a5347232cb3c610c12ba9477c12f712 100644 (file)
@@ -31,7 +31,9 @@
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_ViewManager_i.hh"
 #include "VISU_Plot3DPL.hxx"
 
 #include "SUIT_ResourceMgr.h"
 #include "LightApp_Application.h"
 
+#include "QtxDblSpinBox.h"
+
 #include <qlayout.h>
 #include <qvalidator.h>
 #include <qtabwidget.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -247,8 +254,7 @@ VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
 //purpose  :
 //=======================================================================
 VisuGUI_Plot3DPane::~VisuGUI_Plot3DPane()
-{
-}
+{}
 
 //=======================================================================
 //function : storePrsParams
@@ -260,8 +266,7 @@ void VisuGUI_Plot3DPane::storePrsParams()
   if (!myPipeCopy)
     myPipeCopy = VISU_Plot3DPL::New();
   if (myPrs) {
-    myPipeCopy->SetIDMapper(myPrs->GetPL()->GetIDMapper());
-    myPipeCopy->ShallowCopy(myPrs->GetPL());
+    myPipeCopy->ShallowCopy(myPrs->GetPipeLine(), true);
     storeToPrsObject(myPrs);
   }
 }
@@ -275,7 +280,7 @@ void VisuGUI_Plot3DPane::restorePrsParams()
   if (!myPipeCopy)
     myPipeCopy = VISU_Plot3DPL::New();
   if (myPrs)
-    myPrs->GetPL()->ShallowCopy(myPipeCopy);
+    myPrs->GetPipeLine()->ShallowCopy(myPipeCopy, false);
 }
 
 //=======================================================================
@@ -287,7 +292,7 @@ void VisuGUI_Plot3DPane::onPositionSpn()
   if (myPrs && !RelativeChkB->isChecked()) {
     vtkFloatingPointType minPos, maxPos;
     storePrsParams();
-    myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+    myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos);
     restorePrsParams();
     if (minPos > PositionSpn->value())
       minPos = PositionSpn->value();
@@ -326,7 +331,7 @@ void VisuGUI_Plot3DPane::onRelativePos(bool isRelativePos)
   vtkFloatingPointType minPos = 0., maxPos = 1., pos = PositionSpn->value();
   if (myPrs) {
     storePrsParams();
-    myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
+    myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos);
     restorePrsParams();
     if (-1e-7 < (maxPos - minPos) && (maxPos - minPos) < 1e-7) {
       pos = 0;
@@ -377,12 +382,12 @@ void VisuGUI_Plot3DPane::updatePreview()
     if (!planePreview) {
       myPreviewActor = planePreview = new TPlane(myPrs->GetInput()->GetLength());
       myViewWindow->AddActor(planePreview);
-      fitall = !VISU::GetActor(myPrs, myViewWindow);
+      fitall = !VISU::FindActor(myViewWindow, myPrs);
     }
     // set plane parameters corresponding to control values
     storePrsParams();
     vtkFloatingPointType normal[3], origin[3];
-    myPrs->GetPlot3DPL()->GetBasePlane(origin, normal, true);
+    myPrs->GetSpecificPL()->GetBasePlane(origin, normal, true);
     planePreview->Set(origin, normal);
     restorePrsParams();
   }
@@ -439,7 +444,7 @@ void VisuGUI_Plot3DPane::initFromPrsObject(VISU::Plot3D_i* thePrs)
 
   // disable cutting plane controls if the mesh is planar
 
-  if (thePrs->GetPL()->IsPlanarInput())
+  if (thePrs->GetPipeLine()->IsPlanarInput())
   {
     GBOrientation->setEnabled(false);
     Rot1         ->setEnabled(false);
@@ -496,7 +501,6 @@ bool VisuGUI_Plot3DPane::check()
 {
   if(!myPreviewActor) return true;
   
-  SVTK_ViewWindow* aView;
   vtkRenderer* aRend    = myPreviewActor->GetRenderer();
   vtkRenderWindow* aWnd = aRend->GetRenderWindow();
   if(aRend && aWnd){
@@ -543,8 +547,7 @@ void VisuGUI_Plot3DPane::setPlane(int theOrientation, double theXRotation, doubl
 //purpose  :
 //=======================================================================
 VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
-  : QDialog(VISU::GetDesktop(theModule), "VisuGUI_Plot3DDlg", false, WStyle_Customize |
-            WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setCaption(tr("TITLE"));
   setSizeGripEnabled(TRUE);
@@ -553,15 +556,17 @@ VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
   TopLayout->setSpacing(6);
   TopLayout->setMargin(11);
 
-  QTabWidget* aTabBox = new QTabWidget (this);
+  myTabBox = new QTabWidget (this);
   myIsoPane = new VisuGUI_Plot3DPane (this);
   myIsoPane->setMargin(5);
-  aTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
+  myTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
   myScalarPane = new VisuGUI_ScalarBarPane (this, false);
   myScalarPane->setMargin(5);
-  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB_TITLE"));
+  myInputPane = new VisuGUI_InputPane(VISU::TPLOT3D, theModule, this);
+  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB_TITLE"));
+  myTabBox->addTab(myInputPane, tr("INPUT_TAB_TITLE"));
 
-  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(myTabBox);
 
   QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
@@ -593,6 +598,9 @@ VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
 }
 
+VisuGUI_Plot3DDlg::~VisuGUI_Plot3DDlg()
+{}
+
 //=======================================================================
 //function : accept
 //purpose  :
@@ -618,6 +626,52 @@ void VisuGUI_Plot3DDlg::reject()
   QDialog::reject();
 }
 
+//=======================================================================
+//function : initFromPrsObject
+//purpose  :
+//=======================================================================
+void VisuGUI_Plot3DDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+{
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TPLOT3D>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject(myPrsCopy);
+  myIsoPane->initFromPrsObject(myPrsCopy);
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose  :
+//=======================================================================
+int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
+{ 
+  int ok = 1;
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+
+    ok = myInputPane->storeToPrsObject( myPrsCopy );
+  }
+  ok = ok && myScalarPane->storeToPrsObject(myPrsCopy) && myIsoPane->storeToPrsObject(myPrsCopy);
+
+  VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(thePrs, myPrsCopy);
+
+  return ok;
+}
+
 //=======================================================================
 //function : onHelp
 //purpose  :
index 230df0004e3b1bc1bf8887ed651441ee83e5e0f3..baee658903e65d2ac6d4ca8a4064707c56ce6843 100644 (file)
 #ifndef VISUGUI_PLOT3D_H
 #define VISUGUI_PLOT3D_H
 
-#include "VisuGUI_ScalarBarDlg.h"
-
-#include "VISU_Plot3D_i.hh"
+#include "VisuGUI_Prs3dDlg.h"
 
 #include <qhbuttongroup.h>
+#include <qtabwidget.h>
 
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 
-namespace VISU {
+namespace VISU 
+{
   class Plot3D_i;
 };
 
@@ -95,19 +96,16 @@ class VisuGUI_Plot3DPane : public QVBox
 };
 
 
-class VisuGUI_Plot3DDlg : public QDialog
+class VisuGUI_Plot3DDlg : public VisuGUI_Prs3dDlg
 {
   Q_OBJECT
 
  public:
   VisuGUI_Plot3DDlg (SalomeApp_Module* theModule);
-  ~VisuGUI_Plot3DDlg() {};
+  ~VisuGUI_Plot3DDlg();
 
-  void initFromPrsObject (VISU::Plot3D_i* thePrs)
-    { myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs); }
-
-  int storeToPrsObject (VISU::Plot3D_i* thePrs)
-    { return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs); }
+  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
   void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos);
 
@@ -120,8 +118,12 @@ class VisuGUI_Plot3DDlg : public QDialog
   void onHelp();
 
  private:
+  QTabWidget*            myTabBox;
   VisuGUI_Plot3DPane*    myIsoPane;
   VisuGUI_ScalarBarPane* myScalarPane;
+  VisuGUI_InputPane*     myInputPane;
+
+  SALOME::GenericObjPtr<VISU::Plot3D_i> myPrsCopy;
 };
 
 #endif // VISUGUI_PLOT3D_H
index 45d034d939acaee43cca21f06586e49fa9324069..2ce90f0c8f361ee72ae0a53f55681d282fbf68e8 100644 (file)
@@ -77,15 +77,21 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
 QString VisuGUI_Selection::type( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  CORBA::Object_var anObject = GetSelectedObj( aStudy, entry( ind ), &aMap );  
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
-  if ( !CORBA::is_nil( aVisuObj ) ){
-    VISU::VISUType aType = aVisuObj->GetType();
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
+  VISU::Base_i* aBase = anObjectInfo.myBase;
+  if(aBase){
+    VISU::VISUType aType = aBase->GetType();
+    if(aType == VISU::TCOLOREDPRS3DHOLDER){
+      CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+      aType = aHolder->GetPrsType();
+    }
     switch (aType) {
       ENUM2STRING( aResStr, VISU::TVISUGEN );
       ENUM2STRING( aResStr, VISU::TRESULT );
@@ -134,13 +140,15 @@ QString VisuGUI_Selection::type( const int ind ) const
 QString VisuGUI_Selection::nbComponents( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  GetSelectedObj( aStudy, entry( ind ), &aMap );  
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
-  const QString& aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
+  QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
   if ( isExist )
     aResStr = aVal;
   return aResStr;
@@ -148,10 +156,15 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const
 
 QString VisuGUI_Selection::medEntity( const int ind ) const
 {
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return QString();
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
-  VISU::Storable::TRestoringMap aMap;
-  GetSelectedObj( GetStudy(), entry( ind ), &aMap );  
-  const QString& aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
+  QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
   if ( isExist ) {
     using namespace VISU;
     TEntity anEntityId = TEntity(aVal.toInt());
@@ -199,11 +212,13 @@ QString VisuGUI_Selection::medSource( const int ind ) const
 QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  GetSelectedObj( aStudy, entry( ind ), &aMap );  
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
   const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
   if ( isExist )
@@ -211,26 +226,110 @@ QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
   return aResStr;
 }
 
-QString VisuGUI_Selection::representation( const int ind ) const
-{
-  QString aResStr;
 
-  if (SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
-    if (VISU_Actor* anVISUActor = FindActor(aView, entry(ind).latin1())) {
-      int aRepresent = anVISUActor->GetRepresentation();
-      switch (aRepresent) {
-       ENUM2STRING( aResStr, VISU::POINT );
-       ENUM2STRING( aResStr, VISU::WIREFRAME );
-       ENUM2STRING( aResStr, VISU::SHADED );
-       ENUM2STRING( aResStr, VISU::INSIDEFRAME );
-       ENUM2STRING( aResStr, VISU::SURFACEFRAME );
-      }
+//----------------------------------------------------------------------------
+template<class TPopupFunctor>
+struct TPopupDispatcher
+{
+  QString
+  operator()(const SalomeApp_Module* theModule, 
+            const QString& theEntry)
+  {
+    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+      QString aType = aViewManager->getType();
+      TPopupFunctor aFunctor;
+      if(aType == SVTK_Viewer::Type())
+       return aFunctor.template Get<SVTK_Viewer>(theModule, theEntry);
+      else if(aType == VVTK_Viewer::Type())
+       return aFunctor.template Get<VVTK_Viewer>(theModule, theEntry);
     }
+    return QString();
+  }    
+};
+
+
+//----------------------------------------------------------------------------
+template<class TViewer>
+bool
+GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                     const QString& theEntry,
+                     VISU::Prs3d_i*& thePrs3d,
+                     SVTK_ViewWindow*& theViewWindow,
+                     VISU_Actor*& thenActor)
+{
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), theEntry);
+  thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+  if(!thePrs3d)
+    return false;
+  
+  typedef typename TViewer::TViewWindow TViewWindow;
+  theViewWindow = GetActiveViewWindow<TViewWindow>(theModule);
+  if(!theViewWindow)
+    return false;
+  
+  thenActor = FindActor(theViewWindow, thePrs3d);
+  if(!thenActor)
+    return false;
+  
+  return true;
+}
+
+
+//----------------------------------------------------------------------------
+struct TViewFunctor
+{
+  template<class TViewer>
+  QString
+  Get(const SalomeApp_Module* theModule, 
+      const QString& theEntry)
+  {
+    VISU_Actor* anActor = NULL;
+    VISU::Prs3d_i* aPrs3d = NULL;
+    SVTK_ViewWindow* aViewWindow = NULL;
+    if(!GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
+      return QString();
+    
+    return get(aPrs3d, aViewWindow, anActor);
+  }
+  
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return QString();
   }
+};
 
-  return aResStr;
+
+//----------------------------------------------------------------------------
+struct TGetRepesentationFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    QString aResStr;
+    switch (theActor->GetRepresentation()) {
+      ENUM2STRING( aResStr, VISU::POINT );
+      ENUM2STRING( aResStr, VISU::WIREFRAME );
+      ENUM2STRING( aResStr, VISU::SHADED );
+      ENUM2STRING( aResStr, VISU::INSIDEFRAME );
+      ENUM2STRING( aResStr, VISU::SURFACEFRAME );
+    }      
+    return aResStr;
+  }
+};
+
+QString VisuGUI_Selection::representation( const int ind ) const
+{
+  return TPopupDispatcher<TGetRepesentationFunctor>()(myModule, entry(ind));
 }
 
+//----------------------------------------------------------------------------
 SalomeApp_Study* VisuGUI_Selection::GetStudy() const
   
 {
@@ -238,6 +337,7 @@ SalomeApp_Study* VisuGUI_Selection::GetStudy() const
   return dynamic_cast<SalomeApp_Study*>( aLightStudy );
 }
 
+//----------------------------------------------------------------------------
 int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
 {
   int cnt = 0;
@@ -258,6 +358,7 @@ int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
   return cnt;
 }
 
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::nbChildren( const int ind ) const
 {
   QString aResStr;
@@ -265,6 +366,7 @@ QString VisuGUI_Selection::nbChildren( const int ind ) const
   return aResStr;
 }
 
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
 {
   QString aResStr;
@@ -272,92 +374,93 @@ QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
   return aResStr;
 }
 
-namespace
-{
-  struct TIsVisibleFunctor
-  {
-    template<class TViewer>
-    QString
-    Get(VisuGUI* theModule, 
-       const QString& theEntry)
-    {
-      typedef typename TViewer::TViewWindow TViewWindow;
-      if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule))
-       if (VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
-         return anActor->GetVisibility() ? "true" : "false";
-
-      return QString();
-    }
-  };
 
-  template<class TPopupFunctor>
-  struct TPopupDispatcher
+//----------------------------------------------------------------------------
+struct TIsVisibleFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
   {
-    QString
-    operator()(VisuGUI* theModule, 
-              const QString& theEntry)
-    {
-      if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
-       QString aType = aViewManager->getType();
-       TPopupFunctor aFunctor;
-       if(aType == SVTK_Viewer::Type())
-         return aFunctor.template Get<SVTK_Viewer>(theModule,theEntry);
-       else if(aType == VVTK_Viewer::Type())
-         return aFunctor.template Get<VVTK_Viewer>(theModule,theEntry);
-      }
-      return QString();
-    }    
-  };
-}
+    return theActor->GetVisibility() ? "true" : "false";
+  }
+};
 
 QString VisuGUI_Selection::isVisible( const int ind ) const
 {
-  return TPopupDispatcher<TIsVisibleFunctor>()((VisuGUI*)myModule,entry(ind));
+  return TPopupDispatcher<TIsVisibleFunctor>()(myModule, entry(ind));
 }
 
-QString VisuGUI_Selection::isShrunk( const int ind ) const
-{
-  QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      if ( anVISUActor->IsShrunkable() )
-       aResStr = anVISUActor->IsShrunk() ? "1" : "0";
+//----------------------------------------------------------------------------
+struct TIsShrunkFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return theActor->IsShrunk() ? "1" : "0";
+  }
+};
 
-  return aResStr;
+QString VisuGUI_Selection::isShrunk( const int ind ) const
+{
+  return TPopupDispatcher<TIsShrunkFunctor>()(myModule, entry(ind));
 }
 
+
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::hasActor( const int ind ) const
 {
   return representation( ind ).isEmpty() ? "0" : "1";
 }
 
+
+//----------------------------------------------------------------------------
+struct TIsShadingFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor))
+      return anActor->IsShading() ? "1" : "0";
+    return QString();
+  }
+};
+
 QString VisuGUI_Selection::isShading( const int ind ) const
 {
-  QString aResStr;
-  
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      if ( VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor) )
-       aResStr = anActor->IsShading() ? "1" : "0";
-  
-  return aResStr;      
+  return TPopupDispatcher<TIsShadingFunctor>()(myModule, entry(ind));
 }
 
-QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
-{
-  QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-    {
-      VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
-      aResStr = anActor ? "1" : "0";
-    }
+//----------------------------------------------------------------------------
+struct TIsScalarMapActFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return dynamic_cast<VISU_ScalarMapAct*>(theActor)? "1" : "0";
+  }
+};
 
-  return aResStr;
+QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
+{
+  return TPopupDispatcher<TIsScalarMapActFunctor>()(myModule, entry(ind));
 }
 
+
+//----------------------------------------------------------------------------
 bool VisuGUI_Selection::isVisuComponent( const int ind ) const
 {
   SalomeApp_Study* study = GetStudy();
index 62b46d5156dfd0095de629a048dcca274e0d6ead..4ca72b11c4252461984c4559d0753408ae9c549f 100644 (file)
 #ifndef VisuGUI_Prs3dTools_HeaderFile
 #define VisuGUI_Prs3dTools_HeaderFile
 
-#include "VISU_Gen_i.hh"
+#include "VISUConfig.hh"
+#include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
-#include "VisuGUI_DialogRunner.h"
+#include "VISU_ColoredPrs3dFactory.hh"
+#include "VISU_PipeLine.hxx"
 
 #include <vtkRenderer.h>
 
 namespace VISU
 {
-  class CutLines_i;
-
-  //---------------------------------------------------------------
-  inline
-  int
-  runAndWait( QDialog* dlg, const bool modal )
-  {
-    VisuGUI_DialogRunner r( dlg );
-    return r.run( modal );
-  }
-
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int TIsDlgModal>
   void
   EditPrs3d(VisuGUI* theModule, 
+           Handle(SALOME_InteractiveObject)& theIO,
            VISU::Prs3d_i* thePrs3d,
            SVTK_ViewWindow* theViewWindow)
   {
     if (TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)) {
+      bool isModal = TIsDlgModal;
+      if( ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<ColoredPrs3d_i*>(aPrs3d) )
+       if( !aColoredPrs3d->IsTimeStampFixed() )
+         isModal = 0;
+
       TDlg* aDlg = new TDlg (theModule);
       aDlg->initFromPrsObject(aPrs3d);
-      if (runAndWait(aDlg,TIsDlgModal)) {
+      if (runAndWait(aDlg,isModal)) {
        if (!(aDlg->storeToPrsObject(aPrs3d))) {
          delete aDlg;
          return;
@@ -74,6 +71,7 @@ namespace VISU
             QObject::tr("BUT_OK"));
        }
        if (theViewWindow) {
+         theViewWindow->highlight(theIO, 1);
          theViewWindow->getRenderer()->ResetCameraClippingRange();
          theViewWindow->Repaint();
        }
@@ -86,11 +84,13 @@ namespace VISU
        QApplication::restoreOverrideCursor();
       }
       delete aDlg;
+      RestoreSelection(theModule, NULL/*thePrs3d*/);
     }
   }
 
+
+  //----------------------------------------------------------------------------
   template<class TPrs3d_i, class TDlg, int TIsDlgModal>
-  inline
   void
   EditPrs3d(VisuGUI* theModule,
            Handle(SALOME_InteractiveObject)& theIO,
@@ -102,28 +102,82 @@ namespace VISU
       // Create SVTK_ViewWindow, if it does not exist
       aViewWindow = GetViewWindow<SVTK_Viewer>(theModule);
     if (aViewWindow) {
-      EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, thePrs3d, aViewWindow);
-      aViewWindow->highlight(theIO, 1);
+      EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, theIO, thePrs3d, aViewWindow);
     }
   }
 
+
   //---------------------------------------------------------------
   template<class TPrs3d_i>
-  inline
   TPrs3d_i*
-  CreatePrs3d(VisuGUI* theModule,
-             _PTR(SObject) theTimeStamp,
-             const char* theMeshName,
-             VISU::Entity theEntity,
-             const char* theFieldName,
-             int theTimeId)
+  CreatePrs3dFromFactory(VisuGUI* theModule,
+                        _PTR(SObject) theTimeStamp,
+                        const char* theMeshName,
+                        VISU::Entity theEntity,
+                        const char* theFieldName,
+                        int theTimeId,
+                        ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
     VISU::Result_var aResult;
-    if (CheckResult(theModule,theTimeStamp,aResult)){
+    if (CheckResult(theModule, theTimeStamp, aResult)){
       QApplication::setOverrideCursor(Qt::waitCursor);
-      TPrs3d_i* aPrs3d =
-       GetVisuGen(theModule)->template CreatePrs3d<TPrs3d_i>
-       (aResult,theMeshName,theEntity,theFieldName,theTimeId);
+      TPrs3d_i* aPrs3d = NULL;
+      if(thePublishInStudyMode == VISU::ColoredPrs3d_i::EPublishUnderTimeStamp)
+       aPrs3d = VISU::CreatePrs3d<TPrs3d_i>(aResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theTimeId);
+      else
+      {
+       CORBA::Float anUsedMemory = 0.0;
+       CORBA::Float aRequiredMemory = 0.0;
+       VISU::ColoredPrs3dCache::EnlargeType anEnlargeType = 
+         VISU::GetRequiredCacheMemory<TPrs3d_i>(aResult,
+                                                theMeshName,
+                                                theEntity,
+                                                theFieldName,
+                                                theTimeId,
+                                                anUsedMemory,
+                                                aRequiredMemory);
+
+       if( anEnlargeType == VISU::ColoredPrs3dCache::IMPOSSIBLE )
+       {
+         size_t aMb = 1024 * 1024;
+         double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+
+         CORBA::Float aNecessaryMemory = aRequiredMemory - aFreeMemory - anUsedMemory;
+         SUIT_MessageBox::warn1(GetDesktop(theModule),
+                                QObject::tr("WRN_VISU"),
+                                QObject::tr("ERR_NO_MEMORY_TO_BUILD").arg(aNecessaryMemory),
+                                QObject::tr("&OK") );
+         QApplication::restoreOverrideCursor();
+         return NULL;
+       }
+       else
+       {
+         if( anEnlargeType == VISU::ColoredPrs3dCache::ENLARGE )
+         {
+           if(SUIT_MessageBox::info2(GetDesktop(theModule),
+                                     QObject::tr("WRN_VISU"),
+                                     QObject::tr("WRN_EXTRA_MEMORY_REQUIRED").arg(aRequiredMemory),
+                                     QObject::tr("&OK"), QObject::tr("&Cancel"),
+                                     0, 1, 0) == 1)
+           {
+             QApplication::restoreOverrideCursor();
+             return NULL;
+           }
+         }
+         aPrs3d = VISU::CreateHolder2GetDeviceByType<TPrs3d_i>(aResult,
+                                                               theMeshName,
+                                                               theEntity,
+                                                               theFieldName,
+                                                               theTimeId,
+                                                               anEnlargeType,
+                                                               aRequiredMemory);
+       }
+      }
+      
       QApplication::restoreOverrideCursor();
       if(aPrs3d)
        return aPrs3d;
@@ -138,18 +192,17 @@ namespace VISU
 
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
-  inline
-  bool
-  CreatePrs3d(VisuGUI* theModule,
-             _PTR(SObject) theTimeStamp,
-             const Handle(SALOME_InteractiveObject)& theIO)
+  TPrs3d_i*
+  CreateAndEditPrs3d(VisuGUI* theModule,
+                    _PTR(SObject) theTimeStamp,
+                    ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
     Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
 
     bool isExist;
     QString aType = Storable::FindValue(aMap,"myType",&isExist);
     if (!isExist || aType.toInt() != TTIMESTAMP )
-      return false;
+      return NULL;
 
     QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
     QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
@@ -167,13 +220,14 @@ namespace VISU
     QApplication::setOverrideCursor(Qt::waitCursor);
 
     TPrs3d_i* aPrs3d =
-      CreatePrs3d<TPrs3d_i>(theModule,
-                           theTimeStamp,
-                           aMeshName.latin1(),
-                           (Entity)anEntity.toInt(),
-                           aFieldName.latin1(),
-                           aTimeStampId.toInt());
-
+      CreatePrs3dFromFactory<TPrs3d_i>(theModule,
+                                      theTimeStamp,
+                                      aMeshName.latin1(),
+                                      (Entity)anEntity.toInt(),
+                                      aFieldName.latin1(),
+                                      aTimeStampId.toInt(),
+                                      thePublishInStudyMode);
+    
     QApplication::restoreOverrideCursor();
     if (aPrs3d) {
       SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
@@ -193,10 +247,10 @@ namespace VISU
              QApplication::restoreOverrideCursor();
              delete aDlg;
            } else {
-             DeletePrs3d(theModule,aPrs3d,theIO);
+             DeletePrs3d(theModule,aPrs3d);
              QApplication::restoreOverrideCursor();
              delete aDlg;
-             return false;
+             return NULL;
            }
        }
       }
@@ -209,49 +263,100 @@ namespace VISU
        AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
       }
 
-      return true;
+      return aPrs3d;
     }
 
-    return false;
+    return NULL;
   }
 
 
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
-  inline
   void
-  CreatePrs3d(VisuGUI* theModule)
+  CreatePrs3dInViewer(VisuGUI* theModule,
+                     _PTR(SObject) theTimeStampSObj,
+                     ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
-    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
-      return;
-
-    _PTR(SObject) aTimeStampSObj;
-    Handle(SALOME_InteractiveObject) anIO;
-    if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
-      return;
-
     // Create new TViewWindow instance, if it does not exist.
     typedef typename TViewer::TViewWindow TViewWindow;
     if (!GetViewWindow<TViewer>(theModule))
       return;
 
-    if (!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
-      return;
+    TPrs3d_i* aPrs3d = CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>
+      (theModule,theTimeStampSObj,thePublishInStudyMode);
+
+    RestoreSelection(theModule, aPrs3d);
 
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
   }
 
+
+  //----------------------------------------------------------------------------
   template<class TPrs3d_i, class TDlg, int IsDlgModal>
-  inline
   void
-  CreatePrs3d(VisuGUI* theModule)
+  CreatePrs3d(VisuGUI* theModule,
+             const QString& theDesiredViewerType = QString())
   {
-    if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager())
-      if (aViewManager->getType() == VVTK_Viewer::Type()) 
-       return CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule);
+    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
+      return;
+
+    _PTR(SObject) aTimeStampSObj;
+    Handle(SALOME_InteractiveObject) anIO;
+    ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode;
+    if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode))
+      return;
 
-    CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule);
+    if(aPublishInStudyMode == VISU::ColoredPrs3d_i::EPublishIndependently){
+      CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,0>
+       (theModule,aTimeStampSObj,aPublishInStudyMode);
+      return;
+    }else{
+      if(theDesiredViewerType.isNull()){
+       if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager())
+         if (aViewManager->getType() == VVTK_Viewer::Type()){ 
+           CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+             (theModule,aTimeStampSObj,aPublishInStudyMode);
+           return;
+         }
+       CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
+         (theModule,aTimeStampSObj,aPublishInStudyMode);
+      }else{
+       if(theDesiredViewerType == VVTK_Viewer::Type())
+         CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+           (theModule,aTimeStampSObj,aPublishInStudyMode);
+       else
+         CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
+           (theModule,aTimeStampSObj,aPublishInStudyMode);
+      }
+    }
+  }
+
+
+  //----------------------------------------------------------------------------
+  template<typename TInterface> 
+  typename TInterface::_var_type
+  GetInterface(CORBA::Object_ptr theObject)
+  {
+    if(!CORBA::is_nil(theObject))
+      return TInterface::_narrow(theObject);
+    return TInterface::_nil();
   }
+  
+
+  //----------------------------------------------------------------------------
+  template<typename TServant> 
+  TServant*
+  GetServantInterface(CORBA::Object_ptr theObject)
+  {
+    if(!CORBA::is_nil(theObject)){
+      PortableServer::ServantBase_var aServant = GetServant(theObject);
+      return dynamic_cast<TServant*>(aServant.in());
+    }
+    return NULL;
+  }
+  
+
+  //----------------------------------------------------------------------------
 }
 
 #endif
index 45e47f88ce54d5d0ba08857be07a1b70bb2f982d..8455b972670bf223174cd6c51c641b91ba898800 100644 (file)
@@ -31,6 +31,7 @@
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
 
 #include "SVTK_ViewWindow.h"
 #include "SVTK_FontWidget.h"
@@ -42,6 +43,9 @@
 #include "VISU_ScalarMap_i.hh"
 #include "VISU_ScalarMapAct.h"
 
+#include "VISU_Result_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
+
 #include "LightApp_Application.h"
 
 #include "SUIT_Session.h"
 #include <qlayout.h>
 #include <qvalidator.h>
 #include <qcolordialog.h>
-
+#include <qtabwidget.h>
 #include <vtkTextProperty.h>
 
 using namespace std;
 
-
-VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
-  QVBox(parent), myPreviewActor(0)
-{
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-  QString propertyName;
-  propertyName = QString("scalar_bar_vertical_");
-  myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
-  myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
-  myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
-  myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
-  
-  propertyName = QString("scalar_bar_horizontal_");
-  myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
-  myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
-  myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
-  myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
-  
-  Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
-  myRangeMode = -1;
-
-  setSpacing(6);
-  //setMargin(11);
-
-  // Range ============================================================
-  RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
-  RangeGroup->setColumnLayout(0, Qt::Vertical );
-  RangeGroup->layout()->setSpacing( 0 );
-  RangeGroup->layout()->setMargin( 0 );
-  QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
-  RangeGroupLayout->setAlignment( Qt::AlignTop );
-  RangeGroupLayout->setSpacing( 6 );
-  RangeGroupLayout->setMargin( 11 );
-
-  myModeLbl = new QLabel("Scalar Mode", RangeGroup);
-
-  myModeCombo = new QComboBox(RangeGroup);
-
-  CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
-  CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
-  RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
-  RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
-  RBFrange->setChecked( true );
-
-  MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
-  MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  MinEdit->setMinimumWidth( 70 );
-  MinEdit->setValidator( new QDoubleValidator(this) );
-  MinEdit->setText( "0.0" );
-  QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
-  MinLabel->setBuddy(MinEdit);
-
-  MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
-  MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  MaxEdit->setMinimumWidth( 70 );
-  MaxEdit->setValidator( new QDoubleValidator(this) );
-  MaxEdit->setText( "0.0" );
-  QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
-  MaxLabel->setBuddy(MaxEdit);
-
-  RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
-  RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
-  RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
-  RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
-  RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
-  RangeGroupLayout->addWidget( MinLabel, 3, 0 );
-  RangeGroupLayout->addWidget( MinEdit,  3, 1 );
-  RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
-  RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
-
-  //TopLayout->addWidget( RangeGroup );
-
-  // Colors and Labels ========================================================
-  QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
-  ColLabGroup->setColumnLayout(0, Qt::Vertical );
-  ColLabGroup->layout()->setSpacing( 0 );
-  ColLabGroup->layout()->setMargin( 0 );
-  QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
-  ColLabGroupLayout->setAlignment( Qt::AlignTop );
-  ColLabGroupLayout->setSpacing( 6 );
-  ColLabGroupLayout->setMargin( 11 );
-
-  QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
-  ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
-  ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  ColorSpin->setMinimumWidth( 70 );
-  ColorSpin->setValue( 64 );
-
-  QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
-  LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
-  LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  LabelSpin->setMinimumWidth( 70 );
-  LabelSpin->setValue( 5 );
-
-  ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
-  ColLabGroupLayout->addWidget( ColorSpin,  0, 1);
-  ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
-  ColLabGroupLayout->addWidget( LabelSpin,  0, 3);
-
-  //TopLayout->addWidget( ColLabGroup );
-
-  // Orientation ==========================================================
-  QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
-  OrientGroup->setColumnLayout(0, Qt::Vertical );
-  OrientGroup->layout()->setSpacing( 0 );
-  OrientGroup->layout()->setMargin( 0 );
-  QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
-  OrientGroupLayout->setAlignment( Qt::AlignTop );
-  OrientGroupLayout->setSpacing( 6 );
-  OrientGroupLayout->setMargin( 11 );
-
-  RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
-  RBvert->setChecked( true );
-  RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
-  OrientGroupLayout->addWidget( RBvert, 0, 0 );
-  OrientGroupLayout->addWidget( RBhori, 0, 1 );
-
-  //  TopLayout->addWidget( OrientGroup );
-
-  // Origin ===============================================================
-  QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
-  OriginGroup->setColumnLayout(0, Qt::Vertical );
-  OriginGroup->layout()->setSpacing( 0 );
-  OriginGroup->layout()->setMargin( 0 );
-  QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
-  OriginGroupLayout->setAlignment( Qt::AlignTop );
-  OriginGroupLayout->setSpacing( 6 );
-  OriginGroupLayout->setMargin( 11 );
-
-  QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
-  XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
-  XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  XSpin->setMinimumWidth( 70 );
-  XSpin->setValue( 0.01 );
-
-  QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
-  YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
-  YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  YSpin->setMinimumWidth( 70 );
-  YSpin->setValue( 0.01 );
-
-  OriginGroupLayout->addWidget( XLabel, 0, 0);
-  OriginGroupLayout->addWidget( XSpin,  0, 1);
-  OriginGroupLayout->addWidget( YLabel, 0, 2);
-  OriginGroupLayout->addWidget( YSpin,  0, 3);
-
-  //TopLayout->addWidget( OriginGroup );
-
-  // Dimensions =========================================================
-  QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
-  DimGroup->setColumnLayout(0, Qt::Vertical );
-  DimGroup->layout()->setSpacing( 0 );
-  DimGroup->layout()->setMargin( 0 );
-  QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
-  DimGroupLayout->setAlignment( Qt::AlignTop );
-  DimGroupLayout->setSpacing( 6 );
-  DimGroupLayout->setMargin( 11 );
-
-  QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
-  WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
-  WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  WidthSpin->setMinimumWidth( 70 );
-  WidthSpin->setValue( 0.1 );
-
-  QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
-  HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
-  HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  HeightSpin->setMinimumWidth( 70 );
-  HeightSpin->setValue( 0.8 );
-
-  DimGroupLayout->addWidget( WidthLabel, 0, 0);
-  DimGroupLayout->addWidget( WidthSpin,  0, 1);
-  DimGroupLayout->addWidget( HeightLabel, 0, 2);
-  DimGroupLayout->addWidget( HeightSpin,  0, 3);
-
-  //TopLayout->addWidget( DimGroup );
-
-  // Save check box ===========================================================
-  QHBox* aSaveBox = new QHBox(this);
-  if (!SetPref) {
-    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
-    //TopLayout->addWidget(CBSave);
-  }
-  else {
-    CBSave = 0;
-  }
-  myTextBtn = new QPushButton("Text properties...", aSaveBox);
-  myTextDlg = new VisuGUI_TextPrefDlg(this);
-  myTextDlg->setTitleVisible(!SetPref);
-
-  QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
-  CheckGroup->setColumnLayout(0, Qt::Vertical );
-  CheckGroup->layout()->setSpacing( 0 );
-  CheckGroup->layout()->setMargin( 0 );
-  QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
-  
-  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
-  myPreviewCheck->setChecked(false);
-  CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
-
-  // signals and slots connections ===========================================
-  connect( RangeGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
-  connect( myModeCombo,   SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
-  connect( OrientGroup,  SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
-  connect( XSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
-  connect( YSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
-  connect( myTextBtn,    SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
-  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
-  connect( ColorSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
-  connect( LabelSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
-  connect( WidthSpin,    SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
-  connect( HeightSpin,   SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
-  connect( CBLog,        SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
-  changeRange( 0 );
-  changeDefaults( 0 );
-  myIsStoreTextProp = false;
-  myBusy = false;
-}
-
-/**
- * Initializes dialog box values from resources
- */
-void VisuGUI_ScalarBarPane::initFromResources() {
-  int sbCol=64,sbLab=5,orient=0;
-  float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
-  float sbVmin=0., sbVmax=0.;
-  bool sbRange=false;
-  QString aString;
-
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
-  bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
-  int aPlace = 1;
-  if (anIsArrangeBar){
-    aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
-  }
-
-  int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
-  myModeCombo->setCurrentItem(aScalarMode);
-
-  orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
-  if(orient != 0){
-    orient=1;
-    sbX1=0.2;
-    sbY1=0.01;
-    sbW=0.6;
-    sbH=0.12;
-  }
-  
-  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
-  sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
-  sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
-
-  sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
-  sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
-  
-  if(orient){
-    sbY1 += sbH*(aPlace-1);
-  } else {
-    sbX1 += sbW*(aPlace-1);
-  }
-  sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
-  sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
-
-  int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-  if (rangeType == 1) sbRange = true;
-  sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
-  sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
-
-  bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
-  setLogarithmic(isLog);
-  
-  if((sbX1 < 0.) || (sbY1 < 0.) ||
-     ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
-    if(orient == 0) {
-      sbX1=0.01;
-      sbY1=0.1;
-      sbW=0.1;
-      sbH=0.8;
-    } else {
-      sbX1=0.2;
-      sbY1=0.01;
-      sbW=0.6;
-      sbH=0.12;
-    }
-  }
-  if(sbCol < 2) sbCol=2;
-  if(sbCol > 64) sbCol=64;
-  if(sbLab < 2) sbLab=2;
-  if(sbLab > 65) sbLab=65;
-
-  if(sbVmin > sbVmax) {
-    sbVmin=0.;
-    sbVmax=0.;
-  }
-
-  setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
-  setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
-  setScalarBarData( sbCol, sbLab );
-
-  // "Title"
-  bool isBold = false, isItalic = false, isShadow = false;
-  int aFontFamily = VTK_ARIAL;
-
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
-      
-      if ( f.family() == "Arial" )
-       aFontFamily = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       aFontFamily = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       aFontFamily = VTK_TIMES;
-      
-      isBold = f.bold();
-      isItalic = f.italic();
-      isShadow =  f.underline();
-    }
-  
-  QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
-  
-  myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-
-  // "Labels"
-  isBold = isItalic = isShadow = false;
-  aFontFamily = VTK_ARIAL;
-
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
-      
-      if ( f.family() == "Arial" )
-       aFontFamily = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       aFontFamily = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       aFontFamily = VTK_TIMES;
-      
-      isBold = f.bold();
-      isItalic = f.italic();
-      isShadow =  f.underline();
-    }
-  
-  aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
-  
-  myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-}
-
-/**
- * Stores dialog values to resources
- */
-void VisuGUI_ScalarBarPane::storeToResources() {
-  int orient = (RBvert->isChecked())? 0 : 1;
-  float sbX1   = XSpin->value();
-  float sbY1   = YSpin->value();
-  float sbW    = WidthSpin->value();
-  float sbH    = HeightSpin->value();
-  int sbCol  = ColorSpin->value();
-  int sbLab  = LabelSpin->value();
-
-  if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
-    if(orient == 0) {
-      sbX1=0.01;
-      sbY1=0.1;
-      sbW=0.17;
-      sbH=0.8;
-    } else {
-      sbX1=0.2;
-      sbY1=0.01;
-      sbW=0.6;
-      sbH=0.12;
-    }
-  }
-
-  bool sbRange = RBIrange->isChecked();
-  float sbVmin = (float)(MinEdit->text().toDouble());
-  float sbVmax = (float)(MaxEdit->text().toDouble());
-
-  if(sbVmin > sbVmax) {
-    sbVmin=0.;
-    sbVmax=0.;
-  }
-
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
-  aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
-
-  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
-  aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
-  aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
-  aResourceMgr->setValue("VISU", propertyName + "width", sbW);
-  aResourceMgr->setValue("VISU", propertyName + "height", sbH);
-
-  aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
-  aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
-
-  if(sbRange)
-    {
-      aResourceMgr->setValue("VISU", "scalar_range_type", 1);
-      aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
-      aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
-    }
-  else
-    aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-  
-  aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
-  ////
-
-  if (myIsStoreTextProp) {
-    // "Title"
-    QColor aTitleColor (255, 255, 255);
-    int aTitleFontFamily = VTK_ARIAL;
-    bool isTitleBold = false;
-    bool isTitleItalic = false;
-    bool isTitleShadow = false;
-
-    myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
-                                    isTitleBold, isTitleItalic, isTitleShadow);
-
-    QFont aTitleFont;
-    
-    aTitleFont.setBold(isTitleBold);
-    aTitleFont.setItalic(isTitleItalic);
-    aTitleFont.setUnderline(isTitleShadow);
-    
-    QString titleFontFamily;
-    switch (aTitleFontFamily) {
-    case VTK_ARIAL:
-      titleFontFamily = "Arial";
-      break;
-    case VTK_COURIER:
-      titleFontFamily = "Courier";
-      break;
-    case VTK_TIMES:
-      titleFontFamily = "Times";
-      break;
-    }
-    aTitleFont.setFamily(titleFontFamily);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-    
-    // "Label"
-    QColor aLabelColor (255, 255, 255);
-    int aLabelFontFamily = VTK_ARIAL;
-    bool isLabelBold = false;
-    bool isLabelItalic = false;
-    bool isLabelShadow = false;
-
-    myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                    isLabelBold, isLabelItalic, isLabelShadow);
-
-
-    QFont aLabelFont;
-    
-    aLabelFont.setBold(isLabelBold);
-    aLabelFont.setItalic(isLabelItalic);
-    aLabelFont.setUnderline(isLabelShadow);
-
-    QString labelFontFamily;
-    switch (aLabelFontFamily) {
-    case VTK_ARIAL:
-      labelFontFamily = "Arial";
-      break;
-    case VTK_COURIER:
-      labelFontFamily = "Courier";
-      break;
-    case VTK_TIMES:
-      labelFontFamily = "Times";
-      break;
-    }
-
-    aLabelFont.setFamily(labelFontFamily);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
-
-    aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
-  }
-}
-
-/**
- * Initialise dialog box from presentation object
- */
-void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
-  initFromResources();
-  myScalarMap = thePrs;
-  myTitle = thePrs->GetTitle();
-  setPosAndSize( thePrs->GetPosX(),
-                thePrs->GetPosY(),
-                thePrs->GetWidth(),
-                thePrs->GetHeight(),
-                thePrs->GetBarOrientation());
-  switch(thePrs->GetScaling()){
-  case VISU::LOGARITHMIC :
-    setLogarithmic(true);
-    break;
-  default:
-    setLogarithmic(false);
-  }
-  vtkFloatingPointType aRange[2];
-  thePrs->GetScalarMapPL()->GetSourceRange(aRange);
-  Rmin = aRange[0]; Rmax = aRange[1];
-  setRange( thePrs->GetMin(), thePrs->GetMax(),
-           /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
-  setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
-
-  // Update myModeCombo
-  int aNbComp = thePrs->GetField()->myNbComp;
-  bool isScalarMode = (aNbComp > 1);
-  myModeCombo->clear();
-  myModeCombo->insertItem("<Modulus>");
-  const VISU::PField& aField = thePrs->GetField();
-  const VISU::TNames& aCompNames = aField->myCompNames;
-  const VISU::TNames& aUnitNames = aField->myUnitNames;
-  for(int i = 0; i < aNbComp; i++){
-    QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace();
-    if(aComponent.isNull() || aComponent == "")
-      aComponent = "Component " + QString::number(i+1);
-    else
-      aComponent = "[" + QString::number(i+1) + "] " + aComponent;
-
-    QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace();
-    if(anUnit.isNull() || anUnit == "")
-      anUnit = "-";
-    
-    aComponent = aComponent + ", " + anUnit;
-
-    myModeCombo->insertItem(aComponent);
-  }
-  //
-  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
-  if (aNbComp==1){
-    myModeCombo->setCurrentItem(1);
-  }
-  //
-  myModeLbl->setEnabled(isScalarMode);
-  myModeCombo->setEnabled(isScalarMode);
-
-  // "Title"
-  myTextDlg->setTitleText(QString(thePrs->GetTitle()));
-
-  vtkFloatingPointType R, G, B;
-  thePrs->GetTitleColor(&R, &G, &B);
-
-  myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
-                                  thePrs->GetTitFontType(),
-                                  thePrs->IsBoldTitle(),
-                                  thePrs->IsItalicTitle(),
-                                  thePrs->IsShadowTitle());
-
-  // "Labels"
-  thePrs->GetLabelColor(&R, &G, &B);
-
-  myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
-                                  thePrs->GetLblFontType(),
-                                  thePrs->IsBoldLabel(),
-                                  thePrs->IsItalicLabel(),
-                                  thePrs->IsShadowLabel());
-
-  // Draw Preview
-  if (myPreviewCheck->isChecked()) {
-    createScalarBar();
-    updatePreview();
-  }
-
-}
-/*! Slot update preview of scalar bar, if preview is checked
- */
-void VisuGUI_ScalarBarPane::updatePreview()
-{
-  if (myPreviewCheck->isChecked()) {
-    if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
-      deleteScalarBar();
-      createScalarBar();
-      vf->Repaint();
-    }
-  }
-}
-
-/*! Creating preview scalar bar
- */
-void VisuGUI_ScalarBarPane::createScalarBar()
-{
-  if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
-  if (myPreviewActor != 0) return;
-  if (myScalarMap == NULL) return;
-
-  if (!check()) return;
-  myScalarMapPL = VISU_ScalarMapPL::New();
-  if(myScalarMap->GetScalarMapPL())
-    myScalarMapPL->ShallowCopy(myScalarMap->GetScalarMapPL());
-  
-  if ( myBusy ) return;
-
-  myBusy = true;
-
-  int sbCol,sbLab;
-  sbCol = getNbColors();
-  sbLab = getNbLabels();
-  if(sbCol < 2) sbCol=2;
-  if(sbCol > 64) sbCol=64;
-  if(sbLab < 2) sbLab=2;
-  if(sbLab > 65) sbLab=65;
-  myPreviewActor = VISU_ScalarMapAct::New();
-  VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
-  myPreviewActor->GetScalarBar()->VisibilityOn();
-  myPreviewActor->PickableOff();
-  
-  myScalarMapPL->SetScalarMode(myModeCombo->currentItem());
-  if(isLogarithmic())
-    myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
-  else
-    myScalarMapPL->SetScaling(VISU::LINEAR);
-  vtkFloatingPointType theRange[2];
-  theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
-  theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
-  myScalarMapPL->SetScalarRange(theRange);
-  myScalarMapPL->SetNbColors(sbCol);
-  
-  myScalarMapPL->Update();
-  
-  aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
-  
-  if (myTextDlg->getTitleText().latin1() != "") 
-    aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
-  else
-    aScalarBarActor->SetTitle(myTitle.c_str());
-  aScalarBarActor->SetOrientation(getOrientation());
-  aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
-  aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
-  aScalarBarActor->SetWidth(getWidth());
-  aScalarBarActor->SetHeight(getHeight());
-  aScalarBarActor->SetNumberOfLabels(sbLab);
-  aScalarBarActor->SetMaximumNumberOfColors(sbCol);
-
-  // title text property
-  QColor aTitleColor;
-  int aTitleFontFamily;
-  bool isTitleBold;
-  bool isTitleItalic;
-  bool isTitleShadow;
-  myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
-                                 isTitleBold,isTitleItalic,isTitleShadow);
-  vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
-  aTitleProp->SetFontFamily(aTitleFontFamily);
-  aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
-                      vtkFloatingPointType(aTitleColor.green())/255.,
-                      vtkFloatingPointType(aTitleColor.blue())/255.);
-  (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
-  (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
-  (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-  
-  // label text property
-  QColor aLabelColor;
-  int aLabelFontFamily;
-  bool isLabelBold;
-  bool isLabelItalic;
-  bool isLabelShadow;
-  myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                 isLabelBold, isLabelItalic, isLabelShadow);
-  vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
-  aLabelProp->SetFontFamily(aLabelFontFamily);
-  aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
-                      vtkFloatingPointType(aLabelColor.green())/255.,
-                      vtkFloatingPointType(aLabelColor.blue())/255.);
-  (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
-  (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
-  (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
-
-  aScalarBarActor->Modified();
-
-  VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
-
-  myBusy = false;
-}
-/*! Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deleteScalarBar()
-{
-  if ( myBusy ) return;
-  
-  if (myPreviewActor == 0) return;
-  vtkRenderer* aRend       = myPreviewActor->GetRenderer();
-  vtkRenderWindow* aWnd = aRend->GetRenderWindow();
-  if(aRend && aWnd)
-    myPreviewActor->RemoveFromRender(aRend);
-  myPreviewActor->GetScalarBar()->VisibilityOff();
-  myPreviewActor->Delete();
-  myPreviewActor = 0;
-
-  if (myScalarMapPL){
-    myScalarMapPL->Delete();
-    myScalarMapPL = 0;
-  }
-}
-/*! public: Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deletePreview()
-{
-  deleteScalarBar();
-  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
-    vf->Repaint();
-}
-/**
- * Store values to presentation object
- */
-int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
-  thePrs->SetScalarMode(myModeCombo->currentItem());
-  thePrs->SetPosition(XSpin->value(), YSpin->value());
-  thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
-  thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
-  if(isLogarithmic())
-    thePrs->SetScaling(VISU::LOGARITHMIC);
-  else
-    thePrs->SetScaling(VISU::LINEAR);
-
-  if (RBFrange->isChecked()) {
-    thePrs->SetSourceRange();
-  } else {
-    thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
-  }
-  thePrs->SetNbColors(ColorSpin->value());
-  thePrs->SetLabels(LabelSpin->value());
-
-  if (isToSave()) storeToResources();
-
-  if (myIsStoreTextProp) {
-    // "Title"
-    thePrs->SetTitle(myTextDlg->getTitleText().latin1());
-
-    QColor aTitColor (255, 255, 255);
-    int aTitleFontFamily = VTK_ARIAL;
-    bool isTitleBold = false;
-    bool isTitleItalic = false;
-    bool isTitleShadow = false;
-
-    myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
-                                    isTitleBold, isTitleItalic, isTitleShadow);
-
-    thePrs->SetBoldTitle(isTitleBold);
-    thePrs->SetItalicTitle(isTitleItalic);
-    thePrs->SetShadowTitle(isTitleShadow);
-    thePrs->SetTitFontType(aTitleFontFamily);
-    thePrs->SetTitleColor(aTitColor.red()/255.,
-                         aTitColor.green()/255.,
-                         aTitColor.blue()/255.);
-
-    // "Label"
-    QColor aLblColor (255, 255, 255);
-    int aLabelFontFamily = VTK_ARIAL;
-    bool isLabelBold = false;
-    bool isLabelItalic = false;
-    bool isLabelShadow = false;
-
-    myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
-                                    isLabelBold, isLabelItalic, isLabelShadow);
-
-    thePrs->SetBoldLabel(isLabelBold);
-    thePrs->SetItalicLabel(isLabelItalic);
-    thePrs->SetShadowLabel(isLabelShadow);
-    thePrs->SetLblFontType(aLabelFontFamily);
-    thePrs->SetLabelColor(aLblColor.red()/255.,
-                         aLblColor.green()/255.,
-                         aLblColor.blue()/255.);
-    myIsStoreTextProp = false;
-  }
-
-  return 1;
-}
-
-/*!
-  Called when orientation is changed
-*/
-void VisuGUI_ScalarBarPane::changeDefaults( int )
-{
-  if ( RBvert->isChecked() ) {
-    XSpin->setValue( myVerX );
-    YSpin->setValue( myVerY );
-    WidthSpin->setValue( myVerW );
-    HeightSpin->setValue( myVerH );
-  }
-  else {
-    XSpin->setValue( myHorX );
-    YSpin->setValue( myHorY );
-    WidthSpin->setValue( myHorW );
-    HeightSpin->setValue( myHorH );
-  }
-  updatePreview();
-}
-
-/*!
-  Called when Range mode is changed
-*/
-void VisuGUI_ScalarBarPane::changeRange( int )
-{
-  int mode = -1;
-  if ( RBFrange->isChecked() )
-    mode = 0;
-  if ( RBIrange->isChecked() )
-    mode = 1;
-  if ( myRangeMode == mode )
-    return;
-  //MinSpin->setMaxValue( Fmin );
-  //MaxSpin->setMinValue( Fmax );
-  if ( RBFrange->isChecked() ) {
-    //MinLabel->setEnabled( false );
-    MinEdit->setEnabled( false );
-    //MaxLabel->setEnabled( false );
-    MaxEdit->setEnabled( false );
-    if ( mode != -1 ) {
-      Imin = MinEdit->text().toDouble();
-      Imax = MaxEdit->text().toDouble();
-    }
-    MinEdit->setText( QString::number( Rmin ) );
-    MaxEdit->setText( QString::number( Rmax ) );
-  }
-  else {
-    //MinLabel->setEnabled( true );
-    MinEdit->setEnabled( true );
-    //MaxLabel->setEnabled( true );
-    MaxEdit->setEnabled( true );
-    MinEdit->setText( QString::number( Imin ) );
-    MaxEdit->setText( QString::number( Imax ) );
-  }
-  myRangeMode = mode;
-  updatePreview();
-}
-
-/*!
-  Called when X,Y position is changed
-*/
-void VisuGUI_ScalarBarPane::XYChanged( double )
-{
-  QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
-  if ( snd == XSpin ) {
-    WidthSpin->setMaxValue( 1.0 - XSpin->value() );
-  }
-  if ( snd == YSpin ) {
-    HeightSpin->setMaxValue( 1.0 - YSpin->value() );
-  }
-  updatePreview();
-}
-
-/*!
-  Called when scalar mode is changed
-*/
-void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
-{
-  if ( myScalarMap ) {
-    if ( RBFrange->isChecked() ) {
-      vtkFloatingPointType aRange[2];
-      int aMode = myScalarMap->GetScalarMode();
-      myScalarMap->SetScalarMode(theMode);
-      myScalarMap->GetScalarMapPL()->GetSourceRange(aRange);
-      MinEdit->setText( QString::number( aRange[0] ) );
-      MaxEdit->setText( QString::number( aRange[1] ) );
-      myScalarMap->SetScalarMode(aMode);
-    }
-  }
-  updatePreview();
-}
-
-/*!
-  Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
-{
-  Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
-  if ( RBIrange->isChecked() ) {
-    MinEdit->setText( QString::number( Imin ) );
-    MaxEdit->setText( QString::number( Imax ) );
-  }
-  else {
-    MinEdit->setText( QString::number( Rmin ) );
-    MaxEdit->setText( QString::number( Rmax ) );
-  }
-  myRangeMode = -1;
-  if( sbRange )
-    RBIrange->setChecked( true );
-  else
-    RBFrange->setChecked( true );
-  changeRange( 0 );
-}
-
-/*!
-  Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
-  Rmin = imin;
-  Rmax = imax;
-}
-
-/*!
-  Sets size and position
-*/
-void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
-{
-  if ( vert ) {
-    myVerX = x;
-    myVerY = y;
-    myVerW = w;
-    myVerH = h;
-    RBvert->setChecked( true );
-  }
-  else {
-    myHorX = x;
-    myHorY = y;
-    myHorW = w;
-    myHorH = h;
-    RBhori->setChecked( true );
-  }
-  changeDefaults( 0 );
-}
-
-/*!
-  Sets colors and labels number
-*/
-void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
-{
-  ColorSpin->setValue( colors );
-  LabelSpin->setValue( labels );
-}
-
-/*!
-  Gets orientation
-*/
-int  VisuGUI_ScalarBarPane::getOrientation()
-{
-  if (RBvert->isChecked() )
-    return  1;
-  else
-    return 0;
-}
-
-/*!
-  Called when <OK> button is clicked, validates data and closes dialog
-*/
-bool VisuGUI_ScalarBarPane::check()
-{
-  double minVal = MinEdit->text().toDouble();
-  double maxVal = MaxEdit->text().toDouble();
-  if ( RBIrange->isChecked() ) {
-    if (minVal >= maxVal) {
-      SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
-                            tr("MSG_MINMAX_VALUES"),
-                            tr("BUT_OK"));
-      return false;
-    }
-  }
-  // check if logarithmic mode is on and check imposed range to not contain negative values
-  if ( CBLog->isChecked() ) {
-    if ( RBIrange->isChecked() ) {
-      if ( (minVal > 0) && (maxVal > 0) ) {
-       // nothing to do
-      }
-      else {
-       SUIT_MessageBox::warn1( this,
-                               tr("WRN_VISU"),
-                               tr("WRN_LOGARITHMIC_RANGE"),
-                               tr("BUT_OK"));
-       return false;
-      }
-    }
-    else {
-      if ( Rmin > 0 && Rmax > 0 ) {
-       // nothing to do
-      }
-      else {
-       SUIT_MessageBox::warn1( this,
-                               tr("WRN_VISU"),
-                               tr("WRN_LOGARITHMIC_FIELD_RANGE"),
-                               tr("BUT_OK"));
-       RBIrange->setChecked(1);
-       changeRange(1);
-       //MinEdit->setText( QString::number( Rmin ) );
-       //MaxEdit->setText( QString::number( Rmax ) );
-       return false;
-      }
-    }
-  }
-  return true;
-}
-
-void VisuGUI_ScalarBarPane::onTextPref()
-{
-  myTextDlg->storeBeginValues();
-  myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
-  updatePreview();
-}
-
-void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
-{
-  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
-    if (thePreview) {
-      createScalarBar();
-    } else {
-      deleteScalarBar();
-    }
-    vf->Repaint();
-  }
-}
-
-//#######################################################################################
-
 /*!
   Constructor
 */
 VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref)
-    : QDialog(VISU::GetDesktop(theModule), 0, true,
-              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setName("VisuGUI_ScalarBarDlg");
   setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
@@ -1082,8 +75,14 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se
   TopLayout->setSpacing(6);
   TopLayout->setMargin(11);
 
+  myTabBox = new QTabWidget(this);
   myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref);
-  TopLayout->addWidget(myScalarPane);
+  myScalarPane->setMargin( 5 );
+  myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAP, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
+
+  TopLayout->addWidget(myTabBox);
 
   // Common buttons ===========================================================
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
@@ -1116,6 +115,9 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se
   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
 }
 
+VisuGUI_ScalarBarDlg::~VisuGUI_ScalarBarDlg()
+{}
+
 /*!
   Called when <OK> button is clicked, validates data and closes dialog
 */
@@ -1157,135 +159,53 @@ void VisuGUI_ScalarBarDlg::onHelp()
 }
 
 /*!
-  Provides help on F1 button click
+  Initialize dialog from the presentation
 */
-void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
-}
-
-//#######################################################################################
-VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
-  : QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  setName("VisuGUI_TextPrefDlg");
-  setCaption(tr("TIT_TEXT_PREF"));
-  setSizeGripEnabled(TRUE);
-
-  QVBoxLayout* TopLayout = new QVBoxLayout(this);
-  TopLayout->setSpacing(6);
-  TopLayout->setMargin(11);
-
-  // "Title" grp
-  QGroupBox* aTitleGrp = new QGroupBox (2, Qt::Vertical, tr("LBL_TITLE"), this);
-
-  //   edit line
-  myTitleEdt = new QLineEdit (aTitleGrp);
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAP>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  //   font
-  QHBox* aHBox = new QHBox (aTitleGrp);
-  aHBox->setSpacing(5);
-  myTitleFont = new SVTK_FontWidget (aHBox);
+  myScalarPane->initFromPrsObject( myPrsCopy );
 
-  TopLayout->addWidget(aTitleGrp);
-
-  // "Labels" grp
-  QGroupBox* aLabelsGrp = new QGroupBox (1, Qt::Vertical, tr("LBL_LABELS"), this);
-
-  //   font
-  aHBox = new QHBox (aLabelsGrp);
-  aHBox->setSpacing(5);
-  myLabelFont = new SVTK_FontWidget (aHBox);
-
-  TopLayout->addWidget(aLabelsGrp);
-
-  // Common buttons ===========================================================
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-
-  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
-  QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" );
-  buttonHelp->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
-
-  TopLayout->addWidget( GroupButtons );
-
-  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
-  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-  connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
-}
+  if( !theInit )
+    return;
 
-void VisuGUI_TextPrefDlg::onHelp()
-{
-  QString aHelpFileName = "/files/scalar_map_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
   }
-}
-
-void VisuGUI_TextPrefDlg::storeBeginValues()
-{
-  myTitle = myTitleEdt->text();
-  myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
-  myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+  myTabBox->setCurrentPage( 0 );
 }
 
 /*!
-  Called when <Cancel> button is clicked, restore begin values
+  Store dialog to the presentation
 */
-void VisuGUI_TextPrefDlg::reject()
+int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  myTitleEdt->setText(myTitle);
-  myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]);
-  myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
+  int ok = 1;
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
 
-  QDialog::reject();
-}
-/*!
-  Called when <Ok> button is clicked, store begin values
-*/
-void VisuGUI_TextPrefDlg::accept()
-{
-  storeBeginValues();
+    ok = myInputPane->storeToPrsObject( myPrsCopy );
+  }
+
+  ok = ok && myScalarPane->storeToPrsObject( myPrsCopy );
 
-  QDialog::accept();
+  VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(thePrs, myPrsCopy);
+
+  return ok;
 }
 
 /*!
   Provides help on F1 button click
 */
-void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e )
+void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e )
 {
   QDialog::keyPressEvent( e );
   if ( e->isAccepted() )
index d9d0f6f2e909adce0adecc8c64e1424d89b1c5bd..56cd2849948bd3cd06009d64b7e0a2e6caab52b5 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef VISUGUI_SCALARBARDLG_H
 #define VISUGUI_SCALARBARDLG_H
 
-#include <qdialog.h>
+#include "VisuGUI_Prs3dDlg.h"
+
 #include <qbuttongroup.h>
 #include <qgroupbox.h>
 #include <qlabel.h>
 #include <qlineedit.h>
 #include <qcombobox.h>
 #include <qvbox.h>
-#include <qtoolbutton.h>
 
 #include "QtxDblSpinBox.h"
 
-#include "VISU_ScalarMap_i.hh"
-
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QRadioButton;
-class QCheckBox;
-class QPushButton;
-class QSpinBox;
-class QLineEdit;
-class QComboBox;
-class QVBox;
-class QToolButton;
-
-class QtxDblSpinBox;
-class SalomeApp_Module;
-class SVTK_FontWidget;
-class VISU_ScalarMapAct;
-
-class VisuGUI_TextPrefDlg: public QDialog
-{
-  Q_OBJECT;
-
- public:
-  VisuGUI_TextPrefDlg (QWidget* parent);
-  ~VisuGUI_TextPrefDlg() {};
-
-  QString getTitleText() { return myTitleEdt->text(); }
-  void setTitleText(QString theText) { myTitleEdt->setText(theText); }
-
-  void setTitleVisible (bool isVisible)
-    { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
-
-  void storeBeginValues();
-
- private:
-  void keyPressEvent( QKeyEvent* e );
-
- public:
-  SVTK_FontWidget* myTitleFont;
-  SVTK_FontWidget* myLabelFont;
-
- protected slots:
-  void accept();
-  void reject();
-  void onHelp();
-
- private:
-  QLineEdit* myTitleEdt;
-  QString    myTitle;
-  QColor     myColors[2];
-  int        myComboVals[2];
-  bool       myCheckVals[6];
-};
-
+class VisuGUI_InputPane;
 
-class VisuGUI_ScalarBarPane : public QVBox
+namespace VISU
 {
-  Q_OBJECT;
-
- public:
-  VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
-  ~VisuGUI_ScalarBarPane() {};
-
-  void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
-  void    setDefaultRange(double imin, double imax);
-  bool    isIRange() {return RBIrange->isChecked();}
-  double  getMin() {return MinEdit->text().toDouble();}
-  double  getMax() {return MaxEdit->text().toDouble();}
-  int     getOrientation();
-  void    setPosAndSize( double x, double y, double w, double h, bool vert );
-  double  getX() {return XSpin->value();}
-  double  getY() {return YSpin->value();}
-  double  getWidth() {return WidthSpin->value();}
-  double  getHeight() {return HeightSpin->value();}
-  void    setScalarBarData( int colors, int labels );
-  int     getNbColors() {return ColorSpin->value();}
-  int     getNbLabels() {return LabelSpin->value();}
-  bool    isLogarithmic() {return CBLog->isChecked();}
-  void    setLogarithmic( bool on ) {CBLog->setChecked( on );}
-  bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
-
-  void initFromResources();
-  void storeToResources();
-
-  void initFromPrsObject(VISU::ScalarMap_i* thePrs);
-  int storeToPrsObject(VISU::ScalarMap_i* thePrs);
-
-  bool check();
-  void deletePreview();
+  class ScalarMap_i;
+}
 
- protected:
-  QButtonGroup*   RangeGroup;
-  QRadioButton*   RBFrange;
-  QRadioButton*   RBIrange;
-  QLineEdit*      MinEdit;
-  QLineEdit*      MaxEdit;
-
-  QRadioButton*   RBhori;
-  QRadioButton*   RBvert;
-
-  QtxDblSpinBox* XSpin;
-  QtxDblSpinBox* YSpin;
-
-  QtxDblSpinBox* WidthSpin;
-  QtxDblSpinBox* HeightSpin;
-
-  QSpinBox*       ColorSpin;
-  QSpinBox*       LabelSpin;
-
-  QCheckBox*      CBSave;
-  QCheckBox*      CBLog;
-  QLabel*         myModeLbl;
-  QComboBox*      myModeCombo;
-  QPushButton*    myTextBtn;
-  VisuGUI_TextPrefDlg* myTextDlg;
-
-  double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
-  double          myHorX, myHorY, myHorW, myHorH;
-  double          myVerX, myVerY, myVerW, myVerH;
-  int             myRangeMode;
-  bool myIsStoreTextProp;
-
- private slots:
-  void changeDefaults( int );
-  void changeRange( int );
-  void XYChanged( double );
-  void changeScalarMode( int );
-  void onTextPref();
-  void onPreviewCheck(bool thePreview);
-  void updatePreview();
-
- private:
-  void createScalarBar();
-  void deleteScalarBar();
-
-  QCheckBox* myPreviewCheck;
-  VISU_ScalarMapAct* myPreviewActor;
-  VISU::ScalarMap_i* myScalarMap;
-  VISU_ScalarMapPL* myScalarMapPL;
-  std::string       myTitle;
-
-  bool myBusy;
-};
-
-
-class VisuGUI_ScalarBarDlg : public QDialog
+class VisuGUI_ScalarBarDlg : public VisuGUI_Prs3dDlg
 {
   Q_OBJECT;
 
  public:
   VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
-  ~VisuGUI_ScalarBarDlg() {};
+  ~VisuGUI_ScalarBarDlg();
 
   bool isToSave() {return myScalarPane->isToSave();}
 
   void initFromResources() {myScalarPane->initFromResources();}
   void storeToResources() {myScalarPane->storeToResources();}
 
-  void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
-  int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
+  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
  private:
   void keyPressEvent( QKeyEvent* e );
@@ -216,6 +77,10 @@ class VisuGUI_ScalarBarDlg : public QDialog
 
  protected:
   VisuGUI_ScalarBarPane* myScalarPane;
+  VisuGUI_InputPane* myInputPane;
+  QTabWidget* myTabBox;
+
+  SALOME::GenericObjPtr<VISU::ScalarMap_i> myPrsCopy;
 };
 
 #endif // VISUGUI_SCALARBARDLG_H
index b65bf0c282ed8e167c7b22e3bde0c1602a2436cf..8fb375efaa5889b15eb0b44fb9c23e39a0c27d86 100644 (file)
 #include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
 
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
 
 #include "VISU_Result_i.hh"
 #include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
 
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_ScalarMapOnDeformedShapePL.hxx"
@@ -61,12 +63,12 @@ using namespace std;
  * Constructor
  */
 VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
-    : QDialog(VISU::GetDesktop(theModule), "VisuGUI_ScalarMapOnDeformedShapeDlg", false,
-              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-      myIsAnimation(false),
-      myVisuGUI(theModule)
+  : VisuGUI_Prs3dDlg(theModule),
+    myIsAnimation(false),
+    myUpdateScalars(true),
+    myIteration(1),
+    myVisuGUI(theModule)
 {
-  myPrs = NULL;
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
 
@@ -74,7 +76,7 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
   TopLayout->setSpacing(6);
   TopLayout->setMargin(11);
 
-  QTabWidget* aTabBox = new QTabWidget (this);
+  myTabBox = new QTabWidget (this);
 
   // Scalar Map on Deformed shape pane
   QVBox* aBox = new QVBox (this);
@@ -112,13 +114,15 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
   TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
 
   //
-  aTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
+  myTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
 
   // Scalar bar pane
   myScalarPane = new VisuGUI_ScalarBarPane (this, false);
   myScalarPane->setMargin(5);
+  myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAPONDEFORMEDSHAPE, theModule, this);
 
-  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
 
   // Buttons
   QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
@@ -148,7 +152,7 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
   GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
 
   // Add Tab box and Buttons to the top layout
-  TopLayout->addWidget(aTabBox);
+  TopLayout->addWidget(myTabBox);
   TopLayout->addWidget(GroupButtons);
 
   // signals and slots connections
@@ -159,20 +163,25 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
   connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
 }
 
-void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
-             (VISU::ScalarMapOnDeformedShape_i* thePrs, bool isAnim)
-{
-  myIsAnimation = isAnim;
-  myPrs = thePrs;
-
-  setFactor(myPrs->GetScale());
-  myTimeStampsCombo->setDisabled(isAnim);
+VisuGUI_ScalarMapOnDeformedShapeDlg::~VisuGUI_ScalarMapOnDeformedShapeDlg()
+{}
 
-  QString aFieldName(myPrs->GetScalarFieldName().c_str());
-  float aIterFloat = GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
-                                             myPrs->GetScalarFieldName().c_str(),
-                                             myPrs->GetScalarIteration(),
-                                             myPrs->GetScalarEntity());
+void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+{
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(thePrs,
+                                                                              VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  setFactor(myPrsCopy->GetScale());
+  myTimeStampsCombo->setDisabled(myIsAnimation);
+  myCurrMeshName = myPrsCopy->GetCMeshName();
+
+  QString aFieldName(myPrsCopy->GetScalarFieldName().c_str());
+  CORBA::String_var aMeshName = myPrsCopy->GetMeshName();
+  float aIterFloat = GetFloatValueOfTimeStamp(aMeshName.in(),
+                                             myPrsCopy->GetScalarFieldName().c_str(),
+                                             myPrsCopy->GetScalarIteration(),
+                                             myPrsCopy->GetScalarEntity());
   QString aIteration(QString("%1").arg(aIterFloat));
 
   if (myMeshFieldsTimes.size() == 0)
@@ -244,8 +253,6 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
 
       for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
         _PTR(SObject) aChildSObj = aIter->Value();
-        CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
-
         _PTR(GenericAttribute) anAttr;
         if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
           _PTR(AttributeComment) aComment (anAttr);
@@ -257,12 +264,13 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
           VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
           if (isExist) {
             if ((aType == VISU::TTIMESTAMP)) {
-              _PTR(GenericAttribute) aNameAttr;
-              if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
-                _PTR(AttributeName) aName (aNameAttr);
-                VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+              _PTR(GenericAttribute) anAttr;
+              if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
+                _PTR(AttributeName) aNameAttr(anAttr);
                 QString aMeshName = VISU::getValue(aChildSObj, "myMeshName");
-                if (QString(myPrs->GetMeshName().c_str()) != aMeshName) continue;
+               CORBA::String_var aName = myPrsCopy->GetMeshName();
+                if (aMeshName != aName.in()) 
+                 continue;
                 myCurrMeshName = aMeshName;
                 QString aFieldName = VISU::getValue(aChildSObj, "myFieldName");
                 QString aTimeIter  = VISU::getValue(aChildSObj, "myTimeStampId");
@@ -277,7 +285,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
                 TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
                 TFE aKey (aFieldName.latin1(), anEntity);
                 aFieldsMap[aKey][aTimeIter.toInt()] = 
-                  GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
+                  GetFloatValueOfTimeStamp(aMeshName.latin1(),
                                            aFieldName.latin1(),
                                            aTimeIter.toInt(),
                                            anEntity);
@@ -295,32 +303,50 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject
   myTimeStampsCombo->setCurrentText(aIteration);
   SetScalarField( false );
 
-  myScalarPane->initFromPrsObject(myPrs);
+  myScalarPane->initFromPrsObject(myPrsCopy);
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
-int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject
-            (VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalars, int theIter)
+int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  thePrs->SetScale(getFactor());
+  myPrsCopy->SetScale(getFactor());
 
   if (myIsAnimation)
-    thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
-                          getCurrentScalarFieldName().latin1(),
-                          theIter,
-                          myPrs->GetScalarEntity());
+    myPrsCopy->SetCScalarField(myPrsCopy->GetScalarMeshName().c_str(),
+                              getCurrentScalarFieldName().latin1(),
+                              myIteration,
+                              myPrsCopy->GetScalarEntity());
   else
-    thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
-                          getCurrentScalarFieldName().latin1(),
-                          myTimeStampsCombo->currentItem() + 1,
-                          myPrs->GetScalarEntity());
+    myPrsCopy->SetCScalarField(myPrsCopy->GetScalarMeshName().c_str(),
+                              getCurrentScalarFieldName().latin1(),
+                              myTimeStampsCombo->currentItem() + 1,
+                              myPrsCopy->GetScalarEntity());
 
-  if (theUpdateScalars) SetScalarField( false );
+  if (myUpdateScalars) SetScalarField( false );
 
-  thePrs->ShowColored(true);
+  myPrsCopy->ShowColored(true);
 
-  myScalarPane->storeToPrsObject(thePrs);
+  myScalarPane->storeToPrsObject(myPrsCopy);
+
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+    myInputPane->storeToPrsObject( myPrsCopy );
+  }
 
-  myPrs = thePrs;
+  VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
 
   return 1;
 }
@@ -364,14 +390,14 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString the
 
   VISU::TEntity anEntity = getCurrentScalarEntity();
 
-  myPrs->SetScalarField(myCurrMeshName.latin1(),
-                       aFieldName.latin1(),
-                       theIter,
-                       anEntity);
+  myPrsCopy->SetCScalarField(myCurrMeshName.latin1(),
+                        aFieldName.latin1(),
+                        theIter,
+                        anEntity);
 
   if( save_scalar_pane )
   {
-    myScalarPane->storeToPrsObject(myPrs);
+    myScalarPane->storeToPrsObject(myPrsCopy);
     UpdateScalarField();
   }
 }
@@ -445,15 +471,15 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
-  myPrs->SetScale(getFactor());
+  myPrsCopy->SetScale(getFactor());
   vtkFloatingPointType aRange[2];
-  myPrs->GetScalarMapOnDeformedShapePL()->Build();
-  myPrs->GetScalarMapOnDeformedShapePL()->Update();
-  myPrs->GetScalarMapOnDeformedShapePL()->GetSourceRange(aRange);
+  myPrsCopy->GetSpecificPL()->Build();
+  myPrsCopy->GetSpecificPL()->Update();
+  myPrsCopy->GetSpecificPL()->GetSourceRange(aRange);
   double aDoubleRange[2];
   aDoubleRange[0] = double(aRange[0]);
   aDoubleRange[1] = double(aRange[1]);
-  myScalarPane->initFromPrsObject(myPrs);
+  myScalarPane->initFromPrsObject(myPrsCopy);
   myScalarPane->setRange(aDoubleRange[0],aDoubleRange[1],myScalarPane->isIRange());
 }
 
@@ -462,7 +488,7 @@ float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(const char*
                                                                    const int   theIter,
                                                                    const VISU::TEntity  theEntity){
   float ret=1;
-  VISU::Result_i* theResult = myPrs->GetResult();
+  VISU::Result_i* theResult = myPrsCopy->GetCResult();
   VISU::PField aField = theResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
   if(!aField) return ret;
   VISU::TValField& aValField = aField->myValField;
index 3151bd934c0a93859c38bb09e140c8ef9788f9a7..f891508f25f3a6f5ade6bf0439040bf66aa83ac8 100644 (file)
 #ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
 #define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Convertor.hxx"
 
 #include "QtxDblSpinBox.h"
 
 #include <qdialog.h>
 #include <qgroupbox.h>
 #include <qcheckbox.h>
+#include <qcombobox.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
+#include <qtabwidget.h>
 
 #include <set>
 
 class SalomeApp_Module;
-class QComboBox;
-class QString;
+class VisuGUI_InputPane;
 
-namespace VISU{
+namespace VISU
+{
   class ScalarMapOnDeformedShape_i;
 }
 
-class VisuGUI_ScalarMapOnDeformedShapeDlg : public QDialog
+class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 
 public:
     VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule);
-    ~VisuGUI_ScalarMapOnDeformedShapeDlg() {};
+    ~VisuGUI_ScalarMapOnDeformedShapeDlg();
 
     double getFactor()
       { return ScalFact->value(); }
     void setFactor(double theFactor)
       { ScalFact->setValue(theFactor); }
     
+    void setAnimation( bool on ) { myIsAnimation = on; }
+    void setUpdateScalars( bool on ) { myUpdateScalars = on; }
+    void setIteration( int value ) { myIteration = value; }
 
-    void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false);
-    int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars=true,int theIter=1);
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
     int getCurrentScalarFieldNamePos();
     QString getCurrentScalarFieldName();
@@ -85,7 +93,9 @@ private slots:
 
 private:
  QtxDblSpinBox* ScalFact;
+ QTabWidget* myTabBox;
  VisuGUI_ScalarBarPane* myScalarPane;
+ VisuGUI_InputPane*     myInputPane;
  QComboBox *myFieldsCombo;
  QComboBox *myTimeStampsCombo;
  
@@ -98,9 +108,11 @@ private:
  QString myCurrMeshName;
  int myCurrScalarIter;
  bool myIsAnimation;
+ bool myUpdateScalars;
+ int myIteration;
  
  _PTR(SObject) mySelectionObj;
VISU::ScalarMapOnDeformedShape_i* myPrs;
SALOME::GenericObjPtr<VISU::ScalarMapOnDeformedShape_i> myPrsCopy;
  SalomeApp_Module* myVisuGUI;
  
 protected:
index 6ddd429f89265398c21e28e0acaa80bfddba71f6..3a5c5bdfaa707f6dd70b8097371a4ec8928b9d47 100644 (file)
@@ -415,7 +415,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
     myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
 
     VISU_Actor* anVISUActor =
-      VISU::FindActor(aViewWindow, aSObject->GetID().c_str());
+      VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str());
     if (anVISUActor) {
       vtkFloatingPointType aCoord[6];
       anVISUActor->GetBounds(aCoord);
@@ -575,7 +575,7 @@ bool onIdEdit (const QString& theText,
 
   if (aPrs3d) {
     int anId = theText.toInt();
-    vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput();
+    vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput();
     int aMaxId = (aDataSet->*theMethod)();
     if (anId < 0) anId = 0;
     if (anId >= aMaxId) anId = aMaxId - 1;
index 7a1820c13868dad69bc36c110c3d0fef1ba81b69..6ed2d9781a1bf1930f304823ffd63c1839302abf 100644 (file)
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
 
 #include "VISU_Mesh_i.hh"
 #include "VISU_Gen_i.hh"
 #include "VISU_StreamLines_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_Actor.h"
 
 
 #include <SALOMEDSClient_SObject.hxx>
 
+#include "QtxDblSpinBox.h"
+
 #include <limits.h>
 #include <qlayout.h>
+#include <qcheckbox.h>
 #include <qgroupbox.h>
 #include <qcolordialog.h>
 #include <qtabwidget.h>
+#include <qpushbutton.h>
 
 using namespace std;
 
 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
-     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_StreamLinesDlg", false,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-       myVisuGUI(theModule)
+  : VisuGUI_Prs3dDlg(theModule),
+    myVisuGUI(theModule)
 {
-  myPrs = NULL;
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
 
@@ -68,7 +72,7 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   aBoxLayout->setSpacing( 6 );
   aBoxLayout->setMargin( 11 );
 
-  QTabWidget* aTabBox = new QTabWidget(this);
+  myTabBox = new QTabWidget(this);
 
   QFrame* aTopBox = new QFrame(this);
   aTopBox->setMargin( 11 );
@@ -266,12 +270,14 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
   TopLayout->addWidget( SelColor, 5, 1);
 
-  aTabBox->addTab(aTopBox, "Stream Lines");
+  myTabBox->addTab(aTopBox, "Stream Lines");
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
   myScalarPane->setMargin( 5 );
-  aTabBox->addTab(myScalarPane, "Scalar Bar");
+  myInputPane = new VisuGUI_InputPane(VISU::TSTREAMLINES, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
 
-  aBoxLayout->addWidget(aTabBox);
+  aBoxLayout->addWidget(myTabBox);
 
   QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
   aGroupButtons->setColumnLayout(0, Qt::Vertical );
@@ -306,14 +312,18 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   enableSetColor();
 }
 
+VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
+{}
 
-void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
+void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
 {
-  myScalarPane->initFromPrsObject(thePrs);
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  myScalarPane->initFromPrsObject( myPrsCopy );
 
-  myPrs = thePrs;
   static int aNbOfSteps = 30;
-  VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL();
+  VISU_StreamLinesPL* aStreamLinesPL = myPrsCopy->GetSpecificPL();
   float aMin, aMax;
   aMin = aStreamLinesPL->GetMinPropagationTime();
   aMax = aStreamLinesPL->GetMaxPropagationTime();
@@ -333,7 +343,7 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
   myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
   myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
 
-  switch (thePrs->GetDirection()) {
+  switch (myPrsCopy->GetDirection()) {
   case VISU::StreamLines::FORWARD:
     myDirCombo->setCurrentItem(0);
     break;
@@ -343,13 +353,13 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
   case VISU::StreamLines::BOTH:
     myDirCombo->setCurrentItem(2);
   }
-  myUseScalar->setChecked(thePrs->IsColored());
-  myPntPercent->setValue(thePrs->GetUsedPoints());
+  myUseScalar->setChecked(myPrsCopy->IsColored());
+  myPntPercent->setValue(myPrsCopy->GetUsedPoints());
 
   mySrcCombo->setEnabled(false);
-  QString aSrcEntry = thePrs->GetSourceEntry();
+  QString aSrcEntry = myPrsCopy->GetSourceEntry();
 
-  SALOMEDS::Color anOldColor = thePrs->GetColor();
+  SALOMEDS::Color anOldColor = myPrsCopy->GetColor();
   QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
   setColor(aColor);
   enableSetColor();
@@ -374,19 +384,40 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
     INITPRS(myPrsList, 4);
   }
 #undef INITPRS
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
+
 }
 
-int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
+int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
+  bool isAccepted = myScalarPane->storeToPrsObject(myPrsCopy);
+
+  if( isAccepted && !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+    isAccepted = myInputPane->storeToPrsObject( myPrsCopy );
+  }
+
   if (isAccepted) {
-    thePrs->ShowColored(myUseScalar->isChecked());
-    if (!thePrs->IsColored()) {
+    myPrsCopy->ShowColored(myUseScalar->isChecked());
+    if (!myPrsCopy->IsColored()) {
       SALOMEDS::Color aColor;
       aColor.R = myColor.red()/255.;
       aColor.G = myColor.green()/255.;
       aColor.B = myColor.blue()/255.;
-      thePrs->SetColor(aColor);
+      myPrsCopy->SetColor(aColor);
     }
 
     VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
@@ -431,7 +462,7 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
        aPrs = createMesh(aType, aName);
       }
     }
-    isAccepted = thePrs->SetParams(myIntegStepLen->value(),
+    isAccepted = myPrsCopy->SetParams(myIntegStepLen->value(),
                                   myPropTime->value(),
                                   myStepLen->value(),
                                   aPrs,
@@ -442,6 +473,9 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
   //  SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"),
   //                         tr("ERR_CANT_BUILD_PRESENTATION"),
   //                         tr("BUT_OK"));
+
+  VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(thePrs, myPrsCopy);
+
   return isAccepted;
 }
 
index 263ef4be4923dd22c7bdbe8795e138c10647d72c..1d67efd1fc3a39d7bb0333995f96807417f95a7d 100644 (file)
 #ifndef VISUGUI_STREAMLINESDLG_H
 #define VISUGUI_STREAMLINESDLG_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
 
-#include <qdialog.h>
+#include <qlabel.h>
 #include <qcombobox.h>
 #include <qcheckbox.h>
 #include <qstringlist.h>
+#include <qtabwidget.h>
+
+#include "VISUConfig.hh"
 
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 class QtxDblSpinBox;
 
-namespace VISU{
+namespace VISU
+{
   class StreamLines_i;
 }
 
-class VisuGUI_StreamLinesDlg: public QDialog
+class VisuGUI_StreamLinesDlg: public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 public:
     VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule);
-    ~VisuGUI_StreamLinesDlg() {};
+    ~VisuGUI_StreamLinesDlg();
+
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
-    void initFromPrsObject(VISU::StreamLines_i* thePrs);
-    int storeToPrsObject(VISU::StreamLines_i* thePrs);
     void setColor( QColor color );
     void enableMagnColor( bool enable );
 
@@ -80,7 +86,9 @@ private:
     QtxDblSpinBox* myPntPercent;
     QComboBox* mySrcCombo;
 
+    QTabWidget*            myTabBox;
     VisuGUI_ScalarBarPane* myScalarPane;
+    VisuGUI_InputPane*     myInputPane;
 
     QValueList<VISU::Prs3d_var> myPrsList;
     QValueList<VISU::Prs3d_var> myEntityList;
@@ -92,7 +100,7 @@ private:
     QStringList myPrsLst;
 
     _PTR(SObject) mySelectionObj;
-    VISU::StreamLines_i* myPrs;
+    SALOME::GenericObjPtr<VISU::StreamLines_i> myPrsCopy;
     SalomeApp_Module* myVisuGUI;
 
 private slots:
index 91d6fd39fc44b869568fcf682dc213654a118dc1..70f7fc77796a87559aede6579424256a1ad13514 100644 (file)
@@ -26,6 +26,7 @@
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
+#include "VisuGUI_ScalarBarDlg.h"
 #include "VisuGUI_DeformedShapeDlg.h"
 #include "VisuGUI_CutPlanesDlg.h"
 #include "VisuGUI_CutLinesDlg.h"
@@ -80,6 +81,7 @@
 #include <qhgroupbox.h>
 #include <qlcdnumber.h>
 #include <qvgroupbox.h>
+#include <qtoolbutton.h>
 
 #define  MAXVAL 1e10
 
@@ -105,30 +107,34 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   myFieldLst->setSelected(0, true);
 }
 
-ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow)
+ArrangeDlg::ArrangeDlg(QWidget* theParent, 
+                      const SalomeApp_Module* theModule,
+                      SVTK_ViewWindow* theViewWindow)
   : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize |
             WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-    myAnimator(NULL), myViewWindow(theViewWindow)
+    myAnimator(NULL), 
+    myViewWindow(theViewWindow)
 {
   myCurrent = 0;
   init();
   QStringList aPrsNames;
-  vtkActor* anActor;
-  vtkActorCollection *anActColl = myViewWindow->getRenderer()->GetActors();
-  for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;) {
-    VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor);
-    if (anVISUActor)
-      if (anVISUActor->GetVisibility() != 0) {
-       VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
-       if (aPrs) {
-         if (!myPrsMap.contains(aPrs)) {
-           SALOMEDS::SObject_var aSObject = aPrs->GetSObject();
-           if(!aSObject->_is_nil()){
-             SALOMEDS::GenericAttribute_var anAttr;
+  vtkActorCollection *aCollection = myViewWindow->getRenderer()->GetActors();
+  aCollection->InitTraversal();
+  while(vtkActor* anActor = aCollection->GetNextActor()){
+    if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+      if(anVISUActor->GetVisibility() != 0){
+       if (VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d()){
+         if(!myPrsMap.contains(aPrs)){
+           Handle(SALOME_InteractiveObject) anIO = aPrs->GetIO();
+           if(!anIO->hasEntry())
+             continue;
+           SalomeApp_Study* aStudy = VISU::GetAppStudy(theModule);
+           VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anIO->getEntry());
+           if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+             _PTR(GenericAttribute) anAttr;
              if (aSObject->FindAttribute(anAttr, "AttributeName")) {
-               SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-               string aNam = aName->Value();
-               QString strIn(aNam.c_str());
+               _PTR(AttributeName) aName(anAttr);
+               QString strIn(aName->Value().c_str());
                aPrsNames.append(strIn);
                myPrsMap[aPrs] = myOffsets.count();
                Offset aOffs;
@@ -360,7 +366,7 @@ void ArrangeDlg::acceptViewWindow()
     for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it) {
       VISU::Prs3d_i* aPrs = it.key();
       Offset& aOffs = myOffsets[it.data()];
-      if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow))
+      if (VISU_Actor* anActor = VISU::FindActor(myViewWindow, aPrs))
         anActor->SetPosition(aOffs.myOffset);
       if (mySaveChk)
        if (mySaveChk->isChecked())
@@ -375,7 +381,7 @@ void ArrangeDlg::acceptViewWindow()
     QMap<VISU::Prs3d_i*, int>::Iterator it;
     for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) {
       VISU::Prs3d_i* aPrs = it.key();
-      if (VISU_Actor* aActor = VISU::GetActor(aPrs, myViewWindow)) {
+      if (VISU_Actor* aActor = VISU::FindActor(myViewWindow, aPrs)) {
        int aAxis = getAxis();
 
        vtkFloatingPointType aZeroOffset[3];
@@ -792,7 +798,8 @@ void SetupDlg::onPreferencesDlg()
       typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
       typedef VISU::ScalarMapOnDeformedShape_i TYPE;
       DLG* aDlg = new DLG (myModule);
-      aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]),true);
+      aDlg->setAnimation( true );
+      aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]));
       if (aDlg->exec())
         { 
          int anbFrames=aDlg->getCurrentScalarNbIterations();
@@ -802,7 +809,9 @@ void SetupDlg::onPreferencesDlg()
            aIter = i+1;
            if(i+1 > anbFrames)
              aIter=anbFrames;
-           aDlg->storeToPrsObject(aCurrPrs_i,false,aIter);
+           aDlg->setUpdateScalars(false);
+           aDlg->setIteration(aIter);
+           aDlg->storeToPrsObject(aCurrPrs_i);
          }
        }
       delete aDlg;
index 604cd24bc4e01c096528a04d86dadc0eafbc2862..dcaea8a0777ec3284ae8e5f48f4bc08d057cb0a2 100644 (file)
 #include <map>
 
 class VisuGUI;
+class SalomeApp_Module;
 class VISU_TimeAnimation;
 
-namespace VISU {
+namespace VISU 
+{
   class Prs3d_i;
 }
 
@@ -64,8 +66,13 @@ class ArrangeDlg: public QDialog
   enum { AutoMode, ManualMode };
   enum { XAxis, YAxis, ZAxis };
 
-  ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
-  ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
+  ArrangeDlg(QWidget* theParent, 
+            VISU_TimeAnimation* theAnimator);
+
+  ArrangeDlg(QWidget* theParent, 
+            const SalomeApp_Module* theModule,
+            SVTK_ViewWindow* theViewWindow);
+
   ~ArrangeDlg() {};
 
   int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }
index f9ea32df126fa8ad8b97be5e44f3dd72cec0fd02..a60184ea14b6c724373aede83f94cea22afd6a9e 100644 (file)
 
 
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_Prs3dTools.h"
+#include "VisuGUI_DialogRunner.h"
 
 #include "VisuGUI.h"
-#include "VisuGUI_ViewTools.h"
 
 #include "VISU_Gen_i.hh"
 #include "VISU_Prs3d_i.hh"
 //=============================================================================
 namespace VISU
 {
+  //------------------------------------------------------------
   SUIT_Desktop*
   GetDesktop(const CAM_Module* theModule)
   {
     return theModule->application()->desktop();
   }
 
+  //------------------------------------------------------------
   LightApp_SelectionMgr*
   GetSelectionMgr(const SalomeApp_Module* theModule)
   {
     return theModule->getApp()->selectionMgr();
   }
 
+  //------------------------------------------------------------
   SalomeApp_Study*
   GetAppStudy(const CAM_Module* theModule)
   {
@@ -91,12 +96,14 @@ namespace VISU
       dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
   }
 
+  //------------------------------------------------------------
   _PTR(Study)
   GetCStudy(const SalomeApp_Study* theStudy)
   {
     return theStudy->studyDS();
   }
 
+  //------------------------------------------------------------
   bool
   IsStudyLocked( _PTR(Study) theStudy )
   {
@@ -105,6 +112,7 @@ namespace VISU
     return true;
   }
 
+  //------------------------------------------------------------
   bool
   CheckLock( _PTR(Study) theStudy,
             QWidget* theWidget )
@@ -119,6 +127,15 @@ namespace VISU
     return false;
   }
 
+  //------------------------------------------------------------
+  int
+  runAndWait( QDialog* dlg, const bool modal )
+  {
+    VisuGUI_DialogRunner r( dlg );
+    return r.run( modal );
+  }
+
+  //------------------------------------------------------------
   LightApp_DataObject*
   FindDataObject(SUIT_DataObject* theDataObject,
                 const QString& theEntry,
@@ -146,6 +163,7 @@ namespace VISU
     return NULL;
   }
 
+  //------------------------------------------------------------
   LightApp_DataObject*
   FindDataObject(CAM_Module* theModule,
                 _PTR(SObject) theSObject)
@@ -160,6 +178,7 @@ namespace VISU
     return FindDataObject(aRootDataObject,anEntry.c_str(),aLevel);
   }
 
+  //------------------------------------------------------------
   void
   UpdateObjBrowser(SalomeApp_Module* theModule,
                   bool theIsUpdateDataModel,
@@ -173,6 +192,7 @@ namespace VISU
     theModule->getApp()->updateActions();
   }
 
+  //------------------------------------------------------------
   bool
   IsSObjectTable( _PTR(SObject) theSObject )
   {
@@ -186,6 +206,7 @@ namespace VISU
     return false;
   }
 
+  //------------------------------------------------------------
   VISU_Gen_i*
   GetVisuGen(const CAM_Module* theModule)
   {
@@ -204,6 +225,7 @@ namespace VISU
     return aGen;
   }
 
+  //------------------------------------------------------------
   SALOME_MED::MED_Gen_var
   GetMEDEngine()
   {
@@ -219,7 +241,9 @@ namespace VISU
   }
 
 
-  VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject)
+  //------------------------------------------------------------
+  VISU::Storable::TRestoringMap 
+  getMapOfValue(_PTR(SObject) theSObject)
   {
     VISU::Storable::TRestoringMap aMap;
     if (theSObject) {
@@ -234,7 +258,9 @@ namespace VISU
     return aMap;
   }
 
-  QString getValue (_PTR(SObject) theSObject, QString theKey)
+  //------------------------------------------------------------
+  QString 
+  getValue(_PTR(SObject) theSObject, QString theKey)
   {
     QString aStr("");
     VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
@@ -243,69 +269,122 @@ namespace VISU
     return aStr;
   }
 
-  //------------------------------------------------------------
-  // Selection
-  CORBA::Object_var
-  GetSelectedObj(const SalomeApp_Study* theStudy,
-                const QString& theEntry,
-                VISU::Storable::TRestoringMap* theMap)
-  {
-    if (!theStudy || theEntry.isEmpty())
-      return CORBA::Object::_nil();
 
-    _PTR(Study) aStudy = GetCStudy(theStudy);
-    _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry.latin1());
-    if (aSObject) {
-      _PTR(GenericAttribute) anAttr;
-      if (theMap && aSObject->FindAttribute(anAttr,"AttributeComment")) {
-       _PTR(AttributeComment) aComment (anAttr);
-       std::string aValue = aComment->Value();
-       QString aString (aValue.c_str());
-       VISU::Storable::StrToMap(aString, *theMap);
-      }
-      return VISU::ClientSObjectToObject(aSObject);
-    }
-    return CORBA::Object::_nil();
-  }
-
-  CORBA::Object_var
-  GetSelectedObj(const SalomeApp_Module* theModule,
-                Handle(SALOME_InteractiveObject)* theIO,
-                VISU::Storable::TRestoringMap* theMap)
+  //----------------------------------------------------------------------------
+  // Selection
+  TSelectionInfo
+  GetSelectedObjects(const SalomeApp_Module* theModule)
   {
+    TSelectionInfo aSelectionInfo;
+    const SalomeApp_Study* aStudy = GetAppStudy(theModule);
     LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
     SALOME_ListIO aListIO;
     aSelectionMgr->selectedObjects(aListIO);
     SALOME_ListIteratorOfListIO anIter(aListIO);
-    if(anIter.More()){
-      Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-      if(theIO)
-       *theIO = anIO;
-      if(anIO->hasEntry())
-       return GetSelectedObj( GetAppStudy(theModule), anIO->getEntry(), theMap );
+    while(anIter.More())
+       {
+               Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+               if(anIO->hasEntry())
+               {
+                       TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
+                       TSelectionItem aSelectionItem;
+                       aSelectionItem.myObjectInfo = anObjectInfo;
+                       aSelectionItem.myIO = anIO;
+                       aSelectionInfo.push_back(aSelectionItem);
+       }
+               anIter.Next(); // MULTIPR fixed
     }
-    return CORBA::Object::_nil();
+    return aSelectionInfo;
   }
 
+
+  //----------------------------------------------------------------------------
+  TObjectInfo
+  GetObjectByEntry(const SalomeApp_Study* theStudy,
+                  const std::string& theEntry)
+  {
+    TObjectInfo anObjectInfo;
+    if(!theStudy || theEntry == "")
+      return anObjectInfo;
+
+    _PTR(Study) aStudy = GetCStudy(theStudy);
+    if(_PTR(SObject) aSObject = aStudy->FindObjectID(theEntry)){
+      anObjectInfo.mySObject = aSObject;
+      CORBA::Object_var anObject = ClientSObjectToObject(aSObject);
+      if(VISU::Base_i* aBase = GetServantInterface<VISU::Base_i>(anObject))
+       anObjectInfo.myBase = aBase;
+    }
+    
+    return anObjectInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
   VISU::Prs3d_i*
-  GetPrsToModify(const SalomeApp_Module* theModule,
-                Handle(SALOME_InteractiveObject)* theIO,
-                VISU::Storable::TRestoringMap* theMap)
+  GetPrs3dToModify(const SalomeApp_Module* theModule,
+                  Base_i* theBase)
   {
-    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
+    if (CheckLock(GetCStudy(GetAppStudy(theModule)), GetDesktop(theModule)))
       return NULL;
 
-    CORBA::Object_var anObject = GetSelectedObj(theModule, theIO);
-    if (CORBA::is_nil(anObject))
-      return NULL;
+    return GetPrs3dFromBase(theBase);
+  }
 
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in())
-      return NULL;
+  //----------------------------------------------------------------------------
+  VISU::Prs3d_i*
+  GetPrs3dFromBase(Base_i* theBase)
+  {
+    if(theBase && theBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
+      CORBA::Object_var anObject = theBase->_this();
+      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+      VISU::Prs3d_var aPrs3d = aHolder->GetDevice();
+      return VISU::GetServantInterface<VISU::Prs3d_i>(aPrs3d);
+    }
+    return dynamic_cast<VISU::Prs3d_i*>(theBase);
+  }
 
-    return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+  //----------------------------------------------------------------------------
+  Storable::TRestoringMap
+  GetStorableMap(_PTR(SObject) theSObject)
+  {
+    Storable::TRestoringMap aMap;
+    _PTR(GenericAttribute) anAttr;
+    if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+      _PTR(AttributeComment) aComment (anAttr);
+      std::string aValue = aComment->Value();
+      VISU::Storable::StrToMap(aValue.c_str(), aMap);
+    }
+    return aMap;
   }
 
+  //----------------------------------------------------------------------------
+  bool
+  GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                       VISU::Prs3d_i*& thePrs3d,
+                       SVTK_ViewWindow*& theViewWindow,
+                       VISU_Actor*& thenActor)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return false;
+  
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!thePrs3d)
+      return false;
+  
+    theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!theViewWindow)
+      return false;
+  
+    thenActor = FindActor(theViewWindow, thePrs3d);
+    if(!thenActor)
+      return false;
+    
+    return true;
+  }
+
+  //----------------------------------------------------------------------------
   void
   Add(LightApp_SelectionMgr* theSelectionMgr,
       const Handle(SALOME_InteractiveObject)& theIO)
@@ -316,6 +395,7 @@ namespace VISU
     theSelectionMgr->setSelectedObjects(aListIO);
   }
 
+  //------------------------------------------------------------
   void
   Remove(LightApp_SelectionMgr* theSelectionMgr,
         const Handle(SALOME_InteractiveObject)& theIO)
@@ -333,6 +413,24 @@ namespace VISU
     theSelectionMgr->setSelectedObjects(aNewListIO);
   }
 
+  //------------------------------------------------------------
+  //! Restores selection after presentation creating and editing
+  void
+  RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d)
+  {
+    SALOME_ListIO aList;
+    theModule->selectedObjects(aList);
+
+    if( thePrs3d )
+    {
+      Handle(SALOME_InteractiveObject) anIO = thePrs3d->GetIO();
+      aList.Append(anIO);
+    }
+
+    LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+    aSelectionMgr->setSelectedObjects(aList);
+  }
+
   /*!
    * \brief Check, if "Delete" popup-menu can be put on current selection
    *
@@ -428,6 +526,7 @@ namespace VISU
     return true;
   }
 
+  //------------------------------------------------------------
   void
   DeleteSObject(VisuGUI* theModule,
                _PTR(Study) theStudy,
@@ -435,132 +534,153 @@ namespace VISU
   {
     _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject);
     for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
-      _PTR(SObject) aChildSObject = aChildIter->Value();
-      CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
-      ErasePrs(theModule, aChildObj, /*repaint_view_window = */false);
+      _PTR(SObject) aSObject = aChildIter->Value();
+      TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(theModule), aSObject->GetID());
+      ErasePrs(theModule, anObjectInfo.myBase, /*repaint_view_window = */false);
     }
 
-    CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject);
-    if (!CORBA::is_nil(anObj)) {
-      ErasePrs(theModule, anObj, /*repaint_view_window = */true);
+    TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(theModule), theSObject->GetID());
+    if(anObjectInfo.myBase){
+      ErasePrs(theModule, anObjectInfo.myBase, /*repaint_view_window = */true);
 
-      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
+      CORBA::Object_var anObject = ClientSObjectToObject(theSObject);
+      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObject);
       if (!CORBA::is_nil(aRemovableObject)) {
         aRemovableObject->RemoveFromStudy();
       }
     } else {
       // Remove aSObject together with all its sub-objects
-
       VISU::RemoveFromStudy(theSObject,
                             false,  // remove not only IOR attribute, but Object With Children
                             false); // not Destroy() sub-objects
     }
   }
 
+  //------------------------------------------------------------
   void
   DeletePrs3d(VisuGUI* theModule,
-              VISU::Prs3d_i* thePrs,
-              const Handle(SALOME_InteractiveObject)& theIO)
+              VISU::Prs3d_i* thePrs)
   {
     if (!thePrs)
       return;
+
     if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
       return;
 
-    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-    RemoveScalarBarPosition(theModule, vw, thePrs);
-
+    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule))
+      RemoveScalarBarPosition(theModule, aViewWindow, thePrs);
+
+    if(VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs)){
+      std::string anEntry = aColoredPrs3d->GetHolderEntry();
+      if(anEntry != ""){
+       VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), anEntry);
+       if(VISU::Base_i* aBase = anObjectInfo.myBase){
+         if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
+           CORBA::Object_var anObject = aBase->_this();
+           VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObject);
+           aRemovableObject->RemoveFromStudy();
+           return;
+         }
+       }
+      }
+    } 
+      
     thePrs->RemoveFromStudy();
+      
   }
 
+  //------------------------------------------------------------
   // Presentation management
-
   void
   ChangeRepresentation (const SalomeApp_Module* theModule,
                         VISU::PresentationType  theType)
   {
-    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-    if (!vw)
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
       return;
 
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
-    if (CORBA::is_nil(anObject)) return;
-
-    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-    if (CORBA::is_nil(aVisuObj)) return;
-
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in()) return;
-
-    VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-    if (aPrs3d) {
-      if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
-        switch (theType) {
-        case VISU::SHRINK:
-          if (anActor->IsShrunk())
-            anActor->UnShrink();
-          else
-            anActor->SetShrink();
-          break;
-        default:
-          if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
-            aMesh->SetPresentationType(theType);
-            RecreateActor(theModule, aMesh);
-          } else {
-            anActor->SetRepresentation(theType);
-          }
-        }
-        vw->Repaint();
+    TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!aPrs3d)
+      return;
+
+    SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!aViewWindow)
+      return;
+
+    VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+    if(!anActor)
+      return;
+
+    switch (theType) {
+    case VISU::SHRINK:
+      if (anActor->IsShrunk())
+       anActor->UnShrink();
+      else
+       anActor->SetShrink();
+      break;
+    default:
+      if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+       aMesh->SetPresentationType(theType);
+       RecreateActor(theModule, aMesh);
+      } else {
+       anActor->SetRepresentation(theType);
       }
     }
+    aViewWindow->Repaint();
   }
 
+  //------------------------------------------------------------
   void
   SetShading ( const SalomeApp_Module* theModule,
              bool theOn )
   {
-    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-    if (!vw)
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
       return;
 
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
-    if (CORBA::is_nil(anObject)) return;
+    TSelectionItem aSelectionItem = GetSelectedObjects(theModule).front();
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!aPrs3d)
+      return;
 
-    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-    if (CORBA::is_nil(aVisuObj)) return;
+    SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!aViewWindow)
+      return;
 
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in()) return;
+    VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+    if(!anActor)
+      return;
 
-    VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-    if (aPrs3d) {
-      if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
-       if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
-         aScalarMapActor->SetShading( theOn );
-      }
-      vw->Repaint();
+    if(VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor)){
+      aScalarMapActor->SetShading(theOn);
+      aViewWindow->Repaint();
     }
   }
 
+  //------------------------------------------------------------
   // SObject type
-
   bool
   CheckTimeStamp(const SalomeApp_Module* theModule,
                  _PTR(SObject)&          theSObject,
-                 Handle(SALOME_InteractiveObject)* theIO)
+                 Handle(SALOME_InteractiveObject)& theIO,
+                ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode)
   {
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
-    if (theIO)
-      *theIO = anIO;
-    if (!anIO.IsNull() && anIO->hasEntry()){
-      _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
-      theSObject = aStudy->FindObjectID(anIO->getEntry());
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(!aSelectionInfo.empty()){
+      TSelectionItem aSelectionItem = aSelectionInfo.front();
+      theIO = aSelectionItem.myIO;
+      theSObject = aSelectionItem.myObjectInfo.mySObject;
       QString aValue = getValue(theSObject,"myType");
-      if (aValue.toInt() == int(VISU::TTIMESTAMP))
+      if (aValue.toInt() == int(VISU::TTIMESTAMP)){
+       thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp;
         return true;
+      }
+      if (aValue.toInt() == int(VISU::TFIELD)){
+       thePublishInStudyMode = ColoredPrs3d_i::EPublishIndependently;
+       if(theSObject->FindSubObject(2,theSObject))
+         return true;
+      }
     }
     SUIT_MessageBox::warn1(GetDesktop(theModule),
                            QObject::tr("WRN_VISU"),
@@ -569,6 +689,7 @@ namespace VISU
     return false;
   }
 
+  //------------------------------------------------------------
   VISU::Result_i*
   CheckResult(const SalomeApp_Module* theModule,
               _PTR(SObject)           theSource,
@@ -604,8 +725,8 @@ namespace VISU
     return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
   }
 
+  //------------------------------------------------------------
   // VTK View
-
   VISU_Actor*
   PublishMeshInView(const SalomeApp_Module* theModule,
                     VISU::Prs3d_i* thePrs,
@@ -630,6 +751,7 @@ namespace VISU
     return aActor;
   }
 
+  //------------------------------------------------------------
   void
   RepaintViewWindows (const SalomeApp_Module* theModule,
                       const Handle(SALOME_InteractiveObject)& theIObject)
@@ -657,30 +779,18 @@ namespace VISU
     }
   }
 
+  //------------------------------------------------------------
   VISU_Actor*
-  FindActor(SVTK_ViewWindow* theViewWindow,
-            const char* theEntry)
-  {
-    using namespace SVTK;
-    if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
-      if(vtkActorCollection* aCollection = aRenderer->GetActors()){
-        if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
-          return anActor;
-        }
-      }
-    }
-    return NULL;
-  }
-
-  VISU_Actor*
-  FindActor(SVTK_ViewWindow* theViewWindow,
-            VISU::Prs3d_i* thePrs)
+  FindActor(const SalomeApp_Study* theStudy,
+           SVTK_ViewWindow* theViewWindow,
+           const QString& theEntry)
   {
-    SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
-    CORBA::String_var anEntry = aSObject->GetID();
-    return FindActor(theViewWindow,anEntry.in());
+    TObjectInfo anObjectInfo = GetObjectByEntry(theStudy, theEntry);
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+    return FindActor(theViewWindow, aPrs3d);
   }
 
+  //------------------------------------------------------------
   void
   RecreateActor (const SalomeApp_Module* theModule,
                  VISU::Prs3d_i* thePrs)
@@ -706,6 +816,7 @@ namespace VISU
     QApplication::restoreOverrideCursor();
   }
 
+  //------------------------------------------------------------
   static 
   bool
   ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow,
@@ -744,6 +855,7 @@ namespace VISU
     return somethingVisible;
   }
 
+  //------------------------------------------------------------
   void SetFitAll(SVTK_ViewWindow* theViewWindow)
   {
     static vtkFloatingPointType PRECISION = 0.000001;
@@ -805,6 +917,7 @@ namespace VISU
     return NULL;
   }
 
+  //------------------------------------------------------------
   // Internal function used by several public functions below
   void
   UpdateCurve(VISU::Curve_i* theCurve,
@@ -858,6 +971,7 @@ namespace VISU
     }
   }
 
+  //------------------------------------------------------------
   void
   PlotTable(const SalomeApp_Module* theModule,
             VISU::Table_i* table,
@@ -875,7 +989,7 @@ namespace VISU
     QList<Plot2d_Curve> clist;
     aPlot->getCurves( clist );
     _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
-    _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry().latin1() );
+    _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry() );
     if ( TableSO ) {
       _PTR(ChildIterator) Iter = aStudy->NewChildIterator( TableSO );
       for ( ; Iter->More(); Iter->Next() ) {
@@ -889,7 +1003,7 @@ namespace VISU
             for ( int i = 0; i < clist.count(); i++ ) {
               tmpCurve = dynamic_cast<SPlot2d_Curve*>( clist.at( i ) );
               if (tmpCurve && tmpCurve->hasIO() &&
-                  !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) {
+                  theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) {
                 plotCurve = tmpCurve;
                 break;
               }
@@ -907,6 +1021,7 @@ namespace VISU
     }
   }
 
+  //------------------------------------------------------------
   void
   PlotCurve(const SalomeApp_Module* theModule,
             VISU::Curve_i* theCurve,
@@ -928,7 +1043,7 @@ namespace VISU
     for (int i = 0; i < clist.count(); i++) {
       tmpCurve = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
       if (tmpCurve && tmpCurve->hasIO() &&
-          !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) {
+          theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) {
         plotCurve = tmpCurve;
       } else if (theDisplaying == VISU::eDisplayOnly) {
         aPlot->eraseCurve(clist.at(i));
@@ -940,6 +1055,7 @@ namespace VISU
     aPlot->Repaint();
   }
 
+  //------------------------------------------------------------
   void
   PlotRemoveCurve(const SalomeApp_Module* theModule,
                  VISU::Curve_i* pCrv)
@@ -967,6 +1083,7 @@ namespace VISU
     }
   }
   
+  //------------------------------------------------------------
   void
   PlotContainer(const SalomeApp_Module* theModule,
                 VISU::Container_i* container,
@@ -989,7 +1106,7 @@ namespace VISU
         VISU::Curve_i* theCurve = container->GetCurve( k );
         if ( theCurve && theCurve->IsValid() ) {
           SPlot2d_Curve* plotCurve = dynamic_cast<SPlot2d_Curve*>
-            (aView->getCurveByIO(new SALOME_InteractiveObject (theCurve->GetEntry(), "", "")));
+            (aView->getCurveByIO(new SALOME_InteractiveObject(theCurve->GetEntry().c_str(), "", "")));
 
           UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
 
@@ -1002,6 +1119,7 @@ namespace VISU
     aPlot->Repaint();
   }
 
+  //------------------------------------------------------------
   void
   CreatePlot(SalomeApp_Module* theModule,
              _PTR(SObject) theTableSO)
@@ -1041,8 +1159,8 @@ namespace VISU
   void CreateMesh (const SalomeApp_Module* theModule,
                    const Handle(SALOME_InteractiveObject)& theIO,
                    SVTK_ViewWindow* theViewWindow)
-  {
-    _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
+  {  
+       _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
     //if (CheckLock(aStudy))
     //  return;
 
@@ -1256,6 +1374,7 @@ namespace VISU
     return aList;
   }
 
+  //------------------------------------------------------------
   int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow)
   {
     int minIndx = 1;
@@ -1277,6 +1396,7 @@ namespace VISU
     return minIndx;
   }
 
+  //------------------------------------------------------------
   void AddScalarBarPosition (VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
                              VISU::Prs3d_i* thePrs3d, int pos)
   {
@@ -1285,6 +1405,7 @@ namespace VISU
     aMap[theViewWindow].insert(aPair);
   }
 
+  //------------------------------------------------------------
   void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
                                VISU::Prs3d_i* thePrs3d)
   {
@@ -1296,4 +1417,5 @@ namespace VISU
        return;
       }
   }
+  //------------------------------------------------------------
 }
index 0e4258a0dae942263bf0c9ad3a5f1729593a3d7e..469c19ce276f5ebc6353fcbdff9b3d3c9e766f75 100644 (file)
@@ -31,6 +31,7 @@
 #include "SALOME_InteractiveObject.hxx"
 
 #include "VISUConfig.hh"
+#include "VISU_ColoredPrs3d_i.hh"
 
 #include "SALOMEDSClient_Study.hxx"
 
@@ -38,6 +39,7 @@
 #include CORBA_SERVER_HEADER(MED_Gen)
 
 class QWidget;
+class QDialog;
 
 class SUIT_Desktop;
 class SUIT_ViewWindow;
@@ -52,7 +54,12 @@ class SalomeApp_Module;
 class SalomeApp_Study;
 class VisuGUI;
 
-namespace VISU {
+#include <vector>
+#include <utility>
+
+namespace VISU 
+{
+  class Base_i;
   class Prs3d_i;
   class Result_i;
   class Table_i;
@@ -61,6 +68,7 @@ namespace VISU {
 
   typedef std::vector<SVTK_ViewWindow*> TViewWindows;
 
+  //----------------------------------------------------------------------------
   SUIT_Desktop*                        GetDesktop(const CAM_Module* theModule);
   SalomeApp_Study*                     GetAppStudy(const CAM_Module* theModule);
   _PTR(Study)                          GetCStudy(const SalomeApp_Study* theStudy);
@@ -69,10 +77,14 @@ namespace VISU {
   bool                                 CheckLock( _PTR(Study) theStudy,
                                                  QWidget* theWidget );
 
+  //----------------------------------------------------------------------------
+  int                                  runAndWait( QDialog* dlg, const bool modal );
+
   void                                 UpdateObjBrowser(SalomeApp_Module* theModule,
                                                        bool theIsUpdateDataModel = true,
                                                        _PTR(SObject) theSObject = _PTR(SObject)());
 
+  //----------------------------------------------------------------------------
   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
   SALOME_MED::MED_Gen_var              GetMEDEngine();
 
@@ -81,29 +93,52 @@ namespace VISU {
 
   // Selection
   LightApp_SelectionMgr*               GetSelectionMgr(const SalomeApp_Module* theModule);
-  CORBA::Object_var                    GetSelectedObj(const SalomeApp_Study* theStudy,
-                                                     const QString& theEntry,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
-  CORBA::Object_var                    GetSelectedObj(const SalomeApp_Module* theModule,
-                                                     Handle(SALOME_InteractiveObject)* theIO = NULL,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
-  VISU::Prs3d_i*                       GetPrsToModify(const SalomeApp_Module* theModule,
-                                                     Handle(SALOME_InteractiveObject)* theIO = NULL,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
 
+  //----------------------------------------------------------------------------
+  struct TObjectInfo
+  {
+    Base_i* myBase;
+    _PTR(SObject) mySObject;
+    TObjectInfo():
+      myBase(NULL)
+    {}
+  };
+
+  struct TSelectionItem
+  {
+    TObjectInfo myObjectInfo;
+    Handle(SALOME_InteractiveObject) myIO;
+  };
+
+  typedef std::vector<TSelectionItem>  TSelectionInfo;
+
+  TSelectionInfo                       GetSelectedObjects(const SalomeApp_Module* theModule);
+
+  TObjectInfo                          GetObjectByEntry(const SalomeApp_Study* theStudy,
+                                                       const std::string& theEntry);
+  
+  VISU::Prs3d_i*                       GetPrs3dToModify(const SalomeApp_Module* theModule,
+                                                       Base_i* theBase);
+
+  VISU::Prs3d_i*                       GetPrs3dFromBase(Base_i* theBase);
+  
+  Storable::TRestoringMap              GetStorableMap(_PTR(SObject) theSObject);
+
+  //----------------------------------------------------------------------------
   void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
                                           const Handle(SALOME_InteractiveObject)& theIO);
   void                                 Remove(LightApp_SelectionMgr* theSelectionMgr,
                                              const Handle(SALOME_InteractiveObject)& theIO);
 
+  void                                 RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d);
+
   bool                                 IsRemovableSelected(const SalomeApp_Module* theModule);
 
   void                                 DeleteSObject(VisuGUI* theModule,
                                                     _PTR(Study)       theStudy,
                                                     _PTR(SObject)     theSObject);
   void                                 DeletePrs3d(VisuGUI* theModule,
-                                                  VISU::Prs3d_i* thePrs,
-                                                  const Handle(SALOME_InteractiveObject)& theIO);
+                                                  VISU::Prs3d_i* thePrs);
 
   // Presentation management
   void ChangeRepresentation (const SalomeApp_Module* theModule,
@@ -114,7 +149,8 @@ namespace VISU {
   // SObject type
   bool                                 CheckTimeStamp(const SalomeApp_Module* theModule,
                                                      _PTR(SObject)&          theSObject,
-                                                     Handle(SALOME_InteractiveObject)* theIO = NULL);
+                                                     Handle(SALOME_InteractiveObject)& theIO,
+                                                     ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode);
   VISU::Result_i*                      CheckResult(const SalomeApp_Module* theModule,
                                                   _PTR(SObject) theSource,
                                                   VISU::Result_var& theResult);
@@ -134,8 +170,9 @@ namespace VISU {
   void                                 RepaintViewWindows(const SalomeApp_Module* theModule,
                                                          const Handle(SALOME_InteractiveObject)& theIObject);
 
-  VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
-                                                const char* theEntry);
+  VISU_Actor*                          FindActor(const SalomeApp_Study* theStudy,
+                                                SVTK_ViewWindow* theViewWindow,
+                                                const QString& theEntry);
   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
                                                 VISU::Prs3d_i* thePrs);
   void                                 RecreateActor(const SalomeApp_Module* theModule,
index 2739cf7adad75a33d0da39a128315d70aa6b3956..af6de916a173165771285202b69c2af1dbcd0d5b 100644 (file)
@@ -69,6 +69,7 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule,
                                      WFlags fl)
      : QDialog( VISU::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
                 WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+     myModule(theModule),
      mySelectionMgr( VISU::GetSelectionMgr( theModule ) ),
      myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule) )
 {
@@ -207,10 +208,10 @@ void VisuGUI_TransparencyDlg::SetTransparency()
     SALOME_ListIO aList;
     mySelectionMgr->selectedObjects(aList);
 
-    SALOME_ListIteratorOfListIO It (aList);
-    for (;It.More(); It.Next()) {
-      Handle(SALOME_InteractiveObject) IOS = It.Value();
-      VISU_Actor* anActor = VISU::FindActor(myViewWindow, IOS->getEntry());
+    SALOME_ListIteratorOfListIO anIter(aList);
+    for (; anIter.More(); anIter.Next()) {
+      Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+      VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry());
       if (anActor)
        anActor->SetOpacity(opacity);
     }
@@ -243,7 +244,7 @@ void VisuGUI_TransparencyDlg::onSelectionChanged()
     if (aList.Extent() == 1) {
       Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
       if (!FirstIOS.IsNull()) {
-       VISU_Actor* anActor = VISU::FindActor(myViewWindow, FirstIOS->getEntry());
+       VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, FirstIOS->getEntry());
        if (anActor)
          opacity = int(anActor->GetOpacity() * 100. + 0.5);
       }
@@ -253,7 +254,7 @@ void VisuGUI_TransparencyDlg::onSelectionChanged()
       for (; It.More(); It.Next()) {
        Handle(SALOME_InteractiveObject) IO = It.Value();
        if (!IO.IsNull()) {
-         VISU_Actor* anActor = VISU::FindActor(myViewWindow, IO->getEntry());
+         VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, IO->getEntry());
          if (anActor) {
            int op = int(anActor->GetOpacity() * 100. + 0.5);
            if (setOp < 0)
index 2809a46055777f66492fa586cc4192e79a4aabf5..2bf3ddbb98875c9557f7b1a7c7aef1dbbbf9c6c2 100644 (file)
@@ -36,6 +36,7 @@ class QLabel;
 class QPushButton;
 class QSlider;
 class LightApp_SelectionMgr;
+class SalomeApp_Module;
 class SVTK_Selector;
 class SVTK_ViewWindow;
 class VisuGUI;
@@ -62,6 +63,7 @@ private:
 private :
   LightApp_SelectionMgr*  mySelectionMgr;
   SVTK_ViewWindow*        myViewWindow;
+  const SalomeApp_Module* myModule;
 
   QPushButton*            buttonOk;
   QPushButton*            buttonHelp;
index b9c660c0b466275a3f5d86741a5350c9ac08a896..11331d553436e790d2b40f7d8db12c4b63d44f37 100644 (file)
 #include "VisuGUI_VectorsDlg.h"
 
 #include "VisuGUI.h"
-//#include "VisuGUI_Selection.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_Vectors_i.hh"
 #include "LightApp_Application.h"
 #include "SalomeApp_Module.h"
@@ -51,8 +52,7 @@ using namespace std;
   Constructor
 */
 VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
-    : QDialog(VISU::GetDesktop(theModule), "VisuGUI_VectorsDlg", true,
-      WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+  : VisuGUI_Prs3dDlg(theModule)
 {
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
@@ -61,7 +61,7 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin( 11 );
 
-  QTabWidget* aTabBox = new QTabWidget(this);
+  myTabBox = new QTabWidget(this);
 
   QVBox* aBox = new QVBox(this);
   aBox->setMargin( 11 );
@@ -171,12 +171,14 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
   GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
 
   // top layout
-  aTabBox->addTab(aBox, "Vectors");
+  myTabBox->addTab(aBox, "Vectors");
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
   myScalarPane->setMargin( 5 );
-  aTabBox->addTab(myScalarPane, "Scalar Bar");  
+  myInputPane = new VisuGUI_InputPane(VISU::TVECTORS, theModule, this);
+  myTabBox->addTab(myScalarPane, "Scalar Bar");  
+  myTabBox->addTab(myInputPane, "Input");
 
-  TopLayout->addWidget( aTabBox );
+  TopLayout->addWidget( myTabBox );
   TopLayout->addWidget( GroupButtons );
   
   // signals and slots connections
@@ -197,45 +199,71 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
   enableSetColor();
 }
 
+VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
+{}
 
+void VisuGUI_VectorsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit) {
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TVECTORS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
-  myScalarPane->initFromPrsObject(thePrs);
-  setScaleFactor(thePrs->GetScale());
-  setLineWidth((int)thePrs->GetLineWidth());
-  setUseMagnColor(thePrs->IsColored());
-  SALOMEDS::Color anOldColor = thePrs->GetColor();
+  myScalarPane->initFromPrsObject( myPrsCopy );
+
+  setScaleFactor(myPrsCopy->GetScale());
+  setLineWidth((int)myPrsCopy->GetLineWidth());
+  setUseMagnColor(myPrsCopy->IsColored());
+  SALOMEDS::Color anOldColor = myPrsCopy->GetColor();
   QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
   setColor(aColor);
   
-  if (thePrs->GetGlyphType() != VISU::Vectors::NONE) {
+  if (myPrsCopy->GetGlyphType() != VISU::Vectors::NONE) {
     setUseGlyphs(true);
-    setGlyphType(thePrs->GetGlyphType());
-    setGlyphPos(thePrs->GetGlyphPos());
+    setGlyphType(myPrsCopy->GetGlyphType());
+    setGlyphPos(myPrsCopy->GetGlyphPos());
   } else 
     setUseGlyphs(false);
 
   enableSetColor();
+
+  if( !theInit )
+    return;
+
+  if( myPrsCopy->IsTimeStampFixed() )
+    myTabBox->removePage( myInputPane );
+  else
+  {
+    myInputPane->initFromPrsObject( myPrsCopy );
+    myTabBox->showPage( myInputPane );
+  }
+  myTabBox->setCurrentPage( 0 );
 }
 
 
-int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
-  myScalarPane->storeToPrsObject(thePrs);
-  thePrs->SetScale(getScaleFactor());
-  thePrs->SetLineWidth(getLineWidth());
-  thePrs->ShowColored(getUseMagnColor());
-  if(!thePrs->IsColored()){
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
+  myScalarPane->storeToPrsObject(myPrsCopy);
+  if( !myPrsCopy->IsTimeStampFixed() )
+  {
+    if( !myInputPane->check() )
+      return 0;
+    myInputPane->storeToPrsObject( myPrsCopy );
+  }
+  myPrsCopy->SetScale(getScaleFactor());
+  myPrsCopy->SetLineWidth(getLineWidth());
+  myPrsCopy->ShowColored(getUseMagnColor());
+  if(!myPrsCopy->IsColored()){
     SALOMEDS::Color aColor;
     aColor.R = myColor.red()/255.;
     aColor.G = myColor.green()/255.;
     aColor.B = myColor.blue()/255.;
-    thePrs->SetColor(aColor);
+    myPrsCopy->SetColor(aColor);
   }
   if (getUseGlyphs()) {
-    thePrs->SetGlyphPos(getGlyphPos());
-    thePrs->SetGlyphType(getGlyphType());
+    myPrsCopy->SetGlyphPos(getGlyphPos());
+    myPrsCopy->SetGlyphType(getGlyphType());
   } else 
-    thePrs->SetGlyphType(VISU::Vectors::NONE);
+    myPrsCopy->SetGlyphType(VISU::Vectors::NONE);
+
+  VISU::TSameAsFactory<VISU::TVECTORS>().Copy(thePrs, myPrsCopy);
+
   return 1;
 }
 
index 091fec4d36e49c4b5a12946324087fd85089e658..829747fccab062aa113934ebe5b15862ade40bb4 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef VISUGUI_VECTORSDLG_H
 #define VISUGUI_VECTORSDLG_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
 #include "QtxDblSpinBox.h"
 
 #include <qdialog.h>
 #include <qlabel.h>
 #include <qspinbox.h>
 #include <qpushbutton.h>
+#include <qtabwidget.h>
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(VISU_Gen)
 
 class SalomeApp_Module;
+class VisuGUI_InputPane;
 
-namespace VISU{
+namespace VISU
+{
   class Vectors_i;
 }
 
-class VisuGUI_VectorsDlg : public QDialog
+class VisuGUI_VectorsDlg : public VisuGUI_Prs3dDlg
 {
     Q_OBJECT
 
 public:
     VisuGUI_VectorsDlg (SalomeApp_Module* theModule);
-    ~VisuGUI_VectorsDlg() {};
+    ~VisuGUI_VectorsDlg();
 
     void   setScaleFactor( double sf );
     double getScaleFactor();
@@ -76,8 +79,8 @@ public:
     VISU::Vectors::GlyphPos getGlyphPos();
     void   enableMagnColor( bool enable );
 
-    void initFromPrsObject(VISU::Vectors_i* thePrs);
-    int storeToPrsObject(VISU::Vectors_i* thePrs);
+    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
 private:
     void keyPressEvent( QKeyEvent* e );
@@ -112,7 +115,12 @@ private:
     QPushButton*    buttonHelp;
 
     QColor          myColor;
+    QTabWidget*            myTabBox;
+
     VisuGUI_ScalarBarPane* myScalarPane;
+    VisuGUI_InputPane*     myInputPane;
+
+    SALOME::GenericObjPtr<VISU::Vectors_i> myPrsCopy;
 
 private slots:
     void enableGlyphType();
index 047603e99ff765a5ef3ace35f36eb8543f9eeeb3..4422d585fd082aec10bb9250c776b592be00434a 100644 (file)
 
 namespace VISU 
 {
+  //----------------------------------------------------------------------------
+  void
+  ErasePrs3d(VisuGUI* theModule,
+             VISU::Prs3d_i* thePrs,
+            bool theDoRepaint)
+  {
+    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
+      if(VISU_Actor* anActor = FindActor(aViewWindow, thePrs)){
+        anActor->VisibilityOff();
+       if(theDoRepaint)
+         aViewWindow->Repaint();
+      }
+    }
+  }
+
+  //----------------------------------------------------------------------------
   void
   ErasePrs(VisuGUI* theModule,
-          CORBA::Object_ptr theObject
-          bool theDoRepaintVW)
+          Base_i* theBase
+          bool theDoRepaint)
   {
-    if (CORBA::is_nil(theObject)) return;
-    VISU::Base_var aBase = VISU::Base::_narrow(theObject);
-    if (CORBA::is_nil(aBase)) return;
+    if(!theBase)
+      return;
 
-    VISU::VISUType aType = aBase->GetType();
-    switch (aType) {
+    switch (theBase->GetType()) {
     case VISU::TCURVE: {
-      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(theBase))
        PlotCurve(theModule, aCurve, VISU::eErase );
       break;
     }
     case VISU::TCONTAINER: {
-      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(theBase))
        PlotContainer(theModule, aContainer, VISU::eErase );
       break;
     }
     case VISU::TTABLE: {
-      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase))
        PlotTable(theModule, aTable, VISU::eErase );
       break;
     }
     default: {
-      if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
-        SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-       RemoveScalarBarPosition(theModule, vw, aPrsObject);
-        ErasePrs3d(theModule, aPrsObject, theDoRepaintVW);
+      if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(theBase)){
+       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
+         RemoveScalarBarPosition(theModule, aViewWindow, aPrs3d);
+         ErasePrs3d(theModule, aPrs3d, theDoRepaint);
+       }
       }
     }} // switch (aType)
   }
+
 }
index 1e7c3d0ee5508a89220b6acd2b155b5488af1326..9c7ae8995d72a01a0b607d8b614c285a854c66d9 100644 (file)
@@ -243,24 +243,14 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  inline
   void
   ErasePrs3d(VisuGUI* theModule,
              VISU::Prs3d_i* thePrs,
-            const bool theDoRepaintVW = true)
-  {
-    if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
-      if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs)) {
-        anActor->VisibilityOff();
-       if (theDoRepaintVW)
-         aViewWindow->Repaint();
-      }
-    }
-  }
+            bool theDoRepaint = true);
 
   void
   ErasePrs(VisuGUI* theModule,
-          CORBA::Object_ptr theObject
+          Base_i* theBase
           bool theDoRepaintVW);
 }
 
index 41b9c67e5df289959da881e30d2926f6ce2b67d0..5319a3a91fe41b97565fc80c2ec948164d5821c7 100644 (file)
@@ -47,15 +47,19 @@ LIB_SRC = \
        VISU_CutLines_i.cc \
        VISU_Vectors_i.cc \
        VISU_StreamLines_i.cc \
+       VISU_ScalarMapOnDeformedShape_i.cc \
+       VISU_ColoredPrs3dCache_i.cc \
+       VISU_ColoredPrs3dHolder_i.cc \
+       VISU_ColoredPrs3dFactory.cc \
        VISU_Mesh_i.cc \
-       VISU_Table_i.cc \
-       VISU_Gen_i.cc \
        VISU_ViewManager_i.cc \
-       VISU_View_i.cc \
        VISU_TimeAnimation.cxx \
+       VISU_View_i.cc \
+       VISU_Table_i.cc \
+       VISU_Gen_i.cc \
        VISU_CorbaMedConvertor.cxx \
        VISU_DumpPython.cc \
-       VISU_ScalarMapOnDeformedShape_i.cc
+       SALOME_GenericObjPointer.cc
 
 LIB_MOC = \
        VISU_TimeAnimation.h
@@ -65,7 +69,7 @@ LIB_SERVER_IDL = \
        VISU_Gen.idl \
        SALOME_Component.idl \
        SALOME_Exception.idl \
-       SALOME_GenericObj.idl 
+       SALOME_GenericObj.idl    
 
 LIB_CLIENT_IDL = \
        SALOMEDS.idl \
@@ -100,7 +104,9 @@ EXPORT_HEADERS = \
        VISU_ViewManager_i.hh \
        VISU_View_i.hh \
        VISU_TimeAnimation.h \
-       VISU_ScalarMapOnDeformedShape_i.hh
+       VISU_ScalarMapOnDeformedShape_i.hh \
+       VISU_ColoredPrs3dFactory.hh \
+       SALOME_GenericObjPointer.hh
 
 # additionnal information to compil and link file
 CPPFLAGS += \
@@ -124,7 +130,7 @@ LDFLAGS  += \
        $(BOOST_LIBS) \
        $(KERNEL_LDFLAGS) \
        $(GUI_LDFLAGS) \
-       $(MED_LDFLAGS) 
+       $(MED_LDFLAGS)
 
 LIBS+=  -lboost_signals${BOOST_LIBSUFFIX} \
        -lSalomeHDFPersist \
@@ -143,7 +149,8 @@ LIBS+=  -lboost_signals${BOOST_LIBSUFFIX} \
        -lVisuPipeLine \
        -lVisuObject \
        -lVVTK \
-       -lVISUGUITOOLS
+       -lVISUGUITOOLS \
+       -lMULTIPR_API
 
 LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) \
        $(KERNEL_LDFLAGS) \
@@ -178,7 +185,10 @@ LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) \
        -lMEDWrapperBase \
        -lMEDWrapper_V2_2 \
        -lMEDWrapper_V2_1 \
-       -lmed_V2_1
+       -lmed_V2_1 \
+       -lmedmem \
+       -lmedsplitter \
+       -lMULTIPR_API
 
 # additional file to be cleaned
 MOSTLYCLEAN =
index 72c1635d2a0c258571691ad3760371256e4f4b93..81e7492d22f49042a3f2a84d141e7c6daae5158a 100644 (file)
@@ -97,7 +97,10 @@ namespace VISU{
 
   //===========================================================================
   static Storable::TCallbackMap VisuStoreMap;
-  string Storable::ToString(){
+  std::string 
+  Storable
+  ::ToString()
+  {
     ostringstream strOut;
     Storable::DataToStream( strOut, "myComment", GetComment() );
     ToStream(strOut);
@@ -106,7 +109,10 @@ namespace VISU{
     return strOut.str();
   }
 
-  void Storable::Registry(const char* theComment, TStorableEngine theEngine)
+  void 
+  Storable
+  ::Registry(const std::string& theComment, 
+            TStorableEngine theEngine)
   {
     if(!VisuStoreMap.insert(TCallbackMap::value_type(theComment,theEngine)).second){
       if(MYDEBUG) MESSAGE("Storable::Registry >> dupliacte registring !!!");
@@ -114,7 +120,11 @@ namespace VISU{
     }
   }
 
-  void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){
+  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++ ) {
@@ -136,28 +146,47 @@ namespace VISU{
     }
   }
 
-  void Storable::DataToStream(ostringstream& theStr, const QString& theName, const QString& theVal) {
+  void
+  Storable
+  ::DataToStream(std::ostringstream& theStr, 
+                const QString& theName, 
+                const QString& theVal) 
+  {
     QString output = ( !theName.isNull() ? theName : QString("") )
                    + QString( "=" )
                   + ( !theVal.isNull()  ? theVal  : QString("") );
     theStr<<output.latin1()<<";";
   }
 
-  void Storable::DataToStream(ostringstream& theStr, const QString& theName, const int theVal) {
+  void 
+  Storable
+  ::DataToStream(std::ostringstream& theStr, 
+                const QString& theName, 
+                const int theVal) 
+  {
     QString output = ( !theName.isNull() ? theName : QString("") )
                    + QString( "=" )
                   + QString::number( theVal );
     theStr<<output.latin1()<<";";
   }
 
-  void Storable::DataToStream(ostringstream& theStr, const QString& theName, const double theVal) {
+  void
+  Storable
+  ::DataToStream(std::ostringstream& 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)
+
+  Storable* 
+  Storable
+  ::Create(SALOMEDS::SObject_ptr theSObject,
+          const std::string& thePrefix, 
+          const std::string& theLocalPersistentID)
   {
     try{
       QString strIn( theLocalPersistentID.c_str() );
@@ -179,7 +208,11 @@ namespace VISU{
     return NULL;
   }
 
-  QString Storable::FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind)
+  QString
+  Storable
+  ::FindValue(const TRestoringMap& theMap, 
+             const std::string& theArg, 
+             bool* isFind)
   {
     TRestoringMap::const_iterator i = theMap.find(theArg);
     if(i == theMap.end()) {
@@ -194,7 +227,11 @@ namespace VISU{
   }
 
 
-  QString Storable::FindValue(const TRestoringMap& theMap, const string& theArg, const QString& theDefaultValue)
+  QString
+  Storable
+  ::FindValue(const TRestoringMap& theMap, 
+             const std::string& theArg, 
+             const QString& theDefaultValue)
   {
     bool anIsFound = false;
     QString aValue = FindValue(theMap,theArg,&anIsFound);
@@ -205,7 +242,9 @@ namespace VISU{
 
 
   //===========================================================================
-  PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){
+  PortableServer::ServantBase_var
+  GetServant(CORBA::Object_ptr theObject)
+  {
     if(CORBA::is_nil(theObject))  return NULL;
     try{
       PortableServer::POA_ptr aPOA = Base_i::GetPOA();
@@ -219,48 +258,59 @@ namespace VISU{
 
 
   //===========================================================================
-  CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject){
+  CORBA::Object_var 
+  SObjectToObject(SALOMEDS::SObject_ptr theSObject)
+  {
     SALOMEDS::GenericAttribute_var anAttr;
-    CORBA::Object_var anObj;
+    CORBA::Object_var anObject;
+    if(CORBA::is_nil(theSObject))
+      return anObject;
     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);
+         anObject = anORB->string_to_object(aValue);
       }
     }catch(...){
       INFOS("SObjectToObject - Unknown exception was occured!!!");
     }
-    return anObj;
+    return anObject;
   }
 
   //===========================================================================
-  CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject){
+  CORBA::Object_var
+  ClientSObjectToObject(_PTR(SObject) theSObject)
+  {
     _PTR(GenericAttribute) anAttr;
-    CORBA::Object_var anObj;
+    CORBA::Object_var anObject;
+    if(!theSObject)
+      return anObject;
     try{
       if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
        _PTR(AttributeIOR) anIOR  = anAttr;
        CORBA::String_var aValue = anIOR->Value().c_str();
        CORBA::ORB_ptr anORB = Base_i::GetORB();
        if(strcmp(aValue,"") != 0)
-         anObj = anORB->string_to_object(aValue);
+         anObject = anORB->string_to_object(aValue);
       }
     }catch(...){
       INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
     }
-    return anObj;
+    return anObject;
   }
 
 
   //===========================================================================
-  string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
-                             const char* theComment, int IsAllLevels)
+  std::string
+  FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, 
+                      const std::string& theStartEntry,
+                      const std::string& theComment, 
+                      int IsAllLevels)
   {
     SALOMEDS::ChildIterator_var anIter =
-      theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry));
+      theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry.c_str()));
     anIter->InitEx(IsAllLevels);
     SALOMEDS::SObject_var aFieldSO;
     for(;anIter->More();anIter->Next()) {
@@ -280,41 +330,45 @@ namespace VISU{
     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)
+  std::string
+  CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
+                  const std::string& theFatherEntry, 
+                  const std::string& theRefFatherEntry,
+                  const std::string& theIOR, 
+                  const std::string& theName,
+                  const std::string& thePersistentRef, 
+                  const std::string& theComment,
+                  CORBA::Boolean theCreateNew)
   {
     SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
-    SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry);
+    SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
     SALOMEDS::SObject_var newObj;
     if (theCreateNew) newObj = aStudyBuilder->NewObject(aFather);
     else newObj = aFather;
     SALOMEDS::GenericAttribute_var anAttr;
-    if(strcmp(theIOR,"") != 0){
+    if(theIOR != ""){
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-      anIOR->SetValue(theIOR);
+      anIOR->SetValue(theIOR.c_str());
     }
-    if(strcmp(theName,"") != 0){
+    if(theName != ""){
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-      aName->SetValue(theName);
+      aName->SetValue(theName.c_str());
     }
-    if(strcmp(thePersistentRef,"") != 0){
+    if(thePersistentRef != ""){
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef");
       SALOMEDS::AttributePersistentRef_var aPRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr);
-      aPRef->SetValue(thePersistentRef);
+      aPRef->SetValue(thePersistentRef.c_str());
     }
-    if(strcmp(theComment,"") != 0){
+    if(theComment != ""){
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
       SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
-      aCmnt->SetValue(theComment);
+      aCmnt->SetValue(theComment.c_str());
       if(MYDEBUG) INFOS("CreateAttributes - Comment = "<<theComment);
     }
-    if(strcmp(theRefFatherEntry,"") != 0){
-      SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
+    if(theRefFatherEntry != ""){
+      SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry.c_str());
       SALOMEDS::SObject_var anObj = aStudyBuilder->NewObject(aRefFather);
       aStudyBuilder->Addreference(anObj,newObj);
     }
@@ -324,11 +378,16 @@ namespace VISU{
       INFOS("CreateAttributes - StudyId = "<<theStudyDocument->StudyId()<<"; anEntry = "<<aRet<<"; IOR = '"<<theIOR<<"'");
     return aRet;
   }
-  string CreateAttributes(_PTR(Study) theStudyDocument,
-                         const char* theFatherEntry, const char* theRefFatherEntry,
-                         const char* theIOR, const char* theName,
-                         const char* thePersistentRef, const char* theComment,
-                         CORBA::Boolean theCreateNew)
+  
+  std::string
+  CreateAttributes(_PTR(Study) theStudyDocument,
+                  const std::string& theFatherEntry, 
+                  const std::string& theRefFatherEntry,
+                  const std::string& theIOR, 
+                  const std::string& theName,
+                  const std::string& thePersistentRef, 
+                  const std::string& theComment,
+                  CORBA::Boolean theCreateNew)
   {
     _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
     _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
@@ -339,28 +398,28 @@ namespace VISU{
       newObj = aFather;
 
     _PTR(GenericAttribute) anAttr;
-    if (strcmp(theIOR, "") != 0) {
+    if (theIOR != "") {
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
       _PTR(AttributeIOR) anIOR (anAttr);
       anIOR->SetValue(theIOR);
     }
-    if (strcmp(theName, "") != 0) {
+    if (theName != "") {
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
       _PTR(AttributeName) aName (anAttr);
       aName->SetValue(theName);
     }
-    if (strcmp(thePersistentRef, "") != 0) {
+    if (thePersistentRef != "") {
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef");
       _PTR(AttributePersistentRef) aPRef (anAttr);
       aPRef->SetValue(thePersistentRef);
     }
-    if (strcmp(theComment, "") != 0) {
+    if (theComment != "") {
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
       _PTR(AttributeComment) aCmnt (anAttr);
       aCmnt->SetValue(theComment);
       if (MYDEBUG) INFOS("CreateAttributes - Comment = " << theComment);
     }
-    if (strcmp(theRefFatherEntry, "") != 0) {
+    if (theRefFatherEntry != "") {
       _PTR(SObject) aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
       _PTR(SObject) anObj = aStudyBuilder->NewObject(aRefFather);
       aStudyBuilder->Addreference(anObj, newObj);
@@ -372,7 +431,9 @@ namespace VISU{
     return aRet;
   }
 
-  QString GenerateName(const string& theFmt, int theId){
+  QString 
+  GenerateName(const string& theFmt, int theId)
+  {
     static QString aName;
     if(theId > 0)
       aName.sprintf("%s:%d",theFmt.c_str(),theId);
@@ -382,7 +443,8 @@ namespace VISU{
   }
 
 
-  SALOMEDS::StudyManager_var GetStudyManager()
+  SALOMEDS::StudyManager_var 
+  GetStudyManager()
   {
     static SALOMEDS::StudyManager_var aStudyManager;
     if(CORBA::is_nil(aStudyManager)){
@@ -394,7 +456,8 @@ namespace VISU{
   }
 
 
-  SALOMEDS::Study_var GetDSStudy(_PTR(Study) theStudy)
+  SALOMEDS::Study_var 
+  GetDSStudy(_PTR(Study) theStudy)
   {
     //std::string aStudyName = theStudy->Name();
     //return GetStudyManager()->GetStudyByName(aStudyName.c_str());
@@ -402,7 +465,8 @@ namespace VISU{
     return GetStudyManager()->GetStudyByID(aStudyID);
   }
 
-  SALOMEDS::SObject_var GetSObject( _PTR(SObject) obj )
+  SALOMEDS::SObject_var 
+  GetSObject( _PTR(SObject) obj )
   {
     _PTR(Study) aStudy = obj->GetStudy();
     SALOMEDS::Study_var aSalomeDSStudy = GetDSStudy( aStudy );
@@ -410,17 +474,19 @@ namespace VISU{
     return aSalomeDSStudy->FindObjectID( id.c_str() );
   }
 
-  _PTR(SObject) GetClientSObject( SALOMEDS::SObject_var obj,
-                                 _PTR(Study) study )
+  _PTR(SObject) 
+  GetClientSObject( SALOMEDS::SObject_var obj,
+                   _PTR(Study) study )
   {
     return study->FindObjectID( obj->GetID() );
 
   }
 
 
-  void RemoveFromStudy (SALOMEDS::SObject_ptr theSObject,
-                       bool theIsAttrOnly,
-                       bool theDestroySubObjects)
+  void
+  RemoveFromStudy (SALOMEDS::SObject_ptr theSObject,
+                  bool theIsAttrOnly,
+                  bool theDestroySubObjects)
   {
     if (theSObject->_is_nil()) return;
 
@@ -445,10 +511,10 @@ namespace VISU{
     }
 
     // asl, fix for PAL10455: Remove references to SObject
-    SALOMEDS::Study::ListOfSObject* aRefs = aStudyDocument->FindDependances( theSObject );
+    SALOMEDS::Study::ListOfSObject_var aRefs = aStudyDocument->FindDependances( theSObject );
     for( int i=0, n=aRefs->length(); i<n; i++ )
     {
-      SALOMEDS::SObject_var o = (*aRefs)[i];
+      SALOMEDS::SObject_var o = aRefs[i];
       if( o->GetFatherComponent()->ComponentDataType()==theSObject->GetFatherComponent()->ComponentDataType() )
       {
        aStudyBuilder->RemoveReference( o );
@@ -460,9 +526,10 @@ namespace VISU{
     aStudyBuilder->RemoveObjectWithChildren(theSObject);
   }
 
-  void RemoveFromStudy (_PTR(SObject) theSObject,
-                       bool theIsAttrOnly,
-                       bool theDestroySubObjects)
+  void
+  RemoveFromStudy (_PTR(SObject) theSObject,
+                  bool theIsAttrOnly,
+                  bool theDestroySubObjects)
   {
     if (!theSObject) return;
 
index 48ea0f5fa072d6c5b332a285fa856e527fbda2ae..5464c505d3066c65328a7718273fa91fa26a22f9 100644 (file)
@@ -53,6 +53,7 @@
 
 // STL headers
 #include <map>
+#include <deque>
 #include <string>
 #include <sstream>
 #include <iostream>
@@ -75,6 +76,8 @@ namespace VISU
                  public virtual PortableServer::RefCountServantBase
   {
   public:
+    typedef VISU::Base TInterface;
+
     Base_i();
     virtual ~Base_i();
     virtual char* GetID();
@@ -115,29 +118,69 @@ namespace VISU
   protected:
     virtual void ToStream(std::ostringstream& theStr) = 0;
   public:
-    std::string ToString();
-    virtual const char* GetComment() const = 0;
+    std::string
+    ToString();
+
+    virtual
+    const char* 
+    GetComment() const = 0;
+
     typedef std::map<std::string,QString> TRestoringMap;
+
     typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
-                                        const std::string& thePrefix, const TRestoringMap& theMap);
+                                        const std::string& thePrefix,
+                                        const TRestoringMap& theMap);
     typedef std::map<std::string,TStorableEngine> TCallbackMap;
-    static void Registry(const char* theComment, TStorableEngine theEngine);
-    static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
-    static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
-    static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue);
-    static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
-    static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
-    static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal);
-    static void DataToStream(std::ostringstream& theStr, const QString& theName, const int theVal);
-    static void DataToStream(std::ostringstream& theStr, const QString& theName, const double theVal);
-  };
 
-  //===========================================================================
-  class RemovableObject_i : public virtual POA_VISU::RemovableObject,
-                            public virtual Storable
-  {
-  public:
-    virtual void RemoveFromStudy() = 0;
+    static 
+    void
+    Registry(const std::string& theComment, 
+            TStorableEngine theEngine);
+
+    static
+    Storable* 
+    Create(SALOMEDS::SObject_ptr, 
+          const std::string& thePrefix, 
+          const std::string& theString);
+
+    static 
+    QString 
+    FindValue(const TRestoringMap& theMap, 
+             const std::string& theArg, 
+             bool* isFind = NULL);
+
+    static 
+    QString
+    FindValue(const TRestoringMap& theMap, 
+             const std::string& theArg, 
+             const QString& theDefaultValue);
+
+    static
+    void
+    StrToMap(const QString& theStr, 
+            VISU::Storable::TRestoringMap& theMap);
+
+    static
+    SALOMEDS::SObject_ptr 
+    GetResultSO(SALOMEDS::SObject_ptr theSObject);
+
+    static
+    void
+    DataToStream(std::ostringstream& theStr, 
+                const QString& theName, 
+                const QString& theVal);
+
+    static 
+    void
+    DataToStream(std::ostringstream& theStr, 
+                const QString& theName, 
+                const int theVal);
+
+    static
+    void
+    DataToStream(std::ostringstream& theStr, 
+                const QString& theName, 
+                const double theVal);
   };
 
   //===========================================================================
@@ -151,32 +194,49 @@ namespace VISU
   _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument);
   SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
 
-  std::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);
-
-  std::string CreateAttributes(_PTR(Study) theStudyDocument,
-                              const char* theFatherEntry, const char* theRefFatherEntry,
-                              const char* theIOR, const char* theName,
-                              const char* thePersistentRef, const char* theComment,
-                              CORBA::Boolean theCreateNew = true);
-
-  std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
-                                  const char* theComment, int IsAllLevels = true);
-
-  SALOMEDS::SObject_var GetSObject(_PTR(SObject));
-  _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
-
-  SALOMEDS::Study_var GetDSStudy(_PTR(Study));
-
-  void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject,
-                      bool theIsAttrOnly = true,
-                      bool theDestroySubObjects = false);
-  void RemoveFromStudy(_PTR(SObject) theSObject,
-                      bool theIsAttrOnly = true,
-                      bool theDestroySubObjects = false);
+  std::string 
+  CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
+                  const std::string& theFatherEntry, 
+                  const std::string& theRefFatherEntry,
+                  const std::string& theIOR, 
+                  const std::string& theName,
+                  const std::string& thePersistentRef, 
+                  const std::string& theComment,
+                  CORBA::Boolean theCreateNew = true);
+
+  std::string 
+  CreateAttributes(_PTR(Study) theStudyDocument,
+                  const std::string& theFatherEntry, 
+                  const std::string& theRefFatherEntry,
+                  const std::string& theIOR, 
+                  const std::string& theName,
+                  const std::string& thePersistentRef, 
+                  const std::string& theComment,
+                  CORBA::Boolean theCreateNew = true);
+
+  std::string 
+  FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, 
+                      const std::string& theStartEntry,
+                      const std::string& theComment, 
+                      int IsAllLevels = true);
+  
+  SALOMEDS::SObject_var
+  GetSObject(_PTR(SObject));
+
+  _PTR(SObject) 
+    GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
+
+  SALOMEDS::Study_var 
+  GetDSStudy(_PTR(Study));
+
+  void
+  RemoveFromStudy(SALOMEDS::SObject_ptr theSObject,
+                 bool theIsAttrOnly = true,
+                 bool theDestroySubObjects = false);
+  void 
+  RemoveFromStudy(_PTR(SObject) theSObject,
+                 bool theIsAttrOnly = true,
+                 bool theDestroySubObjects = false);
 }
 
 #endif
index 275d3e2e92fa7d8a1db3c37a92cb81238acd9f6f..02a20b454526ea864cc9ccb740231aa638860fad 100644 (file)
 
 #include "VISU_ColoredPrs3d_i.hh"
 
-#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ColoredPL.hxx"
 #include "VISU_Result_i.hh"
 #include "VISU_Convertor.hxx"
 
 #include "SUIT_ResourceMgr.h"
 #include "SALOME_Event.hxx"
 
+#include <strstream>
 #include <vtkMapper.h>
-
-using namespace VISU;
-using namespace std;
+#include <vtkDataSet.h>
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -48,23 +47,14 @@ static int MYDEBUG = 0;
 
 //============================================================================
 VISU::ColoredPrs3d_i::
-ColoredPrs3d_i(Result_i* theResult,
-              bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theAddToStudy),
-  myScalarMapPL(NULL),
-  myIsFixedRange(false)
-{}
-
-VISU::ColoredPrs3d_i::
-ColoredPrs3d_i(Result_i* theResult,
-              SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
-  myScalarMapPL(NULL),
+ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
+  myPublishInStudyMode(thePublishInStudyMode),
+  myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
+  myColoredPL(NULL),
   myIsFixedRange(false)
 {}
 
+//---------------------------------------------------------------
 VISU::ColoredPrs3d_i
 ::~ColoredPrs3d_i()
 {}
@@ -95,34 +85,372 @@ VISU::ColoredPrs3d_i
   ProcessVoidEvent(new TRemoveFromStudy(this));
 }
 
+//---------------------------------------------------------------
+bool 
+VISU::ColoredPrs3d_i
+::SetInput(bool theReInit)
+{
+  try{
+    if(TSuperClass::SetInput(theReInit)){
+      if(CheckIsPossible()){
+       if(OnSetInput(theReInit)){
+         if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()))
+           return true;
+       }else
+         return true;
+      }
+    }
+  }catch(...){
+  }
+
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::ColoredPrs3d_i
+::OnRestoreInput()
+{
+  TSuperClass::OnRestoreInput();
+  myEntity = myPreviousEntity;
+  myFieldName = myPreviousFieldName;
+  myTimeStampNumber = myPreviousTimeStampNumber;
+}
+
+
+//---------------------------------------------------------------
+bool 
+VISU::ColoredPrs3d_i
+::OnSetInput(bool theReInit)
+{
+  myPreviousEntity = myEntity;
+  myPreviousFieldName = myFieldName;
+  myPreviousTimeStampNumber = myTimeStampNumber;
+
+  bool anIsCreatNew = !IsPipeLineExists();
+  if(anIsCreatNew)
+    CreatePipeLine(NULL); // to create proper pipeline
+
+  try{
+    DoSetInput(anIsCreatNew, theReInit);
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+    throw;
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+    throw;
+  }
+
+  // To update title according to the new input
+  SetTitle(GetCFieldName().c_str());
+
+  return anIsCreatNew;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetEntity(VISU::Entity theEntity)
+{
+  if(myEntity != theEntity){
+    myEntity = theEntity;
+    myParamsTime.Modified();
+  }
+}
+
+
+//---------------------------------------------------------------
+VISU::Entity
+VISU::ColoredPrs3d_i
+::GetEntity()
+{
+  return myEntity;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TEntity
+VISU::ColoredPrs3d_i
+::GetTEntity() const 
+{ 
+  return VISU::TEntity(int(myEntity));
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::ColoredPrs3d_i
+::SetFieldName(const char* theFieldName)
+{
+  if(myFieldName != theFieldName){
+    myFieldName = theFieldName;
+    myParamsTime.Modified();
+  }
+}
+
+
+//----------------------------------------------------------------------------
+char*
+VISU::ColoredPrs3d_i
+::GetFieldName()
+{
+  return CORBA::string_dup(myFieldName.c_str());
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetCFieldName() const
+{
+  return myFieldName;
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PField&
+VISU::ColoredPrs3d_i
+::GetField() const 
+{ 
+  return myField;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetField(VISU::PField theField)
+{
+  myField = theField;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::ColoredPrs3d_i
+::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
+{
+  if(myTimeStampNumber != theTimeStampNumber){
+    myTimeStampNumber = theTimeStampNumber;
+    myParamsTime.Modified();
+  }
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampNumber()
+{
+  return myTimeStampNumber;
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampNumberByIndex( CORBA::Long theIndex )
+{
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+  CORBA::Long aLength = aTimeStampsRange->length();
+
+  if( theIndex >= 0 && theIndex < aLength )
+  {
+    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
+    return anInfo.myNumber;
+  }
+
+  return -1;
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampIndexByNumber( CORBA::Long theNumber )
+{
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+  CORBA::Long aLength = aTimeStampsRange->length();
+
+  for( int index = 0; index < aLength; index++ )
+  {
+    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ index ];
+
+    if( anInfo.myNumber == theNumber )
+      return index;
+  }
+
+  return -1;
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PValForTime&
+VISU::ColoredPrs3d_i
+::GetValForTime() const 
+{ 
+  VISU::TValField& aValField = GetField()->myValField;
+  PValForTime& aValForTime = aValField[myTimeStampNumber];
+  return aValForTime;
+}
+
+
+VISU::ColoredPrs3d::TimeStampsRange* 
+VISU::ColoredPrs3d_i
+::GetTimeStampsRange()
+{
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange();
+  VISU::TValField& aValField = GetField()->myValField;
+  if(IsTimeStampFixed()){
+    aTimeStampsRange->length(1);
+    PValForTime& aValForTime = aValField[GetTimeStampNumber()];
+    std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
+    VISU::ColoredPrs3d::TimeStampInfo anInfo;
+    anInfo.myNumber = GetTimeStampNumber();
+    anInfo.myTime = aTime.c_str();
+    aTimeStampsRange[0] = anInfo;
+    return aTimeStampsRange._retn();    
+  }
+
+  // To exclude timstamps with repeated time
+  typedef std::map<std::string, long> TTimeStampsRange;
+  TTimeStampsRange aRange;
+  {
+    VISU::TValField::const_iterator anIter = aValField.begin();
+    for(; anIter != aValField.end(); anIter++){
+      vtkIdType aTimeStampNumber = anIter->first;
+      const PValForTime& aValForTime = anIter->second;
+      std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
+      aRange[aTime] = aTimeStampNumber;
+    }
+  }
+
+  // To sort timestamps according to their timestamp number
+  typedef std::map<long, std::string> TTimeStampsSortedRange;
+  TTimeStampsSortedRange aSortedRange;
+  {
+    TTimeStampsRange::const_iterator anIter = aRange.begin();
+    for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){
+      vtkIdType aTimeStampNumber = anIter->second;
+      const std::string& aTime = anIter->first;
+      aSortedRange[aTimeStampNumber] = aTime;
+    }
+  }
+
+  // To map the C++ data structures to the corresponding CORBA ones
+  {
+    aTimeStampsRange->length(aRange.size());
+    TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin();
+    for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){
+      vtkIdType aTimeStampNumber = anIter->first;
+      const std::string& aTime = anIter->second;
+      VISU::ColoredPrs3d::TimeStampInfo anInfo;
+      anInfo.myNumber = aTimeStampNumber;
+      anInfo.myTime = aTime.c_str();
+      aTimeStampsRange[aCounter] = anInfo;
+    }
+  }
+  return aTimeStampsRange._retn();
+}
+
+CORBA::Float
+VISU::ColoredPrs3d_i
+::GetMemorySize()
+{
+  return TSuperClass::GetMemorySize();
+}
+
+VISU::ColoredPrs3dHolder::BasicInput*
+VISU::ColoredPrs3d_i
+::GetBasicInput()
+{
+  VISU::ColoredPrs3dHolder::BasicInput* aBasicInput = new VISU::ColoredPrs3dHolder::BasicInput();
+  aBasicInput->myResult = GetResultObject();
+  aBasicInput->myMeshName = GetMeshName();
+  aBasicInput->myEntity = GetEntity();
+  aBasicInput->myFieldName = GetFieldName();
+  aBasicInput->myTimeStampNumber = GetTimeStampNumber();
+
+  return aBasicInput;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetHolderEntry(const std::string& theEntry)
+{
+  myHolderEntry = theEntry;
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetHolderEntry()
+{
+  return myHolderEntry;
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetActorEntry()
+{
+  if(myHolderEntry != "")
+    return myHolderEntry;
+  return TSuperClass::GetActorEntry();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean 
+VISU::ColoredPrs3d_i
+::IsTimeStampFixed()
+{
+  return myIsTimeStampFixed;
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i::EPublishInStudyMode 
+VISU::ColoredPrs3d_i
+::GetPublishInStudyMode()
+{
+  return myPublishInStudyMode;
+}
+
 //---------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
   if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
-    DoHook();
-
     ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
  
-    myField = anOrigin->GetField();
-    myMeshName = myField->myMeshName;
-    myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity;
-    myIteration = anOrigin->GetIteration();
-    myFieldName = anOrigin->GetFieldName();
-    
-    Build(-1);
+    bool anIsCreatNew = OnSetInput(false);
+    if(anIsCreatNew)
+      Build(ESameAs);
     
     TSuperClass::SameAs(theOrigin);
     
-    SetScalarMode(anOrigin->GetScalarMode());
+    CORBA::Long aNbComp = GetField()->myNbComp;
+    CORBA::Long anOriginNbComp = anOrigin->GetField()->myNbComp;
+    if(anOriginNbComp < aNbComp)
+      SetScalarMode(0);
+    else
+      SetScalarMode(anOrigin->GetScalarMode());
+
     SetNbColors(anOrigin->GetNbColors());
     SetBarOrientation(anOrigin->GetBarOrientation());
     
     SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
     SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
     SetLabels(anOrigin->GetLabels());
-    SetTitle(anOrigin->GetTitle());
+    if(anIsCreatNew)
+      SetTitle(anOrigin->GetTitle());
     
     SetBoldTitle(anOrigin->IsBoldTitle());
     SetItalicTitle(anOrigin->IsItalicTitle());
@@ -138,72 +466,138 @@ VISU::ColoredPrs3d_i
     SetLblFontType(anOrigin->GetLblFontType());
     anOrigin->GetLabelColor(&r,&g,&b);
     SetLabelColor(r,g,b);
+
+    UseFixedRange( anOrigin->IsRangeFixed() );
+    myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
+
+    SetHolderEntry( anOrigin->GetHolderEntry() );
   }
 }
   
+//----------------------------------------------------------------------------
+CORBA::Long 
+VISU::ColoredPrs3d_i
+::GetScalarMode()
+{
+  return myColoredPL->GetScalarMode();
+}
+
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SameAsParams(const ColoredPrs3d_i* theOrigin)
+::SetScalarMode(CORBA::Long theScalarMode) 
 {
-  int anIteration = GetIteration();
-  SameAs(theOrigin);
-  myIteration = anIteration;
+  CORBA::Long aNbComp = GetField()->myNbComp;
+  if(aNbComp == 1)
+    theScalarMode = 1;
+  else if(theScalarMode > aNbComp)
+    theScalarMode = 0;
 
-  Build(-1);
-  Update();
+  myColoredPL->SetScalarMode(theScalarMode);
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::ColoredPrs3d_i
+::GetMin()
+{
+  return myColoredPL->GetScalarRange()[0];
 }
 
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::ColoredPrs3d_i
+::GetMax()
+{
+  return myColoredPL->GetScalarRange()[1];
+}
 
 //----------------------------------------------------------------------------
-CORBA::Long 
+void
 VISU::ColoredPrs3d_i
-::GetScalarMode()
+::SetRange(CORBA::Double theMin, CORBA::Double theMax)
 {
-  return myScalarMapPL->GetScalarMode();
+  if(theMin > theMax) 
+    return;
+  vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
+  GetSpecificPL()->SetScalarRange(aScalarRange);
+  UseFixedRange(true);
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetScalarMode(CORBA::Long theScalarMode) 
+::SetSourceRange()
 {
-  myScalarMapPL->SetScalarMode(theScalarMode);
+  if(IsTimeStampFixed())
+    GetSpecificPL()->SetSourceRange();
+  else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
+    GetSpecificPL()->SetScalarRange(aScalarRange);
+  }
+  UseFixedRange(false);
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double 
 VISU::ColoredPrs3d_i
-::GetMin()
+::GetSourceMin()
 {
-  return myScalarMapPL->GetScalarRange()[0];
+  if(IsTimeStampFixed()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[0];
+  }else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    return aTMinMax.first;
+  }
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double 
 VISU::ColoredPrs3d_i
-::GetMax()
+::GetSourceMax()
 {
-  return myScalarMapPL->GetScalarRange()[1];
+  if(IsTimeStampFixed()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[1];
+  }else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    return aTMinMax.second;
+  }
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetNbColors(CORBA::Long theNbColors)
 {
-  myScalarMapPL->SetNbColors(theNbColors);
+  GetSpecificPL()->SetNbColors(theNbColors);
 }
 
+//----------------------------------------------------------------------------
 CORBA::Long 
 VISU::ColoredPrs3d_i
 ::GetNbColors()
 {
-  return myScalarMapPL->GetNbColors();
+  return GetSpecificPL()->GetNbColors();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation)
 {
-  myOrientation = theOrientation;
+  if(myOrientation != theOrientation){
+    myOrientation = theOrientation;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 VISU::ScalarMap::Orientation 
 VISU::ColoredPrs3d_i
 ::GetBarOrientation() 
@@ -211,14 +605,17 @@ VISU::ColoredPrs3d_i
   return myOrientation;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetPosition(CORBA::Double X, CORBA::Double Y) 
 { 
   myPosition[0] = X; 
   myPosition[1] = Y;
+  myParamsTime.Modified();
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetPosX() 
@@ -226,6 +623,7 @@ VISU::ColoredPrs3d_i
   return myPosition[0];
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetPosY() 
@@ -233,14 +631,17 @@ VISU::ColoredPrs3d_i
   return myPosition[1];
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) 
 {
   myWidth = theWidth; 
   myHeight = theHeight;
+  myParamsTime.Modified();
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetWidth() 
@@ -248,6 +649,7 @@ VISU::ColoredPrs3d_i
   return myWidth;
 }
 
+//----------------------------------------------------------------------------
 CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetHeight() 
@@ -255,13 +657,18 @@ VISU::ColoredPrs3d_i
   return myHeight;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetLabels(CORBA::Long theNbLabels)
 {
-  myNumberOfLabels = theNbLabels;
+  if(myNumberOfLabels != theNbLabels){
+    myNumberOfLabels = theNbLabels;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 CORBA::Long
 VISU::ColoredPrs3d_i
 ::GetLabels() 
@@ -269,13 +676,23 @@ VISU::ColoredPrs3d_i
   return myNumberOfLabels;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetTitle(const char* theName) 
+::SetTitle(const char* theTitle) 
 {
-  myTitle = theName;
+  std::strstream aStream;
+  const VISU::PValForTime& aValForTime = GetValForTime();
+  aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aValForTime->myTime)<<std::ends;
+  std::string aScalarBarTitle = aStream.str();
+  if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
+    myScalarBarTitle = aScalarBarTitle;
+    myTitle = theTitle;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 char* 
 VISU::ColoredPrs3d_i
 ::GetTitle() 
@@ -283,6 +700,15 @@ VISU::ColoredPrs3d_i
   return CORBA::string_dup(myTitle.c_str());
 }
 
+//----------------------------------------------------------------------------
+std::string 
+VISU::ColoredPrs3d_i
+::GetCTitle() 
+{ 
+  return myTitle;
+}
+
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsBoldTitle() 
@@ -290,13 +716,18 @@ VISU::ColoredPrs3d_i
   return myIsBoldTitle;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetBoldTitle(bool isBold)
+::SetBoldTitle(bool theIsBoldTitle)
 {
-  myIsBoldTitle = isBold;
+  if(myIsBoldTitle != theIsBoldTitle){
+    myIsBoldTitle = theIsBoldTitle;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsItalicTitle() 
@@ -304,13 +735,18 @@ VISU::ColoredPrs3d_i
   return myIsItalicTitle;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetItalicTitle(bool isItalic)
+::SetItalicTitle(bool theIsItalicTitle)
 { 
-  myIsItalicTitle = isItalic;
+  if(myIsItalicTitle != theIsItalicTitle){
+    myIsItalicTitle = theIsItalicTitle;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsShadowTitle() 
@@ -318,13 +754,18 @@ VISU::ColoredPrs3d_i
   return myIsShadowTitle;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetShadowTitle(bool isShadow)
+::SetShadowTitle(bool theIsShadowTitle)
 { 
-  myIsShadowTitle = isShadow;
+  if(myIsShadowTitle != theIsShadowTitle){
+    myIsShadowTitle = theIsShadowTitle;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 int
 VISU::ColoredPrs3d_i
 ::GetTitFontType()
@@ -332,13 +773,18 @@ VISU::ColoredPrs3d_i
   return myTitFontType;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetTitFontType(int theType)
+::SetTitFontType(int theTitFontType)
 {
-  myTitFontType = theType;
+  if(myTitFontType != theTitFontType){
+    myTitFontType = theTitFontType;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::GetTitleColor(vtkFloatingPointType* theR, 
@@ -350,6 +796,7 @@ VISU::ColoredPrs3d_i
   *theB = myTitleColor[2];
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetTitleColor(vtkFloatingPointType theR, 
@@ -359,8 +806,10 @@ VISU::ColoredPrs3d_i
   myTitleColor[0] = theR; 
   myTitleColor[1] = theG; 
   myTitleColor[2] = theB; 
+  myParamsTime.Modified();
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsBoldLabel()
@@ -368,13 +817,18 @@ VISU::ColoredPrs3d_i
   return myIsBoldLabel;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetBoldLabel(bool isBold
+::SetBoldLabel(bool theIsBoldLabel
 {
-  myIsBoldLabel = isBold;
+  if(myIsBoldLabel != theIsBoldLabel){
+    myIsBoldLabel = theIsBoldLabel;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsItalicLabel() 
@@ -382,13 +836,18 @@ VISU::ColoredPrs3d_i
   return myIsItalicLabel;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetItalicLabel(bool isItalic)
+::SetItalicLabel(bool theIsItalicLabel)
 {
-  myIsItalicLabel = isItalic;
+  if(myIsItalicLabel != theIsItalicLabel){
+    myIsItalicLabel = theIsItalicLabel;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3d_i
 ::IsShadowLabel() 
@@ -396,13 +855,18 @@ VISU::ColoredPrs3d_i
   return myIsShadowLabel;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetShadowLabel(bool isShadow)
+::SetShadowLabel(bool theIsShadowLabel)
 {
-  myIsShadowLabel = isShadow;
+  if(myIsShadowLabel != theIsShadowLabel){
+    myIsShadowLabel = theIsShadowLabel;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 int
 VISU::ColoredPrs3d_i
 ::GetLblFontType()
@@ -410,13 +874,18 @@ VISU::ColoredPrs3d_i
   return myLblFontType;
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::SetLblFontType(int theType)
+::SetLblFontType(int theLblFontType)
 {
-  myLblFontType = theType;
+  if(myIsShadowLabel != theLblFontType){
+    myLblFontType = theLblFontType;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::GetLabelColor(vtkFloatingPointType* theR, 
@@ -428,6 +897,7 @@ VISU::ColoredPrs3d_i
   *theB = myLabelColor[2];
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
 ::SetLabelColor(vtkFloatingPointType theR, 
@@ -437,8 +907,33 @@ VISU::ColoredPrs3d_i
   myLabelColor[0] = theR; 
   myLabelColor[1] = theG; 
   myLabelColor[2] = theB; 
+  myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::IsRangeFixed() 
+{ 
+  return myIsFixedRange; 
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::UseFixedRange(bool theUseFixedRange)
+{
+  myIsFixedRange = theUseFixedRange;
 }
 
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetScalarBarTitle()
+{
+  return myScalarBarTitle;
+}
 
 //----------------------------------------------------------------------------
 /**
@@ -446,19 +941,18 @@ VISU::ColoredPrs3d_i
  */
 VISU::Storable* 
 VISU::ColoredPrs3d_i
-::Create(const char* theMeshName, 
+::Create(const std::string& theMeshName, 
         VISU::Entity theEntity,
-        const char* theFieldName, 
-        int theIteration)
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  DoHook(); // to create proper pipeline
+  SetMeshName(theMeshName.c_str());
+  SetEntity(theEntity);
+  SetFieldName(theFieldName.c_str());
+  SetTimeStampNumber(theTimeStampNumber);
+  OnSetInput(false);
 
-  myMeshName = theMeshName;
-  myEntity = (VISU::TEntity)theEntity;
-  myFieldName =theFieldName;
-  myIteration = theIteration;
-
-  Build(false); // to get corresponding input from result and initilize the pipeline
+  Build(ECreateNew); // to get corresponding input from result and initilize the pipeline
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
@@ -558,22 +1052,22 @@ VISU::ColoredPrs3d_i
   return this;
 }
 
+//----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ColoredPrs3d_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  DoHook();
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
-  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
-  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
+  SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
+  SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1());
+  SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
+  myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed").toInt();
+  OnSetInput(false);
 
-  myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
-
-  Build(true);
-
-  TSuperClass::Restore(theMap);
+  Build(ERestore);
 
   SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
@@ -605,21 +1099,22 @@ VISU::ColoredPrs3d_i
   return this;
 }
 
+//----------------------------------------------------------------------------
 void 
 VISU::ColoredPrs3d_i
 ::ToStream(std::ostringstream& theStr)
 {
   TSuperClass::ToStream(theStr);
 
+  Storable::DataToStream( theStr, "myEntity",         GetEntity() );
+  Storable::DataToStream( theStr, "myFieldName",      GetCFieldName() );
+  Storable::DataToStream( theStr, "myIteration",      int(GetTimeStampNumber()) );
+  Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
+
   Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
   Storable::DataToStream( theStr, "myOrientation",    myOrientation );
 
-  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, "myTitle",          myTitle.c_str() );
   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
   Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
@@ -648,53 +1143,104 @@ VISU::ColoredPrs3d_i
 //----------------------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
-::DoHook()
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
 {
-  if(MYDEBUG) MESSAGE("ColoredPrs3d_i::DoHook() - "<<myPipeLine);
-  if(!myPipeLine){
-    myPipeLine = VISU_ScalarMapPL::New();
-    myPipeLine->GetMapper()->SetScalarVisibility(1);
+  if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<<thePipeLine);
+  myColoredPL = dynamic_cast<VISU_ColoredPL*>(thePipeLine);
+
+  SetPipeLine(myColoredPL);
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy)
+{
+  static char aFolderName[] = "3D Presentations";
+  CORBA::String_var anEntry;
+  SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName);
+  if(!CORBA::is_nil(aSObject) && aSObject->Depth() == 3){
+    anEntry = aSObject->GetID();
+    return anEntry.in();
   }
-  myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
+  SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy);
+  CORBA::String_var aFatherEntry = aSComponent->GetID();
+  anEntry = VISU::CreateAttributes(theStudy,
+                                  aFatherEntry.in(),
+                                  "",
+                                  "",
+                                  aFolderName,
+                                  "",
+                                  "",
+                                  true).c_str();
+  return anEntry.in();
 }
 
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ColoredPrs3d_i
-::Build(int theRestoring)
+::Build(EBuildMode theBuildMode)
 {
   if(MYDEBUG)
-    MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-  if(myAddToStudy) 
+    MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theBuildMode = "<<theBuildMode);
+  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+  bool anIsPublishInStudy = (myPublishInStudyMode == EPublishUnderTimeStamp || myPublishInStudyMode == EPublishIndependently);
+  if(anIsPublishInStudy) 
     aStudyBuilder->NewCommand();  // There is a transaction
 #ifndef _DEXCEPT_
   try{
 #endif
-    DoSetInput(myResult);
     QString aComment;
-    myName = "NoName";
-    if(theRestoring <= 0){
-      if(theRestoring == 0) myScalarMapPL->Init();
-      if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
-      const VISU::TValField& aValField = myField->myValField;
-      const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
-      aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
-      if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
+    SetName("NoName", false);
+    if(theBuildMode == ECreateNew || theBuildMode == ESameAs){
+      if(!IsRangeFixed()) 
+       SetSourceRange();
+      if(theBuildMode == ECreateNew) 
+       SetTitle(GetCFieldName().c_str());
     }
-    if(myAddToStudy){
-      myName = GenerateName().latin1();
+    if(myPublishInStudyMode == EPublishUnderTimeStamp){
+      SetName(GenerateName().latin1(), false);
       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(),myIteration,myField->myNbComp);
-      string aResultEntry = myResult->GetEntry();
-      string aRefFatherEntry = myResult->GetRefFatherEntry();
-      string anEntry = myResult->GetEntry(aComment.latin1());
-      if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
+                      VISU::TTIMESTAMP,
+                      GetCMeshName().c_str(),
+                      GetEntity(),
+                      GetCFieldName().c_str(),
+                      GetTimeStampNumber(),
+                      GetField()->myNbComp);
+      std::string aResultEntry = GetCResult()->GetEntry();
+      std::string aRefFatherEntry = GetCResult()->GetRefFatherEntry();
+      std::string anEntry = GetCResult()->GetEntry(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",
-                      GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
+                      GetComment(),
+                      GetCMeshName().c_str(),
+                      GetEntity(),
+                      GetCFieldName().c_str(),
+                      GetTimeStampNumber(),
+                      GetField()->myNbComp);
+      CORBA::String_var anIOR = GetID();
+      CreateAttributes(GetStudyDocument(),
+                      anEntry,
+                      aRefFatherEntry,
+                      anIOR.in(),
+                      GetName(),
+                      "",
+                      aComment.latin1(),
+                      true);
+    }else if(myPublishInStudyMode == EPublishIndependently){
+      SetName(GenerateName().latin1(), false);
       CORBA::String_var anIOR = GetID();
-      CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
-      mySObject = myStudy->FindObjectIOR(anIOR);
+      std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument());
+      aComment.sprintf("myComment=%s",
+                      GetComment());
+      CreateAttributes(GetStudyDocument(),
+                      aFatherEntry,
+                      "",
+                      anIOR.in(),
+                      GetName(),
+                      "",
+                      aComment.latin1(),
+                      true);
     }
 #ifndef _DEXCEPT_
   }catch(std::exception& exc){
@@ -705,51 +1251,7 @@ VISU::ColoredPrs3d_i
     throw;
   }
 #endif
-  if(myAddToStudy) 
+  if(anIsPublishInStudy) 
     aStudyBuilder->CommitCommand();
   return this;
 }
-
-
-//----------------------------------------------------------------------------
-const VISU::PField&
-VISU::ColoredPrs3d_i
-::GetField() const 
-{ 
-  return myField;
-}
-
-const std::string&
-VISU::ColoredPrs3d_i
-::GetMeshName() const 
-{ 
-  return myMeshName;
-}
-
-VISU::Entity
-VISU::ColoredPrs3d_i
-::GetEntity() const 
-{ 
-  return VISU::Entity(myEntity);
-}
-
-const std::string&
-VISU::ColoredPrs3d_i
-::GetFieldName() const 
-{ 
-  return myFieldName;
-}
-
-int
-VISU::ColoredPrs3d_i
-::GetIteration() const 
-{ 
-  return myIteration;
-}
-
-VISU_ScalarMapPL*
-VISU::ColoredPrs3d_i
-::GetScalarMapPL()
-{ 
-  return myScalarMapPL;
-}
index b5417b22a32dde891548d36b3b4f34ccf6400579..1115bbef967b18058fa25230c179e4abc77e68aa 100644 (file)
 
 #include "VISU_Prs3d_i.hh"
 
-class VISU_ScalarMapPL;
+class VISU_ColoredPL;
 
 namespace VISU
 {
+  std::string
+  FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy);
+
   //============================================================================
   class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
                         public virtual Prs3d_i
@@ -42,13 +45,15 @@ namespace VISU
   public:
     //----------------------------------------------------------------------------
     typedef Prs3d_i TSuperClass;
+    typedef VISU::ColoredPrs3d TInterface;
+
+    /*! 
+      The enumeration allow to define what mode should be used for the presentation building.
+    */
+    enum EPublishInStudyMode {EPublishUnderTimeStamp, EPublishIndependently, ERegisterInCache, EDoNotPublish};
 
     explicit
-    ColoredPrs3d_i(Result_i* theResult,
-                  bool theAddToStudy);
-    explicit
-    ColoredPrs3d_i(Result_i* theResult,
-                  SALOMEDS::SObject_ptr theSObject);
+    ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode);
 
     virtual
     ~ColoredPrs3d_i();
@@ -57,6 +62,65 @@ namespace VISU
     void
     RemoveFromStudy();
 
+    //----------------------------------------------------------------------------
+    virtual
+    void
+    SetEntity(Entity theEntity);
+
+    virtual
+    Entity
+    GetEntity();
+
+    TEntity
+    GetTEntity() const;
+
+    virtual
+    void
+    SetFieldName(const char* theFieldName);
+
+    virtual
+    char*
+    GetFieldName();
+
+    std::string
+    GetCFieldName() const;
+
+    virtual 
+    const VISU::PField&
+    GetField() const;
+
+    virtual
+    void 
+    SetTimeStampNumber(CORBA::Long theTimeStampNumber);
+
+    virtual
+    CORBA::Long
+    GetTimeStampNumber();
+
+    virtual
+    CORBA::Long
+    GetTimeStampNumberByIndex( CORBA::Long theIndex );
+
+    virtual
+    CORBA::Long
+    GetTimeStampIndexByNumber( CORBA::Long theNumber );
+
+    virtual 
+    const VISU::PValForTime&
+    GetValForTime() const;
+
+    virtual
+    VISU::ColoredPrs3d::TimeStampsRange*
+    GetTimeStampsRange();
+
+    virtual 
+    CORBA::Boolean 
+    IsTimeStampFixed();
+
+    virtual
+    EPublishInStudyMode
+    GetPublishInStudyMode();
+
     //----------------------------------------------------------------------------
     virtual
     CORBA::Long
@@ -74,6 +138,26 @@ namespace VISU
     CORBA::Double 
     GetMax();
 
+    virtual
+    void
+    SetRange(CORBA::Double theMin, CORBA::Double theMax);
+
+    virtual
+    CORBA::Double 
+    GetSourceMin();
+
+    virtual
+    CORBA::Double 
+    GetSourceMax();
+
+    virtual 
+    void
+    SetSourceRange();
+
+    virtual
+    CORBA::Boolean
+    IsRangeFixed();
+
     virtual 
     void 
     SetNbColors(CORBA::Long theNbColors);
@@ -124,66 +208,68 @@ namespace VISU
 
     virtual
     void
-    SetTitle(const char* theName);
+    SetTitle(const char* theTitle);
 
     virtual
     char* 
     GetTitle();
 
+    std::string 
+    GetCTitle();
+
     //----------------------------------------------------------------------------
-  protected:
-    VISU::ScalarMap::Orientation myOrientation;
-    std::string myTitle;
-    int myNumberOfLabels;
-    vtkFloatingPointType myPosition[2], myWidth, myHeight;
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
 
-  public:
     //----------------------------------------------------------------------------
+    //! Returns presentation input
+    VISU::ColoredPrs3dHolder::BasicInput*
+    GetBasicInput();
+
+    virtual
+    void
+    SetHolderEntry(const std::string& theEntry);
+
+    virtual
+    std::string
+    GetHolderEntry();
+
+    //----------------------------------------------------------------------------
+  public:
+    /*!
+      Initlizes the in first time presentation
+    */
     virtual
     Storable* 
-    Create(const char* theMeshName, 
+    Create(const std::string& theMeshName, 
           VISU::Entity theEntity,
-          const char* theFieldName, 
-          int theIteration);
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
+    /*!
+      Retores state of the presentation
+    */
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
+    /*!
+      Writes persistent params of the presentation into the given stream
+    */
     virtual 
     void
     ToStream(std::ostringstream& theStr);
 
+    /*!
+      Update state of the presentation according to the input.
+    */
     virtual 
     void
     SameAs(const Prs3d_i* theOrigin);
 
-    /*!
-     *  \brief Works like SameAs() method, but keep myIteration value unchanged.
-     *
-     *  Is used in VISU_TimeAnimation class implementation.
-     */
-    void
-    SameAsParams(const ColoredPrs3d_i* theOrigin);
-
-    virtual const VISU::PField&
-    GetField() const;
-
-    const std::string& 
-    GetMeshName() const;
-
-    VISU::Entity
-    GetEntity() const;
-
-    const std::string& 
-    GetFieldName() const;
-
-    int
-    GetIteration() const;
-
-    VISU_ScalarMapPL* 
-    GetScalarMapPL();
-
     virtual 
     bool
     IsBoldTitle();
@@ -272,12 +358,109 @@ namespace VISU
                  vtkFloatingPointType theG, 
                  vtkFloatingPointType theB);
 
+    VISU_ColoredPL* 
+    GetSpecificPL() const
+    { 
+      return myColoredPL; 
+    }
+    
     //----------------------------------------------------------------------------
   protected:
-    PField myField;
-    TEntity myEntity;
+    /*!
+      Applyes basic input parameters to the presentation.
+      Returns true if all are right.
+    */
+    virtual 
+    bool 
+    SetInput(bool theReInit);
+
+    //! Restore input parameters if Apply function fails (redefines Prs3d::OnRestoreInput)
+    virtual 
+    void 
+    OnRestoreInput();
+
+    /*!
+      Checks whether it is possible to create presentation 
+      with the given basic parameters or not.
+    */
+    virtual 
+    bool 
+    CheckIsPossible() = 0;
+
+    /*!
+      Creates proper instance of VTK pipeline.
+    */
+    virtual
+    void 
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    /*!
+      First checks whether corresponding VTK pipeline exists and create it if not. 
+      Then calls VISU_ColoredPrs3d_i::DoSetInput.
+      Returns true if during the call corresponding VTK pipeline was created,
+      false otherwise.
+    */
+    virtual 
+    bool
+    OnSetInput(bool theReInit);
+
+   /*!
+      Sets input data set according to basic input parameters -
+      Result, MeshName, Entity, FieldName and TimeStampNumber.
+    */
+    virtual 
+    void
+    DoSetInput(bool theIsInitilizePipe, bool theReInit) = 0;
+
+    /*! 
+      The enumeration allow to define what mode should be used for the presentation building.
+    */
+    enum EBuildMode {ECreateNew, ESameAs, ERestore};
+
+    /*! 
+      The enumeration allow to define what mode should be used for the presentation building.
+    */
+    Storable* 
+    Build(EBuildMode theBuildMode);
+
+    void
+    SetField(VISU::PField theField);
+
+    void
+    UseFixedRange(bool theUseFixedRange);
+
+    std::string 
+    GetScalarBarTitle();
+
+    //! Used in derived classes to initilize the IO for actors
+    virtual
+    std::string
+    GetActorEntry();
+
+  private:
+    // Decalare basic input parameters
+    VISU::Entity myEntity;
+    VISU::Entity myPreviousEntity;
+
     std::string myFieldName;
-    int myIteration;
+    std::string myPreviousFieldName;
+
+    CORBA::Long myTimeStampNumber;
+    CORBA::Long myPreviousTimeStampNumber;
+
+    bool myIsTimeStampFixed;
+
+    PField myField;
+    EPublishInStudyMode myPublishInStudyMode;
+
+    std::string myHolderEntry;
+
+    std::string myTitle;
+    std::string myScalarBarTitle;
+
+    int myNumberOfLabels;
+    VISU::ScalarMap::Orientation myOrientation;
+    vtkFloatingPointType myPosition[2], myWidth, myHeight;
 
     //Font management
     bool myIsBoldTitle;
@@ -292,21 +475,22 @@ namespace VISU
     int  myLblFontType;
     vtkFloatingPointType myLabelColor[3];
 
-    VISU_ScalarMapPL* myScalarMapPL;
+    VISU_ColoredPL* myColoredPL;
     bool myIsFixedRange;
-
-    virtual 
-    void
-    DoSetInput(Result_i* theResult) = 0;
-
-    Storable* 
-    Build(int theRestoring);
-
-    virtual
-    void 
-    DoHook();
   };
 
+  //----------------------------------------------------------------------------
+  template<class TColoredPrs3d>
+  Storable* 
+  Restore(SALOMEDS::SObject_ptr theSObject,
+         const std::string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+  {
+    TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
+    SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+    return aColoredPrs3d->Restore(aStudy, theMap);
+  }
+  //----------------------------------------------------------------------------
 }
 
 #endif
index 26b5074b7d53df1085dc9afc4702a2fc3d9a537c..dd78ea91ada673c003429e4d3265948e4e153df5 100644 (file)
@@ -28,6 +28,7 @@
 //  Copyright (C) 2003  CEA/DEN, EDF R&D
 
 #include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <vtkCellType.h>
 
@@ -348,9 +349,6 @@ VISU_MEDFieldConvertor::Build()
   aMesh->myName = aMeshName.in();
   aMesh->myMesh = aMEDMesh;
 
-  TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
-  aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
-
   if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
   TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -360,11 +358,11 @@ VISU_MEDFieldConvertor::Build()
   aMeshOnEntity->mySupport = aMEDSupport;
 
   if(aVEntity == NODE_ENTITY)
-    ::InitMeshOnEntity(aMesh,CELL_ENTITY,aMeshOnEntity);
+    ::InitMeshOnEntity(aMesh, CELL_ENTITY, aMeshOnEntity);
   else
-    ::InitMeshOnEntity(aMesh,NODE_ENTITY,aMeshOnEntity);
+    ::InitMeshOnEntity(aMesh, NODE_ENTITY, aMeshOnEntity);
 
-  ::GetCellsSize(aMesh,aMEDMesh,aVEntity);
+  ::GetCellsSize(aMesh, aMEDMesh, aVEntity);
 
   TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
   PCField aField = aFieldMap[aFieldName.in()](new TCField());
@@ -372,9 +370,14 @@ VISU_MEDFieldConvertor::Build()
   aField->myName = aFieldName.in();
   aField->myEntity = aVEntity;
   aField->myMeshName = aMeshName.in();
-  aField->InitArrays(myField->getNumberOfComponents());
   aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
 
+  vtkIdType aDataType = VTK_DOUBLE;
+  SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(myField);
+  if(aFieldDouble->_is_nil())
+    aDataType = VTK_INT;
+  aField->Init(myField->getNumberOfComponents(), aDataType);
+
   if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
   TValField& aValField = aField->myValField;
@@ -531,9 +534,6 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
       aMesh->myName = aMeshName.in();
       aMesh->myMesh = aMEDMesh;
 
-      TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
-      aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
-
       if(MYDEBUG) 
        MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
@@ -765,8 +765,14 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          aField->myName = aFieldName.in();
          aField->myEntity = anEntity;
          aField->myMeshName = aMeshName.in();
-         aField->InitArrays(aMEDField->getNumberOfComponents());
          aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
+
+         vtkIdType aDataType = VTK_DOUBLE;
+         SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
+         if(aFieldDouble->_is_nil())
+           aDataType = VTK_INT;
+         aField->Init(aMEDField->getNumberOfComponents(), aDataType);
+
          if(MYDEBUG) 
            MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
        }else
@@ -827,9 +833,6 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
       aMesh->myName = aMeshName.in();
       aMesh->myMesh = aMEDMesh;
       
-      TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
-      aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
-
       myMeshMap[aMeshName.in()] = aMesh;
 
       if(MYDEBUG) 
@@ -867,9 +870,14 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
       aField->myName = aFieldName.in();
       aField->myEntity = aVEntity;
       aField->myMeshName = aMeshName.in();
-      aField->InitArrays(aMEDField->getNumberOfComponents());
       aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
       
+      vtkIdType aDataType = VTK_DOUBLE;
+      SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
+      if(aFieldDouble->_is_nil())
+       aDataType = VTK_INT;
+      aField->Init(aMEDField->getNumberOfComponents(), aDataType);
+
       aFieldMap[aFieldName.in()] = aField;
 
       if(MYDEBUG) 
@@ -988,9 +996,8 @@ VISU_MEDConvertor
     return 0;
   
   SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
-  int aDim = theMesh->myDim;
-  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-  int aNbElem = aCoords.GetNbPoints();
+  vtkIdType aDim = theMesh->GetDim();
+  vtkIdType aNbElem = theMesh->GetNbPoints();
 
   if(MYDEBUG) MESSAGE("LoadPoints - aNbElem = "<<aNbElem);
 
@@ -998,11 +1005,11 @@ VISU_MEDConvertor
     throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
 
   SALOME_MED::double_array_var aCCoord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
-  for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
-    VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem);
-    for(int iDim = 0; iDim < aDim; iDim++)
-      aCoordSlice[iDim] = aCCoord[anId++];
-  }
+  TCMEDCoordHolder* aCoordHolder = new TCMEDCoordHolder();
+  aCoordHolder->Init(aNbElem, aDim, aCCoord);
+
+  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+  aCoords.Init(PCoordHolder(aCoordHolder));
   
   if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
   
@@ -1034,9 +1041,7 @@ VISU_MEDConvertor
   if(theFamily->myIsDone) 
     return 0;
 
-  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-  int aNbElem = aCoords.GetNbPoints();
-
+  vtkIdType aNbElem = theMesh->GetNbPoints();
   SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily;
   CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
   TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
@@ -1084,9 +1089,8 @@ VISU_MEDConvertor
   const TEntity& aVEntity = theMeshOnEntity->myEntity;
   int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
   const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
-  const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
   TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
-  int aNbPoints = aCoords.GetNbPoints();
+  vtkIdType aNbPoints = theMesh->GetNbPoints();
 
   for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
     SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
@@ -1259,34 +1263,28 @@ VISU_MEDConvertor
 }
 
 
-template<class TArray> 
-int 
-ImportField(TArray& theArray, 
+template<class TValueType,
+        class TContainerType> 
+void 
+ImportField(TContainerType& theContainer, 
            VISU::PCMesh theMesh,
            VISU::PCField theField,
            VISU::PCValForTime theValForTime,
            VISU::PCMeshOnEntity theMeshOnEntity)
 {
-  int aNbComp = theField->myNbComp;
+  typedef TTCMEDMeshValue<TValueType, TContainerType> TVMeshValue;
+  vtkIdType aNbComp = theField->myNbComp;
   if(theField->myEntity == NODE_ENTITY){
     VISU::EGeometry aEGeom = VISU::ePOINT1;
-    int aNbGauss = theValForTime->GetNbGauss(aEGeom);
-    const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-    int aNbElem = aCoords.GetNbPoints();
+    vtkIdType aNbGauss = theValForTime->GetNbGauss(aEGeom);
+    vtkIdType aNbElem = theMesh->GetNbPoints();
 
     if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<<aNbElem);
 
-    TMeshValue& aMeshValue = theValForTime->GetMeshValue(VISU::ePOINT1);
-    aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
-    for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
-      TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
-      for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
-       TValueSlice& aValueSlice = aValueSliceArr[iGauss];
-       for(int iComp = 0; iComp < aNbComp; iComp++){
-         aValueSlice[iComp] = theArray[anId++];
-       }
-      }
-    }
+    PMeshValue& aVMeshValue = theValForTime->GetMeshValue(VISU::ePOINT1);
+    TVMeshValue* aMeshValue = new TVMeshValue();
+    aMeshValue->Init(aNbElem, aNbGauss, aNbComp, theContainer, 0);
+    aVMeshValue.reset(aMeshValue);
   }else{
     SALOME_MED::medGeometryElement* aGeomElems;
     const TEntity& aVEntity = theField->myEntity;
@@ -1294,7 +1292,7 @@ ImportField(TArray& theArray,
     for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
       SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
       VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
-      int aNbGauss = theValForTime->GetNbGauss(aEGeom);
+      vtkIdType aNbGauss = theValForTime->GetNbGauss(aEGeom);
       const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
       TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom);
       if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
@@ -1304,22 +1302,15 @@ ImportField(TArray& theArray,
                  "; aIndexAndSize = {"<<aIndexAndSize.first<<
                  ","<<aIndexAndSize.second<<"}");
 
-       int aNbElem = aIndexAndSize.second;
-       int aStart = aIndexAndSize.first*aNbComp;
-       TMeshValue& aMeshValue = theValForTime->GetMeshValue(aEGeom);
-       aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
-       for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){
-         TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
-         for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
-           TValueSlice& aValueSlice = aValueSliceArr[iGauss];
-           for(int iComp = 0; iComp < aNbComp; iComp++)
-             aValueSlice[iComp] = theArray[aStart+anId+iComp];
-         }
-       }
+       vtkIdType aNbElem = aIndexAndSize.second;
+       vtkIdType aStart = aIndexAndSize.first * aNbComp;
+       PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+       TVMeshValue* aMeshValue = new TVMeshValue();
+       aMeshValue->Init(aNbElem, aNbGauss, aNbComp, theContainer, aStart);
+       aVMeshValue.reset(aMeshValue);
       }
     }
   }
-  return 1;
 }
 
 int
@@ -1330,8 +1321,8 @@ VISU_MEDConvertor
            VISU::PCValForTime theValForTime)
 {
   //Check on loading already done
-  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
-  if(anIDMapperFilter->myIsVTKDone) 
+  PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
+  if(anUnstructuredGridIDMapper->myIsVTKDone) 
     return 0;
   
   PCProfile aProfile(new TCProfile());
@@ -1343,16 +1334,25 @@ VISU_MEDConvertor
   if(!aFieldDouble->_is_nil()){
     SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
-    ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
+    ImportField<CORBA::Double>(anArray,
+                              theMesh,
+                              theField,
+                              theValForTime,
+                              theMeshOnEntity);
   }
+
   SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
   if(!aFieldInt->_is_nil()){
     SALOME_MED::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
-    ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
+    ImportField<CORBA::Long>(anArray,
+                            theMesh,
+                            theField,
+                            theValForTime,
+                            theMeshOnEntity);
   }
 
-  anIDMapperFilter->myIsVTKDone = true;
+  anUnstructuredGridIDMapper->myIsVTKDone = true;
 
   return 1;
 }
index 97d470418fa36056efd5860917778a56f52dcfa7..e51c580932e2263d3cd3aebe3068b9ff8e45b48f 100644 (file)
 
 #include "VISUConfig.hh"
 #include "VISU_Convertor_impl.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
 
 #include <string>      
 
 namespace VISU
 {
+  //---------------------------------------------------------------
+  struct TCMEDCoordHolder: TCoordHolder<SALOME_MED::double_array_var>
+  {
+    virtual
+    const TCoord*
+    GetPointer() const
+    {
+      return &myCoord[0];
+    }
+
+    virtual
+    TCoord*
+    GetPointer()
+    {
+      return &myCoord[0];
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<class TValueType, class TContainerType>
+  struct TTCMEDMeshValue: TTMeshValueHolder<TValueType, TContainerType>
+  {
+    typedef TTMeshValueHolder<TValueType, TContainerType> TSuperClass;
+    vtkIdType myStartIndex;
+
+    //! To initilize the class instance
+    void
+    Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp,
+        const TContainerType& theContainer,
+        vtkIdType theStartIndex)
+    {
+      TSuperClass::Init(theNbElem, theNbGauss, theNbComp, theContainer);
+      myStartIndex = theStartIndex;
+    }
+
+    virtual
+    const TValueType*
+    GetPointer() const
+    {
+      return &(this->myContainer[myStartIndex]);
+    }
+
+    virtual
+    TValueType*
+    GetPointer()
+    {
+      return &(this->myContainer[myStartIndex]);
+    }
+  };
+
+
   //---------------------------------------------------------------
   struct TCMesh: virtual TMeshImpl
   {
     SALOME_MED::MESH_var myMesh;
   };
-  typedef SharedPtr<TCMesh> PCMesh;
+  typedef MED::SharedPtr<TCMesh> PCMesh;
 
 
   //---------------------------------------------------------------
   struct TCProfile: virtual TProfileImpl
   {};
-  typedef SharedPtr<TCProfile> PCProfile;
+  typedef MED::SharedPtr<TCProfile> PCProfile;
 
 
   //---------------------------------------------------------------
   struct TCSubMesh: virtual TSubMeshImpl
   {};
-  typedef SharedPtr<TCSubMesh> PCSubMesh;
+  typedef MED::SharedPtr<TCSubMesh> PCSubMesh;
 
 
   //---------------------------------------------------------------
@@ -65,7 +122,7 @@ namespace VISU
     typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
     TCellsFirstIndex myCellsFirstIndex;
   };
-  typedef SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
+  typedef MED::SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
   
 
   //---------------------------------------------------------------
@@ -73,7 +130,7 @@ namespace VISU
   {
     SALOME_MED::FAMILY_var myFamily;
   };
-  typedef SharedPtr<TCFamily> PCFamily;
+  typedef MED::SharedPtr<TCFamily> PCFamily;
   
 
   //---------------------------------------------------------------
@@ -81,13 +138,13 @@ namespace VISU
   {
     SALOME_MED::GROUP_var myGroup;
   };
-  typedef SharedPtr<TCGroup> PCGroup;
+  typedef MED::SharedPtr<TCGroup> PCGroup;
 
 
   //---------------------------------------------------------------
   struct TCField: virtual TFieldImpl
   {};
-  typedef SharedPtr<TCField> PCField;
+  typedef MED::SharedPtr<TCField> PCField;
 
 
   //---------------------------------------------------------------
@@ -95,12 +152,14 @@ namespace VISU
   {
     SALOME_MED::FIELD_var myField;
   };
-  typedef SharedPtr<TCValForTime> PCValForTime;
+  typedef MED::SharedPtr<TCValForTime> PCValForTime;
 
 }
 
 
-class VISU_MEDConvertor: public VISU_Convertor_impl{
+//---------------------------------------------------------------
+class VISU_MEDConvertor: public VISU_Convertor_impl
+{
  protected:
   SALOMEDS::SObject_var mySObject;
   VISU_MEDConvertor() {};
@@ -179,6 +238,8 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
 
 };
 
+
+//---------------------------------------------------------------
 class VISU_MEDFieldConvertor: public VISU_MEDConvertor
 {
  protected:
index a44b5216b7274eb92ac8c2745cb447cf854a5442..d09bc322d6bfdeb59fd3fe6c3ff72cc4028f4950 100644 (file)
@@ -36,9 +36,6 @@
 
 #include <vtkAppendPolyData.h>
 
-using namespace VISU;
-using namespace std;
-
 static vtkFloatingPointType EPS_machine = 1.0E-7;
 
 #ifdef _DEBUG_
@@ -47,59 +44,88 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
-int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t
+VISU::CutLines_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity, 
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber, 
+            bool theIsMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+  return TSuperClass::IsPossible(theResult,
+                                theMeshName,
+                                theEntity,
+                                theFieldName,
+                                theTimeStampNumber,
+                                theIsMemoryCheck);
 }
 
+//---------------------------------------------------------------
 int VISU::CutLines_i::myNbPresent = 0;
-QString VISU::CutLines_i::GenerateName() { return VISU::GenerateName("CutLines",myNbPresent++);}
 
-const string VISU::CutLines_i::myComment = "CUTLINES";
-const char* VISU::CutLines_i::GetComment() const { return myComment.c_str();}
+//---------------------------------------------------------------
+QString 
+VISU::CutLines_i::GenerateName() 
+{ 
+  return VISU::GenerateName("CutLines",myNbPresent++);
+}
 
+//---------------------------------------------------------------
+const string VISU::CutLines_i::myComment = "CUTLINES";
 
-VISU::CutLines_i::
-CutLines_i(Result_i* theResult, 
-          bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myCutLinesPL(NULL)
-{}
+//---------------------------------------------------------------
+const char* 
+VISU::CutLines_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
 
 
+//---------------------------------------------------------------
 VISU::CutLines_i::
-CutLines_i(Result_i* theResult, 
-          SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myCutLinesPL(NULL)
-{
-}
+{}
 
 
+//---------------------------------------------------------------
 /*! Copy map to /a myMapCurvesInverted.
  * \param theCurves - map
  */
-void VISU::CutLines_i::CopyCurvesInverted(const TCurvesInv& theCurves){
+void 
+VISU::CutLines_i
+::CopyCurvesInverted(const TCurvesInv& theCurves)
+{
   myMapCurvesInverted = theCurves;
 }
 
-VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                        const char* theFieldName, int theIteration)
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutLines_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::CutLines_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
@@ -139,8 +165,12 @@ VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap)
 }
 
 
-void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
-  ScalarMap_i::ToStream(theStr);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
   int aNbLines = GetNbLines();
   
@@ -171,91 +201,187 @@ void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myMapCurvesInverted", aStrCurvesInverted.latin1());
 }
 
-VISU::CutLines_i::~CutLines_i(){
+
+//---------------------------------------------------------------
+VISU::CutLines_i
+::~CutLines_i()
+{
   if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()");
 }
 
 
-void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
-                                     CORBA::Double theXAngle, CORBA::Double theYAngle)
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                CORBA::Double theXAngle, 
+                CORBA::Double theYAngle)
 {
   myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
-                              theXAngle,theYAngle);
+                              theXAngle,
+                              theYAngle);
 }
-void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
-                                      CORBA::Double theXAngle, CORBA::Double theYAngle)
+
+//---------------------------------------------------------------
+void 
+VISU::CutLines_i
+::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+                 CORBA::Double theXAngle, 
+                 CORBA::Double theYAngle)
 {
   myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
-                              theXAngle,theYAngle,1);
+                              theXAngle,
+                              theYAngle,
+                              1);
 }
 
-VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() { 
+//---------------------------------------------------------------
+VISU::CutPlanes::Orientation 
+VISU::CutLines_i
+::GetOrientationType() 
+{ 
   return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation());
 }
-VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType2() { 
+
+//---------------------------------------------------------------
+VISU::CutPlanes::Orientation 
+VISU::CutLines_i
+::GetOrientationType2() 
+{ 
   return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1));
 }
 
-CORBA::Double VISU::CutLines_i::GetRotateX(){
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetRotateX()
+{
   return myCutLinesPL->GetRotateX();
 }
-CORBA::Double VISU::CutLines_i::GetRotateY(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetRotateY()
+{
   return myCutLinesPL->GetRotateY();
 }
 
-CORBA::Double VISU::CutLines_i::GetRotateX2(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetRotateX2()
+{
   return myCutLinesPL->GetRotateX(1);
 }
-CORBA::Double VISU::CutLines_i::GetRotateY2(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetRotateY2()
+{
   return myCutLinesPL->GetRotateY(1);
 }
 
 
-void VISU::CutLines_i::SetDisplacement(CORBA::Double theDisp) { 
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDisplacement(CORBA::Double theDisp) 
+{ 
   myCutLinesPL->SetDisplacement(theDisp);
 }
-void VISU::CutLines_i::SetDisplacement2(CORBA::Double theDisp) { 
+
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDisplacement2(CORBA::Double theDisp) 
+{ 
   myCutLinesPL->SetDisplacement(theDisp,1);
 }
 
-CORBA::Double VISU::CutLines_i::GetDisplacement() { 
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetDisplacement() 
+{ 
   return myCutLinesPL->GetDisplacement();
 }
-CORBA::Double VISU::CutLines_i::GetDisplacement2() { 
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetDisplacement2() 
+{ 
   return myCutLinesPL->GetDisplacement(1);
 }
 
 
-void VISU::CutLines_i::SetBasePlanePosition(CORBA::Double thePlanePosition){
+//---------------------------------------------------------------
+void 
+VISU::CutLines_i
+::SetBasePlanePosition(CORBA::Double thePlanePosition)
+{
   myCutLinesPL->SetPosition(thePlanePosition);
 }
 
-CORBA::Double VISU::CutLines_i::GetBasePlanePosition(){ 
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetBasePlanePosition()
+{ 
   return myCutLinesPL->GetPosition();
 }
 
-void VISU::CutLines_i::SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){
+//---------------------------------------------------------------
+void 
+VISU::CutLines_i
+::SetLinePosition(CORBA::Long thePlaneNumber, 
+                 CORBA::Double thePlanePosition)
+{
   myCutLinesPL->SetPartPosition(thePlaneNumber,thePlanePosition);
 }
 
-CORBA::Double VISU::CutLines_i::GetLinePosition(CORBA::Long thePlaneNumber){ 
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::CutLines_i
+::GetLinePosition(CORBA::Long thePlaneNumber)
+{ 
   return myCutLinesPL->GetPartPosition(thePlaneNumber,1);
 }
 
 
-void VISU::CutLines_i::SetDefault(){
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDefault()
+{
   myCutLinesPL->SetDefault();
 }
 
-CORBA::Boolean VISU::CutLines_i::IsDefault(){ 
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::CutLines_i
+::IsDefault()
+{ 
   return myCutLinesPL->IsDefault();
 }
 
-void VISU::CutLines_i::SetDefaultPosition(CORBA::Long thePlaneNumber){
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDefaultPosition(CORBA::Long thePlaneNumber)
+{
   myCutLinesPL->SetPartDefault(thePlaneNumber);
 }
 
-CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){ 
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::CutLines_i
+::IsDefaultPosition(CORBA::Long thePlaneNumber)
+{ 
   return myCutLinesPL->IsPartDefault(thePlaneNumber);
 }
 
@@ -263,14 +389,20 @@ CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){
  * see void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert)
  * \param theInvert - Invert all curves, if value is TRUE, else not.
  */
-void VISU::CutLines_i::SetAllCurvesInverted(CORBA::Boolean theInvert){
+void
+VISU::CutLines_i
+::SetAllCurvesInverted(CORBA::Boolean theInvert)
+{
   for (int i=0; i<GetNbLines(); i++) SetCurveInverted(i,theInvert);
 }
 
 /*! Checks the orientation of all curves
  * \retval TRUE - if all curves are inverted, else FALSE
  */
-CORBA::Boolean VISU::CutLines_i::IsAllCurvesInverted(){
+CORBA::Boolean 
+VISU::CutLines_i
+::IsAllCurvesInverted()
+{
   for (int i=0; i<GetNbLines(); i++)
     if (!IsCurveInverted(i)) return false;
   return true;
@@ -280,7 +412,10 @@ CORBA::Boolean VISU::CutLines_i::IsAllCurvesInverted(){
  * \param theCurveNumber - integer value, number of cut line.
  * \param theInvert      - boolean value, TRUE or false.
  */
-void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert){
+void
+VISU::CutLines_i
+::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert)
+{
   myMapCurvesInverted[theCurveNumber] = theInvert;
 }
 
@@ -288,30 +423,59 @@ void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolea
  * \param theCurveNumber - integer value, number of cut line.
  * \retval TRUE - if line in the table is inverted, else FALSE.
  */
-CORBA::Boolean VISU::CutLines_i::IsCurveInverted(CORBA::Long theCurveNumber){
+CORBA::Boolean
+VISU::CutLines_i
+::IsCurveInverted(CORBA::Long theCurveNumber)
+{
   return myMapCurvesInverted[theCurveNumber];
 }
 
-void VISU::CutLines_i::SetNbLines(CORBA::Long theNb) { 
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetNbLines(CORBA::Long theNb) 
+{ 
   myCutLinesPL->SetNbParts(theNb);
 }
-CORBA::Long VISU::CutLines_i::GetNbLines() { 
+
+//---------------------------------------------------------------
+CORBA::Long
+VISU::CutLines_i
+::GetNbLines() 
+{ 
   return myCutLinesPL->GetNbParts();
 }
 
 
-void VISU::CutLines_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New();
-  myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(myPipeLine);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myCutLinesPL = VISU_CutLinesPL::New();
+  }else
+    myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myCutLinesPL);
+}
+
 
-  ScalarMap_i::DoHook();
+//----------------------------------------------------------------------------
+bool
+VISU::CutLines_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
 }
 
+
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::CutLines_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor()
 {
-  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2);
@@ -321,12 +485,16 @@ VISU::CutLines_i
   return NULL;
 }
 
-void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::BuildTableOfReal(SALOMEDS::SObject_var theSObject)
+{
   try{
     if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
     Update();
     SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
     anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
     SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
     
@@ -336,7 +504,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     typedef map<long,long> TLineIdCont;
     
     QString aTitle;
-    aTitle.sprintf("%s",myTitle.c_str());
+    aTitle.sprintf("%s",GetCTitle().c_str());
     aTitle = aTitle.simplifyWhiteSpace();
     aTableOfReal->SetTitle(aTitle.latin1());
     
@@ -479,10 +647,10 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     {
       aTableOfReal->SetRowTitle(1,"X");
       aTableOfReal->SetRowUnit(1,"-");
-      QString aUnitName = myField->myUnitNames[0].c_str();
+      QString aUnitName = GetField()->myUnitNames[0].c_str();
       int aScalarMode = myCutLinesPL->GetScalarMode();
       if(aScalarMode != 0) 
-       aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
+       aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
       aUnitName = aUnitName.simplifyWhiteSpace();
       if(aUnitName.isEmpty()) aUnitName = "-";
       TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
index 6464d210f074838a299d6fe1edb4c6a37d9b0c25..216e7a664900126d2c3865765809128e1d8f231c 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_CutLinesPL;
 
-namespace VISU{
+namespace VISU
+{
   class CutLines_i : public virtual POA_VISU::CutLines,
                      public virtual ScalarMap_i
   {
@@ -43,86 +44,206 @@ namespace VISU{
     typedef ScalarMap_i TSuperClass;
 
     explicit
-    CutLines_i(Result_i* theResult,
-              bool theAddToStudy);
-    explicit
-    CutLines_i(Result_i* theResult,
-              SALOMEDS::SObject_ptr theSObject);
-    virtual ~CutLines_i();
+    CutLines_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    ~CutLines_i();
+
+    virtual
+    VISU::VISUType
+    GetType() 
+    {
+      return VISU::TCUTLINES;
+    }
+
+    virtual
+    void
+    SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                  CORBA::Double theXAngle, 
+                  CORBA::Double theYAngle);
+    
+    virtual
+    void
+    SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+                   CORBA::Double theXAngle, 
+                   CORBA::Double theYAngle);
+
+    virtual 
+    VISU::CutPlanes::Orientation 
+    GetOrientationType();
 
-    virtual VISU::VISUType GetType() { return VISU::TCUTLINES;};
+    virtual
+    VISU::CutPlanes::Orientation 
+    GetOrientationType2();
 
-    virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient,
-                               CORBA::Double theXAngle, CORBA::Double theYAngle);
-    virtual void SetOrientation2(VISU::CutPlanes::Orientation theOrient,
-                                CORBA::Double theXAngle, CORBA::Double theYAngle);
+    virtual 
+    CORBA::Double 
+    GetRotateX();
 
-    virtual VISU::CutPlanes::Orientation GetOrientationType();
-    virtual VISU::CutPlanes::Orientation GetOrientationType2();
+    virtual
+    CORBA::Double 
+    GetRotateY();
 
-    virtual CORBA::Double GetRotateX();
-    virtual CORBA::Double GetRotateY();
+    virtual
+    CORBA::Double 
+    GetRotateX2();
 
-    virtual CORBA::Double GetRotateX2();
-    virtual CORBA::Double GetRotateY2();
+    virtual 
+    CORBA::Double 
+    GetRotateY2();
 
-    virtual void SetDisplacement(CORBA::Double theDisp);
-    virtual CORBA::Double GetDisplacement();
+    virtual
+    void 
+    SetDisplacement(CORBA::Double theDisp);
 
-    virtual void SetDisplacement2(CORBA::Double theDisp);
-    virtual CORBA::Double GetDisplacement2();
+    virtual
+    CORBA::Double 
+    GetDisplacement();
 
-    virtual void SetBasePlanePosition(CORBA::Double thePlanePosition);
-    virtual CORBA::Double GetBasePlanePosition();
+    virtual
+    void 
+    SetDisplacement2(CORBA::Double theDisp);
 
-    virtual void SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition);
-    virtual CORBA::Double GetLinePosition(CORBA::Long thePlaneNumber);
+    virtual
+    CORBA::Double 
+    GetDisplacement2();
 
-    virtual void SetDefault();
-    virtual CORBA::Boolean IsDefault();
+    virtual
+    void 
+    SetBasePlanePosition(CORBA::Double thePlanePosition);
 
-    virtual void SetDefaultPosition(CORBA::Long thePlaneNumber);
-    virtual CORBA::Boolean IsDefaultPosition(CORBA::Long thePlaneNumber);
+    virtual
+    CORBA::Double 
+    GetBasePlanePosition();
 
-    virtual void SetAllCurvesInverted(CORBA::Boolean theInvert);
-    virtual CORBA::Boolean IsAllCurvesInverted();
-    virtual void SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert);
-    virtual CORBA::Boolean IsCurveInverted(CORBA::Long theCurveNumber);
+    virtual
+    void 
+    SetLinePosition(CORBA::Long thePlaneNumber, 
+                   CORBA::Double thePlanePosition);
+
+    virtual
+    CORBA::Double
+    GetLinePosition(CORBA::Long thePlaneNumber);
+
+    virtual
+    void 
+    SetDefault();
+
+    virtual 
+    CORBA::Boolean 
+    IsDefault();
+
+    virtual
+    void 
+    SetDefaultPosition(CORBA::Long thePlaneNumber);
+
+    virtual
+    CORBA::Boolean 
+    IsDefaultPosition(CORBA::Long thePlaneNumber);
+
+    virtual
+    void
+    SetAllCurvesInverted(CORBA::Boolean theInvert);
+
+    virtual
+    CORBA::Boolean
+    IsAllCurvesInverted();
+
+    virtual
+    void
+    SetCurveInverted(CORBA::Long theCurveNumber,
+                    CORBA::Boolean theInvert);
+
+    virtual
+    CORBA::Boolean
+    IsCurveInverted(CORBA::Long theCurveNumber);
+
+    virtual 
+    void 
+    SetNbLines(CORBA::Long theNb);
+
+    virtual
+    CORBA::Long
+    GetNbLines();
 
-    virtual void SetNbLines(CORBA::Long theNb);
-    virtual CORBA::Long GetNbLines();
-    typedef VISU::CutLines TInterface;
-    VISU_CutLinesPL* GetCutLinesPL(){ return myCutLinesPL;}
-    
     typedef std::map<int,bool> TCurvesInv;
-    TCurvesInv GetCurvesInverted() {return myMapCurvesInverted;}
-    void CopyCurvesInverted(const TCurvesInv& theCurves);
+    TCurvesInv
+    GetCurvesInverted() 
+    {
+      return myMapCurvesInverted;
+    }
+
+    void
+    CopyCurvesInverted(const TCurvesInv& theCurves);
+
+    typedef VISU::CutLines TInterface;
 
+    VISU_CutLinesPL* 
+    GetSpecificPL() const
+    { 
+      return myCutLinesPL; 
+    }
+    
   protected:
-    virtual void DoHook();
+    //! Extends VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Extends VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     VISU_CutLinesPL *myCutLinesPL;
     TCurvesInv myMapCurvesInverted;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
+    //! Extends VISU_ColoredPrs3d_i::IsPossible
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Extends VISU_ColoredPrs3d_i::Create
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
-    virtual void ToStream(std::ostringstream& theStr);
+    //! Extends VISU_ColoredPrs3d_i::ToStream
+    virtual 
+    void
+    ToStream(std::ostringstream& theStr);
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    //! Extends VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
+    //! Extends VISU_ColoredPrs3d_i::CreateActor
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
-    void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
+    void BuildTableOfReal(SALOMEDS::SObject_var theSObject);
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
+
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString 
+    GenerateName();
   };
 }
 
index c4b952e594f443d0349300035b7275d033483f24..a0fb3197da8e5afd14565d1383d32fa4f37353e3 100644 (file)
 
 #include "SUIT_ResourceMgr.h"
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
 
-int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                 const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//----------------------------------------------------------------------------
+size_t 
+VISU::CutPlanes_i
+::IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+  return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,theIsMemoryCheck);
 }
 
 
+//----------------------------------------------------------------------------
 int VISU::CutPlanes_i::myNbPresent = 0;
-QString VISU::CutPlanes_i::GenerateName() { return VISU::GenerateName("CutPlanes",myNbPresent++);}
 
+//----------------------------------------------------------------------------
+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,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myCutPlanesPL(NULL)
-{}
+//----------------------------------------------------------------------------
+const char* 
+VISU::CutPlanes_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
 
 
-VISU::CutPlanes_i::
-CutPlanes_i(Result_i* theResult, 
-           SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+//----------------------------------------------------------------------------
+VISU::CutPlanes_i
+::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode):
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myCutPlanesPL(NULL)
-{
-}
+{}
 
 
-VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                         const char* theFieldName, int theIteration)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::CutPlanes_i
+::Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber)
 {
-  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::CutPlanes_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement").toDouble());
@@ -104,6 +120,7 @@ VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap
 }
 
 
+//----------------------------------------------------------------------------
 void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
   ScalarMap_i::ToStream(theStr);
 
@@ -123,73 +140,148 @@ void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::CutPlanes_i::~CutPlanes_i(){
+//----------------------------------------------------------------------------
+VISU::CutPlanes_i
+::~CutPlanes_i()
+{
   if(MYDEBUG) MESSAGE("CutPlanes_i::~CutPlanes_i()");
 }
 
 
-void VISU::CutPlanes_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
-                                      CORBA::Double theXAngle, CORBA::Double theYAngle)
+//----------------------------------------------------------------------------
+void
+VISU::CutPlanes_i
+::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                CORBA::Double theXAngle, 
+                CORBA::Double theYAngle)
 {
   myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
-                               theXAngle,theYAngle);
+                               theXAngle,
+                               theYAngle);
 }
 
-VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() { 
+//----------------------------------------------------------------------------
+VISU::CutPlanes::Orientation 
+VISU::CutPlanes_i
+::GetOrientationType() 
+{ 
   return VISU::CutPlanes::Orientation(myCutPlanesPL->GetPlaneOrientation());
 }
-CORBA::Double VISU::CutPlanes_i::GetRotateX(){
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::CutPlanes_i
+::GetRotateX()
+{
   return myCutPlanesPL->GetRotateX();
 }
-CORBA::Double VISU::CutPlanes_i::GetRotateY(){
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::CutPlanes_i
+::GetRotateY()
+{
   return myCutPlanesPL->GetRotateY();
 }
 
 
-void VISU::CutPlanes_i::SetDisplacement(CORBA::Double theDisp) { 
+//----------------------------------------------------------------------------
+void
+VISU::CutPlanes_i
+::SetDisplacement(CORBA::Double theDisp) 
+{  
   myCutPlanesPL->SetDisplacement(theDisp);
 }
-CORBA::Double VISU::CutPlanes_i::GetDisplacement() { 
+
+//----------------------------------------------------------------------------
+CORBA::Double
+VISU::CutPlanes_i
+::GetDisplacement() 
+{ 
   return myCutPlanesPL->GetDisplacement();
 }
 
 
-void VISU::CutPlanes_i::SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){
+//----------------------------------------------------------------------------
+void
+VISU::CutPlanes_i
+::SetPlanePosition(CORBA::Long thePlaneNumber, 
+                  CORBA::Double thePlanePosition)
+{
   myCutPlanesPL->SetPartPosition(thePlaneNumber,thePlanePosition);
 }
-CORBA::Double VISU::CutPlanes_i::GetPlanePosition(CORBA::Long thePlaneNumber){ 
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::CutPlanes_i
+::GetPlanePosition(CORBA::Long thePlaneNumber)
+{ 
   return myCutPlanesPL->GetPartPosition(thePlaneNumber);
 }
 
 
-void VISU::CutPlanes_i::SetDefault(CORBA::Long thePlaneNumber){
+//----------------------------------------------------------------------------
+void
+VISU::CutPlanes_i
+::SetDefault(CORBA::Long thePlaneNumber)
+{
   myCutPlanesPL->SetPartDefault(thePlaneNumber);
 }
-CORBA::Boolean VISU::CutPlanes_i::IsDefault(CORBA::Long thePlaneNumber){ 
+
+//----------------------------------------------------------------------------
+CORBA::Boolean 
+VISU::CutPlanes_i
+::IsDefault(CORBA::Long thePlaneNumber)
+{ 
   return myCutPlanesPL->IsPartDefault(thePlaneNumber);
 }
 
 
-void VISU::CutPlanes_i::SetNbPlanes(CORBA::Long theNb) { 
+//----------------------------------------------------------------------------
+void 
+VISU::CutPlanes_i
+::SetNbPlanes(CORBA::Long theNb) 
+{ 
   myCutPlanesPL->SetNbParts(theNb);
 }
-CORBA::Long VISU::CutPlanes_i::GetNbPlanes() { 
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::CutPlanes_i
+::GetNbPlanes() 
+{ 
   return myCutPlanesPL->GetNbParts();
 }
 
 
-void VISU::CutPlanes_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New();
-  myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(myPipeLine);
+//----------------------------------------------------------------------------
+void 
+VISU::CutPlanes_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){ 
+    myCutPlanesPL = VISU_CutPlanesPL::New();
+  }else
+    myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine);
 
-  ScalarMap_i::DoHook();
+  TSuperClass::CreatePipeLine(myCutPlanesPL);
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::CutPlanes_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
 }
 
+//----------------------------------------------------------------------------
 VISU_Actor* 
 VISU::CutPlanes_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor()
 {
-  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int aDispMode = aResourceMgr->integerValue("VISU" , "cut_planes_represent", 1);
index de65dbb7911c6f083bfdc30361da31d7d350970b..6f58872d5d3add7761c7ca1db1774a66e2d8be47 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_CutPlanesPL;
 
-namespace VISU{
+namespace VISU
+{
   class CutPlanes_i : public virtual POA_VISU::CutPlanes,
                      public virtual ScalarMap_i
   {
@@ -43,59 +44,135 @@ namespace VISU{
     typedef ScalarMap_i TSuperClass;
 
     explicit
-    CutPlanes_i(Result_i* theResult,
-               bool theAddToStudy);
-    explicit
-    CutPlanes_i(Result_i* theResult,
-               SALOMEDS::SObject_ptr theSObject);
-    virtual ~CutPlanes_i();
+    CutPlanes_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    ~CutPlanes_i();
+
+    virtual
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TCUTPLANES;
+    }
 
-    virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
+    virtual
+    void
+    SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                  CORBA::Double theXAngle, 
+                  CORBA::Double theYAngle);
+
+    virtual 
+    VISU::CutPlanes::Orientation 
+    GetOrientationType();
 
-    virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient,
-                               CORBA::Double theXAngle, CORBA::Double theYAngle);
+    virtual
+    CORBA::Double
+    GetRotateX();
 
-    virtual VISU::CutPlanes::Orientation GetOrientationType();
-    virtual CORBA::Double GetRotateX();
-    virtual CORBA::Double GetRotateY();
+    virtual
+    CORBA::Double
+    GetRotateY();
+
+    virtual
+    void
+    SetDisplacement(CORBA::Double theDisp);
+
+    virtual
+    CORBA::Double
+    GetDisplacement();
+
+    virtual
+    void
+    SetPlanePosition(CORBA::Long thePlaneNumber, 
+                    CORBA::Double thePlanePosition);
+    virtual 
+    CORBA::Double 
+    GetPlanePosition(CORBA::Long thePlaneNumber);
 
-    virtual void SetDisplacement(CORBA::Double theDisp);
-    virtual CORBA::Double GetDisplacement();
+    virtual
+    void
+    SetDefault(CORBA::Long thePlaneNumber);
 
-    virtual void SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition);
-    virtual CORBA::Double GetPlanePosition(CORBA::Long thePlaneNumber);
+    virtual
+    CORBA::Boolean 
+    IsDefault(CORBA::Long thePlaneNumber);
 
-    virtual void SetDefault(CORBA::Long thePlaneNumber);
-    virtual CORBA::Boolean IsDefault(CORBA::Long thePlaneNumber);
+    virtual
+    void
+    SetNbPlanes(CORBA::Long theNb);
 
-    virtual void SetNbPlanes(CORBA::Long theNb);
-    virtual CORBA::Long GetNbPlanes();
+    virtual
+    CORBA::Long
+    GetNbPlanes();
 
     typedef VISU::CutPlanes TInterface;
-    VISU_CutPlanesPL* GetCutPlanesPL(){ return myCutPlanesPL;}
 
+    VISU_CutPlanesPL* 
+    GetSpecificPL() const
+    { 
+      return myCutPlanesPL; 
+    }
+    
   protected:
-    virtual void DoHook();
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     VISU_CutPlanesPL *myCutPlanesPL;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
-
-    virtual void ToStream(std::ostringstream& theStr);
-
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
-
+    //! Redefines VISU_ColoredPrs3d_i::IsPossible
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Redefines VISU_ColoredPrs3d_i::Create
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
+
+    //! Redefines VISU_ColoredPrs3d_i::ToStream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
+    //! Redefines VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
+
+    //! Redefines VISU_ColoredPrs3d_i::CreateActor
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
+
+    //! Redefines VISU_ColoredPrs3d_i::GetComment
+    virtual 
+    const char* 
+    GetComment() const;
+
+    //! Redefines VISU_ColoredPrs3d_i::GenerateName
+    virtual
+    QString
+    GenerateName();
   };
 }
 
index 8c2920dccd005ea1c7522027ecdfe7e0e527fbb9..a41f512e0c3f3f6064c6aa7853636ad01e0bf293 100644 (file)
 #include <vtkDataSetMapper.h>
 #include <vtkProperty.h>
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
 
-int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                     const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t
+VISU::DeformedShape_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
   try{
-    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0;
-    const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-    return aField->myNbComp > 1;
+    size_t aResult = TSuperClass::IsPossible(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theTimeStampNumber,
+                                            theIsMemoryCheck);
+    if(aResult){
+      VISU::Result_i::TInput* anInput = theResult->GetInput();
+      VISU::PField aField = anInput->GetField(theMeshName,
+                                             (VISU::TEntity)theEntity,
+                                             theFieldName);
+      if(aField->myNbComp > 1)
+       return aResult;
+    }
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
@@ -60,40 +76,45 @@ int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshNa
   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();}
+//---------------------------------------------------------------
+QString 
+VISU::DeformedShape_i
+::GenerateName() 
+{ 
+  return VISU::GenerateName("Def.Shape",myNbPresent++);
+}
 
+//---------------------------------------------------------------
+const string VISU::DeformedShape_i::myComment = "DEFORMEDSHAPE";
 
-VISU::DeformedShape_i::
-DeformedShape_i(Result_i* theResult, 
-               bool theAddToStudy) : 
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myDeformedShapePL(NULL)
-{
-  if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
+//---------------------------------------------------------------
+const char* 
+VISU::DeformedShape_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
 }
 
 
-VISU::DeformedShape_i::
-DeformedShape_i(Result_i* theResult, 
-               SALOMEDS::SObject_ptr theSObject) : 
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+//---------------------------------------------------------------
+VISU::DeformedShape_i
+::DeformedShape_i(EPublishInStudyMode thePublishInStudyMode):
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myDeformedShapePL(NULL)
 {
   if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
 }
 
 
-void VISU::DeformedShape_i::SameAs(const Prs3d_i* theOrigin)
+//---------------------------------------------------------------
+void 
+VISU::DeformedShape_i
+::SameAs(const Prs3d_i* theOrigin)
 {
   TSuperClass::SameAs(theOrigin);
 
@@ -105,18 +126,28 @@ void VISU::DeformedShape_i::SameAs(const Prs3d_i* theOrigin)
 }
 
 
-VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                             const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::DeformedShape_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
   myIsColored = false;
   myColor.R = myColor.G = myColor.B = 0.5;
-  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::DeformedShape_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
   myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
@@ -128,8 +159,12 @@ VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& th
 }
 
 
-void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
-  ScalarMap_i::ToStream(theStr);
+//---------------------------------------------------------------
+void
+VISU::DeformedShape_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myFactor", GetScale() );
 
@@ -140,38 +175,108 @@ void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::DeformedShape_i::~DeformedShape_i(){
+//---------------------------------------------------------------
+VISU::DeformedShape_i
+::~DeformedShape_i()
+{
   if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()");
 }
 
 
-void VISU::DeformedShape_i::SetScale(CORBA::Double theScale) { 
+//---------------------------------------------------------------
+void 
+VISU::DeformedShape_i
+::SetScale(CORBA::Double theScale) 
+{ 
   myDeformedShapePL->SetScale(theScale);
 }
-CORBA::Double VISU::DeformedShape_i::GetScale(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::DeformedShape_i
+::GetScale()
+{
   return myDeformedShapePL->GetScale();
 }
 
 
-void VISU::DeformedShape_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_DeformedShapePL::New();
-  myDeformedShapePL = dynamic_cast<VISU_DeformedShapePL*>(myPipeLine);
-  myPipeLine->GetMapper()->SetScalarVisibility(IsColored());
+//---------------------------------------------------------------
+CORBA::Boolean 
+VISU::DeformedShape_i
+::IsColored()
+{
+  return myIsColored;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShape_i
+::ShowColored(CORBA::Boolean theColored)
+{
+  myIsColored = theColored; 
+  myParamsTime.Modified();
+}
 
-  ScalarMap_i::DoHook();
+//---------------------------------------------------------------
+SALOMEDS::Color 
+VISU::DeformedShape_i
+::GetColor()
+{
+  return myColor;
 }
 
 
-void VISU::DeformedShape_i::SetMapScale(double theMapScale){
+//---------------------------------------------------------------
+void
+VISU::DeformedShape_i
+::SetColor(const SALOMEDS::Color& theColor)
+{
+  myColor = theColor;
+  myParamsTime.Modified();
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShape_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myDeformedShapePL = VISU_DeformedShapePL::New();
+  }else
+    myDeformedShapePL = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine);
+
+  myDeformedShapePL->GetMapper()->SetScalarVisibility(IsColored());
+
+  TSuperClass::CreatePipeLine(myDeformedShapePL);
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::DeformedShape_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+
+//---------------------------------------------------------------
+void 
+VISU::DeformedShape_i
+::SetMapScale(double theMapScale)
+{
   myDeformedShapePL->SetMapScale(theMapScale);
 }
 
 
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::DeformedShape_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) 
+::CreateActor(bool toSupressShrinking) 
 {
-  VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO, true);
+  VISU_Actor* anActor = TSuperClass::CreateActor(true);
   anActor->SetVTKMapping(false);
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
   int  aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1);
@@ -182,23 +287,30 @@ VISU::DeformedShape_i
   return anActor;
 }
 
+
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::DeformedShape_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO
+::CreateActor() 
 {
-  return CreateActor(theIO, false);
+  return CreateActor(false);
 }
 
-void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) {
+
+//---------------------------------------------------------------
+void
+VISU::DeformedShape_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     if(IsColored()){
       anActor->SetBarVisibility(true);
-      myPipeLine->GetMapper()->SetScalarVisibility(1);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(1);
     }else{
       anActor->SetBarVisibility(false);
-      myPipeLine->GetMapper()->SetScalarVisibility(0);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(0);
       anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
     }
-    VISU::ScalarMap_i::UpdateActor(theActor);
+    TSuperClass::UpdateActor(theActor);
   }
 }
index 42854699e5679991f2f24fa8ba90cf8d8f2b4555..5f3d79cd808ae4e070bb3aa012e112631aead667 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_DeformedShapePL;
 
-namespace VISU{
+namespace VISU
+{
   class DeformedShape_i : public virtual POA_VISU::DeformedShape,
                          public virtual ScalarMap_i
   {
@@ -43,60 +44,120 @@ namespace VISU{
     typedef ScalarMap_i TSuperClass;
 
     explicit
-    DeformedShape_i(Result_i* theResult,
-                   bool theAddToStudy);
-    explicit
-    DeformedShape_i(Result_i* theResult,
-                   SALOMEDS::SObject_ptr theSObject);
-    virtual void SameAs(const Prs3d_i* theOrigin);
-    virtual ~DeformedShape_i();
+    DeformedShape_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual 
+    void 
+    SameAs(const Prs3d_i* theOrigin);
 
-    virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
+    virtual 
+    ~DeformedShape_i();
+
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TDEFORMEDSHAPE;
+    }
 
-    virtual void SetScale(CORBA::Double theScale);
-    virtual CORBA::Double GetScale();
+    virtual
+    void 
+    SetScale(CORBA::Double theScale);
 
-    virtual CORBA::Boolean IsColored() { return myIsColored; }
-    virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; }
+    virtual
+    CORBA::Double 
+    GetScale();
 
-    virtual SALOMEDS::Color GetColor() { return myColor;}
-    virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;}
+    virtual 
+    CORBA::Boolean 
+    IsColored();
+
+    virtual 
+    void
+    ShowColored(CORBA::Boolean theColored);
+
+    virtual 
+    SALOMEDS::Color 
+    GetColor();
+
+    virtual
+    void
+    SetColor(const SALOMEDS::Color& theColor);
 
     typedef VISU::DeformedShape TInterface;
-    VISU_DeformedShapePL* GetDeformedShapePL(){ return myDeformedShapePL;}
 
+    VISU_DeformedShapePL* 
+    GetSpecificPL() const
+    { 
+      return myDeformedShapePL; 
+    }
+    
   protected:
-    virtual void DoHook();
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     VISU_DeformedShapePL *myDeformedShapePL;
     SALOMEDS::Color myColor;
     bool myIsColored;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
 
-    virtual void ToStream(std::ostringstream& theStr);
+    virtual 
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString 
+    GenerateName();
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
 
-    virtual void SetMapScale(double theMapScale = 1.0);
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
+
+    virtual
+    void
+    SetMapScale(double theMapScale = 1.0);
 
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking);
+    CreateActor(bool toSupressShrinking);
 
-    virtual void UpdateActor(VISU_Actor* theActor) ;
+    virtual 
+    void
+    UpdateActor(VISU_Actor* theActor) ;
   };
 }
 
index a2e810a8711ee7edd5f21ea816b754ad72c08421..fe78c72aa1473e5cfa9a9dbdbbacec7010620159 100644 (file)
@@ -181,10 +181,10 @@ namespace VISU
     }
 
     theStr<<thePrefix<<theName<<" = aVisu."<<theConstructorName<<"("<<theArgumentName<<
-      ",'"<<theServant->GetMeshName()<<"'"<<
+      ",'"<<theServant->GetCMeshName()<<"'"<<
       ","<<aParam<<
-      ",'"<<theServant->GetFieldName()<<"'"<<
-      ","<<theServant->GetIteration()<<
+      ",'"<<theServant->GetCFieldName()<<"'"<<
+      ","<<theServant->GetTimeStampNumber()<<
       ")"<<endl;
 
     theStr<<thePrefix<<"if "<<theName<<":"<<endl;
@@ -636,18 +636,18 @@ namespace VISU
 
              if(aSubMeshName == "")
                theStr<<thePrefix<<aName<<" = aVisu.MeshOnEntity("<<theArgumentName<<
-                 ",'"<<aServant->GetMeshName()<<"'"<<
+                 ",'"<<aServant->GetCMeshName()<<"'"<<
                  ","<<aParam<<
                  ")"<<endl;
              else
                theStr<<thePrefix<<aName<<" = aVisu.FamilyMeshOnEntity("<<theArgumentName<<
-                 ",'"<<aServant->GetMeshName()<<"'"<<
+                 ",'"<<aServant->GetCMeshName()<<"'"<<
                  ","<<aParam<<
                  ",'"<<aSubMeshName<<"'"<<
                  ")"<<endl;
            }else
              theStr<<thePrefix<<aName<<" = aVisu.GroupMesh("<<theArgumentName<<
-               ",'"<<aServant->GetMeshName()<<"'"<<
+               ",'"<<aServant->GetCMeshName()<<"'"<<
                ",'"<<aSubMeshName<<"'"<<
                ")"<<endl;
 
@@ -773,7 +773,7 @@ namespace VISU
           if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(GetServant(anObj).in())){
            thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix);
 
-           theStr<<thePrefix<<aName<<".SetSourceRange("<<aServant->GetSourceRangeMin()<<","<<aServant->GetSourceRangeMax()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetRange("<<aServant->GetMin()<<","<<aServant->GetMax()<<")"<<endl;
            theStr<<thePrefix<<aName<<".SetScale("<<aServant->GetScale()<<")"<<endl;
 
            std::string aParam;
index 2fde203e88d8f84600bbc39a0b1706cd9fb0896d..5f5f01c2e22142b84eb2588561142261294a6395 100644 (file)
 
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VISU_ScalarBarCtrl.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_Convertor.hxx"
 
 #include "SUIT_ResourceMgr.h"
 
+#include "VISU_PipeLineUtils.hxx"
+
 #include <vtkImageData.h>
 #include <vtkXMLImageDataReader.h>
 #include <vtkScalarBarActor.h>
 #include <vtkTextProperty.h>
 #include <vtkProperty.h>
 
-using namespace VISU;
-using namespace std;
+#include "MULTIPR_API.hxx"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -52,27 +55,43 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
+static int INCMEMORY = 10;
+
 //----------------------------------------------------------------------------
-int
+size_t
 VISU::GaussPoints_i
 ::IsPossible(Result_i* theResult, 
-            const char* theMeshName, 
-            VISU::Entity theEntity, 
-            const char* theFieldName, 
-            int theIteration, 
-            int isMemoryCheck)
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
+  size_t aResult = 0;
+  if(theEntity == VISU::NODE)
+    return aResult;
   try{
-    if(theEntity != VISU::NODE)
-      return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
-    else
-      return false;
+    bool anIsEstimated = true;
+    VISU::Result_i::TInput* anInput = theResult->GetInput();
+    size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName,
+                                                      (VISU::TEntity)theEntity,
+                                                      theFieldName,
+                                                      theTimeStampNumber,
+                                                      anIsEstimated);
+      aResult = 1;
+    if(theIsMemoryCheck){
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
+      aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+      if(MYDEBUG) 
+       MESSAGE("GaussPoints_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    }
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
     INFOS("Unknown exception was occured!");
   }
-  return 0;
+  return aResult;
 }
 
 //----------------------------------------------------------------------------
@@ -97,14 +116,10 @@ VISU::GaussPoints_i
 
 
 //----------------------------------------------------------------------------
-VISU::GaussPoints_i::
-GaussPoints_i(Result_i* theResult, 
-             bool theAddToStudy) : 
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
+VISU::GaussPoints_i
+::GaussPoints_i(EPublishInStudyMode thePublishInStudyMode) : 
+  ColoredPrs3d_i(thePublishInStudyMode),
   myGaussPointsPL(NULL),
-  myIsColored(true),
   myColor(Qt::blue),
   myIsActiveLocalScalarBar(true),
   myIsDispGlobalScalarBar(true),
@@ -115,33 +130,15 @@ GaussPoints_i(Result_i* theResult,
 }
 
 
-//----------------------------------------------------------------------------
-VISU::GaussPoints_i::
-GaussPoints_i(Result_i* theResult, 
-             SALOMEDS::SObject_ptr theSObject) : 
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  myGaussPointsPL(NULL),
-  myIsColored(true),
-  myColor(Qt::blue),
-  myIsActiveLocalScalarBar(true),
-  myIsDispGlobalScalarBar(true),
-  myFaceLimit(50000)
-{
-  if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
-}
-
-
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::GaussPoints_i
-::Create(const char* theMeshName, 
-        VISU::Entity theEntity, 
-        const char* theFieldName, 
-        int theIteration)
+::Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber)
 {
-  TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+  TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
@@ -208,12 +205,48 @@ VISU::GaussPoints_i
 }
 
 
+//---------------------------------------------------------------
+void 
+VISU::GaussPoints_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+  TSuperClass::SameAs(theOrigin);
+
+  if(const GaussPoints_i* aPrs3d = dynamic_cast<const GaussPoints_i*>(theOrigin)){
+    GaussPoints_i* anOrigin = const_cast<GaussPoints_i*>(aPrs3d);
+    // To restore the range after shallow copy of the pipeline mapper
+    // in the parent class
+    SetSourceRange(); 
+
+    SetIsActiveLocalScalarBar(anOrigin->GetIsActiveLocalScalarBar());
+    SetIsDispGlobalScalarBar(anOrigin->GetIsDispGlobalScalarBar());
+
+    SetSpacing(anOrigin->GetSpacing());
+
+    SetFaceLimit(anOrigin->GetFaceLimit());
+
+    SetColor(anOrigin->GetColor());
+
+    SetTextures(anOrigin->GetMainTexture(), anOrigin->GetAlphaTexture());
+  }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::GaussPoints_i
+::GetMemorySize()
+{
+  return TSuperClass::GetMemorySize();
+}
+
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::GaussPoints_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
   SetIsDispGlobalScalarBar(Storable::FindValue(theMap,"myIsDispGlobalScalarBar").toInt());
@@ -299,13 +332,24 @@ VISU::GaussPoints_i
 
 
 //----------------------------------------------------------------------------
-VISU_GaussPointsPL* 
+int
 VISU::GaussPoints_i
-::GetGaussPointsPL()
-{ 
-  return myGaussPointsPL; 
+::GetFaceLimit()
+{
+  return myFaceLimit;
+}
+
+void
+VISU::GaussPoints_i
+::SetFaceLimit( int theFaceLimit )
+{
+  if( myFaceLimit != theFaceLimit ){
+    myFaceLimit = theFaceLimit;
+    myParamsTime.Modified();
+  }
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetIsDeformed( bool theIsDeformed )
@@ -320,6 +364,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetIsDeformed();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetScaleFactor( vtkFloatingPointType theScaleFactor )
@@ -334,14 +379,38 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetScale();
 }
 
+//----------------------------------------------------------------------------
+QColor
+VISU::GaussPoints_i
+::GetColor()
+{
+  return myColor;
+}
+
+void
+VISU::GaussPoints_i
+::SetColor( const QColor& theColor )
+{
+  myColor = theColor;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetIsColored( bool theIsColored )
 {
-  myIsColored = theIsColored;
   myGaussPointsPL->SetIsColored( theIsColored );
 }
 
+bool
+VISU::GaussPoints_i
+::GetIsColored()
+{
+  return myGaussPointsPL->GetIsColored();
+}
+
+//----------------------------------------------------------------------------
 bool
 VISU::GaussPoints_i
 ::SetMainTexture( const QString& theMainTexture ) 
@@ -358,6 +427,7 @@ VISU::GaussPoints_i
   return myMainTexture; 
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::GaussPoints_i
 ::SetAlphaTexture( const QString& theAlphaTexture ) 
@@ -374,6 +444,7 @@ VISU::GaussPoints_i
   return myAlphaTexture; 
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetAlphaThreshold( vtkFloatingPointType theAlphaThreshold )
@@ -388,6 +459,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetAlphaThreshold();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetResolution( int theResolution )
@@ -402,6 +474,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetResolution();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetPrimitiveType(int thePrimitiveType)
@@ -416,6 +489,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetPrimitiveType();
 }
 
+//----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU::GaussPoints_i
 ::GetMaximumSupportedSize()
@@ -423,6 +497,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetMaximumSupportedSize();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetClamp(vtkFloatingPointType theClamp)
@@ -437,6 +512,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetClamp();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetGeomSize( vtkFloatingPointType theGeomSize )
@@ -451,6 +527,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetSize();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetMinSize( vtkFloatingPointType theMinSize )
@@ -465,6 +542,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetMinSize();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetMaxSize( vtkFloatingPointType theMaxSize )
@@ -479,6 +557,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetMaxSize();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetMagnification( vtkFloatingPointType theMagnification )
@@ -493,6 +572,7 @@ VISU::GaussPoints_i
   return myGaussPointsPL->GetMagnification();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
 ::SetMagnificationIncrement( vtkFloatingPointType theIncrement )
@@ -510,55 +590,107 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
-::DoSetInput(Result_i* theResult)
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
 {
-  VISU::Result_i::TInput* anInput = theResult->GetInput();
+    static string aStrPrev = "";
+    static VISU::Result_i::TInput* anInputPrev = NULL;
+    
+       // MULTIPR
+       VISU::Result_i::TInput* anInput = NULL;
+       if (GetCResult()->IsDistributedMEDMultipr())
+       {        
+        vector<string> aListMEDFiles = GetCResult()->GetCurrentRepresentationMultipr();
+        
+        string aStrCurrent = "";
+        for (unsigned i = 0 ; i < aListMEDFiles.size() ; i++)
+        {
+            aStrCurrent +=aListMEDFiles[i];
+        }
+        aStrCurrent += GetCMeshName();
+        aStrCurrent += GetCFieldName();
+        if (aStrPrev != aStrCurrent)
+        {        
+            if (anInputPrev != NULL) delete anInputPrev;
+            
+            char aTmpFilename[256];
+            sprintf(aTmpFilename, "__tmp.med");
+            
+            int res = multipr::merge(aListMEDFiles, GetCMeshName().c_str(), GetCFieldName().c_str(), aTmpFilename);
+            if (res == 0) throw std::runtime_error("empty mesh"); 
+            
+            anInput = CreateConvertor(aTmpFilename);
+            anInput->Build();
+            anInputPrev = anInput;
+            
+            aStrPrev = aStrCurrent;
+        }
+        else
+        {
+            anInput = anInputPrev;
+        }     
+       }
+       else
+       {
+               anInput = GetCResult()->GetInput();
+       }
+       
   if(!anInput)
-    throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
+    throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
 
-  myField = anInput->GetField(myMeshName,myEntity,myFieldName);
-  if(!myField
+  SetField(anInput->GetField(GetCMeshName(),GetTEntity(),GetCFieldName()));
+  if(!GetField()
     throw std::runtime_error("There is no Field with the parameters !!!");
 
   VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
-    anInput->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration);
+    anInput->GetTimeStampOnGaussPts(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber());
 
   if(!aGaussPtsIDMapper) 
     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
-  myGaussPointsPL->SetGaussPtsIDMapper(aGaussPtsIDMapper);
-  myGaussPointsPL->Init();
-  myGaussPointsPL->Build();
+  GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+  if(theIsInitilizePipe){
+    GetSpecificPL()->Init();
+  }
+  GetCResult()->MinMaxConnect(this);
 
-  theResult->MinMaxConnect(this);
+  // To update scalar range according to the new input
+  if(!IsTimeStampFixed() || theReInit)
+    SetSourceRange();
 }
 
 
 //----------------------------------------------------------------------------
-void
+bool
 VISU::GaussPoints_i
-::DoHook()
+::CheckIsPossible() 
 {
-  if(!myPipeLine) 
-    myPipeLine = VISU_GaussPointsPL::New();
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
 
-  myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(myPipeLine);
 
-  TSuperClass::DoHook();
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myGaussPointsPL = VISU_GaussPointsPL::New();
+  }else
+    myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myGaussPointsPL);
 }
 
 
 //----------------------------------------------------------------------------
 VISU_PipeLine* 
 VISU::GaussPoints_i
-::GetPipeLine()
+::GetActorPipeLine()
 {
   // We create a new PipeLine instance in order to provide
   //   different representations for different actors (basic and segmented)
   VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
-  aPipeLine->SetGaussPtsIDMapper(myGaussPointsPL->GetGaussPtsIDMapper());
-  aPipeLine->ShallowCopy(myPipeLine);
-  aPipeLine->Update();
+  aPipeLine->ShallowCopy(GetPipeLine(), true);
   return aPipeLine;
 }
 
@@ -566,12 +698,10 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 bool 
 VISU::GaussPoints_i
-::OnCreateActor(VISU_GaussPtsAct* theActor,
-               const Handle(SALOME_InteractiveObject)& theIO)
+::OnCreateActor(VISU_GaussPtsAct* theActor)
 {
   try{
-    TSuperClass::CreateActor(theActor,theIO);
-    theActor->GetPipeLine()->Delete();
+    TSuperClass::CreateActor(theActor);
     UpdateActor(theActor);
     return true;
   }catch(...){
@@ -583,29 +713,29 @@ VISU::GaussPoints_i
 
 VISU_GaussPtsAct1* 
 VISU::GaussPoints_i
-::OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO)
+::OnCreateActor1()
 {
   VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New();
-  if(OnCreateActor(anActor,theIO))
+  if(OnCreateActor(anActor))
     return anActor;
   return NULL;
 }
 
 VISU_GaussPtsAct2* 
 VISU::GaussPoints_i
-::OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO)
+::OnCreateActor2()
 {
   VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New();
-  if(OnCreateActor(anActor,theIO))
+  if(OnCreateActor(anActor))
     return anActor;
   return NULL;
 }
 
 VISU_Actor* 
 VISU::GaussPoints_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO
+::CreateActor() 
 {
-  return OnCreateActor1(theIO);
+  return OnCreateActor1();
 }
 
 //----------------------------------------------------------------------------
@@ -628,28 +758,36 @@ VISU::GaussPoints_i
 ::UpdateScalarBar(vtkScalarBarActor *theScalarBar,
                  vtkLookupTable* theLookupTable)
 {
-  theScalarBar->SetTitle(myTitle.c_str());
-  theScalarBar->SetOrientation(myOrientation);
-  theScalarBar->SetNumberOfLabels(myNumberOfLabels);
+  theScalarBar->SetTitle(GetScalarBarTitle().c_str());
+  theScalarBar->SetOrientation(GetBarOrientation());
+  theScalarBar->SetNumberOfLabels(GetLabels());
 
-  vtkLookupTable* aLookupTable = myScalarMapPL->GetBarTable();
+  vtkLookupTable* aLookupTable = GetSpecificPL()->GetBarTable();
   
   theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors());
   theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors());
 
+  vtkFloatingPointType anRGB[3];
+
   vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty();
-  aTitleProp->SetFontFamily(myTitFontType);
-  aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]);
-  (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
-  (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
-  (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+  aTitleProp->SetFontFamily(GetTitFontType());
+
+  GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+  aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+  IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+  IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+  IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
   
   vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty();
-  aLabelProp->SetFontFamily(myLblFontType);
-  aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]);
-  (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
-  (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
-  (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+  aLabelProp->SetFontFamily(GetLblFontType());
+
+  GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+  aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+  IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+  IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+  IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
   
   theScalarBar->Modified();
 }
@@ -664,16 +802,16 @@ VISU::GaussPoints_i
     VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl();
     if(GetIsColored()){
       anActor->SetBarVisibility(true);
-      myPipeLine->GetMapper()->SetScalarVisibility(1);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(1);
 
       vtkFloatingPointType aRange[2];
-      myScalarMapPL->GetSourceRange(aRange);
+      GetSpecificPL()->GetSourceRange(aRange);
       aScalarBarCtrl->SetRangeLocal(aRange);
       
       TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT);
       bool anIsMinMaxDone = IsGlobalRangeDefined();
       if(anIsMinMaxDone)
-       aTMinMax = myField->GetMinMax(GetScalarMode());
+       aTMinMax = GetField()->GetMinMax(GetScalarMode());
       aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone);
       aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
       
@@ -692,20 +830,22 @@ VISU::GaussPoints_i
        aRangeGlobal[0] = aTMinMax.first;
        aRangeGlobal[1] = aTMinMax.second;
        
-       GetGaussPointsPL()->GetMapper()->SetScalarRange(aRangeGlobal);
+       GetSpecificPL()->GetMapper()->SetScalarRange(aRangeGlobal);
       }
       
       aScalarBarCtrl->SetMode(aScalarBarMode);
       
       // Position
-      aScalarBarCtrl->SetWidth(myWidth);
-      aScalarBarCtrl->SetHeight(myHeight);
-      aScalarBarCtrl->SetPosition(myPosition);
+      aScalarBarCtrl->SetWidth(GetWidth());
+      aScalarBarCtrl->SetHeight(GetHeight());
+
+      vtkFloatingPointType aPosition[] = {GetPosX(), GetPosY()};
+      aScalarBarCtrl->SetPosition(aPosition);
       
       aScalarBarCtrl->SetSpacing(mySpacing);
       
       // Bicolor
-      bool anIsBicolor = GetGaussPointsPL()->GetBicolor();
+      bool anIsBicolor = GetSpecificPL()->GetBicolor();
       aScalarBarCtrl->SetBicolor(anIsBicolor);
       
       UpdateScalarBar(aScalarBarCtrl->GetLocalBar(),
@@ -718,14 +858,14 @@ VISU::GaussPoints_i
     }else{
       anActor->SetBarVisibility(false);
 
-      myPipeLine->GetMapper()->SetScalarVisibility(0);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(0);
 
       anActor->GetProperty()->SetColor(myColor.red() / 255.0,
                                       myColor.green() / 255.0,
                                       myColor.blue() / 255.0);
     }
 
-    if( GetGaussPointsPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
+    if( GetSpecificPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
       theActor->SetRepresentation( VTK_POINTS );
     else
       theActor->SetRepresentation( VTK_SURFACE );
@@ -740,6 +880,7 @@ VISU::GaussPoints_i
 {
   if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
   myGaussPointsPL->ChangeMagnification(theActor->GetChangeMagnification());
+  myParamsTime.Modified();
   UpdateActors();
 }
 
@@ -764,9 +905,12 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 void
 VISU::GaussPoints_i
-::SetIsActiveLocalScalarBar(const bool theFlag)
+::SetIsActiveLocalScalarBar(const bool theIsActiveLocalScalarBar)
 {
-  myIsActiveLocalScalarBar = theFlag;
+  if(myIsActiveLocalScalarBar != theIsActiveLocalScalarBar){
+    myIsActiveLocalScalarBar = theIsActiveLocalScalarBar;
+    myParamsTime.Modified();
+  }
 }
 
 bool
@@ -778,18 +922,65 @@ VISU::GaussPoints_i
 
 void
 VISU::GaussPoints_i
-::SetIsDispGlobalScalarBar(const bool theFlag)
+::SetIsDispGlobalScalarBar(const bool theIsDispGlobalScalarBar)
 {
-  myIsDispGlobalScalarBar=theFlag;
+  if(myIsDispGlobalScalarBar != theIsDispGlobalScalarBar){
+    myIsDispGlobalScalarBar = theIsDispGlobalScalarBar;
+    myParamsTime.Modified();
+  }
 }
 
 bool
 VISU::GaussPoints_i
 ::IsGlobalRangeDefined() const 
 {
-  return myResult->IsMinMaxDone();
+  return GetCResult()->IsMinMaxDone();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetSourceRange()
+{
+  if(IsTimeStampFixed() || GetIsActiveLocalScalarBar())
+    GetSpecificPL()->SetSourceRange();
+  else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
+    GetSpecificPL()->SetScalarRange(aScalarRange);
+  }
+}
+
+CORBA::Double 
+VISU::GaussPoints_i
+::GetSourceMin()
+{
+  if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[0];
+  }else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    return aTMinMax.first;
+  }
+}
+
+CORBA::Double 
+VISU::GaussPoints_i
+::GetSourceMax()
+{
+  if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[1];
+  }else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    return aTMinMax.second;
+  }
 }
 
+
+//----------------------------------------------------------------------------
 bool
 VISU::GaussPoints_i
 ::GetIsDispGlobalScalarBar() const 
@@ -797,25 +988,29 @@ VISU::GaussPoints_i
   return myIsDispGlobalScalarBar;
 }
 
+
 void
 VISU::GaussPoints_i
 ::SetBiColor(bool theIsBiColor)
 {
-  GetGaussPointsPL()->SetBicolor(theIsBiColor);
+  GetSpecificPL()->SetBicolor(theIsBiColor);
 }
 
 bool
 VISU::GaussPoints_i
 ::GetBiColor() 
 {
-  return GetGaussPointsPL()->GetBicolor();
+  return GetSpecificPL()->GetBicolor();
 }
 
 void
 VISU::GaussPoints_i
 ::SetSpacing(const vtkFloatingPointType theSpacing)
 {
-  mySpacing = theSpacing;
+  if(!VISU::CheckIsSameValue(mySpacing, theSpacing)){
+    mySpacing = theSpacing;
+    myParamsTime.Modified();
+  }
 }
 
 vtkFloatingPointType
index c80ef747ece03d9b3c8fef45cbbfa4464102fc05..b1e542337a16daa079302a8ab4d38f3693d11c24 100644 (file)
@@ -51,13 +51,10 @@ namespace VISU
   public:
     //----------------------------------------------------------------------------
     typedef ColoredPrs3d_i TSuperClass;
+    typedef VISU::GaussPoints TInterface;
 
     explicit
-    GaussPoints_i(Result_i* theResult,
-                 bool theAddToStudy);
-    explicit
-    GaussPoints_i(Result_i* theResult,
-                 SALOMEDS::SObject_ptr theSObject);
+    GaussPoints_i(EPublishInStudyMode thePublishInStudyModep);
 
     virtual
     ~GaussPoints_i();
@@ -69,17 +66,18 @@ namespace VISU
       return VISU::TGAUSSPOINTS;
     }
 
-    typedef VISU::GaussPoints TInterface;
-
-    //! Get the Gauss Points Pipeline.
-    VISU_GaussPointsPL* 
-    GetGaussPointsPL();
+    //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
 
+    //----------------------------------------------------------------------------
     int
-    GetFaceLimit() { return myFaceLimit; }
+    GetFaceLimit();
 
     void
-    SetFaceLimit( int theFaceLimit ) { myFaceLimit = theFaceLimit; }
+    SetFaceLimit( int theFaceLimit );
 
     bool 
     GetIsDeformed();
@@ -95,16 +93,16 @@ namespace VISU
 
     //! Get color for Geometry mode of the presentation.
     QColor
-    GetColor() { return myColor; }
+    GetColor();
 
     //! Set color for Geometry mode of the presentation.
     void
-    SetColor( const QColor& theColor ) { myColor = theColor; }
+    SetColor( const QColor& theColor );
 
     //! Get flag indicating which mode of the presentation is active.
     /*! When Results mode is active, returns true. Geometry - false. */
     bool 
-    GetIsColored() { return myIsColored; }
+    GetIsColored();
 
     //! Get flag indicating which mode of the presentation is active.
     void
@@ -241,42 +239,65 @@ namespace VISU
     bool
     IsGlobalRangeDefined() const;
 
+    virtual
+    CORBA::Double 
+    GetSourceMin();
+
+    virtual
+    CORBA::Double 
+    GetSourceMax();
+
+    virtual 
+    void
+    SetSourceRange();
+
     //! To update the min / max automatically
     virtual
     void
     UpdateMinMax();
 
+    VISU_GaussPointsPL* 
+    GetSpecificPL() const
+    { 
+      return myGaussPointsPL; 
+    }
+    
   protected:
+    //! Redefines VISU_ColoredPrs3d_i::DoSetInput
     virtual
     void
-    DoSetInput(Result_i* theResult);
+    DoSetInput(bool theIsInitilizePipe, bool theReInit);
 
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
     virtual
     void
-    DoHook();
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     virtual 
     VISU_PipeLine* 
-    GetPipeLine();
+    GetActorPipeLine();
     
     bool
-    OnCreateActor(VISU_GaussPtsAct* theActor,
-                 const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    OnCreateActor(VISU_GaussPtsAct* theActor);
 
     VISU_GaussPtsAct1* 
-    OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    OnCreateActor1();
 
     VISU_GaussPtsAct2* 
-    OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    OnCreateActor2();
 
     void
     UpdateScalarBar(vtkScalarBarActor *theScalarBar,
                    vtkLookupTable* theLookupTable);
 
-
+  protected:
     VISU_GaussPointsPL *myGaussPointsPL;
-
-    bool myIsColored;
+    
     bool myIsDispGlobalScalarBar;
     bool myIsActiveLocalScalarBar;
     QColor myColor;
@@ -288,19 +309,23 @@ namespace VISU
 
   public:
     static 
-    int
+    size_t
     IsPossible(Result_i* theResult, 
-              const char* theMeshName, 
+              const std::string& theMeshName, 
               VISU::Entity theEntity,
-              const char* theFieldName, 
-              int theIteration, 
-              int isMemoryCheck = true);
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
     virtual
     Storable* 
-    Create(const char* theMeshName, 
+    Create(const std::string& theMeshName, 
           VISU::Entity theEntity,
-          const char* theFieldName, 
-          int theIteration);
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
+
+    virtual 
+    void
+    SameAs(const Prs3d_i* theOrigin);
 
     static const std::string myComment;
 
@@ -318,12 +343,13 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     //----------------------------------------------------------------------------
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
     virtual 
     VISU_GaussPtsAct2* 
@@ -340,4 +366,3 @@ namespace VISU
 }
 
 #endif
-
index ebac78cbbf98ffc92123a52ec7570ae50b6feada..6fa8e99186c28c33b499b12b55067ac1755485ee 100644 (file)
 
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Mesh_i.hh"
-#include "VISU_ScalarMap_i.hh"
-#include "VISU_IsoSurfaces_i.hh"
-#include "VISU_DeformedShape_i.hh"
-#include "VISU_CutPlanes_i.hh"
-#include "VISU_CutLines_i.hh"
-#include "VISU_Vectors_i.hh"
-#include "VISU_StreamLines_i.hh"
-#include "VISU_GaussPoints_i.hh"
-#include "VISU_Plot3D_i.hh"
 #include "VISU_Table_i.hh"
 #include "VISU_TimeAnimation.h"
-#include "VISU_ScalarMapOnDeformedShape_i.hh"
+
+#include "VISU_ColoredPrs3dFactory.hh"
+#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
 
 #include "VISU_Actor.h"
 
 #include <TCollection_AsciiString.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 
-// STL Includes
-#include <strstream>
-
 #include "Utils_ExceptHandlers.hxx"
+UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception);
 
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
-#define NO_CAS_CATCH
-#endif
-
-#include <Standard_Failure.hxx>
-
-#ifdef NO_CAS_CATCH
-#include <Standard_ErrorHandler.hxx>
-#else
-#include "CASCatch.hxx"
-#endif
+// STL Includes
+#include <strstream>
 
 using namespace std;
 
@@ -105,19 +88,18 @@ static QFileInfo aFileInfo;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 #endif
 
-UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception);
-
-extern "C" VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB,
-                                     PortableServer::POA_ptr thePOA,
-                                     SALOME_NamingService* theNamingService,
-                                     QMutex* theMutex)
+extern "C" 
+VISU::VISU_Gen_ptr
+GetImpl(CORBA::ORB_ptr theORB,
+       PortableServer::POA_ptr thePOA,
+       SALOME_NamingService* theNamingService,
+       QMutex* theMutex)
 {
-  if(MYDEBUG) MESSAGE("extern \"C\" GetImpl");
+  if(MYDEBUG) MESSAGE("extern 'C' GetImpl");
   VISU::VISU_Gen_i *aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theNamingService,theMutex);
   //return VISU::VISU_Gen::_duplicate(aVISU_Gen->_this());
   return aVISU_Gen->_this();
@@ -125,13 +107,15 @@ extern "C" VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB,
 
 namespace VISU
 {
+  //----------------------------------------------------------------------------
   static string VisuTmpDir;
 
   static CORBA::Boolean myIsMultiFile;
   const CORBA::Boolean IsMultifile() { return myIsMultiFile;}
 
-  //===========================================================================
-  _PTR(SComponent) ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument)
+  //----------------------------------------------------------------------------
+  _PTR(SComponent) 
+  ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument)
   {
     _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("VISU");
     if (!aSComponent) {
@@ -166,7 +150,11 @@ namespace VISU
     return aSComponent;
   }
 
-  SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument){
+
+  //----------------------------------------------------------------------------
+  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();
@@ -199,9 +187,13 @@ namespace VISU
     return aSComponent;
   }
 
-  void RegistryStorable() {
+
+  //----------------------------------------------------------------------------
+  void
+  RegistryStorable() 
+  {
     Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
-    Storable::Registry(Mesh_i::myComment.c_str(),&(Restore<Mesh_i>));
+    Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore));
     Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
     Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore<GaussPoints_i>));
     Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
@@ -215,12 +207,15 @@ namespace VISU
     Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
     Storable::Registry(Container_i::myComment.c_str(),&(Container_i::Restore));
     Storable::Registry(ScalarMapOnDeformedShape_i::myComment.c_str(),&(Restore<ScalarMapOnDeformedShape_i>));
+    Storable::Registry(ColoredPrs3dHolder_i::myComment.c_str(),&(ColoredPrs3dHolder_i::Restore));
+    Storable::Registry(ColoredPrs3dCache_i::myComment.c_str(),&(ColoredPrs3dCache_i::Restore));
   }
 
 
-  //===========================================================================
-  VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA,
-                        SALOME_NamingService* theNamingService, QMutex* theMutex) :
+  //----------------------------------------------------------------------------
+  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);
@@ -244,54 +239,30 @@ namespace VISU
       if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : there is no opened study in StudyManager !!!");
   }
 
-  bool
-  CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
-                   const char* theMeshName, 
-                   VISU::Entity theEntity,
-                   const char* theFieldName, 
-                   CORBA::Double theIteration)
+
+  //----------------------------------------------------------------------------
+  Prs3d_ptr
+  VISU_Gen_i
+  ::CreatePrs3d(VISUType theType,
+               SALOMEDS::Study_ptr theStudy)
   {
-#ifndef _DEXCEPT_
-#ifdef NO_CAS_CATCH
-    try{
-      OCC_CATCH_SIGNALS;
-#else
-    CASCatch_TRY{
-      try{
-#endif
-#endif
-       if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration)))
-         return true;
-#ifndef _DEXCEPT_
-#ifdef NO_CAS_CATCH
-      }catch(Standard_Failure) {
-       Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-       INFOS("Follow signal was occured :\n"<<aFail->GetMessageString());
-      }catch(std::exception& exc){
-       INFOS("Follow exception was occured :\n"<<exc.what());
-      }catch(...){
-       INFOS("Unknown exception was occured!");
-      }
-#else
-      }catch(std::exception& exc){
-       INFOS("Follow exception was occured :\n"<<exc.what());
-      }catch(...){
-       INFOS("Unknown exception was occured!");
-      }
-    }CASCatch_CATCH(Standard_Failure){
-      Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
-      INFOS("Follow signal was occured :\n"<<aFail->GetMessageString());
-    }
-#endif
-#endif
-    return false;
+    if(ColoredPrs3d_i* aPrs3d = CreatePrs3d_i(theType, theStudy, ColoredPrs3d_i::EPublishIndependently))
+      return aPrs3d->_this();
+    return Prs3d::_nil();
   }
 
-  VISU_Gen_i::~VISU_Gen_i(){
+
+  //----------------------------------------------------------------------------
+  VISU_Gen_i
+  ::~VISU_Gen_i()
+  {
     if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
   }
 
-  void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject)
+
+  //----------------------------------------------------------------------------
+  void
+  CorrectSObjectType(SALOMEDS::SObject_ptr theSObject)
   {
     SALOMEDS::GenericAttribute_var anAttr;
     if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) {
@@ -333,6 +304,7 @@ namespace VISU
              else if ( !aComment.compare(QString("GAUSSVIEW")) ) aVISUType = VISU::TGAUSSVIEW;
              else if ( !aComment.compare(QString("ENTITY")) ) aVISUType = VISU::TENTITY;
              else if ( !aComment.compare(QString("FAMILY")) ) aVISUType = VISU::TFAMILY;
+                 else if ( !aComment.compare(QString("PART")) ) aVISUType = VISU::TPART; // MULTIPR
              else if ( !aComment.compare(QString("GROUP")) ) aVISUType = VISU::TGROUP;
              else if ( !aComment.compare(QString("FIELD")) ) aVISUType = VISU::TFIELD;
              else if ( !aComment.compare(QString("TIMESTAMP")) ) aVISUType = VISU::TTIMESTAMP;
@@ -350,11 +322,14 @@ namespace VISU
     }
   }
 
-  //===========================================================================
-  CORBA::Boolean VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
-                                 const SALOMEDS::TMPFile & theStream,
-                                 const char* theURL,
-                                 bool isMultiFile)
+
+  //----------------------------------------------------------------------------
+  CORBA::Boolean 
+  VISU_Gen_i
+  ::Load(SALOMEDS::SComponent_ptr theComponent,
+        const SALOMEDS::TMPFile & theStream,
+        const char* theURL,
+        bool isMultiFile)
   {
     Mutex mt(myMutex);
     SALOMEDS::Study_var aStudy = theComponent->GetStudy();
@@ -375,18 +350,26 @@ namespace VISU
     return true;
   }
 
-  CORBA::Boolean VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
-                                      const SALOMEDS::TMPFile & theStream,
-                                      const char* theURL,
-                                      bool isMultiFile)
+
+  //----------------------------------------------------------------------------
+  CORBA::Boolean 
+  VISU_Gen_i
+  ::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
+             const SALOMEDS::TMPFile & theStream,
+             const char* theURL,
+             bool isMultiFile)
   {
     return Load(theComponent, theStream, theURL, isMultiFile);
   }
 
-  char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
-                                          const char* aLocalPersistentID,
-                                          CORBA::Boolean isMultiFile,
-                                          CORBA::Boolean isASCII)
+
+  //----------------------------------------------------------------------------
+  char* 
+  VISU_Gen_i
+  ::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
+                          const char* aLocalPersistentID,
+                          CORBA::Boolean isMultiFile,
+                          CORBA::Boolean isASCII)
   {
     CORBA::String_var aString("");
     if(strcmp(aLocalPersistentID,"") != 0) {
@@ -398,10 +381,13 @@ namespace VISU
     return aString._retn();
   }
 
-  //===========================================================================
-  SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
-                                     const char* theURL,
-                                     bool theIsMultiFile)
+
+  //----------------------------------------------------------------------------
+  SALOMEDS::TMPFile* 
+  VISU_Gen_i
+  ::Save(SALOMEDS::SComponent_ptr theComponent,
+        const char* theURL,
+        bool theIsMultiFile)
   {
     Mutex mt(myMutex);
     string aTmpDir = theURL;
@@ -467,9 +453,13 @@ namespace VISU
     return aStreamFile._retn();
   }
 
-  SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
-                                          const char* theURL,
-                                          bool isMultiFile)
+
+  //----------------------------------------------------------------------------
+  SALOMEDS::TMPFile* 
+  VISU_Gen_i
+  ::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
+             const char* theURL,
+             bool isMultiFile)
   {
     Mutex mt(myMutex);
     string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
@@ -523,10 +513,14 @@ namespace VISU
     return aStreamFile._retn();
   }
 
-  char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
-                                          const char* IORString,
-                                          CORBA::Boolean isMultiFile,
-                                          CORBA::Boolean isASCII)
+
+  //----------------------------------------------------------------------------
+  char* 
+  VISU_Gen_i
+  ::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
+                          const char* IORString,
+                          CORBA::Boolean isMultiFile,
+                          CORBA::Boolean isASCII)
   {
     CORBA::String_var aString(IORString);
     if(strcmp(IORString,"") != 0){
@@ -543,11 +537,20 @@ namespace VISU
     return aString._retn();
   }
 
-  char* VISU_Gen_i::GetID(){
+
+  //----------------------------------------------------------------------------
+  char* 
+  VISU_Gen_i
+  ::GetID()
+  {
     return Base_i::GetID();
   }
 
-  void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy)
+
+  //----------------------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::SetCurrentStudy(SALOMEDS::Study_ptr theStudy)
   {
     class TEvent: public SALOME_Event {
       std::string myStudyName;
@@ -598,17 +601,32 @@ namespace VISU
     }
   }
 
-  SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
+
+  //----------------------------------------------------------------------------
+  SALOMEDS::Study_ptr 
+  VISU_Gen_i
+  ::GetCurrentStudy()
+  {
     return SALOMEDS::Study::_duplicate(myStudyDocument);
   }
 
-  ViewManager_ptr VISU_Gen_i::GetViewManager(){
+
+  //----------------------------------------------------------------------------
+  ViewManager_ptr 
+  VISU_Gen_i
+  ::GetViewManager()
+  {
     Mutex mt(myMutex);
     ViewManager_i * aViewManager = new ViewManager_i(myStudyDocument);
     return ViewManager::_duplicate(aViewManager->_this());
   }
 
-  SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){
+
+  //----------------------------------------------------------------------------
+  SALOMEDS::SObject_ptr 
+  VISU_Gen_i
+  ::ImportTables(const char* theFileName)
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return SALOMEDS::SObject::_nil();
     Mutex mt(myMutex);
@@ -616,13 +634,22 @@ namespace VISU
     return aRes._retn();
   }
 
-  CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
-                                              const char* theFileName)
+
+  //----------------------------------------------------------------------------
+  CORBA::Boolean 
+  VISU_Gen_i
+  ::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
+                     const char* theFileName)
   {
     return VISU::ExportTableToFile(theTable, theFileName);
   }
 
-  Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){
+
+  //----------------------------------------------------------------------------
+  Result_ptr
+  VISU_Gen_i
+  ::ImportFile(const char* theFileName)
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
     Mutex mt(myMutex);
@@ -638,7 +665,12 @@ namespace VISU
     }
   }
 
-  Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
+
+  //----------------------------------------------------------------------------
+  Result_ptr
+  VISU_Gen_i
+  ::CreateResult(const char* theFileName)
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
     Mutex mt(myMutex);
@@ -655,7 +687,12 @@ namespace VISU
     }
   }
 
-  Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
+
+  //----------------------------------------------------------------------------
+  Result_ptr
+  VISU_Gen_i
+  ::CopyAndImportFile(const char* theFileName)
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
     Mutex mt(myMutex);
@@ -669,7 +706,11 @@ namespace VISU
     return aResult._retn();
   }
 
-  Result_ptr VISU_Gen_i::ImportMed (SALOMEDS::SObject_ptr theMedSObject)
+
+  //----------------------------------------------------------------------------
+  Result_ptr
+  VISU_Gen_i
+  ::ImportMed(SALOMEDS::SObject_ptr theMedSObject)
   {
     if (myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
@@ -685,7 +726,11 @@ namespace VISU
     }
   }
 
-  Result_ptr VISU_Gen_i::ImportMedField (SALOME_MED::FIELD_ptr theField)
+
+  //----------------------------------------------------------------------------
+  Result_ptr
+  VISU_Gen_i
+  ::ImportMedField (SALOME_MED::FIELD_ptr theField)
   {
     if (myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
@@ -701,11 +746,13 @@ namespace VISU
     }
   }
 
-  void VISU_Gen_i::RenameMeshInStudy(Result_ptr theResult,
-                                    string     theMeshName,
-                                    int        theEntity,      // -1 for group indication
-                                    string     theSubMeshName, // Family or Group name
-                                    string     theNewName)
+  void
+  VISU_Gen_i
+  ::RenameMeshInStudy(Result_ptr theResult,
+                     const std::string& theMeshName,
+                     int theEntity, // -1 for group indication
+                     const std::string& theSubMeshName, // Family or Group name
+                     const std::string& theNewName)
   {
     if (myStudyDocument->GetProperties()->IsLocked()) return;
     Mutex mt(myMutex);
@@ -755,41 +802,57 @@ namespace VISU
     aStudyBuilder->CommitCommand();
   }
 
-  void VISU_Gen_i::RenameEntityInStudy(Result_ptr   theResult,
-                                      const char*  theMeshName,
-                                      VISU::Entity theEntity,
-                                      const char*  theNewName)
+
+  //----------------------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::RenameEntityInStudy(Result_ptr   theResult,
+                       const char*  theMeshName,
+                       VISU::Entity theEntity,
+                       const char*  theNewName)
   {
     RenameMeshInStudy(theResult, theMeshName, (int)theEntity, "", theNewName);
   }
 
-  void VISU_Gen_i::RenameFamilyInStudy(Result_ptr   theResult,
-                                      const char*  theMeshName,
-                                      VISU::Entity theEntity,
-                                      const char*  theFamilyName,
-                                      const char*  theNewName)
+
+  //----------------------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::RenameFamilyInStudy(Result_ptr   theResult,
+                       const char*  theMeshName,
+                       VISU::Entity theEntity,
+                       const char*  theFamilyName,
+                       const char*  theNewName)
   {
     RenameMeshInStudy(theResult, theMeshName, (int)theEntity, theFamilyName, theNewName);
   }
 
-  void VISU_Gen_i::RenameGroupInStudy(Result_ptr  theResult,
-                                     const char* theMeshName,
-                                     const char* theGroupName,
-                                     const char* theNewName)
+
+  //----------------------------------------------------------------------------
+  void 
+  VISU_Gen_i
+  ::RenameGroupInStudy(Result_ptr  theResult,
+                      const char*  theMeshName,
+                      const char* theGroupName,
+                      const char* theNewName)
   {
     RenameMeshInStudy(theResult, theMeshName, -1, theGroupName, theNewName);
   }
 
-  Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
-                                   const char* theMeshName,
-                                   VISU::Entity theEntity)
+
+  //----------------------------------------------------------------------------
+  Mesh_ptr
+  VISU_Gen_i
+  ::MeshOnEntity(Result_ptr theResult,
+                const char* theMeshName,
+                VISU::Entity theEntity)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(aPresent->Create(aResult, theMeshName, theEntity))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -798,17 +861,21 @@ namespace VISU
     return VISU::Mesh::_nil();
   }
 
-  Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
-                                         const char* theMeshName,
-                                         VISU::Entity theEntity,
-                                         const char* theFamilyName)
+
+  //----------------------------------------------------------------------------
+  Mesh_ptr 
+  VISU_Gen_i
+  ::FamilyMeshOnEntity(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFamilyName)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -817,16 +884,20 @@ namespace VISU
     return VISU::Mesh::_nil();
   }
 
-  Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
-                                const char* theMeshName,
-                                const char* theGroupName)
+
+  //----------------------------------------------------------------------------
+  Mesh_ptr
+  VISU_Gen_i
+  ::GroupMesh(Result_ptr theResult,
+             const char* theMeshName,
+             const char* theGroupName)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theGroupName) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(aPresent->Create(aResult, theMeshName, theGroupName))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -835,94 +906,154 @@ namespace VISU
     return VISU::Mesh::_nil();
   }
 
-  ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult,
-                                            const char* theMeshName,
-                                            VISU::Entity theEntity,
-                                            const char* theFieldName,
-                                            CORBA::Double theIteration)
+
+  //----------------------------------------------------------------------------
+  ScalarMap_ptr 
+  VISU_Gen_i
+  ::ScalarMapOnField(Result_ptr theResult,
+                    const char* theMeshName,
+                    VISU::Entity theEntity,
+                    const char* theFieldName,
+                    CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
+    return Prs3dOnField<VISU::ScalarMap_i>(theResult,
+                                          theMeshName,
+                                          theEntity,
+                                          theFieldName,
+                                          theIteration)._retn();
   }
 
-  GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult,
-                                                const char* theMeshName,
-                                                VISU::Entity theEntity,
-                                                const char* theFieldName,
-                                                CORBA::Double theIteration)
+
+  //----------------------------------------------------------------------------
+  GaussPoints_ptr
+  VISU_Gen_i
+  ::GaussPointsOnField(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFieldName,
+                      CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::GaussPoints_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
+    return Prs3dOnField<VISU::GaussPoints_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult,
-                                                    const char* theMeshName,
-                                                    VISU::Entity theEntity,
-                                                    const char* theFieldName,
-                                                    CORBA::Double theIteration)
+  DeformedShape_ptr 
+  VISU_Gen_i
+  ::DeformedShapeOnField(Result_ptr theResult,
+                        const char* theMeshName,
+                        VISU::Entity theEntity,
+                        const char* theFieldName,
+                        CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::DeformedShape_i>(theResult,
+                                              theMeshName,
+                                              theEntity,
+                                              theFieldName,
+                                              theIteration)._retn();
   }
 
-  ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
-                                                                          const char* theMeshName,
-                                                                          VISU::Entity theEntity,
-                                                                          const char* theFieldName,
-                                                                          CORBA::Double theIteration)
+  ScalarMapOnDeformedShape_ptr 
+  VISU_Gen_i
+  ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
+                                   const char* theMeshName,
+                                   VISU::Entity theEntity,
+                                   const char* theFieldName,
+                                   CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::ScalarMapOnDeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::ScalarMapOnDeformedShape_i>(theResult,
+                                                         theMeshName,
+                                                         theEntity,
+                                                         theFieldName,
+                                                         theIteration)._retn();
   }
   
-  Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult,
-                                        const char* theMeshName,
-                                        VISU::Entity theEntity,
-                                        const char* theFieldName,
-                                        CORBA::Double theIteration)
+  Vectors_ptr 
+  VISU_Gen_i
+  ::VectorsOnField(Result_ptr theResult,
+                  const char* theMeshName,
+                  VISU::Entity theEntity,
+                  const char* theFieldName,
+                  CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::Vectors_i>(theResult,
+                                        theMeshName,
+                                        theEntity,
+                                        theFieldName,
+                                        theIteration)._retn();
   }
 
-  IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult,
-                                                const char* theMeshName,
-                                                VISU::Entity theEntity,
-                                                const char* theFieldName,
-                                                CORBA::Double theIteration)
+  IsoSurfaces_ptr 
+  VISU_Gen_i
+  ::IsoSurfacesOnField(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFieldName,
+                      CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult,
-                                                const char* theMeshName,
-                                                VISU::Entity theEntity,
-                                                const char* theFieldName,
-                                                CORBA::Double theIteration)
+  StreamLines_ptr 
+  VISU_Gen_i
+  ::StreamLinesOnField(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFieldName,
+                      CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::StreamLines_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
-                                      const char* theMeshName,
-                                      VISU::Entity theEntity,
-                                      const char* theFieldName,
-                                      CORBA::Double theIteration)
+  Plot3D_ptr 
+  VISU_Gen_i
+  ::Plot3DOnField(Result_ptr theResult,
+                 const char* theMeshName,
+                 VISU::Entity theEntity,
+                 const char* theFieldName,
+                 CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::Plot3D_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::Plot3D_i>(theResult,
+                                       theMeshName,
+                                       theEntity,
+                                       theFieldName,
+                                       theIteration)._retn();
   }
 
   CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
                                             const char* theMeshName,
                                             VISU::Entity theEntity,
                                             const char* theFieldName,
-                                            CORBA::Double theIteration)
+                                            CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::CutPlanes_i>(theResult,
+                                          theMeshName,
+                                          theEntity,
+                                          theFieldName,
+                                          theIteration)._retn();
   }
 
   CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult,
                                           const char* theMeshName,
                                           VISU::Entity theEntity,
                                           const char* theFieldName,
-                                          CORBA::Double theIteration)
+                                          CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::CutLines_i>(theResult,
+                                         theMeshName,
+                                         theEntity,
+                                         theFieldName,
+                                         theIteration)._retn();
   }
 
   Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
@@ -1121,7 +1252,6 @@ namespace VISU
     // Assign an ID = 1 the the type VISU::Result
     theObjectID = 1;
 
-
     SALOMEDS::SComponent_var aSComponent = theObject->GetStudy()->FindComponent("VISU");
     return aStreamFile._retn();
   }
@@ -1189,4 +1319,11 @@ namespace VISU
     anIOR->SetValue(anIORValue);
     return aResultSO._retn();
   }
+
+  VISU::ColoredPrs3dCache_ptr
+  VISU_Gen_i::
+  GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+  {
+    return ColoredPrs3dCache_i::GetInstance(theStudy);
+  }
 }
index 1a5f6f8282b3f9c9cfb40f77187be3f05eb0bb22..3b8280b11a3d2237bce18758fa59e703db290f1f 100644 (file)
 
 #include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
+#include "VISU_ColoredPrs3d_i.hh"
 
 #include <string>
 
 namespace VISU
 {
-  class Result_i;
-  class ColoredPrs3d_i;
-
-  bool
-  CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
-                   const char* theMeshName, 
-                   VISU::Entity theEntity,
-                   const char* theFieldName, 
-                   CORBA::Double theIteration);
-
+  //----------------------------------------------------------------------------
   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
                     public virtual ::Engines_Component_i,
                     public virtual Base_i
@@ -55,7 +47,9 @@ namespace VISU
               PortableServer::POA_ptr thePOA,
               SALOME_NamingService* theNamingService,
               QMutex* theMutex);
-    virtual ~VISU_Gen_i();
+
+    virtual 
+    ~VISU_Gen_i();
 
     virtual 
     char* 
@@ -87,7 +81,7 @@ namespace VISU
                      const char* theFileName );
 
     //Create Result
-    virtual 
+    virtual
     Result_ptr
     ImportFile(const char* theFileName);
 
@@ -110,11 +104,11 @@ namespace VISU
 
     //Rename Presentation Of Submeshes
     void
-    RenameMeshInStudy(Result_ptr  theResult,
-                     std::string theMeshName,
-                     int         theEntity,      // -1 for group indication
-                     std::string theSubMeshName, // Family or Group name
-                     std::string theNewName);
+    RenameMeshInStudy(Result_ptr theResult,
+                     const std::string& theMeshName,
+                     int theEntity, // -1 for group indication
+                     const std::string& theSubMeshName, // Family or Group name
+                     const std::string& theNewName);
     virtual
     void
     RenameEntityInStudy(Result_ptr   theResult,
@@ -131,7 +125,7 @@ namespace VISU
     virtual
     void
     RenameGroupInStudy(Result_ptr  theResult,
-                      const char* theMeshName,
+                      const char*  theMeshName,
                       const char* theGroupName,
                       const char* theNewName);
 
@@ -155,46 +149,9 @@ namespace VISU
              const char* theMeshName, 
              const char* theGroupName);
 
-    //Create 3D collored Presentation Of Different Types
-    template<typename TPrs3d_i> TPrs3d_i*
-    CreatePrs3d(Result_ptr theResult, 
-               const char* theMeshName, 
-               VISU::Entity theEntity,
-               const char* theFieldName, 
-               CORBA::Double theIteration, 
-               bool theAddToStudy = true)
-    {
-      if(myStudyDocument->GetProperties()->IsLocked()) 
-       return NULL;
-
-      typedef typename TPrs3d_i::TInterface TPrs3d;
-      typename TPrs3d::_var_type aPrs3d;
-      Mutex mt(myMutex);
-      if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-       if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){
-         TPrs3d_i* aPresent = new TPrs3d_i(aResult,theAddToStudy);
-         if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration))
-           return aPresent;
-         aPresent->_remove_ref();
-       }
-      }
-      return NULL;
-    }
-
-    template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
-    Prs3dOnField(Result_ptr theResult, 
-                const char* theMeshName, 
-                VISU::Entity theEntity,
-                const char* theFieldName, 
-                CORBA::Double theIteration, 
-                bool theAddToStudy = true)
-    {
-      typedef typename TPrs3d_i::TInterface TPrs3d;
-      typename TPrs3d::_var_type aPrs3d;
-      if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy))
-       return aPrs3d->_this();
-      return TPrs3d::_nil();
-    }
+    Prs3d_ptr
+    CreatePrs3d(VISUType theType,
+               SALOMEDS::Study_ptr theStudy);
 
     virtual
     ScalarMap_ptr
@@ -202,7 +159,7 @@ namespace VISU
                     const char* theMeshName, 
                     VISU::Entity theEntity,
                     const char* theFieldName, 
-                    CORBA::Double theIteration);
+                    CORBA::Long theIteration);
 
     virtual
     GaussPoints_ptr
@@ -210,7 +167,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     DeformedShape_ptr
@@ -218,7 +175,7 @@ namespace VISU
                         const char* theMeshName, 
                         VISU::Entity theEntity,
                         const char* theFieldName, 
-                        CORBA::Double theIteration);
+                        CORBA::Long theIteration);
 
     virtual
     ScalarMapOnDeformedShape_ptr
@@ -226,14 +183,14 @@ namespace VISU
                                    const char* theMeshName, 
                                    VISU::Entity theEntity,
                                    const char* theFieldName, 
-                                   CORBA::Double theIteration);
+                                   CORBA::Long theIteration);
     virtual
     Vectors_ptr
     VectorsOnField(Result_ptr theResult,
                   const char* theMeshName, 
                   VISU::Entity theEntity,
                   const char* theFieldName, 
-                  CORBA::Double theIteration);
+                  CORBA::Long theIteration);
 
     virtual
     IsoSurfaces_ptr
@@ -241,7 +198,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     CutPlanes_ptr
@@ -249,7 +206,7 @@ namespace VISU
                     const char* theMeshName, 
                     VISU::Entity theEntity,
                     const char* theFieldName, 
-                    CORBA::Double theIteration);
+                    CORBA::Long theIteration);
 
     virtual
     CutLines_ptr
@@ -257,7 +214,7 @@ namespace VISU
                    const char* theMeshName, 
                    VISU::Entity theEntity,
                    const char* theFieldName, 
-                   CORBA::Double theIteration);
+                   CORBA::Long theIteration);
 
     virtual
     StreamLines_ptr
@@ -265,7 +222,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     Plot3D_ptr
@@ -273,7 +230,7 @@ namespace VISU
                  const char* theMeshName, 
                  VISU::Entity theEntity,
                  const char* theFieldName, 
-                 CORBA::Double theIteration);
+                 CORBA::Long theIteration);
 
     //Create Digital Presentation
     virtual 
@@ -390,6 +347,10 @@ namespace VISU
     PasteInto(const SALOMEDS::TMPFile& theStream,
              CORBA::Long theObjectID,
              SALOMEDS::SObject_ptr theObject);
+
+    virtual
+    VISU::ColoredPrs3dCache_ptr
+    GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
   };
 }
 
index 649d25df0b09e7b2f82aef2d831f9dab26a62a67..6c8c3973d65372bfa63e809354d02d967d4507fb 100644 (file)
@@ -43,6 +43,7 @@
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_GaussPoints_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
 #include "VISU_ViewManager_i.hh"
 #include "VISU_View_i.hh"
 #include "VISU_TimeAnimation.h"
index 0f0077bc244aa7e1e4a435b459082b38508940a9..b1e533e18c00ec9d956fd9ca0ce43f34224cadb7 100644 (file)
 
 #include "SUIT_ResourceMgr.h"
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
 
-int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                   const char* theFieldName, int theIteration, int isMemoryCheck)
+//---------------------------------------------------------------
+size_t
+VISU::IsoSurfaces_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+  return TSuperClass::IsPossible(theResult,
+                                theMeshName,
+                                theEntity,
+                                theFieldName,
+                                theTimeStampNumber,
+                                theIsMemoryCheck);
 }
 
+//---------------------------------------------------------------
 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();}
+//---------------------------------------------------------------
+QString VISU::IsoSurfaces_i::GenerateName()
+{ 
+  return VISU::GenerateName("IsoSurfaces",myNbPresent++);
+}
 
+//---------------------------------------------------------------
+const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES";
 
-VISU::IsoSurfaces_i::
-IsoSurfaces_i(Result_i* theResult, 
-             bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myIsoSurfacesPL(NULL)
-{}
+//---------------------------------------------------------------
+const char* 
+VISU::IsoSurfaces_i
+::GetComment() const
+{ 
+  return myComment.c_str();
+}
 
 
-VISU::IsoSurfaces_i::
-IsoSurfaces_i(Result_i* theResult, 
-             SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+//---------------------------------------------------------------
+VISU::IsoSurfaces_i
+::IsoSurfaces_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myIsoSurfacesPL(NULL)
-{
-}
+{}
 
 
-VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                           const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::IsoSurfaces_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::IsoSurfaces_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
   float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
@@ -95,8 +114,13 @@ VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theM
   return this;
 }
 
-void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
-  ScalarMap_i::ToStream(theStr);
+
+//---------------------------------------------------------------
+void
+VISU::IsoSurfaces_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) );
   Storable::DataToStream( theStr, "myRange[0]", GetSubMin() );
@@ -104,46 +128,96 @@ void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::IsoSurfaces_i::~IsoSurfaces_i(){
+//---------------------------------------------------------------
+VISU::IsoSurfaces_i
+::~IsoSurfaces_i()
+{
   if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()");
 }
 
 
-void VISU::IsoSurfaces_i::SetNbSurfaces(CORBA::Long theNb){
+//---------------------------------------------------------------
+void 
+VISU::IsoSurfaces_i
+::SetNbSurfaces(CORBA::Long theNb)
+{
   myIsoSurfacesPL->SetNbParts(theNb);
 }
-CORBA::Long VISU::IsoSurfaces_i::GetNbSurfaces(){
+
+//---------------------------------------------------------------
+CORBA::Long 
+VISU::IsoSurfaces_i
+::GetNbSurfaces()
+{
   return myIsoSurfacesPL->GetNbParts();
 }
 
 
-void VISU::IsoSurfaces_i::SetSubRange(CORBA::Double theMin, CORBA::Double theMax)
+//---------------------------------------------------------------
+void
+VISU::IsoSurfaces_i
+::SetSubRange(CORBA::Double theMin, CORBA::Double theMax)
 { 
   vtkFloatingPointType aRange[2] = {theMin, theMax};
   myIsoSurfacesPL->SetRange(aRange);
 }
-CORBA::Double VISU::IsoSurfaces_i::GetSubMin(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::IsoSurfaces_i
+::GetSubMin()
+{
   return myIsoSurfacesPL->GetMin();
 }
-CORBA::Double VISU::IsoSurfaces_i::GetSubMax(){
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::IsoSurfaces_i
+::GetSubMax()
+{
   return myIsoSurfacesPL->GetMax();
 }
 
 
-void VISU::IsoSurfaces_i::DoHook(){
-  if(MYDEBUG) MESSAGE("IsoSurfaces_i::DoHook()- "<<myPipeLine);
-  if(!myPipeLine) myPipeLine = VISU_IsoSurfacesPL::New();
-  myIsoSurfacesPL = dynamic_cast<VISU_IsoSurfacesPL*>(myPipeLine);
+//---------------------------------------------------------------
+void 
+VISU::IsoSurfaces_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myIsoSurfacesPL = VISU_IsoSurfacesPL::New();
+  }else
+    myIsoSurfacesPL = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myIsoSurfacesPL);
+}
+
 
-  ScalarMap_i::DoHook();
+//----------------------------------------------------------------------------
+void 
+VISU::IsoSurfaces_i
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
+{
+  TSuperClass::DoSetInput(theIsInitilizePipe, theReInit);
+  if(theIsInitilizePipe || (!IsTimeStampFixed() && !IsRangeFixed()) || theReInit)
+    SetSubRange(GetSourceMin(), GetSourceMax());
 }
 
 
+//---------------------------------------------------------------
+bool
+VISU::IsoSurfaces_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::IsoSurfaces_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor()
 {
-  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int  aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2);
@@ -153,6 +227,11 @@ VISU::IsoSurfaces_i
   return NULL;
 }
 
-void VISU::IsoSurfaces_i::SetMapScale(double theMapScale){
+
+//---------------------------------------------------------------
+void
+VISU::IsoSurfaces_i
+::SetMapScale(double theMapScale)
+{
   myIsoSurfacesPL->SetMapScale(theMapScale);
 }
index 56db9093c1d88d23a368a36e1450bddeafb02cdb..0daa2b2c003062fc73eb9121cf3d8f11a0e20b78 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_IsoSurfacesPL;
 
-namespace VISU{
+namespace VISU
+{
   class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
                        public virtual ScalarMap_i
   {
@@ -43,48 +44,107 @@ namespace VISU{
     typedef ScalarMap_i TSuperClass;
 
     explicit
-    IsoSurfaces_i(Result_i* theResult,
-                 bool theAddToStudy);
-    explicit
-    IsoSurfaces_i(Result_i* theResult,
-                 SALOMEDS::SObject_ptr theSObject);
-    virtual ~IsoSurfaces_i();
+    IsoSurfaces_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual 
+    ~IsoSurfaces_i();
 
-    virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
+    virtual
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TISOSURFACE;
+    }
 
-    virtual void SetNbSurfaces(CORBA::Long theNb);
-    virtual CORBA::Long GetNbSurfaces();
+    virtual
+    void
+    SetNbSurfaces(CORBA::Long theNb);
 
-    virtual void SetSubRange(CORBA::Double theMin, CORBA::Double theMax);
-    virtual CORBA::Double GetSubMin();
-    virtual CORBA::Double GetSubMax();
+    virtual
+    CORBA::Long 
+    GetNbSurfaces();
+
+    virtual 
+    void
+    SetSubRange(CORBA::Double theMin, CORBA::Double theMax);
+
+    virtual
+    CORBA::Double 
+    GetSubMin();
+
+    virtual
+    CORBA::Double 
+    GetSubMax();
 
     typedef VISU::IsoSurfaces TInterface;
-    VISU_IsoSurfacesPL* GetIsoSurfacesPL(){ return myIsoSurfacesPL;}
 
+    VISU_IsoSurfacesPL* 
+    GetSpecificPL() const
+    { 
+      return myIsoSurfacesPL; 
+    }
+    
   protected:
-    virtual void DoHook();
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void 
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ScalarMap_i::DoSetInput
+    virtual 
+    void
+    DoSetInput(bool theIsInitilizePipe, bool theReInit);
+
+    //! Redefines VISU_ScalarMap_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
+
     VISU_IsoSurfacesPL* myIsoSurfacesPL;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    virtual
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
 
-    virtual void ToStream(std::ostringstream& theStr);
+    virtual 
+    const char* 
+    GetComment() const;
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    virtual
+    QString
+    GenerateName();
+
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
-
-    virtual void SetMapScale(double theMapScale = 1.0);
+    CreateActor();
+    
+    virtual 
+    void 
+    SetMapScale(double theMapScale = 1.0);
   };
 }
 
index ababd5074ccc8c94689164a913db0acd42ab994b..b23962687b465f2cc95e44132559440aced97eb6 100644 (file)
@@ -27,7 +27,6 @@
 #include "VISU_Mesh_i.hh"
 
 #include "VISU_Result_i.hh"
-#include "VISU_ViewManager_i.hh"
 
 #include "VISU_MeshAct.h"
 #include "VISU_MeshPL.hxx"
@@ -37,9 +36,6 @@
 
 #include "SUIT_ResourceMgr.h"
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -48,73 +44,50 @@ static int MYDEBUG = 0;
 
 static int INCMEMORY = 4;
 
+//----------------------------------------------------------------------------
 int VISU::Mesh_i::myNbPresent = 0;
 
-QString VISU::Mesh_i::GenerateName() { return VISU::GenerateName("Mesh",myNbPresent++);}
+//----------------------------------------------------------------------------
+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,false),
-  myMeshPL(VISU_MeshPL::New())
-{
-  myPipeLine = myMeshPL;
+//----------------------------------------------------------------------------
+const char* 
+VISU::Mesh_i
+::GetComment() const
+{ 
+  return myComment.c_str();
 }
 
-
-VISU::Mesh_i::
-Mesh_i(Result_i* theResult,
-       SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::Mesh_i():
   myMeshPL(VISU_MeshPL::New())
 {
-  myPipeLine = myMeshPL;
+  SetPipeLine(myMeshPL);
 }
 
 
-//---------------------------------------------------------------
-void VISU::Mesh_i::RemoveFromStudy()
-{
-  struct TRemoveFromStudy: public SALOME_Event
-  {
-    VISU::Mesh_i* myRemovable;
-    TRemoveFromStudy(VISU::Mesh_i* theRemovable):
-      myRemovable(theRemovable)
-    {}
-    
-    virtual
-    void
-    Execute()
-    {
-      VISU::RemoveFromStudy(myRemovable->GetSObject());
-      myRemovable->TSuperClass::RemoveFromStudy();
-    }
-  };
-
-  ProcessVoidEvent(new TRemoveFromStudy(this));
-}
-
-
-void VISU::Mesh_i::SameAs (const Prs3d_i* theOrigin)
-{
-  return; // "SameAs" command for mesh is not valid in current architecture
-}
-
-
-
-int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName,
-                             Entity theEntity, const char* theFamilyName)
+//----------------------------------------------------------------------------
+size_t
+VISU::Mesh_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName,
+            Entity theEntity, 
+            const std::string& theFamilyName)
 {
   try{
     MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
-    float aSize = INCMEMORY*
+    size_t aSize = INCMEMORY*
       theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity);
-    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -125,25 +98,35 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName,
   return 0;
 }
 
-VISU::Storable* VISU::Mesh_i::Create (const char* theMeshName,
-                                     Entity theEntity,
-                                     const char* theFamilyName)
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        VISU::Entity theEntity, 
+        const std::string& theFamilyName)
 {
-  myMeshName = theMeshName;
-  //jfa IPAL9284:myEntity = VISU::TEntity(theEntity);
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
   myEntity = int(theEntity);//jfa IPAL9284
   mySubMeshName = theFamilyName;
   return Build(false);
 }
 
 
-int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, const char* theGroupName)
+//----------------------------------------------------------------------------
+size_t 
+VISU::Mesh_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            const std::string& theGroupName)
 {
   try{
     MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
-    float aSize = INCMEMORY*
+    size_t aSize = INCMEMORY*
       theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
-    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -155,84 +138,45 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, cons
 }
 
 
-VISU::Storable* VISU::Mesh_i::Create (const char* theMeshName,
-                                     const char* theGroupName)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        const std::string& theGroupName)
 {
-  myMeshName = theMeshName;
-  //jfa IPAL9284:myEntity = VISU::TEntity(-1);
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
   myEntity = -1;//jfa IPAL9284
   mySubMeshName = theGroupName;
   return Build(false);
 }
 
 
-VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap)
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::~Mesh_i()
 {
-  Prs3d_i::Restore(theMap);
-
-  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  //jfa IPAL9284:myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
-  mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
-
-  myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
-
-  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();
-
-  return Build(true);
-}
-
-
-void VISU::Mesh_i::ToStream(std::ostringstream& 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, "myPresentType", int(myPresentType) );
-
-  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::Mesh_i::~Mesh_i(){
   if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
 }
 
 
-VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Build(int theRestoring)
 {
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
   aStudyBuilder->NewCommand();  // There is a transaction
   try {
-    if (myResult->GetInput() == NULL)
-      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
+    if (GetCResult()->GetInput() == NULL)
+      throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
     if (!theRestoring) {
       myPresentType =  VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
       if(myEntity == VISU::NODE_ENTITY)
        myPresentType = VISU::POINT;
-      myName = GenerateName().latin1();
+      SetName(GenerateName().latin1(), false);
       myCellColor.R = 0.0;  myCellColor.G = myCellColor.B = 1.0;
       myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
       myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
@@ -249,47 +193,59 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
     if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
     QString aComment,aTmp;
 
-    VISU::PIDMapper anIDMapper;
+    VISU::PUnstructuredGridIDMapper anIDMapper;
+    VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
     switch(myType){
     case VISU::TENTITY :
-      anIDMapper = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284
+      anIDMapper = anInput->GetMeshOnEntity(GetCMeshName(),
+                                           (VISU::TEntity)myEntity);//jfa IPAL9284
       aComment = "";
       aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
-      aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";");
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
       aComment.append(aTmp.sprintf("myId=%d",myEntity));
       break;
     case VISU::TFAMILY :
-      anIDMapper = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName);
+      anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(),
+                                             (VISU::TEntity)myEntity,
+                                             mySubMeshName);
       aComment = "";
       aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY));
-      aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";");
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
       aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity));
-      aComment.append("myName=");aComment.append(mySubMeshName);
+      aComment.append("myName=");
+      aComment.append(mySubMeshName);
       break;
     case VISU::TGROUP :
-      anIDMapper = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
+      anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
+                                          mySubMeshName);
       aComment = "";
       aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP));
-      aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";");
-      aComment.append("myName=");aComment.append(mySubMeshName);
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
+      aComment.append("myName=");
+      aComment.append(mySubMeshName);
       
       break;
     }
     if(!anIDMapper) 
       throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
 
-    myMeshPL->SetIDMapper(anIDMapper);
-    myMeshPL->Build();
+    myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
 
     if(!theRestoring) { //Setting IOR on the label
       myMeshPL->Init();
-      string aResultEntry = myResult->GetEntry();
-      string anEntry = myResult->GetEntry(aComment.latin1());
+      string aResultEntry = GetCResult()->GetEntry();
+      string anEntry = GetCResult()->GetEntry(aComment.latin1());
       if(anEntry == "") 
        throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
-      mySObject = myStudy->FindObjectID(anEntry.c_str());
-      SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR");
+      SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
+      SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
       CORBA::String_var aString = GetID();
       anIOR->SetValue(aString);
@@ -306,11 +262,207 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
 }
 
 
-VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::SameAs(const VISU::Prs3d_i* theOrigin)
+{
+  return; // "SameAs" command for mesh is not valid in current architecture
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::RemoveFromStudy()
+{
+  struct TRemoveFromStudy: public SALOME_Event
+  {
+    VISU::Mesh_i* myRemovable;
+    TRemoveFromStudy(VISU::Mesh_i* theRemovable):
+      myRemovable(theRemovable)
+    {}
+    
+    virtual
+    void
+    Execute()
+    {
+      VISU::RemoveFromStudy(myRemovable->GetSObject());
+      myRemovable->TSuperClass::RemoveFromStudy();
+    }
+  };
+
+  ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetCellColor(const SALOMEDS::Color& theColor) 
+{ 
+  myCellColor = theColor;
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetCellColor() 
+{ 
+  return myCellColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetNodeColor(const SALOMEDS::Color& theColor) 
+{ 
+  myNodeColor = theColor;
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetNodeColor() 
+{ 
+  return myNodeColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetLinkColor(const SALOMEDS::Color& theColor) 
+{ 
+  myLinkColor = theColor;
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetLinkColor() 
+{ 
+  return myLinkColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetPresentationType(VISU::PresentationType theType) 
+{ 
+  myPresentType = theType;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::PresentationType 
+VISU::Mesh_i
+::GetPresentationType() 
+{ 
+  return myPresentType;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Entity 
+VISU::Mesh_i
+::GetEntity() const
+{ 
+  return VISU::Entity(myEntity);
+}
+
+
+//----------------------------------------------------------------------------
+const std::string&
+VISU::Mesh_i
+::GetSubMeshName() const
+{ 
+  return mySubMeshName;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
+{
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
+
+  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
+  mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
+
+  myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
+
+  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();
+
+  return Build(true);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable*
+VISU::Mesh_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+{
+  Mesh_i* aMesh = new Mesh_i();
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  return aMesh->Restore(aStudy, theMap);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myEntity", myEntity );
+  Storable::DataToStream( theStr, "mySubMeshName", mySubMeshName.c_str() );
+
+  Storable::DataToStream( theStr, "myPresentType", int(myPresentType) );
+
+  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_Actor* 
+VISU::Mesh_i
+::CreateActor()
 {
   VISU_MeshAct* anActor = VISU_MeshAct::New();
   try{
-    VISU::Prs3d_i::CreateActor(anActor,theIO);
+    VISU::Prs3d_i::CreateActor(anActor);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     bool toShrink  = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
     if (toShrink) anActor->SetShrink();
@@ -323,7 +475,11 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th
 }
 
 
-void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) {
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
     if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
     VISU::Prs3d_i::UpdateActor(anActor);
@@ -333,3 +489,5 @@ void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) {
     anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
   }
 }
+
+//----------------------------------------------------------------------------
index c7e43098f55ebbe1c29d7fcdca328aeaf866d201..fd1b2958ce0a30053df6eaf474607c72fa791817 100644 (file)
@@ -37,76 +37,147 @@ namespace VISU
                 public virtual Prs3d_i
   {
     static int myNbPresent;
-    Mesh_i();
     Mesh_i(const Mesh_i&);
 
   public:
     typedef Prs3d_i TSuperClass;
+    typedef VISU::Mesh TInterface;
 
-    explicit
-    Mesh_i(Result_i* theResult);
+    Mesh_i();
 
-    explicit
-    Mesh_i(Result_i* theResult,
-          SALOMEDS::SObject_ptr theSObject);
+    virtual
+    ~Mesh_i();
 
-    virtual void SameAs(const Prs3d_i* theOrigin);
-    virtual ~Mesh_i();
-    virtual void RemoveFromStudy();
+    virtual
+    void
+    SameAs(const Prs3d_i* theOrigin);
 
-    virtual VISU::VISUType GetType() { return VISU::TMESH;};
+    virtual
+    void
+    RemoveFromStudy();
 
-    virtual void SetCellColor(const SALOMEDS::Color& theColor) { myCellColor = theColor;}
-    virtual SALOMEDS::Color GetCellColor() { return myCellColor;}
+    virtual
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TMESH;
+    }
 
-    virtual void SetNodeColor(const SALOMEDS::Color& theColor) { myNodeColor = theColor;}
-    virtual SALOMEDS::Color GetNodeColor() { return myNodeColor;}
+    virtual 
+    void 
+    SetCellColor(const SALOMEDS::Color& theColor);
 
-    virtual void SetLinkColor(const SALOMEDS::Color& theColor) { myLinkColor = theColor;}
-    virtual SALOMEDS::Color GetLinkColor() { return myLinkColor;}
+    virtual 
+    SALOMEDS::Color 
+    GetCellColor();
 
-    virtual void SetPresentationType(VISU::PresentationType theType) { myPresentType = theType;}
-    virtual PresentationType GetPresentationType() { return myPresentType;}
+    virtual 
+    void 
+    SetNodeColor(const SALOMEDS::Color& theColor);
 
-    typedef VISU::Mesh TInterface;
-    VISU_MeshPL* GetMeshPL(){ return myMeshPL;}
+    virtual 
+    SALOMEDS::Color 
+    GetNodeColor();
+
+    virtual 
+    void 
+    SetLinkColor(const SALOMEDS::Color& theColor);
+
+    virtual 
+    SALOMEDS::Color 
+    GetLinkColor();
+
+    virtual 
+    void
+    SetPresentationType(VISU::PresentationType theType);
+
+    virtual
+    VISU::PresentationType 
+    GetPresentationType();
+
+    VISU_MeshPL* GetSpecificPL() const
+    { 
+      return myMeshPL;
+    }
 
   protected:
-    Storable* Build(int theRestoring);
+    Storable* 
+    Build(int theRestoring);
 
     VISU_MeshPL* myMeshPL;
 
-    // std::string myMeshName; move it to Prs3d_i
     int myEntity;//jfa IPAL9284: TEntity myEntity;
     std::string mySubMeshName;
     VISU::VISUType myType;
 
     VISU::PresentationType myPresentType;
-    struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor;
+    SALOMEDS::Color myCellColor;
+    SALOMEDS::Color myNodeColor;
+    SALOMEDS::Color myLinkColor;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName,
-                         Entity theEntity, const char* theFamilyName = "");
-    virtual Storable* Create(const char* theMeshName, Entity theEntity, const char* theFamilyName = "");
-
-    static int IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName);
-    virtual Storable* Create(const char* theMeshName, const char* theGroupName);
-
-    const std::string& GetMeshName() const { return myMeshName;}
-    VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
-    const string& GetSubMeshName() const { return mySubMeshName;}
+    static 
+    size_t
+    IsPossible(VISU::Result_i* theResult, 
+              const std::string& theMeshName,
+              VISU::Entity theEntity, 
+              const std::string& theFamilyName = "");
+    virtual 
+    Storable* 
+    Create(VISU::Result_i* theResult, 
+          const std::string& theMeshName, 
+          VISU::Entity theEntity, 
+          const std::string& theFamilyName = "");
+
+    static 
+    size_t
+    IsPossible(VISU::Result_i* theResult, 
+              const std::string& theMeshName, 
+              const std::string& theGroupName);
+    virtual 
+    Storable* 
+    Create(VISU::Result_i* theResult, 
+          const std::string& theMeshName, 
+          const std::string& theGroupName);
+
+    VISU::Entity
+    GetEntity() const;
+
+    const std::string& 
+    GetSubMeshName() const;
+
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
+    virtual
+    const char* 
+    GetComment() const;
 
-    virtual void ToStream(std::ostringstream& theStr);
-
-    virtual const char* GetComment() const;
     static const std::string myComment;
-    virtual QString GenerateName();
-
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
-
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual
+    QString
+    GenerateName();
+
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
+
+    static 
+    Storable* 
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const std::string& thePrefix,
+           const Storable::TRestoringMap& theMap);
+    
+    virtual
+    VISU_Actor* 
+    CreateActor();
+
+    virtual
+    void 
+    UpdateActor(VISU_Actor* theActor);
   };
 }
 
index d86ca318333de8fa0ea93bbb963ab641722cdbb5..205f9563a0e4a485de7815625bab7e2ddb2b0f84 100644 (file)
 //
 
 #include "VISU_Plot3D_i.hh"
-
 #include "VISU_Result_i.hh"
-
 #include "VISU_Plot3DPL.hxx"
-
 #include "VISU_Actor.h"
-
 #include "SUIT_ResourceMgr.h"
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
 
-int VISU::Plot3D_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                              const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t 
+VISU::Plot3D_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible
-    (theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+  return TSuperClass::IsPossible(theResult,
+                                theMeshName,
+                                theEntity,
+                                theFieldName,
+                                theTimeStampNumber,
+                                theIsMemoryCheck);
 }
 
+//---------------------------------------------------------------
 int VISU::Plot3D_i::myNbPresent = 0;
-QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNbPresent++); }
 
+//---------------------------------------------------------------
+QString 
+VISU::Plot3D_i
+::GenerateName() 
+{ 
+  return VISU::GenerateName("Plot3D",myNbPresent++); 
+}
+
+//---------------------------------------------------------------
 const string VISU::Plot3D_i::myComment = "PLOT3D";
-const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); }
 
+//---------------------------------------------------------------
+const char* 
 VISU::Plot3D_i
-::Plot3D_i(Result_i* theResult, 
-          bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myPlot3DPL(NULL)
-{}
+::GetComment() const 
+{ 
+  return myComment.c_str(); 
+}
+
 
+//---------------------------------------------------------------
 VISU::Plot3D_i
-::Plot3D_i(Result_i* theResult, 
-          SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+::Plot3D_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myPlot3DPL(NULL)
 {}
 
-VISU::Storable* VISU::Plot3D_i::Create (const char* theMeshName, VISU::Entity theEntity,
-                                       const char* theFieldName, int theIteration)
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::Plot3D_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
-VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap)
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::Plot3D_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
                 Storable::FindValue(theMap,"aRot[0]").toDouble(),
@@ -92,9 +114,13 @@ VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap)
   return this;
 }
 
-void VISU::Plot3D_i::ToStream (std::ostringstream& theStr)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::ToStream(std::ostringstream& theStr)
 {
-  ScalarMap_i::ToStream(theStr);
+  TSuperClass::ToStream(theStr);
 
   Storable::DataToStream(theStr, "myBasePlane", int(GetOrientationType()));
   Storable::DataToStream(theStr, "aRot[0]", GetRotateX());
@@ -106,91 +132,165 @@ void VISU::Plot3D_i::ToStream (std::ostringstream& theStr)
   Storable::DataToStream(theStr, "myNbOfContours", int(GetNbOfContours()));
 }
 
-VISU::Plot3D_i::~Plot3D_i(){
+
+//---------------------------------------------------------------
+VISU::Plot3D_i
+::~Plot3D_i()
+{
   if(MYDEBUG) MESSAGE("Plot3D_i::~Plot3D_i()");
 }
 
-void VISU::Plot3D_i::SetOrientation (VISU::Plot3D::Orientation theOrient,
-                                    CORBA::Double theXAngle, CORBA::Double theYAngle)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetOrientation(VISU::Plot3D::Orientation theOrient,
+                CORBA::Double theXAngle, 
+                CORBA::Double theYAngle)
 {
   myPlot3DPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
-                            theXAngle,theYAngle);
+                            theXAngle,
+                            theYAngle);
 }
 
-VISU::Plot3D::Orientation VISU::Plot3D_i::GetOrientationType()
+
+//---------------------------------------------------------------
+VISU::Plot3D::Orientation
+VISU::Plot3D_i
+::GetOrientationType()
 {
   return VISU::Plot3D::Orientation(myPlot3DPL->GetPlaneOrientation());
 }
 
-CORBA::Double VISU::Plot3D_i::GetRotateX()
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::Plot3D_i
+::GetRotateX()
 {
   return myPlot3DPL->GetRotateX();
 }
 
-CORBA::Double VISU::Plot3D_i::GetRotateY()
+
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::Plot3D_i
+::GetRotateY()
 {
   return myPlot3DPL->GetRotateY();
 }
 
-void VISU::Plot3D_i::SetPlanePosition (CORBA::Double  thePlanePosition,
-                                      CORBA::Boolean theIsRelative)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetPlanePosition(CORBA::Double  thePlanePosition,
+                  CORBA::Boolean theIsRelative)
 {
   myPlot3DPL->SetPlanePosition(thePlanePosition, theIsRelative);
 }
 
-CORBA::Double VISU::Plot3D_i::GetPlanePosition()
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::Plot3D_i
+::GetPlanePosition()
 {
   return myPlot3DPL->GetPlanePosition();
 }
 
-CORBA::Boolean VISU::Plot3D_i::IsPositionRelative()
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Plot3D_i
+::IsPositionRelative()
 {
   return myPlot3DPL->IsPositionRelative();
 }
 
-void VISU::Plot3D_i::SetScaleFactor (CORBA::Double theScaleFactor)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetScaleFactor(CORBA::Double theScaleFactor)
 {
   myPlot3DPL->SetScaleFactor(theScaleFactor);
 }
 
-CORBA::Double VISU::Plot3D_i::GetScaleFactor()
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::Plot3D_i
+::GetScaleFactor()
 {
   return myPlot3DPL->GetScaleFactor();
 }
 
-void VISU::Plot3D_i::SetNbOfContours (CORBA::Long theNb)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetNbOfContours(CORBA::Long theNb)
 {
   myPlot3DPL->SetNumberOfContours(theNb);
 }
 
-CORBA::Long VISU::Plot3D_i::GetNbOfContours()
+
+//---------------------------------------------------------------
+CORBA::Long
+VISU::Plot3D_i
+::GetNbOfContours()
 {
   return myPlot3DPL->GetNumberOfContours();
 }
 
-void VISU::Plot3D_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetContourPrs(CORBA::Boolean theIsContourPrs)
 {
   myPlot3DPL->SetContourPrs( theIsContourPrs );
 }
 
-CORBA::Boolean VISU::Plot3D_i::GetIsContourPrs()
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Plot3D_i
+::GetIsContourPrs()
 {
   return myPlot3DPL->GetIsContourPrs();
 }
 
-void VISU::Plot3D_i::DoHook()
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
 {
-  if (!myPipeLine) myPipeLine = VISU_Plot3DPL::New();
-  myPlot3DPL = dynamic_cast<VISU_Plot3DPL*>(myPipeLine);
+  if(!thePipeLine){
+    myPlot3DPL = VISU_Plot3DPL::New();
+  }else
+    myPlot3DPL = dynamic_cast<VISU_Plot3DPL*>(thePipeLine);
 
-  ScalarMap_i::DoHook();
+  TSuperClass::CreatePipeLine(myPlot3DPL);
 }
 
+
+//---------------------------------------------------------------
+bool
+VISU::Plot3D_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::Plot3D_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor()
 {
-  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+  if(VISU_Actor* anActor = TSuperClass::CreateActor()){
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int aDispMode = aResourceMgr->integerValue("VISU", "plot3d_represent", 2);
@@ -200,7 +300,11 @@ VISU::Plot3D_i
   return NULL;
 }
 
-void VISU::Plot3D_i::SetMapScale(double theMapScale)
+
+//---------------------------------------------------------------
+void
+VISU::Plot3D_i
+::SetMapScale(double theMapScale)
 {
   myPlot3DPL->SetMapScale(theMapScale);
 }
index d509b545689fee1a0718035b7534001e206b6ab9..e87571c14339160b122cccfa2a56b22ad535237b 100644 (file)
@@ -25,7 +25,8 @@
 
 class VISU_Plot3DPL;
 
-namespace VISU {
+namespace VISU 
+{
   class Plot3D_i : public virtual POA_VISU::Plot3D,
                    public virtual ScalarMap_i
   {
@@ -37,64 +38,135 @@ namespace VISU {
     typedef ScalarMap_i TSuperClass;
 
     explicit
-    Plot3D_i (Result_i* theResult, bool theAddToStudy = true);
-    explicit
-    Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject);
+    Plot3D_i(EPublishInStudyMode thePublishInStudyModep);
 
-    virtual ~Plot3D_i();
+    virtual 
+    ~Plot3D_i();
 
-    virtual VISU::VISUType GetType() { return VISU::TPLOT3D; };
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TPLOT3D; 
+    }
+
+    virtual
+    void
+    SetOrientation (VISU::Plot3D::Orientation theOrient,
+                   CORBA::Double theXAngle, 
+                   CORBA::Double theYAngle);
 
-    virtual void SetOrientation (VISU::Plot3D::Orientation theOrient,
-                                CORBA::Double theXAngle, CORBA::Double theYAngle);
+    virtual 
+    VISU::Plot3D::Orientation 
+    GetOrientationType();
 
-    virtual VISU::Plot3D::Orientation GetOrientationType();
+    virtual 
+    CORBA::Double 
+    GetRotateX();
 
-    virtual CORBA::Double GetRotateX();
-    virtual CORBA::Double GetRotateY();
+    virtual
+    CORBA::Double 
+    GetRotateY();
 
-    virtual void SetPlanePosition (CORBA::Double  thePlanePosition,
-                                  CORBA::Boolean theIsRelative);
-    virtual CORBA::Double GetPlanePosition();
-    virtual CORBA::Boolean IsPositionRelative();
+    virtual
+    void
+    SetPlanePosition(CORBA::Double  thePlanePosition,
+                    CORBA::Boolean theIsRelative);
 
-    virtual void SetScaleFactor (CORBA::Double theScaleFactor);
-    virtual CORBA::Double GetScaleFactor();
+    virtual
+    CORBA::Double 
+    GetPlanePosition();
 
-    virtual void SetContourPrs (CORBA::Boolean theIsContourPrs );
-    CORBA::Boolean GetIsContourPrs();
+    virtual
+    CORBA::Boolean
+    IsPositionRelative();
 
-    virtual void SetNbOfContours (CORBA::Long theNb);
-    virtual CORBA::Long GetNbOfContours();
+    virtual
+    void
+    SetScaleFactor(CORBA::Double theScaleFactor);
 
-    typedef VISU::Plot3D TInterface;
-    VISU_Plot3DPL* GetPlot3DPL() { return myPlot3DPL; }
+    virtual
+    CORBA::Double
+    GetScaleFactor();
+
+    virtual
+    void
+    SetContourPrs(CORBA::Boolean theIsContourPrs);
+
+    CORBA::Boolean 
+    GetIsContourPrs();
+
+    virtual
+    void
+    SetNbOfContours(CORBA::Long theNb);
 
-    void SetMapScale(double theMapScale);
+    virtual
+    CORBA::Long
+    GetNbOfContours();
 
+    typedef VISU::Plot3D TInterface;
+
+    VISU_Plot3DPL* 
+    GetSpecificPL() const
+    { 
+      return myPlot3DPL; 
+    }
+    
   protected:
-    virtual void DoHook();
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void 
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     VISU_Plot3DPL *myPlot3DPL;
 
   public:
-    static int IsPossible (Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                          const char* theFieldName, int theIteration, int isMemoryCheck = true);
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
 
-    virtual Storable* Create (const char* theMeshName, VISU::Entity theEntity,
-                             const char* theFieldName, int theIteration);
+    virtual 
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
-    virtual void ToStream (std::ostringstream& theStr);
+    virtual
+    void
+    ToStream (std::ostringstream& theStr);
 
-    virtual Storable* Restore (const Storable::TRestoringMap& theMap);
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
+
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString
+    GenerateName();
+    
+    void
+    SetMapScale(double theMapScale);
   };
 }
 
index 70d0e429985a68baf146ddc17c79fc7a5a38ab0e..93a5f995353e53806b0bd008febc482f00b4e3a0 100644 (file)
 #include "SALOME_Event.hxx"
 
 #include <vtkActorCollection.h>
+#include <vtkUnstructuredGrid.h>
 #include <vtkDataSet.h>
 #include <vtkMapper.h>
 
 #include <boost/bind.hpp>
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -50,74 +48,255 @@ static int MYDEBUG = 0;
 
 //----------------------------------------------------------------------------
 VISU::Prs3d_i
-::Prs3d_i(Result_i* theResult,
-         SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  mySObject(SALOMEDS::SObject::_duplicate(theSObject)),
+::Prs3d_i() :
+  PrsObject_i(SALOMEDS::Study::_nil()),
   myActorCollection(vtkActorCollection::New()),
-  myResult(theResult),
-  myAddToStudy(true),
-  myPipeLine(NULL)
+  myIsActiveSatate(true),
+  myIsRestored(true)
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
   myActorCollection->Delete();
-  myResult->Register();
 }
 
-VISU::Prs3d_i
-::Prs3d_i(Result_i* theResult,
-         bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  myActorCollection(vtkActorCollection::New()),
-  mySObject(SALOMEDS::SObject::_nil()),
-  myAddToStudy(theAddToStudy),
-  myResult(theResult),
-  myPipeLine(NULL)
-{
-  if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
-  myOffset[0] = myOffset[1] = myOffset[2] = 0;
-  myActorCollection->Delete();
-  myResult->Register();
-}
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
-  if (Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin)) {
-    myPipeLine->SameAs(aOrigin->GetPL());
-    aOrigin->GetOffset(myOffset);
+  if(Prs3d_i* anOrigin = const_cast<Prs3d_i*>(theOrigin)){
+    GetPipeLine()->SameAs(anOrigin->GetPipeLine());
+    anOrigin->GetOffset(myOffset);
   }
 }
 
+
+//----------------------------------------------------------------------------
 VISU::Prs3d_i
 ::~Prs3d_i() 
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
   myRemoveActorsFromRendererSignal();
-  myPipeLine->Delete();
-  myResult->Destroy();
 }
 
 
+//----------------------------------------------------------------------------
+bool 
+VISU::Prs3d_i
+::SetInput(bool theReInit)
+{
+  if(GetCResult()){
+    if(myMeshName != ""){
+      myPreviousResult = myResult;
+      myPreviousMeshName = myMeshName;
+      return true;
+    }
+  }
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Prs3d_i
+::OnRestoreInput()
+{
+  SetCResult(myPreviousResult);
+  myMeshName = myPreviousMeshName;
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean 
+VISU::Prs3d_i
+::Apply(bool theReInit)
+{
+  try{
+    if(SetInput(theReInit)){
+      UpdateActors();
+      return true;
+    }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+  }
+  OnRestoreInput();
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetCResult(VISU::Result_i* theResult)
+{
+  VISU::Result_i* aResult = GetCResult();
+  if(aResult != theResult){
+    if(aResult)
+      aResult->Destroy();
+    if(theResult){
+      theResult->Register();
+      SetStudyDocument(theResult->GetStudyDocument());
+    }
+    myResult = theResult;
+    myParamsTime.Modified();
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetResultEntry(const std::string& theResultEntry)
+{
+  SetCResult(VISU::GetResult(GetStudyDocument(), theResultEntry));
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::Prs3d_i
+::GetResultEntry()
+{
+  if(VISU::Result_i* aResult = GetCResult())
+    return aResult->GetEntry();
+  return "";
+}
+
+//----------------------------------------------------------------------------
+VISU::Result_i* 
+VISU::Prs3d_i
+::GetCResult() const 
+{ 
+  return myResult;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetResultObject(VISU::Result_ptr theResult)
+{
+  SetCResult(dynamic_cast<VISU::Result_i*>(GetServant(theResult).in()));
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Result_ptr
+VISU::Prs3d_i
+::GetResultObject()
+{
+  return GetCResult()->_this();
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Prs3d_i
+::SetMeshName(const char* theMeshName)
+{
+  if(myMeshName != theMeshName){
+    myMeshName = theMeshName;
+    myParamsTime.Modified();
+  }
+}
+
+
+//----------------------------------------------------------------------------
+char*
+VISU::Prs3d_i
+::GetMeshName()
+{
+  return CORBA::string_dup(myMeshName.c_str());
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::Prs3d_i
+::GetCMeshName() const
+{
+  return myMeshName;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int 
+VISU::Prs3d_i
+::GetMTime()
+{
+  unsigned long int aTime = myParamsTime.GetMTime();
+  if(IsPipeLineExists())
+    aTime = std::max(aTime,GetPipeLine()->GetMTime());
+  return aTime;
+}
+
+//----------------------------------------------------------------------------
+bool 
+VISU::Prs3d_i
+::GetActiveState()
+{
+  return myIsActiveSatate;
+}
+
+//----------------------------------------------------------------------------
+void 
+VISU::Prs3d_i
+::SetActiveState(bool theState)
+{
+  myIsActiveSatate = theState;
+}
+
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::Prs3d_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  myName = VISU::Storable::FindValue(theMap,"myName").latin1();
+  SetStudyDocument(theStudy);
+  SetResultEntry(VISU::Storable::FindValue(theMap,"myResultEntry").latin1());
+  if(!GetCResult())
+    return NULL;
+
+  SetMeshName(VISU::Storable::FindValue(theMap,"myMeshName").latin1());
+  SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false);
   myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat();
   myOffset[1] = VISU::Storable::FindValue(theMap,"myOffset[1]").toFloat();
   myOffset[2] = VISU::Storable::FindValue(theMap,"myOffset[2]").toFloat();
+  myParamsTime.Modified();
   return this;
 }
 
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SaveRestoringState(SALOMEDS::Study_ptr theStudy,
+                    const Storable::TRestoringMap& theMap)
+{
+  myRestoringStudy = SALOMEDS::Study::_duplicate(theStudy);
+  myRestoringMap = theMap;
+  myIsRestored = false;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::InitFromRestoringState()
+{
+  if(!myIsRestored){
+    Restore(myRestoringStudy, myRestoringMap);
+    myIsRestored = true;
+  }
+}
+
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::ToStream(std::ostringstream& theStr)
 {
-  Storable::DataToStream( theStr, "myName",   myName.c_str() );
+  Storable::DataToStream( theStr, "myResultEntry", GetResultEntry() );
+  Storable::DataToStream( theStr, "myMeshName", GetCMeshName() );
+  Storable::DataToStream( theStr, "myName", GetName().c_str() );
   Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] );
   Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] );
   Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] );
@@ -129,26 +308,12 @@ SALOMEDS::SObject_var
 VISU::Prs3d_i
 ::GetSObject()
 {
-  if(CORBA::is_nil(mySObject.in())){
-    const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
+  const SALOMEDS::Study_var& aStudy = GetStudyDocument();
+  if(!CORBA::is_nil(aStudy.in())){
     CORBA::String_var anIOR = GetID();
-    mySObject = aStudy->FindObjectIOR(anIOR);
+    return aStudy->FindObjectIOR(anIOR);
   }
-  return mySObject;
-}
-
-Result_i* 
-VISU::Prs3d_i
-::GetResult() const 
-{ 
-  return myResult;
-}
-
-const std::string& 
-VISU::Prs3d_i
-::GetMeshName() const 
-{ 
-  return myMeshName; 
+  return SALOMEDS::SObject::_nil();
 }
 
 
@@ -157,9 +322,16 @@ void
 VISU::Prs3d_i
 ::Update() 
 {
+  if(GetMTime() < myUpdateTime.GetMTime())
+    return;
+
   if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<<this);
+
   try{
-    myPipeLine->Update();
+    GetPipeLine()->Update();
+    myUpdateTime.Modified();
+  } catch(std::exception&){
+    throw;
   }catch(...){
     throw std::runtime_error("Prs3d_i::Update >> unexpected exception was caught!!!");
   }
@@ -171,43 +343,48 @@ void
 VISU::Prs3d_i
 ::CheckDataSet() 
 {
-  vtkMapper *aMapper = myPipeLine->GetMapper();
+  vtkMapper *aMapper = GetPipeLine()->GetMapper();
   vtkDataSet *aDataSet = aMapper->GetInput();
   if (!aDataSet)
     throw std::runtime_error("There is no input data !!!");
+
   aDataSet->Update();
   static float eps = VTK_LARGE_FLOAT * 0.1 ;
   if (!aDataSet->GetNumberOfCells())
     throw std::runtime_error("There are no visible elements");
+
   if (aDataSet->GetLength() > eps)
     throw std::runtime_error("Diagonal of the actor is too large !!!");
 }
 
+
+//----------------------------------------------------------------------------
+struct TRemoveFromStudy: public SALOME_Event
+{
+  VISU::Prs3d_i* myRemovable;
+  typedef boost::signal0<void> TRemoveFromStudySignal;
+  const TRemoveFromStudySignal& myRemoveFromStudySignal;
+  
+  TRemoveFromStudy(VISU::Prs3d_i* theRemovable,
+                  const TRemoveFromStudySignal& theRemoveFromStudySignal):
+    myRemovable(theRemovable),
+    myRemoveFromStudySignal(theRemoveFromStudySignal)
+  {}
+  
+  virtual
+  void
+  Execute()
+  {
+    myRemoveFromStudySignal();
+    myRemovable->Destroy();
+  }
+};
+
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::RemoveFromStudy() 
 {
-  struct TRemoveFromStudy: public SALOME_Event
-  {
-    VISU::Prs3d_i* myRemovable;
-    typedef boost::signal0<void> TRemoveFromStudySignal;
-    const TRemoveFromStudySignal& myRemoveFromStudySignal;
-
-    TRemoveFromStudy(VISU::Prs3d_i* theRemovable,
-                    const TRemoveFromStudySignal& theRemoveFromStudySignal):
-      myRemovable(theRemovable),
-      myRemoveFromStudySignal(theRemoveFromStudySignal)
-    {}
-    
-    virtual
-    void
-    Execute()
-    {
-      myRemoveFromStudySignal();
-      myRemovable->Destroy();
-    }
-  };
-
   ProcessVoidEvent(new TRemoveFromStudy(this,myRemoveActorsFromRendererSignal));
 }
 
@@ -215,35 +392,76 @@ VISU::Prs3d_i
 //----------------------------------------------------------------------------
 VISU_PipeLine* 
 VISU::Prs3d_i
-::GetPipeLine()
+::GetPipeLine() const
+{
+  if(!myPipeLine.GetPointer())
+    throw std::runtime_error("VISU::Prs3d_i::myPipeLine == NULL !!!");
+
+  return myPipeLine.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetPipeLine(VISU_PipeLine* thePipeLine)
 {
-  return GetPL();
+  myPipeLine = thePipeLine;
+  if(thePipeLine)
+    thePipeLine->Delete();
 }
 
+//----------------------------------------------------------------------------
+bool 
+VISU::Prs3d_i
+::IsPipeLineExists()
+{
+  return myPipeLine.GetPointer() != NULL;
+}
+
+//----------------------------------------------------------------------------
 VISU_PipeLine* 
 VISU::Prs3d_i
-::GetPL()
+::GetActorPipeLine()
 {
-  return myPipeLine;
+  return GetPipeLine();
 }
 
-vtkUnstructuredGrid* 
-VISU::Prs3d_i::
-GetInput()
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU::Prs3d_i
+::GetInput()
 {
-  return myPipeLine->GetInput();
+  return GetPipeLine()->GetInput();
+}
+
+//----------------------------------------------------------------------------
+Handle(SALOME_InteractiveObject)
+VISU::Prs3d_i
+::GetIO()
+{
+  if( myIO.IsNull() )
+    myIO = new SALOME_InteractiveObject(GetActorEntry().c_str(), "VISU", GetName().c_str());
+
+  return myIO;
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::Prs3d_i
+::GetActorEntry()
+{
+  return GetEntry();
 }
 
 
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
-::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor(VISU_Actor* theActor)
 {
   try{
-    Handle(SALOME_InteractiveObject) anIO = theIO;
-    if(anIO.IsNull() && (!mySObject->_is_nil())){
-      anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
+    Handle(SALOME_InteractiveObject) anIO = GetIO();
+    if(!anIO.IsNull() && anIO->hasEntry()){
       theActor->setIO(anIO);
     }
 
@@ -253,7 +471,11 @@ VISU::Prs3d_i
     theActor->SetPrs3d(this);
     theActor->SetShrinkFactor();
     theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
-    theActor->SetPipeLine(GetPipeLine());
+    theActor->SetPipeLine(GetActorPipeLine());
+    if(theActor->GetPipeLine() != GetPipeLine()){
+       // To decrease actor'ss pipeline reference counter
+      theActor->GetPipeLine()->Delete();
+    }
 
     theActor->SetFactory(this);
     myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,theActor));
@@ -261,7 +483,6 @@ VISU::Prs3d_i
 
     myActorCollection->AddItem(theActor);
     theActor->Delete();
-
   }catch(std::bad_alloc& ex){
     throw std::runtime_error("CreateActor >> No enough memory");
     throw ex;
@@ -272,14 +493,16 @@ VISU::Prs3d_i
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::RemoveActor(VISU_Actor* theActor) 
 {
-  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
+  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor<<"; "<<theActor->GetReferenceCount());
   myActorCollection->RemoveItem(theActor);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::RemoveActors()
@@ -289,14 +512,14 @@ VISU::Prs3d_i
   myActorCollection->RemoveAllItems();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::UpdateActor(VISU_Actor* theActor) 
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
-  theActor->ShallowCopyPL(myPipeLine);
   theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
-  theActor->Modified();
+  theActor->ShallowCopyPL(GetPipeLine());
 }
 
 void
@@ -316,37 +539,41 @@ void
 VISU::Prs3d_i
 ::RemoveAllClippingPlanes()
 {
-  myPipeLine->RemoveAllClippingPlanes();
+  GetPipeLine()->RemoveAllClippingPlanes();
 }
 
+//----------------------------------------------------------------------------
 bool
 VISU::Prs3d_i
 ::AddClippingPlane(vtkPlane* thePlane)
 {
-  return myPipeLine->AddClippingPlane(thePlane);
+  return GetPipeLine()->AddClippingPlane(thePlane);
 }
 
+//----------------------------------------------------------------------------
 vtkIdType
 VISU::Prs3d_i
 ::GetNumberOfClippingPlanes() const
 {
-  return myPipeLine->GetNumberOfClippingPlanes();
+  return GetPipeLine()->GetNumberOfClippingPlanes();
 }
 
+//----------------------------------------------------------------------------
 vtkPlane* 
 VISU::Prs3d_i::
 GetClippingPlane(vtkIdType theID) const
 {
-  return myPipeLine->GetClippingPlane(theID);
+  return GetPipeLine()->GetClippingPlane(theID);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
-::SetPlaneParam (vtkFloatingPointType theDir[3], 
-                vtkFloatingPointType theDist, 
-                vtkPlane* thePlane) 
+::SetPlaneParam(vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType theDist, 
+               vtkPlane* thePlane) 
 {
-  myPipeLine->SetPlaneParam(theDir, theDist, thePlane);
+  GetPipeLine()->SetPlaneParam(theDir, theDist, thePlane);
 }
 
 
@@ -355,9 +582,10 @@ void
 VISU::Prs3d_i
 ::GetBounds(vtkFloatingPointType aBounds[6])
 {
-  myPipeLine->GetMapper()->GetBounds(aBounds);
+  GetPipeLine()->GetMapper()->GetBounds(aBounds);
 }
 
+//----------------------------------------------------------------------------
 void 
 VISU::Prs3d_i
 ::SetOffset(const CORBA::Float* theOffsets)
@@ -365,8 +593,10 @@ VISU::Prs3d_i
   myOffset[0] = theOffsets[0];
   myOffset[1] = theOffsets[1];
   myOffset[2] = theOffsets[2];
+  myParamsTime.Modified();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::SetOffset(CORBA::Float theDx, 
@@ -376,8 +606,10 @@ VISU::Prs3d_i
   myOffset[0] = theDx;
   myOffset[1] = theDy;
   myOffset[2] = theDz;
+  myParamsTime.Modified();
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::GetOffset(CORBA::Float* theOffsets)
@@ -387,6 +619,7 @@ VISU::Prs3d_i
   theOffsets[2] = myOffset[2];
 }
 
+//----------------------------------------------------------------------------
 void 
 VISU::Prs3d_i
 ::GetOffset(CORBA::Float& theDx, 
@@ -400,12 +633,23 @@ VISU::Prs3d_i
 
 
 //----------------------------------------------------------------------------
-VISU::Result_i* 
-VISU::GetResult(SALOMEDS::SObject_ptr theSObject)
+CORBA::Float
+VISU::Prs3d_i
+::GetMemorySize()
 {
-  VISU::Result_var aResult = FindResult(theSObject);
-  if(!aResult->_is_nil())
-    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
-  return NULL;
+  // To calculate memory used by VISU PipeLine
+  CORBA::Float aSize = GetPipeLine()->GetMemorySize();
+  //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; GetPipeLine = "<<aSize / (1024.0 * 1024.0)<<endl;
+
+  // To calculate memory used by VISU Actos
+  int anEnd = myActorCollection->GetNumberOfItems();
+  for(int anId = 0; anId < anEnd; anId++)
+    if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
+      if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
+       aSize += anActor->GetMemorySize();
+       //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
+      }
+
+  // Convert to mega bytes
+  return aSize / (1024.0 * 1024.0);
 }
-
index d7bf76280339d94ac7700b9505b319cd272762a0..22cdf4f893e7e06fa7b30dd49970c901237dd6b6 100644 (file)
 #include "VISU_ConvertorDef.hxx"
 
 #include "SALOME_GenericObj_i.hh"
+#include "SALOME_GenericObjPointer.hh"
 #include "SALOME_InteractiveObject.hxx"
 
 #include "VTKViewer.h"
 
 #include <vtkSmartPointer.h>
+#include <vtkTimeStamp.h>
 
 class VISU_PipeLine;
 class VISU_Actor;
 
 class vtkPlane;
 class vtkActorCollection;
-class vtkUnstructuredGrid;
+class vtkDataSet;
 
 namespace VISU
 {
@@ -68,20 +70,16 @@ namespace VISU
     public virtual PrsObject_i
 
   {
-    Prs3d_i();
     Prs3d_i(const Prs3d_i&);
 
   public:
     //----------------------------------------------------------------------------
-    //! A constructor to create a fresh instance of the class
-    explicit
-    Prs3d_i(Result_i* theResult,
-           bool theAddToStudy);
+    typedef PrsObject_i TSuperClass;
+    typedef VISU::Prs3d TInterface;
 
-    //! A constructor to restore an instance of the class
-    explicit
-    Prs3d_i(Result_i* theResult,
-           SALOMEDS::SObject_ptr theSObject);
+    //----------------------------------------------------------------------------
+    //! A constructor to create a fresh instance of the class
+    Prs3d_i();
 
     //! To create a deep copy from another instance of the class
     virtual
@@ -91,6 +89,38 @@ namespace VISU
     virtual
     ~Prs3d_i();
 
+    //----------------------------------------------------------------------------
+    virtual
+    CORBA::Boolean 
+    Apply(bool theReInit);
+
+    //----------------------------------------------------------------------------
+    void 
+    SetCResult(Result_i* theResult);
+
+    Result_i* 
+    GetCResult() const;
+
+    virtual
+    void 
+    SetResultObject(VISU::Result_ptr theResult);
+
+    virtual
+    VISU::Result_ptr
+    GetResultObject();
+
+    //----------------------------------------------------------------------------
+    virtual
+    void 
+    SetMeshName(const char* theMeshName);
+
+    virtual
+    char*
+    GetMeshName();
+
+    std::string
+    GetCMeshName() const;
+
     //----------------------------------------------------------------------------
     //! To generate an unique type name for the class (used into persistent functionality)
     virtual
@@ -102,29 +132,32 @@ namespace VISU
     QString
     GenerateName() = 0;
 
+    //! To save paramters of the instance to std::ostringstream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
     //! To restore paramters of the instance from Storable::TRestoringMap
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
-    //! To save paramters of the instance to std::ostringstream
-    virtual
+    //! To keep restoring params till the explicit Restore() call
     void
-    ToStream(std::ostringstream& theStr);
+    SaveRestoringState(SALOMEDS::Study_ptr theStudy,
+                      const Storable::TRestoringMap& theMap);
 
-    //----------------------------------------------------------------------------
-    //! Get corresponding Result_i
-    Result_i* 
-    GetResult() const;
+    //! To restore the presentation according to the saved state
+    void 
+    InitFromRestoringState();
 
+    //----------------------------------------------------------------------------
     //! Get corresponding SALOMEDS::SObject
     virtual
     SALOMEDS::SObject_var 
     GetSObject();
 
-    const std::string& 
-    GetMeshName() const;
-
     //----------------------------------------------------------------------------
     //! To update is internal state
     virtual 
@@ -139,17 +172,20 @@ namespace VISU
     //----------------------------------------------------------------------------
     //! Get corresponding VISU_PipeLine
     VISU_PipeLine* 
-    GetPL();
+    GetPipeLine() const;
+
+    bool
+    IsPipeLineExists();
 
     //! Get input of the VISU_PipeLine
-    vtkUnstructuredGrid
+    vtkDataSet
     GetInput();
 
     //----------------------------------------------------------------------------
     //! To define a way to create VTK representation of the instance
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
+    CreateActor() = 0;
 
     //! To unregister the pointed actor
     virtual 
@@ -194,18 +230,22 @@ namespace VISU
     void
     GetBounds(vtkFloatingPointType aBounds[6]);
 
+    //! Move the 3D presentation according to the given offset parameters
     void
     SetOffset(const CORBA::Float* theOffsets);
 
+    //! Move the 3D presentation according to the given offset parameters
     virtual
     void
     SetOffset(CORBA::Float theDx, 
              CORBA::Float theDy, 
              CORBA::Float theDz);
 
+    //! Gets offset parameters for the 3D presentation
     void
     GetOffset(CORBA::Float* theOffsets);
 
+    //! Gets offset parameters for the 3D presentation
     virtual
     void
     GetOffset(CORBA::Float& theDx, 
@@ -213,51 +253,109 @@ namespace VISU
              CORBA::Float& theDz);
 
     //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
+    //----------------------------------------------------------------------------
+    //! Gets know whether the factory instance can be used for actor management or not
+    virtual
+    bool 
+    GetActiveState();
+
+    //----------------------------------------------------------------------------
+    //! Return modified time of the presentation
+    virtual
+    unsigned long int 
+    GetMTime();
+
+    //----------------------------------------------------------------------------
+    //! Create and return the interactive object
+    virtual
+    Handle(SALOME_InteractiveObject)
+    GetIO();
+
   protected:
+    /*! 
+      Used in Apply method to get know whether it is possible to create presentation
+      with the input parameters or not. The derived classes can use this method 
+      to customize Apply behaviour.
+    */
+    virtual 
+    bool 
+    SetInput(bool theReInit);
+
+    //! Restore input parameters if Apply function fails
+    virtual 
+    void 
+    OnRestoreInput();
+
+    //! Used in derived classes to initilize the myPipeLine member
     void
-    CreateActor(VISU_Actor* theActor, 
-               const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    SetPipeLine(VISU_PipeLine* thePipeLine);
 
+    //! Used in derived classes to initilize the myPipeLine member
+    void
+    CreateActor(VISU_Actor* theActor);
+
+    //! Gets or creates VISU_PipeLine instance for actor initilization
     virtual 
     VISU_PipeLine* 
-    GetPipeLine();
+    GetActorPipeLine();
 
     //! To check dataset validity, throws std::exception if not valid
     virtual
     void
     CheckDataSet();
 
-    bool myAddToStudy;
-    CORBA::Float myOffset[3];
-    Result_i *myResult;
-    VISU_PipeLine *myPipeLine;
-    SALOMEDS::SObject_var mySObject;
+  protected:
+    vtkTimeStamp myUpdateTime;
+    vtkTimeStamp myParamsTime;
+
+    //! Used in derived classes to initilize the IO for actors
+    virtual
+    std::string
+    GetActorEntry();
+
+  private:
+    bool myIsRestored;
+    SALOMEDS::Study_var myRestoringStudy;
+    Storable::TRestoringMap myRestoringMap;
+
+    void
+    SetResultEntry(const std::string& theResultEntry);
+
+    std::string
+    GetResultEntry();
+
+    typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
+    TResultPtr myResult;
+    TResultPtr myPreviousResult;
+
     std::string myMeshName;
+    std::string myPreviousMeshName;
+
+    CORBA::Float myOffset[3];
 
     boost::signal0<void> myUpdateActorsSignal;
     boost::signal0<void> myRemoveActorsFromRendererSignal;
     vtkSmartPointer<vtkActorCollection> myActorCollection;
 
-  };
+    vtkSmartPointer<VISU_PipeLine> myPipeLine;
 
-  //----------------------------------------------------------------------------
-  Result_i* 
-  GetResult(SALOMEDS::SObject_ptr theSObject);
+    Handle(SALOME_InteractiveObject) myIO;
+
+  private:
+    friend class ColoredPrs3dCache_i;
+
+    //! Sets activity flag for the factory instance
+    void
+    SetActiveState(bool theState);
+    
+    bool myIsActiveSatate;
+  };
 
-  //----------------------------------------------------------------------------
-  template<class TPrs3d>
-  Storable* 
-  Restore(SALOMEDS::SObject_ptr theSObject,
-         const std::string& thePrefix,
-         const Storable::TRestoringMap& theMap)
-  {
-    VISU::Result_i* pResult = GetResult(theSObject);
-    if(pResult != NULL){
-      TPrs3d* pPrs3d = new TPrs3d(pResult,theSObject);
-      return pPrs3d->Restore(theMap);
-    }
-    return NULL;
-  }
   //----------------------------------------------------------------------------
 }
 
index 3a1126cae4290edd810de19d801e5ee27ab19ae5..7fcb4805fdf5d58bea107528377bc411af5ecaa7 100644 (file)
 //  Module : VISU
 
 #include "VISU_PrsObject_i.hh"
-using namespace VISU;
-using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
-static int MYDEBUGWITHFILES = 0;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #endif
 
-void VISU::PrsObject_i::SetName( const char* theName )
+//---------------------------------------------------------------
+VISU::RemovableObject_i
+::RemovableObject_i()
+{
+  if(MYDEBUG) MESSAGE("RemovableObject_i::RemovableObject_i - this = "<<this);
+}
+
+
+//---------------------------------------------------------------
+VISU::RemovableObject_i
+::~RemovableObject_i() 
+{
+  if(MYDEBUG) MESSAGE("RemovableObject_i::~RemovableObject_i - this = "<<this);
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::RemovableObject_i
+::SetName(const std::string& theName,
+         bool theIsUpdateStudyAttr)
 {
   myName = theName;
-  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
-  if(!mySO->_is_nil()){
-    SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder();
-    SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( mySO, "AttributeName" );
-    SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
-    aNameAttr->SetValue( theName );
+  if(theIsUpdateStudyAttr){
+    SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(GetEntry().c_str());
+    if(!aSObject->_is_nil()){
+      SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder();
+      SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" );
+      SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+      aNameAttr->SetValue( theName.c_str() );
+    }
   }
 }
-QString VISU::PrsObject_i::GetEntry() { 
+
+
+//---------------------------------------------------------------
+const std::string&
+VISU::RemovableObject_i
+::GetName() const 
+{ 
+  return myName;
+}
+
+
+//---------------------------------------------------------------
+const SALOMEDS::Study_var& 
+VISU::RemovableObject_i
+::GetStudyDocument() const 
+{ 
+  return myStudy;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::RemovableObject_i
+::SetStudyDocument(SALOMEDS::Study_ptr theStudy) 
+{ 
+  myStudy = SALOMEDS::Study::_duplicate(theStudy);
+}
+
+
+//---------------------------------------------------------------
+std::string 
+VISU::RemovableObject_i
+::GetEntry() 
+{ 
   CORBA::String_var anIOR = GetID();
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in());
-  CORBA::String_var anEntry;
+  CORBA::String_var anEntry("");
   if(!CORBA::is_nil(aSObject.in()))
     anEntry = aSObject->GetID();
   else
     MESSAGE("PrsObject_i::GetEntry - Cannot find SObject in the Study with StudyId = "<<myStudy->StudyId()<<" !!!");
   return anEntry.in();
 }
+
+
+//---------------------------------------------------------------
+VISU::PrsObject_i
+::PrsObject_i(SALOMEDS::Study_ptr theStudy)
+{
+  SetStudyDocument(theStudy);
+}
+
+
index 31e7f71496168fc1d0a7cd949214cd512258eb48..f12a48b8de3efef7a3081fdbaf81a6c195c76e91 100644 (file)
 
 #include "VISUConfig.hh"
 
-namespace VISU{
-  class PrsObject_i : public virtual POA_VISU::PrsObject,
-                      public virtual RemovableObject_i
+namespace VISU
+{
+  //----------------------------------------------------------------------------
+  class RemovableObject_i : public virtual POA_VISU::RemovableObject,
+                            public virtual Storable
   {
-    PrsObject_i(const PrsObject_i&);
-
   public:
-    PrsObject_i(SALOMEDS::Study_ptr theStudy) : myStudy(SALOMEDS::Study::_duplicate(theStudy)) {};
-    virtual ~PrsObject_i() {}
+    typedef Storable TSuperClass;
+
+    virtual 
+    ~RemovableObject_i();
+
+    const SALOMEDS::Study_var& 
+    GetStudyDocument() const;
+
+    virtual
+    std::string
+    GetEntry();
+
+    virtual 
+    const std::string&
+    GetName() const;
+
+    virtual 
+    void
+    SetName(const std::string& theName,
+           bool theIsUpdateStudyAttr);
 
   protected:
+    RemovableObject_i();
+
+    void
+    SetStudyDocument(SALOMEDS::Study_ptr theStudy);
+
+  private:
     std::string myName;
     SALOMEDS::Study_var myStudy;
 
+    RemovableObject_i(const RemovableObject_i&);
+  };
+
+
+  //----------------------------------------------------------------------------
+  class PrsObject_i : public virtual POA_VISU::PrsObject,
+                      public virtual RemovableObject_i
+  {
+    PrsObject_i(const PrsObject_i&);
+    SALOMEDS::Study_var myStudy;
+
   public:
-    virtual const char* GetName() const { return myName.c_str();}
-    virtual void SetName( const char* theName );
-    const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;}
-    QString GetEntry();
+    typedef RemovableObject_i TSuperClass;
+
+    PrsObject_i(SALOMEDS::Study_ptr theStudy = SALOMEDS::Study::_nil());
   };
 }
 
index db7457fba8d80d0435fad6015a0de74c7539d131..9f3a184f8964d389d54afc6f374ee3058364087f 100644 (file)
@@ -60,6 +60,9 @@
 // OCCT Includes
 #include <Bnd_Box.hxx>
 
+// MULTIPR
+#include "MULTIPR_Obj.hxx"
+
 using namespace VISU;
 using namespace std;
 
@@ -96,6 +99,20 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------
+  Result_i* 
+  GetResult(SALOMEDS::Study_ptr theStudy,
+           const std::string& theResultEntry)
+  {
+    if(CORBA::is_nil(theStudy))
+      return NULL;
+
+    SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(theResultEntry.c_str());
+    CORBA::Object_var anObject = SObjectToObject(aSObject);
+    return dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
+  }
+
+
   //---------------------------------------------------------------
   typedef boost::recursive_mutex TMutex;
   typedef TMutex::scoped_lock TLock;
@@ -139,7 +156,7 @@ namespace VISU
 
   //---------------------------------------------------------------
   QString
-  GenerateName (const char* theName)
+  GenerateName (const std::string& theName)
   {
     TLock aLock(myMutex);
 
@@ -222,7 +239,8 @@ namespace VISU
                   const string& theIOR, 
                   const string& theName,
                   const string& theComment,
-                  CORBA::Boolean theCreateNew)
+                  CORBA::Boolean theCreateNew,
+                  const string& theIcon = "")
   {
     TLock aLock(myMutex);
 
@@ -251,6 +269,13 @@ namespace VISU
       _PTR(AttributeComment) aCmnt (anAttr);
       aCmnt->SetValue(theComment);
     }
+       // MULTIPR
+       if (theIcon != "") {
+         anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePixMap");
+      _PTR(AttributePixMap) aPixmap (anAttr);
+      aPixmap->SetPixMap(theIcon.c_str());
+
+       }
     return aNewObj->GetID();
   }
 
@@ -452,6 +477,15 @@ namespace VISU
                           "",
                           true);
       }
+         
+         // MULTIPR
+         aMesh->myPartsEntry =
+         CreateAttributes(theStudy,
+                          aMesh->myEntry,
+                          "",
+                          "",
+                          "",
+                          true);
       
       //Import entities
       TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
@@ -601,110 +635,282 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  void
-  BuildFields(Result_i* theResult,
-             VISU_Convertor* theInput,
-             CORBA::Boolean* theIsDone,
-             CORBA::Boolean theIsBuild,
-             CORBA::Boolean theIsAtOnce,
-             _PTR(Study) theStudy)
-  {
-    if(!theIsBuild || *theIsDone)
-      return;
+void BuildFields(
+       Result_i* theResult,
+       VISU_Convertor* theInput,
+       CORBA::Boolean* theIsDone,
+       CORBA::Boolean theIsBuild,
+       CORBA::Boolean theIsAtOnce,
+       _PTR(Study) theStudy)
+{
+       if(!theIsBuild || *theIsDone)
+               return;
 
-    TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
-    TResultManager aResultManager(theResult);
-    TTransactionManager aTransactionManager(theStudy);
+       TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
+       TResultManager aResultManager(theResult);
+       TTransactionManager aTransactionManager(theStudy);
 
-    {
-      TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
-      theInput->BuildFields();
-    }
+       {
+               TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
+               theInput->BuildFields();
+       }
 
-    QString aComment,aTmp;
-    const TMeshMap& aMeshMap = theInput->GetMeshMap();
-    TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
-    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
-      const string& aMeshName = aMeshMapIter->first;
-      const PMesh& aMesh = aMeshMapIter->second;
-      
-      const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-      if(aMeshOnEntityMap.empty()) 
-       continue;
-      
-      //Import fields
-      bool anIsFieldsEntryUpdated = false;
-      TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-       TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-         if(!anIsFieldsEntryUpdated){
-           aComment = "";
-           aComment.append("myComment=FIELDS;");
-           aComment.append("myMeshName=");aComment.append(aMeshName);
-           
-           UpdateAttributes(theStudy,
-                            aMesh->myFieldsEntry,
-                            "",
-                            "Fields",
-                            aComment.latin1());
+       QString aComment,aTmp;
+       const TMeshMap& aMeshMap = theInput->GetMeshMap();
+       TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
 
-           anIsFieldsEntryUpdated = true;
-         }
-         const string& aFieldName = aFieldMapIter->first;
-         const PField& aField = aFieldMapIter->second;
-         const TValField& aValField = aField->myValField;
-         QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
-         aComment = "";
-         aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD);
-         aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-         aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
-         aComment.append("myName=");aComment.append(aFieldName);aComment.append(";");
-         aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size()));
-         aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp));
-         aField->myEntry = 
-           CreateAttributes(theStudy,
-                            aMesh->myFieldsEntry,
-                            "",
-                            aFieldNameWithUnit.latin1(),
-                            aComment.latin1(),
-                            true);
-         CreateReference(theStudy,
-                         aField->myEntry,
-                         aMeshOnEntity->myEntry);
-         TValField::const_iterator aValFieldIter = aValField.begin();
-         for(; aValFieldIter != aValField.end(); aValFieldIter++){
-           int aTimeStamp = aValFieldIter->first;
-           const PValForTime& aValForTime = aValFieldIter->second;
-           aComment = "";
-           aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP);
-           aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-           aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
-           aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";");
-           aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp));
-           
-           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
-           aValForTime->myEntry = 
-             CreateAttributes(theStudy,
-                              aField->myEntry,
-                              "",
-                              aTimeStampId,
-                              aComment.latin1(),
-                              true);
-         }
+       for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++)
+       {
+               const string& aMeshName = aMeshMapIter->first;
+               const PMesh& aMesh = aMeshMapIter->second;
+       
+               const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+               if(aMeshOnEntityMap.empty()) 
+                       continue;
+       
+               //Import fields
+               bool anIsFieldsEntryUpdated = false;
+               TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+               
+               for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++)
+               {
+                       const TEntity& anEntity = aMeshOnEntityMapIter->first;
+                       const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+                       const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+                       TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+                       
+                       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
+                       {
+                               if(!anIsFieldsEntryUpdated)
+                               {
+                                       aComment = "";
+                                       aComment.append("myComment=FIELDS;");
+                                       aComment.append("myMeshName=");aComment.append(aMeshName);
+       
+                                       UpdateAttributes(
+                                               theStudy,
+                                               aMesh->myFieldsEntry,
+                                               "",
+                                               "Fields",
+                                               aComment.latin1());
+
+                                       anIsFieldsEntryUpdated = true;
+                               }
+                       
+                               const string& aFieldName = aFieldMapIter->first;
+                               const PField& aField = aFieldMapIter->second;
+                               const TValField& aValField = aField->myValField;
+                               QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
+                               aComment = "";
+                               aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD);
+                               aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+                               aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
+                               aComment.append("myName=");aComment.append(aFieldName);aComment.append(";");
+                               aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size()));
+                               aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp));
+
+                               aField->myEntry = CreateAttributes(
+                                       theStudy,
+                                       aMesh->myFieldsEntry,
+                                       "",
+                                       aFieldNameWithUnit.latin1(),
+                                       aComment.latin1(),
+                                       true);
+                               
+                               CreateReference(
+                                       theStudy,
+                                       aField->myEntry,
+                                       aMeshOnEntity->myEntry);
+                               
+                               TValField::const_iterator aValFieldIter = aValField.begin();
+                               
+                               for(; aValFieldIter != aValField.end(); aValFieldIter++)
+                               {
+                                       int aTimeStamp = aValFieldIter->first;
+                                       const PValForTime& aValForTime = aValFieldIter->second;
+                                       aComment = "";
+                                       aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP);
+                                       aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+                                       aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
+                                       aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";");
+                                       aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp));
+                                       
+                                       string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
+                                       
+                                       aValForTime->myEntry = CreateAttributes(
+                                               theStudy,
+                                               aField->myEntry,
+                                               "",
+                                               aTimeStampId,
+                                               aComment.latin1(),
+                                               true);
+                               }
+                       }
+               }
+
+               if(!anIsFieldsEntryUpdated && !theIsAtOnce)
+               
+               RemoveSObject(theStudy, aMesh->myFieldsEntry);
        }
-      }
 
-      if(!anIsFieldsEntryUpdated && !theIsAtOnce)
-       RemoveSObject(theStudy,
-                     aMesh->myFieldsEntry);
-    }
+       ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+}
+
+
+// MULTIPR
+void BuildParts(
+       Result_i* theResult,
+       VISU_Convertor* theInput,
+       CORBA::Boolean* theIsDone,
+       CORBA::Boolean theIsBuild,
+       CORBA::Boolean theIsAtOnce,
+       _PTR(Study) theStudy)
+{
+       if(!theIsBuild || *theIsDone)
+               return;
+       
+    // if MED file is not a distributed MED file (created with MULTIPR), then it is not necessary to build parts
+       cout<<theResult->GetFileInfoMultipr().filePath()<<endl;
+       if (strlen(theResult->GetFileInfoMultipr().filePath().latin1()) == 0)
+               return;
+       
+       QApplication::setOverrideCursor(Qt::waitCursor);
+       
+    try
+    {
+        multipr::Obj multiprObj;
+        multiprObj.create(theResult->GetFileInfoMultipr().filePath().latin1());
+          if (multiprObj.isValidDistributedMEDFile())
+          {
+                 theResult->SetIsDistributedMEDMultipr(true);
     
-    ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
-  }
+                 const TMeshMap& aMeshMap = theInput->GetMeshMap();
+            TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+            const string& aMeshName = aMeshMapIter->first;
+            const PMesh& aMesh = aMeshMapIter->second;
+                 
+                 vector<string> listParts = multiprObj.getParts();
+                 
+                 QString aComment = "Sub-parts: #";
+                 aComment += QString::number(listParts.size());
+                 
+                 UpdateAttributes(
+                        theStudy,
+                        aMesh->myPartsEntry,
+                        "",
+                        "Parts",
+                        aComment.latin1());
+                 
+                 string lastEntry;
+                 
+                 for (unsigned i = 0 ; i < listParts.size() ; i++)
+                 {
+                        const char* strItem = listParts[i].c_str();
+                        const char* strPartInfo = multiprObj.getPartInfo(strItem).c_str();
+                        
+                        char   lMeshName[256];
+                        int    lId;
+                        char   lPartName[256];
+                        char   lPath[256];
+                        char   lMEDFileName[256];
+                        
+                        // parse infos
+                        int ret = sscanf(strPartInfo, "%s %d %s %s %s", 
+                                   lMeshName,
+                                   &lId,
+                                   lPartName,
+                                   lPath,
+                                   lMEDFileName);
+                        
+                        if ((strstr(lPartName,"_MED") != NULL) || (strstr(lPartName,"_LOW") != NULL))
+                        {
+                                   QString aComment = "";
+                                   aComment.append("myComment=PART;"); 
+                                   aComment.append("res=ML;");
+                                   aComment.append("file=");
+                                   aComment.append(lMEDFileName);
+                                   
+                                   CreateAttributes(
+                                          theStudy,
+                                          lastEntry, // father
+                                          "",
+                                          lPartName,
+                                          aComment.latin1(),
+                                          true);
+                        }
+                        else
+                        {
+                                   QString aComment = "";
+                                   
+                                   QString icon = "";
+                                   
+                                   if (i != listParts.size()-1)
+                                   {
+                                          const char* strItemNext = listParts[i+1].c_str();
+                                          const char* strPartInfoNext = multiprObj.getPartInfo(strItemNext).c_str();
+                                          if ((strstr(strPartInfoNext,"_MED") != NULL) || (strstr(strPartInfoNext,"_LOW") != NULL))
+                                          {
+                                                 // next part is MED or LOW resolution
+                                                 icon = "ICON_MULTIPR_VIEW_LOW";
+                                                 theResult->SetResolutionMultipr(lPartName, 'L');
+                                                 
+                                                 aComment.append("myComment=PART;"); 
+                                                 aComment.append("res=FML;");
+                                                 aComment.append("file=");
+                                                 aComment.append(lMEDFileName);
+                                          }
+                                          else
+                                          {
+                                                 // no resolution associated with this part
+                                                 icon = "ICON_MULTIPR_VIEW_FULL";
+                                                 theResult->SetResolutionMultipr(lPartName, 'F');
+                                                 
+                                                 aComment.append("myComment=PART;"); 
+                                                 aComment.append("res=F;");
+                                                 aComment.append("file=");
+                                                 aComment.append(lMEDFileName);
+                                          }
+                                   }
+                                   else
+                                   {
+                                          // last part
+                                          icon = "ICON_MULTIPR_VIEW_FULL";
+                                          theResult->SetResolutionMultipr(lPartName, 'F');
+                                          
+                                          aComment.append("myComment=PART;"); 
+                                          aComment.append("res=FML;");
+                                          aComment.append("file=");
+                                          aComment.append(lMEDFileName);
+                                   }
+                                   
+                                   lastEntry = CreateAttributes(
+                                          theStudy,
+                                          aMesh->myPartsEntry, // father
+                                          "",
+                                          lPartName,
+                                          aComment.latin1(),
+                                          true,
+                                          icon.latin1());
+                        }
+                
+                theResult->AddPartMultipr(lPartName, lMEDFileName);
+                 }
+          }
+          else
+          {
+            // invalid distributed MED file
+            return;
+          }
+    }
+    catch (...)
+    {
+        throw std::runtime_error("error while reading distributed MED file"); 
+    }
+       
+       QApplication::restoreOverrideCursor();
+
+       ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+}
 
 
   //---------------------------------------------------------------
@@ -769,7 +975,9 @@ namespace VISU
     Result_i::TUpdateMinMaxSignal* myUpdateMinMaxSignal;
     CORBA::Boolean* myIsGroupsDone;
     CORBA::Boolean myIsBuildGroups;
-    _PTR(Study) myStudy;
+    CORBA::Boolean* myIsPartsDone;
+    CORBA::Boolean myIsBuildParts;
+       _PTR(Study) myStudy;
 
     TBuildArgs(Result_i* theResult,
               VISU_Convertor* theInput,
@@ -782,7 +990,9 @@ namespace VISU
               Result_i::TUpdateMinMaxSignal* theUpdateMinMaxSignal,
               CORBA::Boolean* theIsGroupsDone,
               CORBA::Boolean theIsBuildGroups,
-              _PTR(Study) theStudy):
+              CORBA::Boolean* theIsPartsDone,
+              CORBA::Boolean theIsBuildParts,
+                  _PTR(Study) theStudy):
       myResult(theResult),
       myInput(theInput),
       myIsEntitiesDone(theIsEntitiesDone),
@@ -794,7 +1004,9 @@ namespace VISU
       myUpdateMinMaxSignal(theUpdateMinMaxSignal),
       myIsGroupsDone(theIsGroupsDone),
       myIsBuildGroups(theIsBuildGroups),
-      myStudy(theStudy)
+      myIsPartsDone(theIsPartsDone),
+      myIsBuildParts(theIsBuildParts),
+         myStudy(theStudy)
     {}
       
   };
@@ -803,6 +1015,7 @@ namespace VISU
   void
   BuildDataTree(TBuildArgs theBuildArgs)
   {
+       
     BuildEntities(theBuildArgs.myResult,
                  theBuildArgs.myInput,
                  theBuildArgs.myIsEntitiesDone,
@@ -811,7 +1024,8 @@ namespace VISU
                  theBuildArgs.myIsBuildGroups,
                  theBuildArgs.myIsBuildFields,
                  theBuildArgs.myStudy);
-    {
+       
+       {
       boost::thread aThread(boost::bind(&BuildGroups,
                                        theBuildArgs.myResult,
                                        theBuildArgs.myInput,
@@ -831,6 +1045,17 @@ namespace VISU
                                        theBuildArgs.myUpdateMinMaxSignal,
                                        theBuildArgs.myStudy));
     }
+       
+       /*
+       // MULTIPR
+       BuildParts(
+               theBuildArgs.myResult,
+               theBuildArgs.myInput,
+               theBuildArgs.myIsPartsDone,
+               theBuildArgs.myIsBuildParts,
+               false,
+               theBuildArgs.myStudy);
+       */
   }
   
 }
@@ -877,14 +1102,17 @@ VISU::Result_i
   myIsBuildFields(theIsBuildFields),
   myIsBuildMinMax(theIsBuildMinMax),
   myIsBuildGroups(theIsBuildGroups),
+  myIsBuildParts(true),
   myIsEntitiesDone(false),
   myIsFieldsDone(false),
   myIsGroupsDone(false),
   myIsMinMaxDone(false),
+  myIsPartsDone(false),
   myIsAllDone(false),
   myInput(NULL)
 {
   myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
+  myIsDistributedMEDMultipr = false;
 }
 
 
@@ -924,13 +1152,13 @@ VISU::Result_i
 
 
 //---------------------------------------------------------------
-int
+size_t
 VISU::Result_i
 ::IsPossible()
 {
   try{
-    float aSize = myInput->GetSize();
-    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    size_t aSize = myInput->GetSize();
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
     return aResult;
   }catch(std::exception& exc){
@@ -1112,21 +1340,75 @@ VISU::Result_i
                myIsBuildMinMax,
                &myUpdateMinMaxSignal);
     
+       // MULTIPR
+       BuildParts(this,
+               myInput,
+               &myIsPartsDone,
+               myIsBuildParts,
+               theIsAtOnce,
+               myStudy);
+               
   }else{
-    TBuildArgs aBuildArgs(this,
-                         myInput,
-                         &myIsEntitiesDone,
-                         aResultEntry,
-                         &myIsFieldsDone,
-                         myIsBuildFields,
-                         &myIsMinMaxDone,
-                         myIsBuildMinMax,
-                         &myUpdateMinMaxSignal,
-                         &myIsGroupsDone,
-                         myIsBuildGroups,
-                         myStudy);
-    boost::thread aThread(boost::bind(&BuildDataTree,
-                                     aBuildArgs));
+       
+       if (strlen(GetFileInfoMultipr().filePath().latin1()) == 0)
+       {
+               // sequential MED file
+               TBuildArgs aBuildArgs(this,
+                       myInput,
+                       &myIsEntitiesDone,
+                       aResultEntry,
+                       &myIsFieldsDone,
+                       myIsBuildFields,
+                       &myIsMinMaxDone,
+                       myIsBuildMinMax,
+                       &myUpdateMinMaxSignal,
+                       &myIsGroupsDone,
+                       myIsBuildGroups,
+                       &myIsPartsDone,
+                       myIsBuildParts,
+                       myStudy);
+       boost::thread aThread(boost::bind(&BuildDataTree, aBuildArgs));
+       }
+       else
+       {
+               // distributed MED file
+               BuildEntities(this,
+                       myInput,
+                       &myIsEntitiesDone,
+                       aResultEntry,
+                       theIsAtOnce,
+                       myIsBuildGroups,
+                       myIsBuildFields,
+                       myStudy);
+       
+               BuildGroups(this,
+                       myInput,
+                       &myIsGroupsDone,
+                       myIsBuildGroups,
+                       theIsAtOnce,
+                       myStudy);
+       
+               BuildFields(this,
+                       myInput,
+                       &myIsFieldsDone,
+                       myIsBuildFields,
+                       theIsAtOnce,
+                       myStudy);
+               
+               BuildMinMax(this,
+                       myInput,
+                       &myIsMinMaxDone,
+                       myIsBuildMinMax,
+                       &myUpdateMinMaxSignal);
+               
+               // MULTIPR
+               BuildParts(this,
+                       myInput,
+                       &myIsPartsDone,
+                       myIsBuildParts,
+                       theIsAtOnce,
+                       myStudy);
+       }
   }
 
   return this;
@@ -1158,9 +1440,46 @@ VISU::Result_i
 VISU::Storable*
 VISU::Result_i::
 Create(const char* theFileName)
-{
+{      
+  
   try{
     myFileInfo.setFile(theFileName);
+       
+       // MULTIPR    
+       if (myFileInfo.filePath().endsWith("_grains_maitre.med"))
+       {
+        // retrieve source MED file (sequential MED file)
+        QString originalMEDFileName = "";
+        FILE* aFile = fopen(theFileName, "rt");
+        char aBuf[1024];
+        while (!feof(aFile))
+        {
+            fgets(aBuf, 1024, aFile);
+            char* strTag = NULL;
+            if ((aBuf[0] == '#') && ((strTag = strstr(aBuf, "[SOURCE]=")) != NULL))
+            {
+                char strSequentialMEDFilename[256];
+                int ret = sscanf(strTag, "[SOURCE]=%s", strSequentialMEDFilename);
+                if (ret == 1)
+                {
+                    originalMEDFileName = strSequentialMEDFilename;
+                    break;
+                }
+            }
+        }
+        fclose(aFile);
+        if (originalMEDFileName == "") 
+            throw std::runtime_error("distributed MED file; bad format"); 
+
+               //cout << "MULTIPR: original med file=" << originalMEDFileName << endl;
+        myFileInfoMultipr.setFile(myFileInfo.filePath());
+               myFileInfo.setFile(originalMEDFileName);
+       }
+       else
+       {
+               myFileInfoMultipr.setFile("");
+       }
+       
     myInitFileName = myFileInfo.filePath().latin1();
     myName = ::GenerateName(myFileInfo.fileName()).latin1();
     if(mySourceId == eRestoredFile){
@@ -1174,7 +1493,9 @@ Create(const char* theFileName)
       if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
       myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
     }
+       
     myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
+       
     if(myInput){
       if(myIsBuildImmediately)
        Build(SALOMEDS::SObject::_nil());
@@ -1503,12 +1824,12 @@ VISU::Result_i
   return "";
 }
 
-string
+std::string
 VISU::Result_i
 ::GetEntry()
 {
   CORBA::String_var anEntry = mySObject->GetID();
-  return string(anEntry);
+  return anEntry.in();
 }
 
 const SALOMEDS::SObject_var& 
@@ -1591,9 +1912,9 @@ Result_i
       return components;
     }
 
-    VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
-                                                         CELL_ENTITY);
-    VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput();
+    VISU::PUnstructuredGridIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
+                                                                         CELL_ENTITY);
+    vtkUnstructuredGrid* aMesh = anIDMapper->GetUnstructuredGridOutput();
 
     if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) {
       MESSAGE( "No cells in the mesh: " << theMeshName );
@@ -1725,3 +2046,94 @@ Result_i
 
   return components;
 }
+
+
+//=======================================================================
+// MULTIPR
+//=======================================================================
+
+// MULTIPR
+void VISU::Result_i::AddPartMultipr(const char* thePartName, const char* theMEDFilename)
+{
+       myMapPartNameToMEDFilename.insert(make_pair(thePartName, theMEDFilename));
+}
+
+// MULTIPR
+void VISU::Result_i::SetResolutionMultipr(const char* theName, char theNewResolution)
+{
+       map<string, char>::iterator anIterator = mySelectedResolutionMultipr.find(theName);
+       
+       if (anIterator == mySelectedResolutionMultipr.end())
+       {
+               // current name does not exist: create
+               mySelectedResolutionMultipr.insert(make_pair(theName, theNewResolution));
+       }
+       else
+       {
+               // modify
+               (*anIterator).second = theNewResolution;
+       }
+}
+
+// MULTIPR
+string VISU::Result_i::FindPartMultipr(const char* theName)
+{
+       map<string, string>::iterator anIterator = myMapPartNameToMEDFilename.find(theName);
+       
+       if (anIterator == myMapPartNameToMEDFilename.end())
+       {
+               return NULL;
+       }
+       return (*anIterator).second;
+}
+
+// MULTIPR
+void VISU::Result_i::SetIsDistributedMEDMultipr(bool theIsDistributedMED)
+{
+       myIsDistributedMEDMultipr = theIsDistributedMED;
+}
+
+// MULTIPR
+bool VISU::Result_i::IsDistributedMEDMultipr() const
+{
+       return myIsDistributedMEDMultipr;
+}
+
+// MULTIPR
+vector<string> VISU::Result_i::GetCurrentRepresentationMultipr()
+{
+    // name of selected parts
+       vector<string> res;
+       
+       // for each part of the mesh
+       for (
+               map<string, char>::iterator it = mySelectedResolutionMultipr.begin() ; 
+               it != mySelectedResolutionMultipr.end() ; 
+               it++)
+       {
+               const char* partName = ((*it).first).c_str();
+               char resolution = (*it).second;
+               
+               //cout << "name=" << partName << " res=" << resolution << endl;
+               
+               if (resolution == 'F')
+               {
+                       res.push_back( FindPartMultipr(partName) );
+               } 
+               else if (resolution == 'M')
+               {
+                       char subPartName[256];
+                       sprintf(subPartName, "%s_MED", partName);
+                       res.push_back( FindPartMultipr(subPartName) );
+               }
+               else if (resolution == 'L')
+               {
+                       char subPartName[256];
+                       sprintf(subPartName, "%s_LOW", partName);
+                       res.push_back( FindPartMultipr(subPartName) );
+               }
+       }
+       
+       return res;
+}
+
index b04fc0d5c85809b58eb3c68fabcb807562159daf..ca878cc641eb4596e8864ea99fc94fc97227963c 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef __VISU_RESULT_I_H__
 #define __VISU_RESULT_I_H__
 
-#include "VISUConfig.hh"
+#include "VISU_PrsObject_i.hh"
 #include "VISU_BoostSignals.h"
 #include "SALOME_GenericObj_i.hh"
 
@@ -35,6 +35,7 @@
 
 #include <gp_Dir.hxx>
 #include <vector>
+#include <map>
 
 class VISU_Convertor;
 
@@ -112,8 +113,14 @@ namespace VISU
     ECreationId myCreationId;
 
     TInput *myInput;
-    std::string myName, myInitFileName;
+       std::string myName, myInitFileName;
     QFileInfo myFileInfo;
+       
+       // MULTIPR
+       QFileInfo                          myFileInfoMultipr;
+       std::map<std::string, std::string> myMapPartNameToMEDFilename;
+       std::map<std::string, char>        mySelectedResolutionMultipr;
+       bool                               myIsDistributedMEDMultipr;
 
   protected:
     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
@@ -127,17 +134,19 @@ namespace VISU
     CORBA::Boolean myIsFieldsDone;
     CORBA::Boolean myIsGroupsDone;
     CORBA::Boolean myIsMinMaxDone;
+       CORBA::Boolean myIsPartsDone; // MULTIPR
 
     CORBA::Boolean myIsBuildFields;
     CORBA::Boolean myIsBuildGroups;
 
     CORBA::Boolean myIsBuildMinMax;
+       CORBA::Boolean myIsBuildParts; // MULTIPR
     TUpdateMinMaxSignal myUpdateMinMaxSignal;
 
     CORBA::Boolean myIsAllDone;
 
   public:
-    virtual int IsPossible();
+    virtual size_t IsPossible();
 
     virtual Storable* Create(const char* theFileName);
     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
@@ -158,8 +167,17 @@ namespace VISU
 
     const std::string& GetName() const { return myName;}
     const QFileInfo& GetFileInfo() const { return myFileInfo;}
+       const QFileInfo& GetFileInfoMultipr() const { return myFileInfoMultipr;}
     const std::string& GetFileName() const { return myInitFileName;}
     const ECreationId& GetCreationId() const { return myCreationId;}
+       
+       // MULTIPR
+    void AddPartMultipr(const char* thePartName, const char* theMEDFilename);
+       void SetResolutionMultipr(const char* theName, char theNewResolution); // 'F'=FULL  'M'=MEDIUM  'L'=LOW  'H'=HIDE 
+       std::string FindPartMultipr(const char* theName);
+       std::vector<std::string> GetCurrentRepresentationMultipr();
+       void SetIsDistributedMEDMultipr(bool theIsDistributedMED);
+       bool IsDistributedMEDMultipr() const;
 
   private:
     SALOMEDS::SObject_var mySObject;
@@ -191,7 +209,14 @@ namespace VISU
     std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
   };
 
-  Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
+  //! To find Result object as published on father of the given SObject
+  Result_var 
+  FindResult(SALOMEDS::SObject_ptr theSObject);
+
+  //! To get VISU::Result object published on the given SALOMEDS::SObject
+  Result_i* 
+  GetResult(SALOMEDS::Study_ptr theStudy,
+           const std::string& theResultEntry);
 }
 
 #endif
index d2c7a7d366ce123d32a4d7eab4a43b62bdfd6154..3a4d51dd0aa8ac7b21218e24b7a330467f7fc46f 100644 (file)
@@ -48,18 +48,41 @@ static int MYDEBUG = 0;
 
 static int INCMEMORY = 4+12;
 
-int VISU::ScalarMapOnDeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                                const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t
+VISU::ScalarMapOnDeformedShape_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
-  bool aResult = false;
+  size_t aResult = 0;
   try{
-    aResult = VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false);
-    if(isMemoryCheck && aResult){
-      const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    aResult = TSuperClass::IsPossible(theResult,
+                                     theMeshName,
+                                     theEntity,
+                                     theFieldName,
+                                     theTimeStampNumber,
+                                     false);
+    if(theIsMemoryCheck && aResult){
+      VISU::Result_i::TInput* anInput = theResult->GetInput();
+      const VISU::PField aField = anInput->GetField(theMeshName,
+                                                   (VISU::TEntity)theEntity,
+                                                   theFieldName);
       if(aField->myNbComp <= 1)
-       return false;
-      float aSize = INCMEMORY*
-       theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
+       return 0;
+
+      bool anIsEstimated = true;
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     }
@@ -71,65 +94,77 @@ int VISU::ScalarMapOnDeformedShape_i::IsPossible(Result_i* theResult, const char
   return aResult;
 }
 
+//---------------------------------------------------------------
 int VISU::ScalarMapOnDeformedShape_i::myNbPresent = 0;
-QString VISU::ScalarMapOnDeformedShape_i::GenerateName() { return VISU::GenerateName("ScalarDef.Shape",myNbPresent++);}
 
-const string VISU::ScalarMapOnDeformedShape_i::myComment = "SCALARMAPONDEFORMEDSHAPE";
-const char* VISU::ScalarMapOnDeformedShape_i::GetComment() const { return myComment.c_str();}
-
-VISU::ScalarMapOnDeformedShape_i::
-ScalarMapOnDeformedShape_i(Result_i* theResult, 
-         bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  myScalarMapOnDeformedShapePL(NULL),
-  myScalarIteration(1)
+//---------------------------------------------------------------
+QString
+VISU::ScalarMapOnDeformedShape_i
+::GenerateName() 
 {
+  return VISU::GenerateName("ScalarDef.Shape",myNbPresent++);
 }
 
-VISU::ScalarMapOnDeformedShape_i::
-ScalarMapOnDeformedShape_i(Result_i* theResult, 
-         SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
+//---------------------------------------------------------------
+const string VISU::ScalarMapOnDeformedShape_i::myComment = "SCALARMAPONDEFORMEDSHAPE";
+
+//---------------------------------------------------------------
+const char* 
+VISU::ScalarMapOnDeformedShape_i
+::GetComment() const
+{ 
+  return myComment.c_str();
+}
+
+
+//---------------------------------------------------------------
+VISU::ScalarMapOnDeformedShape_i
+::ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
   myScalarMapOnDeformedShapePL(NULL),
   myScalarIteration(1)
-{
-}
+{}
+
 
-VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                                        const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::ScalarMapOnDeformedShape_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Create:"<<__LINE__<<endl;
   myIsColored = true;
   myColor.R = myColor.G = myColor.B = 0.5;
-  VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+  VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
   SetScalarFieldName(theFieldName);
-  SetScalarIteration(theIteration);
+  SetScalarIteration(theTimeStampNumber);
   SetScalarMeshName(theMeshName);
   int anEntity = theEntity;
   SetScalarEntity(VISU::TEntity(anEntity));
-  SetScalarField(myScalarMeshName.c_str(),myScalarFieldName.c_str(),myScalarIteration,myScalarEntity);
+  SetCScalarField(myScalarMeshName,myScalarFieldName,myScalarIteration,myScalarEntity);
   return aRes;
 }
 
-VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
+
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::ScalarMapOnDeformedShape_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Restore:"<<__LINE__<<endl;
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
   
   SetScalarFieldName(VISU::Storable::FindValue(theMap,"myScalarFieldName"));
   SetScalarMeshName(VISU::Storable::FindValue(theMap,"myScalarMeshName"));
   SetScalarIteration(VISU::Storable::FindValue(theMap,"myScalarIteration").toInt());
   SetScalarEntity(VISU::TEntity(VISU::Storable::FindValue(theMap,"myScalarEntity").toInt()));
-  SetScalarField(GetScalarMeshName().c_str(),
-                GetScalarFieldName().c_str(),
-                GetScalarIteration(),
-                GetScalarEntity());
+  SetCScalarField(GetScalarMeshName(),
+                 GetScalarFieldName(),
+                 GetScalarIteration(),
+                 GetScalarEntity());
   
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
   myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
@@ -140,9 +175,12 @@ VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TResto
   return this;
 }
 
-void VISU::ScalarMapOnDeformedShape_i::ToStream(std::ostringstream& theStr)
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::ToStream(std::ostringstream& theStr)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::ToStream:"<<__LINE__<<endl;
   TSuperClass::ToStream(theStr);
   
   Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
@@ -155,80 +193,126 @@ void VISU::ScalarMapOnDeformedShape_i::ToStream(std::ostringstream& theStr)
   Storable::DataToStream( theStr, "myColor.R", myColor.R );
   Storable::DataToStream( theStr, "myColor.G", myColor.G );
   Storable::DataToStream( theStr, "myColor.B", myColor.B );
-
 }
 
-VISU::ScalarMapOnDeformedShape_i::~ScalarMapOnDeformedShape_i(){
+
+//---------------------------------------------------------------
+VISU::ScalarMapOnDeformedShape_i
+::~ScalarMapOnDeformedShape_i()
+{
   if(MYDEBUG) MESSAGE("ScalarMapOnDeformedShape_i::~ScalarMapOnDeformedShape_i()");
 }
 
+
+//---------------------------------------------------------------
 void
 VISU::ScalarMapOnDeformedShape_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SameAs:"<<__LINE__<<endl;
   int theScalarIter = this->GetScalarIteration();
   string theScalarMeshName = this->GetScalarMeshName();
   string theScalarFieldName = this->GetScalarFieldName();
-  if(MYDEBUG) cout << "SameAs:"<<endl
-                  << "\t"<<theScalarIter<<":"<<theScalarMeshName.c_str()<<":"<<theScalarFieldName.c_str()<<endl;
 
   TSuperClass::SameAs(theOrigin);
-
+  
   if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
     ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
-
-    this->SetScalarField(anOrigin->GetScalarMeshName().c_str(),
-                        anOrigin->GetScalarFieldName().c_str(),
-                        theScalarIter,
-                        anOrigin->GetScalarEntity());
+    
+    this->SetCScalarField(anOrigin->GetScalarMeshName(),
+                         anOrigin->GetScalarFieldName(),
+                         theScalarIter,
+                         anOrigin->GetScalarEntity());
     Update();
   }
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScale(CORBA::Double theScale) { 
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetScale(CORBA::Double theScale) 
+{ 
   myScalarMapOnDeformedShapePL->SetScale(theScale);
 }
 
-CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetScale(){
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::ScalarMapOnDeformedShape_i
+::GetScale()
+{
   return myScalarMapOnDeformedShapePL->GetScale();
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange){
-  vtkFloatingPointType aRange[2];
-  aRange[0] = vtkFloatingPointType(theMinRange);
-  aRange[1] = vtkFloatingPointType(theMaxRange);
-  myScalarMapOnDeformedShapePL->SetScalarRange(aRange);
+
+//---------------------------------------------------------------
+CORBA::Boolean 
+VISU::ScalarMapOnDeformedShape_i
+::IsColored()
+{
+  return myIsColored;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::ShowColored(CORBA::Boolean theColored)
+{
+  myIsColored = theColored; 
+  myParamsTime.Modified();
 }
 
-CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMin(){
-  vtkFloatingPointType aRange[2];
-  myScalarMapOnDeformedShapePL->GetSourceRange(aRange);
-  return aRange[0];
+//---------------------------------------------------------------
+SALOMEDS::Color 
+VISU::ScalarMapOnDeformedShape_i
+::GetColor()
+{
+  return myColor;
 }
 
-CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMax(){
-  vtkFloatingPointType aRange[2];
-  myScalarMapOnDeformedShapePL->GetSourceRange(aRange);
-  return aRange[1];
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetColor(const SALOMEDS::Color& theColor)
+{
+  myColor = theColor;
+  myParamsTime.Modified();
 }
 
-void VISU::ScalarMapOnDeformedShape_i::DoHook()
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::DoHook:"<<__LINE__<<endl;
-  if(!myPipeLine)
-    myPipeLine = VISU_ScalarMapOnDeformedShapePL::New();
-  
-  myScalarMapOnDeformedShapePL = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(myPipeLine);
-  myPipeLine->GetMapper()->SetScalarVisibility(IsColored());
+  if(!thePipeLine){
+    myScalarMapOnDeformedShapePL = VISU_ScalarMapOnDeformedShapePL::New();
+  }else
+    myScalarMapOnDeformedShapePL = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
 
-  TSuperClass::DoHook();
+  myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(IsColored());
+
+  TSuperClass::CreatePipeLine(myScalarMapOnDeformedShapePL);
 }
 
-VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+
+//---------------------------------------------------------------
+bool
+VISU::ScalarMapOnDeformedShape_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+
+//---------------------------------------------------------------
+VISU_Actor* 
+VISU::ScalarMapOnDeformedShape_i
+::CreateActor() 
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::CreateActor:"<<__LINE__<<endl;
-  VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true);
+  VISU_Actor* anActor = TSuperClass::CreateActor(true);
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
   int  aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2);
   bool toShrink  = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false);
@@ -240,93 +324,158 @@ VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_In
 }
 
 
-void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::UpdateActor:"<<__LINE__<<endl;
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     if(IsColored()){
       anActor->SetBarVisibility(true);
-      myPipeLine->GetMapper()->SetScalarVisibility(1);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(1);
     }else{
       anActor->SetBarVisibility(false);
-      myPipeLine->GetMapper()->SetScalarVisibility(0);
+      GetPipeLine()->GetMapper()->SetScalarVisibility(0);
       anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
     }
     TSuperClass::UpdateActor(theActor);
   }
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
-                                                     const char* theFieldName,
-                                                     int   theIteration,
-                                                     VISU::TEntity  theEntity)
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetCScalarField(const std::string& theMeshName,
+                 const std::string& theFieldName,
+                 int   theIteration,
+                 VISU::TEntity  theEntity)
 {
-  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SetScalarField:"<<__LINE__<<endl;
-  if(MYDEBUG) cout << "\ttheFieldName="<<theFieldName<<endl;
-  if(MYDEBUG) cout << "\ttheIteration="<<theIteration<<endl;
-  myScalarField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
-  TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
-                                                             theEntity,
-                                                             theFieldName,
-                                                             theIteration)->GetVTKOutput();
-  if (myScalarMapOnDeformedShapePL){
-    myScalarMapOnDeformedShapePL->SetScalars(aOut);
-  }
+  VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+  SetField(anInput->GetField(theMeshName,theEntity,theFieldName));
+
+  VISU::PUnstructuredGridIDMapper anIDMapper = 
+    anInput->GetTimeStampOnMesh(theMeshName,
+                               theEntity,
+                               theFieldName,
+                               theIteration);
+
+  vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput();
+  if(myScalarMapOnDeformedShapePL && anOutput)
+    myScalarMapOnDeformedShapePL->SetScalars(anOutput);
+
   this->SetScalarMeshName(theMeshName);
   this->SetScalarFieldName(theFieldName);
   this->SetScalarIteration(theIteration);
   this->SetScalarEntity(theEntity);
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
-                                                     const char* theFieldName,
-                                                     CORBA::Long  theIteration,
-                                                     VISU::Entity  theEntity)
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarField(const char* theMeshName,
+                const char* theFieldName,
+                CORBA::Long  theIteration,
+                VISU::Entity  theEntity)
 {
-  this->SetScalarField(theMeshName,theFieldName,(int)theIteration,VISU::TEntity(theEntity));
+  this->SetCScalarField(theMeshName,theFieldName,(int)theIteration,VISU::TEntity(theEntity));
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarMeshName(const char* theName){
-  myScalarMeshName = theName;
+
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarMeshName(const std::string& theName)
+{
+  if(myScalarMeshName != theName){
+    myScalarMeshName = theName;
+    myParamsTime.Modified();
+  }
 }
-std::string VISU::ScalarMapOnDeformedShape_i::GetScalarMeshName(){
+
+//---------------------------------------------------------------
+std::string 
+VISU::ScalarMapOnDeformedShape_i
+::GetScalarMeshName()
+{
   return myScalarMeshName;
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarFieldName(const char* theName){
-  myScalarFieldName = theName;
+//---------------------------------------------------------------
+void 
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarFieldName(const std::string& theName)
+{
+  if(myScalarFieldName != theName){
+    myScalarFieldName = theName;
+    myParamsTime.Modified();
+  }
 }
-std::string VISU::ScalarMapOnDeformedShape_i::GetScalarFieldName(){
+
+//---------------------------------------------------------------
+std::string
+VISU::ScalarMapOnDeformedShape_i
+::GetScalarFieldName()
+{
   return myScalarFieldName;
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){
-  myScalarIteration = theValue;
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarIteration(const int theValue)
+{
+  if(myScalarIteration != theValue){
+    myScalarIteration = theValue;
+    myParamsTime.Modified();
+  }
 }
 
 
-int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){
+//---------------------------------------------------------------
+int
+VISU::ScalarMapOnDeformedShape_i
+::GetScalarIteration()
+{
   return myScalarIteration;
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarEntity(const VISU::TEntity theValue){
-  myScalarEntity = theValue;
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarEntity(const VISU::TEntity theValue)
+{
+  if(myScalarEntity != theValue){
+    myScalarEntity = theValue;
+    myParamsTime.Modified();
+  }
 }
 
-VISU::TEntity VISU::ScalarMapOnDeformedShape_i::GetScalarEntity(){
+//---------------------------------------------------------------
+VISU::TEntity
+VISU::ScalarMapOnDeformedShape_i
+::GetScalarEntity()
+{
   return myScalarEntity;
 }
 
-void VISU::ScalarMapOnDeformedShape_i::SetScalarEEntity(const VISU::Entity theValue){
-  myScalarEntity = VISU::TEntity(theValue);
-}
-
-VISU::Entity VISU::ScalarMapOnDeformedShape_i::GetScalarEEntity(){
-  return VISU::Entity(myScalarEntity);
+//---------------------------------------------------------------
+void 
+VISU::ScalarMapOnDeformedShape_i
+::SetScalarEEntity(const VISU::Entity theValue)
+{
+  VISU::TEntity anEntity = VISU::TEntity(theValue);
+  if(myScalarEntity != anEntity){
+    myScalarEntity = anEntity;
+    myParamsTime.Modified();
+  }
 }
 
-const VISU::PField&
+//---------------------------------------------------------------
+VISU::Entity
 VISU::ScalarMapOnDeformedShape_i
-::GetField() const 
-{ 
-  return myScalarField;
+::GetScalarEEntity()
+{
+  return VISU::Entity(myScalarEntity);
 }
index f80fce72af36fdb5029093cdfd1ba65c7cd6de1e..8be0305f1ea26e698bd2b2acdfe6ae5617633e66 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_ScalarMapOnDeformedShapePL;
 
-namespace VISU{
+namespace VISU
+{
   
   //! Class of Scalar Map on Deformed Shape presentation.
   class ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape,
@@ -46,48 +47,64 @@ namespace VISU{
     typedef ScalarMap_i TSuperClass;
     
     explicit
-    ScalarMapOnDeformedShape_i(Result_i* theResult,
-                              bool theAddToStudy);
-    explicit
-    ScalarMapOnDeformedShape_i(Result_i* theResult,
-                              SALOMEDS::SObject_ptr theSObject);
+    ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyModep);
     
-    virtual ~ScalarMapOnDeformedShape_i();
+    virtual
+    ~ScalarMapOnDeformedShape_i();
 
-    virtual VISU::VISUType GetType()
+    virtual
+    VISU::VISUType
+    GetType()
     { 
       return VISU::TSCALARMAPONDEFORMEDSHAPE;
-    };
-    
-    typedef VISU::ScalarMapOnDeformedShape TInterface;
+    }
     
-    virtual void SetScale(CORBA::Double theScale);
-    virtual CORBA::Double GetScale();
+    virtual 
+    void
+    SetScale(CORBA::Double theScale);
+
+    virtual
+    CORBA::Double 
+    GetScale();
+
+    virtual
+    CORBA::Boolean 
+    IsColored();
 
-    virtual CORBA::Boolean IsColored() { return myIsColored; }
-    virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; }
+    virtual
+    void
+    ShowColored(CORBA::Boolean theColored);
 
-    virtual SALOMEDS::Color GetColor() { return myColor;}
-    virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;}
+    virtual
+    SALOMEDS::Color 
+    GetColor();
 
-    virtual void SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange);
-    virtual CORBA::Double GetSourceRangeMin();
-    virtual CORBA::Double GetSourceRangeMax();
+    virtual
+    void
+    SetColor(const SALOMEDS::Color& theColor);
 
     virtual 
     void
     SameAs(const Prs3d_i* theOrigin);
 
-    virtual const VISU::PField&
-    GetField() const;
-
-    VISU_ScalarMapOnDeformedShapePL* GetScalarMapOnDeformedShapePL(){ return myScalarMapOnDeformedShapePL;}
+    typedef VISU::ScalarMapOnDeformedShape TInterface;
+    
+    VISU_ScalarMapOnDeformedShapePL* 
+    GetSpecificPL()
+    { 
+      return myScalarMapOnDeformedShapePL;
+    }
    
   protected:
-    
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
     virtual
     void
-    DoHook();
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
     VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL;
     SALOMEDS::Color myColor;
@@ -96,49 +113,108 @@ namespace VISU{
     std::string myScalarFieldName;
     VISU::TEntity myScalarEntity;
     int myScalarIteration;
-    PField myScalarField;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
+    //! Redefines VISU_ColoredPrs3d_i::IsPossible
+    static
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Redefines VISU_ColoredPrs3d_i::IsPossible
+    virtual
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
-    virtual void ToStream(std::ostringstream& theStr);
+    //! Redefines VISU_ColoredPrs3d_i::ToStream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    //! Redefines VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
     
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
-                            const std::string& thePrefix, const Storable::TRestoringMap& theMap);
-
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString 
+    GenerateName();
 
-    virtual void UpdateActor(VISU_Actor* theActor) ;
+    virtual
+    VISU_Actor* 
+    CreateActor();
 
-    virtual void SetScalarField(const char* theMeshName,
-                               const char* theFieldName,
-                               int   theIteration,
-                               VISU::TEntity  theEntity);
+    virtual
+    void
+    UpdateActor(VISU_Actor* theActor) ;
+
+    virtual
+    void
+    SetCScalarField(const std::string& theMeshName,
+                   const std::string& theFieldName,
+                   int   theIteration,
+                   VISU::TEntity  theEntity);
     
-    virtual void SetScalarField(const char* theMeshName,
-                               const char* theFieldName,
-                               CORBA::Long  theIteration,
-                               VISU::Entity  theEntity);
-
-    virtual void SetScalarFieldName(const char* theName);
-    virtual std::string GetScalarFieldName();
-    virtual void SetScalarIteration(const int theValue);
-    virtual int GetScalarIteration();
-    virtual void SetScalarMeshName(const char* theName);
-    virtual std::string GetScalarMeshName();
-    virtual void SetScalarEntity(const VISU::TEntity theValue);
-    virtual VISU::TEntity GetScalarEntity();
-    virtual void SetScalarEEntity(const VISU::Entity theValue);
-    virtual VISU::Entity GetScalarEEntity();
+    virtual 
+    void
+    SetScalarField(const char* theMeshName,
+                  const char* theFieldName,
+                  CORBA::Long  theIteration,
+                  VISU::Entity  theEntity);
+
+    virtual 
+    void
+    SetScalarFieldName(const std::string& theName);
+
+    virtual
+    std::string 
+    GetScalarFieldName();
+
+    virtual
+    void 
+    SetScalarIteration(const int theValue);
+
+    virtual
+    int
+    GetScalarIteration();
+
+    virtual
+    void
+    SetScalarMeshName(const std::string& theName);
+
+    virtual
+    std::string
+    GetScalarMeshName();
+
+    virtual
+    void
+    SetScalarEntity(const VISU::TEntity theValue);
+
+    virtual
+    VISU::TEntity
+    GetScalarEntity();
+
+    virtual
+    void
+    SetScalarEEntity(const VISU::Entity theValue);
+
+    virtual
+    VISU::Entity
+    GetScalarEEntity();
   };
 }
 #endif
index e56862cfe1df96bf0b5d93a146c46ac2bacc0c3d..a2c568595c95cf7f9609194786a96c235958c111 100644 (file)
 #include "VISU_ScalarMap_i.hh"
 
 #include "VISU_Result_i.hh"
-#include "VISU_ViewManager_i.hh"
 
 #include "VISU_ScalarMapAct.h"
 #include "VISU_ScalarMapPL.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_ScalarBarActor.hxx"
 #include "VISU_Convertor.hxx"
 
 #include "SUIT_ResourceMgr.h"
@@ -38,9 +39,6 @@
 #include <vtkDataSetMapper.h>
 #include <vtkTextProperty.h>
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -50,36 +48,47 @@ static int MYDEBUG = 0;
 static int INCMEMORY = 4;
 
 
-//============================================================================
-int
+//----------------------------------------------------------------------------
+size_t
 VISU::ScalarMap_i
 ::IsPossible(Result_i* theResult, 
-            const char* theMeshName, 
-            VISU::Entity theEntity,
-            const char* theFieldName, int theIteration, int isMemoryCheck)
+            const std::string& theMeshName, 
+            VISU::Entity theEntity, 
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber, 
+            bool theIsMemoryCheck)
 {
+  size_t aResult = 0;
   try{
-    float aSize = INCMEMORY*
-      theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
-    bool aResult = true;
-    if(isMemoryCheck){
-      aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-      MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    if(theResult){
+      bool anIsEstimated = true;
+      VISU::Result_i::TInput* anInput = theResult->GetInput();
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
+      aResult = 1;
+      if(theIsMemoryCheck){
+       if(anIsEstimated)
+         aSize *= INCMEMORY;
+       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+       if(MYDEBUG) 
+         MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+      }
     }
-    return aResult;
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
     INFOS("Unknown exception was occured!");
   }
-  return 0;
+  return aResult;
 }
 
 //----------------------------------------------------------------------------
-int
-VISU::ScalarMap_i
-::myNbPresent = 0;
+int VISU::ScalarMap_i::myNbPresent = 0;
 
+//----------------------------------------------------------------------------
 QString
 VISU::ScalarMap_i
 ::GenerateName() 
@@ -87,34 +96,25 @@ VISU::ScalarMap_i
   return VISU::GenerateName("ScalarMap",myNbPresent++);
 }
 
-const string
-VISU::ScalarMap_i
-::myComment = "SCALARMAP";
+//----------------------------------------------------------------------------
+const string VISU::ScalarMap_i::myComment = "SCALARMAP";
 
+//----------------------------------------------------------------------------
 const char* 
 VISU::ScalarMap_i
-::GetComment() const { 
+::GetComment() const 
+{ 
   return myComment.c_str();
 }
 
 
 //----------------------------------------------------------------------------
 VISU::ScalarMap_i::
-ScalarMap_i(Result_i* theResult,
-           bool theAddToStudy) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy)
-{}
-
-VISU::ScalarMap_i::
-ScalarMap_i(Result_i* theResult,
-           SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject)
+ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode)
 {}
 
+//----------------------------------------------------------------------------
 VISU::ScalarMap_i
 ::~ScalarMap_i()
 {}
@@ -131,7 +131,7 @@ VISU::ScalarMap_i
     ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
  
     SetRange(anOrigin->GetMin(), anOrigin->GetMax());
-    myIsFixedRange = anOrigin->IsRangeFixed();
+    UseFixedRange(anOrigin->IsRangeFixed());
 
     SetScaling(anOrigin->GetScaling());
     
@@ -146,25 +146,24 @@ VISU::ScalarMap_i
  */
 VISU::Storable* 
 VISU::ScalarMap_i
-::Create(const char* theMeshName, 
+::Create(const std::string& theMeshName, 
         VISU::Entity theEntity,
-        const char* theFieldName, 
-        int theIteration)
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+  TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
   // Scalar Range
   int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-  myIsFixedRange = (aRangeType == 1) ? true : false;
-
-  if(myIsFixedRange){
+  if(aRangeType == 1){
     float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
     float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
     SetRange(aMin,aMax);
   }
 
+  UseFixedRange((aRangeType == 1) ? true : false);
   bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
 
   if( isLog )
@@ -175,11 +174,22 @@ VISU::ScalarMap_i
   return this;
 }
 
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::ScalarMap_i
+::GetMemorySize()
+{
+  return TSuperClass::GetMemorySize();
+}
+
+//----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ScalarMap_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
 
@@ -187,11 +197,12 @@ VISU::ScalarMap_i
   float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
   SetRange(aMin,aMax);
 
-  myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt();
+  UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt());
 
   return this;
 }
 
+//----------------------------------------------------------------------------
 void 
 VISU::ScalarMap_i
 ::ToStream(std::ostringstream& theStr)
@@ -200,7 +211,7 @@ VISU::ScalarMap_i
 
   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
-  Storable::DataToStream( theStr, "myIsFixedRange",   myIsFixedRange );
+  Storable::DataToStream( theStr, "myIsFixedRange",   IsRangeFixed() );
   Storable::DataToStream( theStr, "myScaling",        GetScaling() );
 }
 
@@ -213,6 +224,7 @@ VISU::ScalarMap_i
   TSuperClass::SetBarOrientation(theOrientation);
 }
 
+//----------------------------------------------------------------------------
 VISU::ScalarMap::Orientation 
 VISU::ScalarMap_i
 ::GetBarOrientation() 
@@ -220,95 +232,108 @@ VISU::ScalarMap_i
   return TSuperClass::GetBarOrientation();
 }
 
+//----------------------------------------------------------------------------
 VISU::Scaling 
 VISU::ScalarMap_i
 ::GetScaling()
 {
-  return VISU::Scaling(myScalarMapPL->GetScaling());
+  return VISU::Scaling(GetSpecificPL()->GetScaling());
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
 ::SetScaling(VISU::Scaling theScaling)
 {
-  myScalarMapPL->SetScaling(theScaling);
+  GetSpecificPL()->SetScaling(theScaling);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
 ::SetRange(CORBA::Double theMin, CORBA::Double theMax)
 {
-  if(theMin > theMax) 
-    return;
-  vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
-  myScalarMapPL->SetScalarRange(aScalarRange);
-  myIsFixedRange = true;
+  TSuperClass::SetRange(theMin, theMax);
 }
 
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::SetSourceRange()
+{
+  TSuperClass::SetSourceRange();
+}
 
 //----------------------------------------------------------------------------
 void 
 VISU::ScalarMap_i
-::DoSetInput(Result_i* theResult)
+::DoSetInput(bool theIsInitilizePipe, bool theReInit)
 {
-  VISU::Result_i::TInput* anInput = theResult->GetInput();
+  VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
   if(!anInput)
-    throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
+    throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
 
-  myField = anInput->GetField(myMeshName,myEntity,myFieldName);
-  if(!myField) 
+  SetField(anInput->GetField(GetCMeshName(),GetTEntity(),GetCFieldName()));
+  if(!GetField())
     throw std::runtime_error("There is no Field with the parameters !!!");
 
-  VISU::PIDMapper anIDMapper =
-    anInput->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
+  VISU::PUnstructuredGridIDMapper anIDMapper =
+    anInput->GetTimeStampOnMesh(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber());
 
   if(!anIDMapper) 
     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
-  myScalarMapPL->SetIDMapper(anIDMapper);
-  myScalarMapPL->Init();
-  myScalarMapPL->Build();
+  GetSpecificPL()->SetUnstructuredGridIDMapper(anIDMapper);
+  if(theIsInitilizePipe){
+    GetSpecificPL()->Init();
+  }
+
+  // To update scalar range according to the new input
+  if(!IsTimeStampFixed() && !IsRangeFixed() || theReInit)
+    SetSourceRange();
 }
 
-void
+
+//----------------------------------------------------------------------------
+bool
 VISU::ScalarMap_i
-::Update() 
+::CheckIsPossible() 
 {
-  TSuperClass::Update();
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
 }
 
 
 //----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
-::SetMapScale(double theMapScale)
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
 {
-  myScalarMapPL->SetMapScale(theMapScale);
-}
-
-bool
-VISU::ScalarMap_i
-::IsRangeFixed() 
-{ 
-  return myIsFixedRange; 
+  if(MYDEBUG) MESSAGE("ScalarMap_i::CreatePipeLine() - "<<thePipeLine);
+  if(!thePipeLine){
+    myScalarMapPL = VISU_ScalarMapPL::New();
+    myScalarMapPL->GetMapper()->SetScalarVisibility(1);
+  }else
+    myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myScalarMapPL);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
-::SetSourceRange()
+::SetMapScale(double theMapScale)
 {
-  myScalarMapPL->SetSourceRange();
-  myIsFixedRange = false;
+  GetSpecificPL()->SetMapScale(theMapScale);
 }
 
 //----------------------------------------------------------------------------
 VISU_Actor* 
 VISU::ScalarMap_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking)
+::CreateActor(bool toSupressShrinking)
 {
   VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New();
   try{
-    TSuperClass::CreateActor(anActor,theIO);
+    TSuperClass::CreateActor(anActor);
     anActor->SetBarVisibility(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int  aDispMode = aResourceMgr->integerValue("VISU", "scalar_map_represent", 2);
@@ -325,41 +350,51 @@ VISU::ScalarMap_i
   return anActor;
 }
 
+//----------------------------------------------------------------------------
 VISU_Actor* 
 VISU::ScalarMap_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+::CreateActor()
 {
-  return CreateActor(theIO, false);
+  return CreateActor(false);
 }
 
+//----------------------------------------------------------------------------
 void
 VISU::ScalarMap_i
 ::UpdateActor(VISU_Actor* theActor) 
 {
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
-    aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
-    aScalarBar->SetTitle(myTitle.c_str());
-    aScalarBar->SetOrientation(myOrientation);
+    aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
+    aScalarBar->SetTitle(GetScalarBarTitle().c_str());
+    aScalarBar->SetOrientation(GetBarOrientation());
     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
-    aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]);
-    aScalarBar->SetWidth(myWidth);
-    aScalarBar->SetHeight(myHeight);
-    aScalarBar->SetNumberOfLabels(myNumberOfLabels);
+    aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
+    aScalarBar->SetWidth(GetWidth());
+    aScalarBar->SetHeight(GetHeight());
+    aScalarBar->SetNumberOfLabels(GetLabels());
+
+    vtkFloatingPointType anRGB[3];
 
     vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
-    aTitleProp->SetFontFamily(myTitFontType);
-    aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]);
-    (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
-    (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
-    (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+    aTitleProp->SetFontFamily(GetTitFontType());
+
+    GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+    aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+    IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+    IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+    IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
 
     vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
-    aLabelProp->SetFontFamily(myLblFontType);
-    aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]);
-    (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
-    (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
-    (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+    aLabelProp->SetFontFamily(GetLblFontType());
+
+    GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+    aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+    IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+    IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+    IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
 
     aScalarBar->Modified();
   }
index ef29f65f428d3954725a72e810ac87ae90fbb141..992e16268bb65c1bf416109df7db760e1220965c 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "VISU_ColoredPrs3d_i.hh"
 
+class VISU_ScalarMapPL;
 
 namespace VISU
 {
@@ -43,13 +44,11 @@ namespace VISU
   public:
     //----------------------------------------------------------------------------
     typedef ColoredPrs3d_i TSuperClass;
+    typedef VISU::ScalarMap TInterface;
 
     explicit
-    ScalarMap_i(Result_i* theResult,
-               bool theAddToStudy);
-    explicit
-    ScalarMap_i(Result_i* theResult,
-               SALOMEDS::SObject_ptr theSObject);
+    ScalarMap_i(EPublishInStudyMode thePublishInStudyModep);
+
     virtual
     ~ScalarMap_i();
 
@@ -60,6 +59,13 @@ namespace VISU
       return VISU::TSCALARMAP;
     }
 
+    //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
+    //----------------------------------------------------------------------------
     virtual 
     VISU::Scaling 
     GetScaling();
@@ -72,6 +78,10 @@ namespace VISU
     void
     SetRange(CORBA::Double theMin, CORBA::Double theMax);
 
+    virtual
+    void
+    SetSourceRange();
+    
     // To provide backward compatibility
     virtual
     void
@@ -81,28 +91,50 @@ namespace VISU
     VISU::ScalarMap::Orientation 
     GetBarOrientation();
 
-    typedef VISU::ScalarMap TInterface;
-
+    //----------------------------------------------------------------------------
+    VISU_ScalarMapPL* 
+    GetSpecificPL() const
+    { 
+      return myScalarMapPL; 
+    }
+    
   protected:
+    //! Redefines VISU_ColoredPrs3d_i::DoSetInput
     virtual 
     void
-    DoSetInput(Result_i* theResult);
+    DoSetInput(bool theIsInitilizePipe, bool theReInit);
+
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
 
   public:
+    /*!
+      Checks staticaly, whether it is possible to create presentation 
+      with the given basic parameters or not.
+    */
     static
-    int
+    size_t
     IsPossible(Result_i* theResult, 
-              const char* theMeshName, 
+              const std::string& theMeshName, 
               VISU::Entity theEntity,
-              const char* theFieldName, 
-              int theIteration, 
-              int isMemoryCheck = true);
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Redefines VISU_ColoredPrs3d_i::Create
     virtual
     Storable* 
-    Create(const char* theMeshName, 
+    Create(const std::string& theMeshName, 
           VISU::Entity theEntity,
-          const char* theFieldName, 
-          int theIteration);
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
     virtual 
     void
@@ -120,45 +152,31 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
-
-    static 
-    Storable* 
-    Restore(SALOMEDS::SObject_ptr theSObject,
-           const std::string& thePrefix, 
+    Restore(SALOMEDS::Study_ptr theStudy,
            const Storable::TRestoringMap& theMap);
 
-    virtual
-    void
-    Update() ;
-
     virtual
     void
     SetMapScale(double theMapScale = 1.0);
 
-    virtual
-    bool
-    IsRangeFixed();
-
-    virtual 
-    void
-    SetSourceRange();
-
     virtual 
     void
     SameAs(const Prs3d_i* theOrigin);
 
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
     
     virtual 
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking);
+    CreateActor(bool toSupressShrinking);
 
     virtual
     void
     UpdateActor(VISU_Actor* theActor);
+
+  private:
+    VISU_ScalarMapPL* myScalarMapPL;
   };
 }
 
index 7aa8273bef16fc7f98260f04be310c3356a084a1..2bb2c7462b0130e4f6bcacb50093cc63e24bf697 100644 (file)
 #include <vtkAppendFilter.h>
 #include <vtkUnstructuredGrid.h>
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
 
-int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                   const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t
+VISU::StreamLines_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
   try{
-    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) 
+    if(!VISU::ScalarMap_i::IsPossible(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, false)) 
       return 0;
 
-    VISU::PIDMapper anIDMapper = 
-      theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
-    VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
-    bool aResult = VISU_StreamLinesPL::IsPossible(aDataSet);
+    VISU::Result_i::TInput* anInput = theResult->GetInput();
+    VISU::PUnstructuredGridIDMapper anIDMapper = 
+      anInput->GetTimeStampOnMesh(theMeshName,
+                                 VISU::TEntity(theEntity),
+                                 theFieldName,
+                                 theTimeStampNumber);
+
+    vtkUnstructuredGrid* aDataSet = anIDMapper->GetUnstructuredGridOutput();
+    size_t aResult = VISU_StreamLinesPL::IsPossible(aDataSet);
     MESSAGE("StreamLines_i::IsPossible - aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -67,44 +77,44 @@ int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName
   return 0;
 }
 
-
+//---------------------------------------------------------------
 int VISU::StreamLines_i::myNbPresent = 0;
-QString VISU::StreamLines_i::GenerateName() { return VISU::GenerateName("StreamLines",myNbPresent++);}
 
+//---------------------------------------------------------------
+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,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  DeformedShape_i(theResult,theAddToStudy),
-  myStreamLinesPL(NULL),
-  myAppendFilter(vtkAppendFilter::New())
-{
+//---------------------------------------------------------------
+const char* 
+VISU::StreamLines_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
 }
 
 
-VISU::StreamLines_i::
-StreamLines_i(Result_i* theResult, 
-             SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  DeformedShape_i(theResult,theSObject),
+//---------------------------------------------------------------
+VISU::StreamLines_i
+::StreamLines_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
+  DeformedShape_i(thePublishInStudyMode),
   myStreamLinesPL(NULL),
   myAppendFilter(vtkAppendFilter::New())
-{
-}
+{}
 
 
-void VISU::StreamLines_i::SameAs(const Prs3d_i* theOrigin)
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::SameAs(const Prs3d_i* theOrigin)
 {
   TSuperClass::SameAs(theOrigin);
 
@@ -115,16 +125,26 @@ void VISU::StreamLines_i::SameAs(const Prs3d_i* theOrigin)
 }
 
 
-VISU::Storable* VISU::StreamLines_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                           const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::StreamLines_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  return DeformedShape_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::StreamLines_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
   double aPropagationTime = VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble();
@@ -143,8 +163,12 @@ VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theM
 }
 
 
-void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){
-  DeformedShape_i::ToStream(theStr);
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myIntegrationStep", GetIntegrationStep());
   Storable::DataToStream( theStr, "myPropagationTime", GetPropagationTime());
@@ -157,59 +181,82 @@ void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::StreamLines_i::~StreamLines_i(){
+//---------------------------------------------------------------
+VISU::StreamLines_i
+::~StreamLines_i()
+{
   if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()");
   myAppendFilter->UnRegisterAllOutputs();
   myAppendFilter->Delete();
 }
 
 
+//---------------------------------------------------------------
 CORBA::Boolean 
-VISU::StreamLines_i::SetParams(CORBA::Double theIntStep,
-                              CORBA::Double thePropogationTime,
-                              CORBA::Double theStepLength,
-                              VISU::Prs3d_ptr thePrs3d, 
-                              CORBA::Double thePercents,
-                              VISU::StreamLines::Direction theDirection) 
+VISU::StreamLines_i
+::SetParams(CORBA::Double theIntStep,
+           CORBA::Double thePropogationTime,
+           CORBA::Double theStepLength,
+           VISU::Prs3d_ptr thePrs3d, 
+           CORBA::Double thePercents,
+           VISU::StreamLines::Direction theDirection) 
 { 
-  VISU::Prs3d_i* aPrs3di = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
   vtkPointSet* aSource = NULL;
   if(!thePrs3d->_is_nil())
-    if((aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in()))){
+    if((aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in()))){
       for(int i = myAppendFilter->GetNumberOfInputs()-1; i >= 0; i--)
        myAppendFilter->RemoveInput(myAppendFilter->GetInput(i));
-      myAppendFilter->AddInput(aPrs3di->GetPL()->GetMapper()->GetInput());
+      myAppendFilter->AddInput(aPrs3d->GetPipeLine()->GetMapper()->GetInput());
       aSource = myAppendFilter->GetOutput();
     }
-  int isAccepted = myStreamLinesPL->SetParams(theIntStep,
-                                             thePropogationTime,
-                                             theStepLength,
-                                             aSource,
-                                             thePercents,
-                                             theDirection,
-                                             1);
-  if(isAccepted == 1) SetSource(aPrs3di);
-  return isAccepted == 1;
+  size_t anIsAccepted = myStreamLinesPL->SetParams(theIntStep,
+                                                  thePropogationTime,
+                                                  theStepLength,
+                                                  aSource,
+                                                  thePercents,
+                                                  theDirection,
+                                                  1);
+  if(anIsAccepted) 
+    SetSource(aPrs3d);
+  return anIsAccepted;
 }
 
 
-void VISU::StreamLines_i::SetSource(VISU::Prs3d_ptr thePrs3d){
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::SetSource(VISU::Prs3d_ptr thePrs3d)
+{
   if(!thePrs3d->_is_nil()){
     VISU::Prs3d_i* aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in());
     SetSource(aPrs3di);
   }
 }
-void VISU::StreamLines_i::SetSource(VISU::Prs3d_i* thePrs3d){
+
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::SetSource(VISU::Prs3d_i* thePrs3d)
+{
   mySourceEntry = "";
   if(thePrs3d){
     SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject();
     CORBA::String_var aString = aSObject->GetID();
     mySourceEntry = aString.in();
+    myParamsTime.Modified();
   }
 }
-void VISU::StreamLines_i::SetSource(){
-  if(!myStreamLinesPL->GetSource() && mySourceEntry == "") return;
-  if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) return;
+
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::SetSource()
+{
+  if(!myStreamLinesPL->GetSource() && mySourceEntry == "") 
+    return;
+  if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) 
+    return;
   VISU::Prs3d_var aPrs3d = GetSource();
   SetParams(GetIntegrationStep(),
            GetPropagationTime(),
@@ -220,58 +267,102 @@ void VISU::StreamLines_i::SetSource(){
 }
 
 
-CORBA::Double VISU::StreamLines_i::GetIntegrationStep() { 
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::StreamLines_i
+::GetIntegrationStep() 
+{ 
   return myStreamLinesPL->GetIntegrationStep();
 }
 
-CORBA::Double VISU::StreamLines_i::GetPropagationTime() { 
+//---------------------------------------------------------------
+CORBA::Double
+VISU::StreamLines_i
+::GetPropagationTime() 
+{ 
   return myStreamLinesPL->GetPropagationTime();
 }
 
-CORBA::Double VISU::StreamLines_i::GetStepLength() { 
+//---------------------------------------------------------------
+CORBA::Double
+VISU::StreamLines_i
+::GetStepLength() 
+{ 
   return myStreamLinesPL->GetStepLength();
 }
 
-VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() { 
+//---------------------------------------------------------------
+VISU::StreamLines::Direction
+VISU::StreamLines_i
+::GetDirection() 
+{ 
   return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection());
 }
 
 
-VISU::Prs3d_ptr VISU::StreamLines_i::GetSource(){
+//---------------------------------------------------------------
+VISU::Prs3d_ptr
+VISU::StreamLines_i
+::GetSource()
+{
   VISU::Prs3d_var aPrs3d;
   if(MYDEBUG) MESSAGE("StreamLines_i::GetSource() mySourceEntry = '"<<mySourceEntry<<"'");
   if(mySourceEntry != ""){
-    SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(mySourceEntry.c_str());
+    SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(mySourceEntry.c_str());
     CORBA::Object_var anObj = SObjectToObject(aSObject);
     if(!CORBA::is_nil(anObj)) aPrs3d = VISU::Prs3d::_narrow(anObj);
   }
   return aPrs3d._retn();
 }
 
-CORBA::Double VISU::StreamLines_i::GetUsedPoints() { 
+//---------------------------------------------------------------
+CORBA::Double 
+VISU::StreamLines_i
+::GetUsedPoints() 
+{ 
   return myStreamLinesPL->GetUsedPoints();
 }
 
 
-void VISU::StreamLines_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New();
-  myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(myPipeLine);
+//---------------------------------------------------------------
+void 
+VISU::StreamLines_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myStreamLinesPL = VISU_StreamLinesPL::New();
+  }else
+    myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine);
+
+  TSuperClass::CreatePipeLine(myStreamLinesPL);
+}
+
 
-  DeformedShape_i::DoHook();
+//----------------------------------------------------------------------------
+bool
+VISU::StreamLines_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
 }
 
 
-void VISU::StreamLines_i::Update() {
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::Update() 
+{
   SetSource();
-  VISU::DeformedShape_i::Update();
+  TSuperClass::Update();
 }
 
 
+//---------------------------------------------------------------
 VISU_Actor* 
 VISU::StreamLines_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO
+::CreateActor() 
 {
-  if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO, true)){
+  if(VISU_Actor* anActor = TSuperClass::CreateActor(true)){
     anActor->SetVTKMapping(true);
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int  aDispMode = aResourceMgr->integerValue("VISU", "stream_lines_represent", 1);
@@ -282,6 +373,10 @@ VISU::StreamLines_i
 }
 
 
-void VISU::StreamLines_i::UpdateActor(VISU_Actor* theActor) {
-  VISU::DeformedShape_i::UpdateActor(theActor);
+//---------------------------------------------------------------
+void
+VISU::StreamLines_i
+::UpdateActor(VISU_Actor* theActor) 
+{
+  TSuperClass::UpdateActor(theActor);
 }
index 9c4af6fe53abb771eaa323ae7562a9e947a19e49..8815eaf7109f8763b2c0d33200414b54c402a8c4 100644 (file)
@@ -32,7 +32,8 @@
 class VISU_StreamLinesPL;
 class vtkAppendFilter;
 
-namespace VISU{
+namespace VISU
+{
   class StreamLines_i : public virtual POA_VISU::StreamLines,
                        public virtual DeformedShape_i
   {
@@ -44,65 +45,150 @@ namespace VISU{
     typedef DeformedShape_i TSuperClass;
 
     explicit
-    StreamLines_i(Result_i* theResult,
-                 bool theAddToStudy);
-    explicit
-    StreamLines_i(Result_i* theResult,
-                 SALOMEDS::SObject_ptr theSObject);
-    virtual void SameAs(const Prs3d_i* theOriginal);
-    virtual ~StreamLines_i();
-
-    virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
-
-    virtual CORBA::Boolean SetParams(CORBA::Double theIntStep,
-                                    CORBA::Double thePropogationTime,
-                                    CORBA::Double theStepLength,
-                                    VISU::Prs3d_ptr thePrs3d,
-                                    CORBA::Double thePercents,
-                                    VISU::StreamLines::Direction theDirection);
-    virtual CORBA::Double GetIntegrationStep();
-    virtual CORBA::Double GetPropagationTime();
-    virtual CORBA::Double GetStepLength();
-    virtual CORBA::Double GetUsedPoints();
-    virtual VISU::Prs3d_ptr GetSource();
-    virtual VISU::StreamLines::Direction GetDirection();
+    StreamLines_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    void
+    SameAs(const Prs3d_i* theOriginal);
+
+    virtual
+    ~StreamLines_i();
+
+    virtual
+    VISU::VISUType GetType()
+    {
+      return VISU::TSTREAMLINES;
+    }
+
+    virtual
+    CORBA::Boolean 
+    SetParams(CORBA::Double theIntStep,
+             CORBA::Double thePropogationTime,
+             CORBA::Double theStepLength,
+             VISU::Prs3d_ptr thePrs3d,
+             CORBA::Double thePercents,
+             VISU::StreamLines::Direction theDirection);
+
+    virtual
+    CORBA::Double
+    GetIntegrationStep();
+
+    virtual
+    CORBA::Double
+    GetPropagationTime();
+
+    virtual
+    CORBA::Double
+    GetStepLength();
+
+    virtual
+    CORBA::Double
+    GetUsedPoints();
+
+    virtual
+    VISU::Prs3d_ptr
+    GetSource();
+
+    virtual
+    VISU::StreamLines::Direction 
+    GetDirection();
 
     typedef VISU::StreamLines TInterface;
-    VISU_StreamLinesPL* GetStreamLinesPL(){ return myStreamLinesPL;}
 
+    VISU_StreamLinesPL* 
+    GetSpecificPL() const
+    { 
+      return myStreamLinesPL; 
+    }
+    
   protected:
-    virtual void DoHook();
-    virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
-    virtual void SetSource(VISU::Prs3d_i* thePrs3d);
-    virtual void SetSource();
+    //! Extends VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual 
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Extends VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
+
+    virtual
+    void
+    SetSource(VISU::Prs3d_ptr thePrs3d);
+
+    virtual
+    void 
+    SetSource(VISU::Prs3d_i* thePrs3d);
+
+    virtual
+    void
+    SetSource();
 
     VISU_StreamLinesPL* myStreamLinesPL;
     vtkAppendFilter* myAppendFilter;
     std::string mySourceEntry;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
-
-    virtual void ToStream(std::ostringstream& theStr);
+    //! Extends VISU_ColoredPrs3d_i::IsPossible
+    static 
+    size_t
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Extends VISU_ColoredPrs3d_i::Create
+    virtual
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
+
+    //! Extends VISU_ColoredPrs3d_i::ToStream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    virtual
+    const char* 
+    GetComment() const;
 
-    virtual void Update();
+    virtual
+    QString 
+    GenerateName();
 
+    //! Extends VISU_ColoredPrs3d_i::Restore
     virtual 
-    VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
-    virtual void UpdateActor(VISU_Actor* theActor);
+    //! Extends VISU_ColoredPrs3d_i::Update
+    virtual 
+    void 
+    Update();
 
-    virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
+    //! Extends VISU_ColoredPrs3d_i::CreateActor
+    virtual 
+    VISU_Actor* 
+    CreateActor();
+
+    //! Extends VISU_ColoredPrs3d_i::UpdateActor
+    virtual
+    void
+    UpdateActor(VISU_Actor* theActor);
+
+    virtual
+    QString
+    GetSourceEntry() 
+    { 
+      return QString(mySourceEntry.c_str()); 
+    }
   };
 }
 
index cb64212609ee4b554372f319d359d7218639816f..cc62432e2172bf7064e57ca51b8fe731ce085ae5 100644 (file)
@@ -84,13 +84,63 @@ VISU::Table_i::~Table_i()
 {
   MESSAGE("Table_i::~Table_i");
 }
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SetTitle( const char* theTitle )
+{
+  SetName( theTitle, true );
+}
+
+//----------------------------------------------------------------------------
+char*
+VISU::Table_i
+::GetTitle()
+{
+  return CORBA::string_dup( GetName().c_str() );
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SetOrientation( VISU::Table::Orientation theOrientation )
+{
+  myOrientation = theOrientation;
+}
+
+//----------------------------------------------------------------------------
+VISU::Table::Orientation
+VISU::Table_i
+::GetOrientation()
+{
+  return myOrientation;
+}
+
+//----------------------------------------------------------------------------
+SALOMEDS::SObject_var
+VISU::Table_i
+::GetSObject() const
+{
+  return mySObj;
+}
+
+//----------------------------------------------------------------------------
+char* 
+VISU::Table_i
+::GetObjectEntry() 
+{
+  return CORBA::string_dup( mySObj->GetID() ); 
+}
+
+//----------------------------------------------------------------------------
 /*!
   Gets number of rows in table
 */
 CORBA::Long VISU::Table_i::GetNbRows()
 {
   SALOMEDS::SObject_var SO = mySObj;
-  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   if ( !SO->_is_nil() ) {
     SALOMEDS::GenericAttribute_var        anAttr;
     if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
@@ -110,7 +160,7 @@ CORBA::Long VISU::Table_i::GetNbRows()
 CORBA::Long VISU::Table_i::GetNbColumns()
 {
   SALOMEDS::SObject_var SO = mySObj;
-  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   if ( !SO->_is_nil() ) {
     SALOMEDS::GenericAttribute_var        anAttr;
     if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
@@ -130,10 +180,10 @@ CORBA::Long VISU::Table_i::GetNbColumns()
 VISU::Storable* VISU::Table_i::Create()
 {
   // generate name ...
-  myName = GetTableTitle();
+  SetName(GetTableTitle(), false);
 
   // mpv (PAL 5357): if name attribute already exist at this label, use it as name of table
-  if ( myName == "" )
+  if ( GetName() == "" )
     if ( !mySObj->_is_nil() ) {
       CutLines_i* pCutLines = NULL;
       CORBA::Object_var anObj = SObjectToObject(mySObj);
@@ -143,11 +193,11 @@ VISU::Storable* VISU::Table_i::Create()
            pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
        }
       if (!pCutLines)
-       if (mySObj->GetName()) myName = mySObj->GetName();
+       if (mySObj->GetName()) SetName(mySObj->GetName(), false);
     }
 
-  if ( myName == "" )
-    myName = GenerateName();
+  if ( GetName() == "" )
+    SetName(GenerateName(), false);
   // ... and build the object
   return Build( false );
 }
@@ -168,11 +218,11 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
       if(!aCutLines->_is_nil())
        pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
     }
-    SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
     SALOMEDS::GenericAttribute_var anAttr;
     // look for component
     if ( !theRestoring ) {
-       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
        // create SObject and set attributes
        QString aComment;
        if(pCutLines)
@@ -196,7 +246,7 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
          }
        }
 
-       string anEntry = CreateAttributes( myStudy,
+       string anEntry = CreateAttributes( GetStudyDocument(),
                                          SO->GetID(),//SComponent->GetID(),
                                          "",
                                          GetID(),
@@ -205,7 +255,7 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
                                          aComment.latin1(),
                                          pCutLines );
        // create SObject referenced to real table object
-       mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID( anEntry.c_str() ));
+       mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() ));
        if(pCutLines) {
          pCutLines->BuildTableOfReal(mySObj);
        }
@@ -223,8 +273,8 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
 VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
 {
   if(MYDEBUG) MESSAGE(GetComment());
-  myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
-  myTitle = (const char*)(VISU::Storable::FindValue(theMap,"myTitle"));
+  SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false);
+  myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
   myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
   mySObj = SALOMEDS::SObject::_duplicate(SO);
   return Build( true );
@@ -234,7 +284,7 @@ VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, S
 */
 void VISU::Table_i::ToStream( std::ostringstream& theStr )
 {
-  Storable::DataToStream( theStr, "myName",        myName.c_str() );
+  Storable::DataToStream( theStr, "myName",        GetName().c_str() );
   Storable::DataToStream( theStr, "myTitle",       myTitle.c_str() );
   Storable::DataToStream( theStr, "myOrientation", myOrientation );
 }
@@ -254,7 +304,7 @@ VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject,
 const char* VISU::Table_i::GetTableTitle()
 {
   SALOMEDS::SObject_var SO = mySObj;
-  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -348,15 +398,93 @@ VISU::Curve_i::~Curve_i()
 {
   MESSAGE("Curve_i::~Curve_i");
 }
+
+//----------------------------------------------------------------------------
+void
+VISU::Curve_i
+::SetTitle( const char* theTitle )
+{
+  SetName( theTitle, true );
+}
+
+//----------------------------------------------------------------------------
+char*
+VISU::Curve_i
+::GetTitle()
+{
+  return CORBA::string_dup( GetName().c_str() );
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Curve_i
+::SetColor( const SALOMEDS::Color& theColor )
+{
+  myColor = theColor; 
+  myAuto = false;
+}
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color
+VISU::Curve_i
+::GetColor()
+{
+  return myColor;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Curve_i
+::SetMarker( VISU::Curve::MarkerType theType )
+{
+  myMarker = theType; 
+  myAuto = false;
+}
+
+//----------------------------------------------------------------------------
+VISU::Curve::MarkerType
+VISU::Curve_i
+::GetMarker()
+{
+  return myMarker;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Curve_i
+::SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth )
+{
+  myLine = theType; 
+  myLineWidth = theWidth; 
+  myAuto = false;
+}
+
+//----------------------------------------------------------------------------
+VISU::Curve::LineType
+VISU::Curve_i
+::GetLine()
+{
+  return myLine;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::Curve_i
+::GetLineWidth()
+{
+  return myLineWidth;
+}
+
+//----------------------------------------------------------------------------
 /*!
   Creates curve object
 */
 VISU::Storable* VISU::Curve_i::Create()
 {
   // generate name ...
-  myName = GetVerTitle();
-  if ( myName == "" )
-    myName = GenerateName();
+  SetName(GetVerTitle(), false);
+  if ( GetName() == "" )
+    SetName(GenerateName(), false);
   // ... and build the object
   return Build( false );
 }
@@ -371,11 +499,11 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring )
     if ( myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
       if ( !theRestoring ) {
        // look for component
-       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+       SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
        // create SObject and set attributes
        QString aComment;
        aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
-       string anEntry = CreateAttributes( myStudy,
+       string anEntry = CreateAttributes( GetStudyDocument(),
                                          myTable->GetObjectEntry(),
                                          "",
                                          GetID(),
@@ -384,7 +512,7 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring )
                                          aComment.latin1(),
                                          true );
        // create SObject referenced to real table object
-       mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str()));
+       mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str()));
       }
       return this;
     }
@@ -398,8 +526,8 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring )
 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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -426,8 +554,8 @@ 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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -456,8 +584,8 @@ 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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -484,8 +612,8 @@ 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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -512,8 +640,8 @@ 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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -540,8 +668,8 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringLis
 {
   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::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
@@ -659,9 +787,10 @@ SPlot2d_Curve* VISU::Curve_i::CreatePresentation()
   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(mySObj->GetID(),"VISU",GetName()));
+  CORBA::String_var aString = mySObj->GetID();
+  crv->setIO(new SALOME_InteractiveObject(aString.in(), "VISU", GetName().c_str()));
   if ( myTable )
-    crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry(),"VISU",myTable->GetName()));
+    crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry(), "VISU", myTable->GetName().c_str()));
   return crv;
 }
 /*!
@@ -671,7 +800,7 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S
 {
   if(MYDEBUG) MESSAGE(GetComment());
   mySObj = SALOMEDS::SObject::_duplicate(theSO);
-  myName = VISU::Storable::FindValue(theMap,"myName").latin1();
+  SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false);
   myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt();
   myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt();
   bool ok = false;
@@ -692,7 +821,7 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S
 */
 void VISU::Curve_i::ToStream( std::ostringstream& theStr )
 {
-  Storable::DataToStream( theStr, "myName",      myName.c_str() );
+  Storable::DataToStream( theStr, "myName",      GetName().c_str() );
   Storable::DataToStream( theStr, "myHRow",      myHRow );
   Storable::DataToStream( theStr, "myVRow",      myVRow );
   Storable::DataToStream( theStr, "myZRow",      myZRow );
@@ -790,19 +919,19 @@ VISU::Container_i::~Container_i()
 */
 void VISU::Container_i::AddCurve( Curve_ptr theCurve )
 {
-  if ( myStudy->_is_nil() )
+  if ( GetStudyDocument()->_is_nil() )
     return;
-  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() );
   if ( mySO->_is_nil() )
     return;
   PortableServer::POA_ptr 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() );
+    SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( entry.latin1() );
     if ( !SO->_is_nil() && myCurves.find( entry ) == myCurves.end() ) {
       myCurves.append( entry );
-      SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+      SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
       SALOMEDS::SObject_var newSO = Builder->NewObject( mySO );
       Builder->Addreference( newSO, SO );
     }
@@ -813,9 +942,9 @@ void VISU::Container_i::AddCurve( Curve_ptr theCurve )
 */
 void VISU::Container_i::RemoveCurve( Curve_ptr theCurve )
 {
-  if ( myStudy->_is_nil() )
+  if ( GetStudyDocument()->_is_nil() )
     return;
-  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() );
   if ( mySO->_is_nil() )
     return;
   PortableServer::POA_ptr aPOA = GetPOA();
@@ -825,8 +954,8 @@ void VISU::Container_i::RemoveCurve( Curve_ptr theCurve )
     if ( myCurves.find( entry ) != myCurves.end() ) {
       // found !!!
       myCurves.remove( entry );
-      SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
-      SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+      SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+      SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO );
       for ( ; CI->More(); CI->Next() ) {
        SALOMEDS::SObject_var childSO = CI->Value();
        SALOMEDS::SObject_var refSO;
@@ -850,19 +979,19 @@ CORBA::Long VISU::Container_i::GetNbCurves()
 */
 void VISU::Container_i::Clear()
 {
-  if ( myStudy->_is_nil() )
+  if ( GetStudyDocument()->_is_nil() )
     return;
-  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() );
   if ( mySO->_is_nil() )
     return;
   QStringList toDelete;
-  SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+  SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO );
   for ( ; CI->More(); CI->Next() ) {
     toDelete.append( CI->Value()->GetID() );
   }
-  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
   for ( int i = 0; i < toDelete.count(); i++ ) {
-    SALOMEDS::SObject_var SO = myStudy->FindObjectID( toDelete[i].latin1() );
+    SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( toDelete[i].latin1() );
     Builder->RemoveObject( SO );
   }
   myCurves.clear();
@@ -873,7 +1002,7 @@ void VISU::Container_i::Clear()
 VISU::Storable* VISU::Container_i::Create()
 {
   // generate name ...
-  myName = GenerateName();
+  SetName(GenerateName(), false);
   // ... and build the object
   return Build( false );
 }
@@ -884,11 +1013,11 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring )
 {
   if ( !theRestoring ) {
     // looking for component
-    SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
+    SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
     // create SObject and set attributes
     QString aComment;
     aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER);
-    string anEntry = CreateAttributes( myStudy,
+    string anEntry = CreateAttributes( GetStudyDocument(),
                                       SComponent->GetID(),
                                       "",
                                       GetID(),
@@ -896,7 +1025,7 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring )
                                       "",
                                       aComment.latin1(),
                                       true );
-    mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str()));
+    mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str()));
   }
   return this;
 }
@@ -905,19 +1034,19 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring )
 */
 void VISU::Container_i::Update()
 {
-  if ( myStudy->_is_nil() )
+  if ( GetStudyDocument()->_is_nil() )
     return;
-  SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
-  SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+  SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() );
   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() );
+      SALOMEDS::SObject_var SO = GetStudyDocument()->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 );
+       SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO );
        bool bFound = false;
        for ( ; CI->More(); CI->Next() ) {
          SALOMEDS::SObject_var childSO = CI->Value();
@@ -941,7 +1070,7 @@ void VISU::Container_i::Update()
       myCurves.remove( toDelete[i] );
     }
     toDelete.clear();
-    SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+    SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO );
     for ( ; CI->More(); CI->Next() ) {
       SALOMEDS::SObject_var childSO = CI->Value();
       SALOMEDS::SObject_var refSO;
@@ -951,7 +1080,7 @@ void VISU::Container_i::Update()
       }
     }
     for ( i = 0; i < toDelete.count(); i++ ) {
-      SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO );
+      SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO );
       for ( ; CI->More(); CI->Next() ) {
        SALOMEDS::SObject_var childSO = CI->Value();
        if ( toDelete[i] == CI->Value()->GetID() ) {
@@ -968,9 +1097,9 @@ void VISU::Container_i::Update()
 VISU::Curve_i* VISU::Container_i::GetCurve( CORBA::Long theIndex )
 {
   if ( theIndex > 0 && theIndex <= myCurves.count()  ) {
-    SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
     SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[  theIndex-1 ].latin1() );
+    SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( myCurves[  theIndex-1 ].latin1() );
     CORBA::Object_var anObject = VISU::SObjectToObject( SO );
     if( !CORBA::is_nil( anObject ) ) {
       // if real Curve Object exists
@@ -988,7 +1117,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa
 {
   if(MYDEBUG) MESSAGE(GetComment());
   mySObj = SALOMEDS::SObject::_duplicate(SO);
-  myName = VISU::Storable::FindValue( theMap, "myName" ).latin1();
+  SetName(VISU::Storable::FindValue( theMap, "myName" ).latin1(), false);
   QString val = VISU::Storable::FindValue( theMap, "myCurves" );
   myCurves = QStringList::split( QString( "*" ), val, false );
   return Build( true );
@@ -998,7 +1127,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa
 */
 void VISU::Container_i::ToStream( std::ostringstream& theStr )
 {
-  Storable::DataToStream( theStr, "myName",   myName.c_str() );
+  Storable::DataToStream( theStr, "myName",   GetName().c_str() );
   Storable::DataToStream( theStr, "myCurves", myCurves.join( QString( "*" ) ) );
 //  theStr<<" myName "<<myName;
 //  theStr<<" myCurves "<<myCurves.join( QString( "*" ) ).latin1()<<"* ";
index ceb9eade3172660c028f0d02119f6f31c3249151..86f8715a51d72264ee89cc78d92b66c15f401e6c 100644 (file)
@@ -46,11 +46,11 @@ namespace VISU{
     virtual ~Table_i();
     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
 
-    virtual void SetTitle( const char* theName ) { SetName( theName ); }
-    virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
+    virtual void SetTitle( const char* theTitle );
+    virtual char* GetTitle();
 
-    virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; }
-    virtual VISU::Table::Orientation GetOrientation() { return myOrientation; }
+    virtual void SetOrientation( VISU::Table::Orientation theOrientation );
+    virtual VISU::Table::Orientation GetOrientation();
 
     virtual CORBA::Long GetNbRows();
     virtual CORBA::Long GetNbColumns();
@@ -67,19 +67,22 @@ namespace VISU{
 
   public:
     virtual Storable* Create();
-    SALOMEDS::SObject_var GetSObject() const { return mySObj;}
+    SALOMEDS::SObject_var GetSObject() const;
+
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap,
+                              SALOMEDS::SObject_ptr SO);
 
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO);
     static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
                             const std::string& thePrefix,
                             const Storable::TRestoringMap& theMap);
+
     virtual void ToStream( std::ostringstream& theStr );
     static const std::string myComment;
     virtual const char* GetComment() const;
     virtual const char* GenerateName();
     virtual const char* GetTableTitle();
 
-    virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); }
+    virtual char* GetObjectEntry();
   };
   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
   bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
@@ -96,19 +99,18 @@ namespace VISU{
     virtual ~Curve_i();
     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
 
-    virtual void SetTitle( const char* theName ) { SetName( theName ); }
-    virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
+    virtual void SetTitle( const char* theTitle );
+    virtual char* GetTitle();
 
-    virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
-    virtual SALOMEDS::Color GetColor() { return myColor; }
+    virtual void SetColor( const SALOMEDS::Color& theColor );
+    virtual SALOMEDS::Color GetColor();
 
-    virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
-    virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
+    virtual void SetMarker( VISU::Curve::MarkerType theType );
+    virtual VISU::Curve::MarkerType GetMarker();
 
-    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; }
+    virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth );
+    virtual VISU::Curve::LineType GetLine();
+    virtual CORBA::Long GetLineWidth();
 
     virtual void RemoveFromStudy();
 
index 5faacca8d429b41547d7a6cc7a2176acf1cfda6b..0f59e786f210db4c0f5a3ae59944d1f114d4a87a 100644 (file)
@@ -245,7 +245,12 @@ namespace
       int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt();
       
       bool anIsCreated = false;
-      TPrs3d* aPresent = new TPrs3d(theResult, false);
+      TPrs3d* aPresent = new TPrs3d(VISU::ColoredPrs3d_i::EDoNotPublish);
+      aPresent->SetCResult(theResult);
+      aPresent->SetMeshName(aMeshName.latin1());
+      aPresent->SetEntity(anEntity);
+      aPresent->SetFieldName(aFieldName.latin1());
+      aPresent->SetTimeStampNumber(aTimeStampId);
 #ifdef NO_CAS_CATCH
       try{       
         OCC_CATCH_SIGNALS;
@@ -253,7 +258,7 @@ namespace
       CASCatch_TRY{
         try{
 #endif
-          if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){
+          if(aPresent->Apply(false)){
             anIsCreated = true;
             theData.myPrs[aFrameId++] = aPresent;
             aMin = std::min(aPresent->GetMin(), aMin);
@@ -1106,12 +1111,12 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       VISU::Storable::TRestoringMap aPrsMap;
       VISU::Storable::StrToMap(strPrsIn,aPrsMap);
 
-      aData.myPrs[0]->Restore(aPrsMap);
+      aData.myPrs[0]->Restore(VISU::GetDSStudy(myStudy), aPrsMap);
     }
     aData.myPrs[0]->GetOffset(aData.myOffset);
     for (int i = 1; i < aData.myNbFrames; i++) {
       //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]);
-      aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005
+      aData.myPrs[i]->SameAs(aData.myPrs[0]);//jfa 03.08.2005
     }
   }
   string aStr = aAnimSObject->GetID();
index c8bd8a59f34e3b2f0bef0809fb6743327752d121..e39def962171de2ebf51b674d1d6265643d5851d 100644 (file)
@@ -35,9 +35,6 @@
 
 #include <vtkProperty.h>
 
-using namespace VISU;
-using namespace std;
-
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -46,62 +43,85 @@ static int MYDEBUG = 0;
 
 static int INCMEMORY = 4+12;
 
-int VISU::Vectors_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                               const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//---------------------------------------------------------------
+size_t 
+VISU::Vectors_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            VISU::Entity theEntity,
+            const std::string& theFieldName, 
+            CORBA::Long theTimeStampNumber,
+            bool theIsMemoryCheck)
 {
-  bool aResult = false;
   try{
-    aResult = DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false);
-    if(isMemoryCheck && aResult){
-      float aSize = INCMEMORY*
-       theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
+    size_t aResult = TSuperClass::IsPossible(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theTimeStampNumber,
+                                            false);
+    if(theIsMemoryCheck && aResult){
+      bool anIsEstimated = true;
+      VISU::Result_i::TInput* anInput = theResult->GetInput();
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-      MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+      if(MYDEBUG) 
+       MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     }
+    return aResult;
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
     INFOS("Unknown exception was occured!");
   }
-  return aResult;
+  return 0;
 }
 
-
+//---------------------------------------------------------------
 int VISU::Vectors_i::myNbPresent = 0;
-QString VISU::Vectors_i::GenerateName() { return VISU::GenerateName("Vectors",myNbPresent++);}
 
+//---------------------------------------------------------------
+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,theAddToStudy),
-  ColoredPrs3d_i(theResult,theAddToStudy),
-  ScalarMap_i(theResult,theAddToStudy),
-  DeformedShape_i(theResult,theAddToStudy),
-  myVectorsPL(NULL)
+//---------------------------------------------------------------
+const char* 
+VISU::Vectors_i
+::GetComment() const
 {
+  return myComment.c_str();
 }
 
 
-VISU::Vectors_i::
-Vectors_i(Result_i* theResult, 
-         SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  DeformedShape_i(theResult,theSObject),
+//---------------------------------------------------------------
+VISU::Vectors_i
+::Vectors_i(EPublishInStudyMode thePublishInStudyMode) :
+  ColoredPrs3d_i(thePublishInStudyMode),
+  ScalarMap_i(thePublishInStudyMode),
+  DeformedShape_i(thePublishInStudyMode),
+  myLineWidth(1.0),
   myVectorsPL(NULL)
-{
-}
+{}
 
 
-void VISU::Vectors_i::SameAs(const VISU::Prs3d_i* theOrigin)
+//---------------------------------------------------------------
+void
+VISU::Vectors_i
+::SameAs(const VISU::Prs3d_i* theOrigin)
 {
   TSuperClass::SameAs(theOrigin);
 
@@ -112,17 +132,26 @@ void VISU::Vectors_i::SameAs(const VISU::Prs3d_i* theOrigin)
 }
 
 
-VISU::Storable* VISU::Vectors_i::Create(const char* theMeshName, VISU::Entity theEntity, 
-                                       const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::Vectors_i
+::Create(const std::string& theMeshName, 
+        VISU::Entity theEntity,
+        const std::string& theFieldName, 
+        CORBA::Long theTimeStampNumber)
 {
-  myLineWidth = 1.0;
-  return DeformedShape_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+  return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
 }
 
 
-VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable* 
+VISU::Vectors_i
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt()));
   SetGlyphPos(VISU::Vectors::GlyphPos(VISU::Storable::FindValue(theMap,"myPosGlyph").toInt()));
@@ -132,8 +161,12 @@ VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap)
 }
 
 
-void VISU::Vectors_i::ToStream(std::ostringstream& theStr){
-  DeformedShape_i::ToStream(theStr);
+//---------------------------------------------------------------
+void 
+VISU::Vectors_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myTypeGlyph", int(GetGlyphType()));
   Storable::DataToStream( theStr, "myPosGlyph",  int(GetGlyphPos()));
@@ -141,57 +174,106 @@ void VISU::Vectors_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::Vectors_i::~Vectors_i(){
+//---------------------------------------------------------------
+VISU::Vectors_i
+::~Vectors_i()
+{
   if(MYDEBUG) MESSAGE("Vectors_i::~Vectors_i()");
 }
 
 
-void VISU::Vectors_i::SetLineWidth(CORBA::Double theWidth) { 
+//---------------------------------------------------------------
+void
+VISU::Vectors_i
+::SetLineWidth(CORBA::Double theWidth) 
+{ 
   myLineWidth = theWidth;
+  myParamsTime.Modified();
 }
-CORBA::Double VISU::Vectors_i::GetLineWidth() { 
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::Vectors_i
+::GetLineWidth() 
+{ 
   return myLineWidth;
 }
 
 
-void VISU::Vectors_i::SetGlyphType(VISU::Vectors::GlyphType theType) { 
+//---------------------------------------------------------------
+void 
+VISU::Vectors_i
+::SetGlyphType(VISU::Vectors::GlyphType theType) 
+{ 
   myVectorsPL->SetGlyphType(VISU_VectorsPL::GlyphType(theType));
 }
-VISU::Vectors::GlyphType VISU::Vectors_i::GetGlyphType() { 
+
+//---------------------------------------------------------------
+VISU::Vectors::GlyphType 
+VISU::Vectors_i
+::GetGlyphType() 
+{ 
   return VISU::Vectors::GlyphType(myVectorsPL->GetGlyphType());
 }
 
 
-void VISU::Vectors_i::SetGlyphPos(VISU::Vectors::GlyphPos thePos) { 
+//---------------------------------------------------------------
+void
+VISU::Vectors_i
+::SetGlyphPos(VISU::Vectors::GlyphPos thePos) 
+{ 
   myVectorsPL->SetGlyphPos(VISU_VectorsPL::GlyphPos(thePos));
 }
-VISU::Vectors::GlyphPos VISU::Vectors_i::GetGlyphPos() { 
+
+//---------------------------------------------------------------
+VISU::Vectors::GlyphPos 
+VISU::Vectors_i::GetGlyphPos() 
+{ 
   return VISU::Vectors::GlyphPos(myVectorsPL->GetGlyphPos());
 }
 
 
-void VISU::Vectors_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_VectorsPL::New();
-  myVectorsPL = dynamic_cast<VISU_VectorsPL*>(myPipeLine);
+//---------------------------------------------------------------
+void
+VISU::Vectors_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+  if(!thePipeLine){
+    myVectorsPL = VISU_VectorsPL::New();
+  }else
+    myVectorsPL = dynamic_cast<VISU_VectorsPL*>(thePipeLine);
 
-  DeformedShape_i::DoHook();
+  TSuperClass::CreatePipeLine(myVectorsPL);
 }
 
 
-VISU_PipeLine* VISU::Vectors_i::GetPipeLine(){
+//---------------------------------------------------------------
+VISU_PipeLine* 
+VISU::Vectors_i
+::GetActorPipeLine()
+{
   VISU_PipeLine* aPipeLine = VISU_VectorsPL::New();
-  aPipeLine->SetIDMapper(myPipeLine->GetIDMapper());
-  aPipeLine->ShallowCopy(myPipeLine);
-  aPipeLine->Update();
+  aPipeLine->ShallowCopy(GetPipeLine(), true);
   return aPipeLine;
 }
 
 
-VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+//---------------------------------------------------------------
+bool
+VISU::Vectors_i
+::CheckIsPossible() 
+{
+  return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+//---------------------------------------------------------------
+VISU_Actor* 
+VISU::Vectors_i
+::CreateActor()
 {
   VISU_VectorsAct* anActor = VISU_VectorsAct::New();
   try{
-    VISU::Prs3d_i::CreateActor(anActor,theIO);
+    VISU::Prs3d_i::CreateActor(anActor);
     anActor->SetVTKMapping(true);
     anActor->SetBarVisibility(true);
     anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
@@ -210,12 +292,16 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)&
 }
 
 
-void VISU::Vectors_i::UpdateActor(VISU_Actor* theActor) {
+//---------------------------------------------------------------
+void 
+VISU::Vectors_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_VectorsAct* anActor = dynamic_cast<VISU_VectorsAct*>(theActor)){
-    VISU::DeformedShape_i::UpdateActor(anActor);
+    TSuperClass::UpdateActor(anActor);
     anActor->GetProperty()->SetLineWidth(GetLineWidth());
     if(VISU_VectorsPL* aVectorsPL = dynamic_cast<VISU_VectorsPL*>(anActor->GetPipeLine())){
-      aVectorsPL->ShallowCopy(myPipeLine);
+      aVectorsPL->ShallowCopy(GetPipeLine(), true);
       aVectorsPL->Update();
       aVectorsPL->SetMapScale(myVectorsPL->GetMapScale());
     }
index 9177228d0792272e73a7ecdef1825e39d6a3b8be..f37080cedd3a77587821cb605e8931c49691e802 100644 (file)
@@ -31,7 +31,8 @@
 
 class VISU_VectorsPL;
 
-namespace VISU{
+namespace VISU
+{
   class Vectors_i : public virtual POA_VISU::Vectors,
                    public virtual DeformedShape_i
   {
@@ -43,54 +44,123 @@ namespace VISU{
     typedef DeformedShape_i TSuperClass;
 
     explicit
-    Vectors_i(Result_i* theResult,
-             bool theAddToStudy);
-    explicit
-    Vectors_i(Result_i* theResult,
-             SALOMEDS::SObject_ptr theSObject);
-    virtual void SameAs(const Prs3d_i* theOrigin);
-    virtual ~Vectors_i();
+    Vectors_i(EPublishInStudyMode thePublishInStudyModep);
+
+    virtual
+    void
+    SameAs(const Prs3d_i* theOrigin);
+
+    virtual
+    ~Vectors_i();
+
+    virtual
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TVECTORS;
+    }
+
+    virtual
+    void 
+    SetLineWidth(CORBA::Double theWidth);
 
-    virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
+    virtual
+    CORBA::Double
+    GetLineWidth();
+
+    virtual 
+    void 
+    SetGlyphType(VISU::Vectors::GlyphType theType);
 
-    virtual void SetLineWidth(CORBA::Double theWidth);
-    virtual CORBA::Double GetLineWidth();
+    virtual
+    VISU::Vectors::GlyphType 
+    GetGlyphType();
 
-    virtual void SetGlyphType(VISU::Vectors::GlyphType theType);
-    virtual VISU::Vectors::GlyphType GetGlyphType();
+    virtual 
+    void 
+    SetGlyphPos(VISU::Vectors::GlyphPos thePos);
 
-    virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos);
-    virtual VISU::Vectors::GlyphPos GetGlyphPos();
+    virtual 
+    VISU::Vectors::GlyphPos 
+    GetGlyphPos();
 
     typedef VISU::Vectors TInterface;
-    VISU_VectorsPL* GetVectorsPL(){ return myVectorsPL;}
 
+    VISU_VectorsPL* 
+    GetSpecificPL() const
+    { 
+      return myVectorsPL; 
+    }
+    
   protected:
-    virtual void DoHook();
-    virtual VISU_PipeLine* GetPipeLine();
+    //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+    virtual
+    void
+    CreatePipeLine(VISU_PipeLine* thePipeLine);
+
+    //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
+    virtual 
+    bool 
+    CheckIsPossible();
+
+    virtual
+    VISU_PipeLine* 
+    GetActorPipeLine();
 
     VISU_VectorsPL *myVectorsPL;
     float myLineWidth;
 
   public:
-    static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
-    virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
-                            const char* theFieldName, int theIteration);
+    //! Redefines VISU_ColoredPrs3d_i::IsPossible
+    static 
+    size_t 
+    IsPossible(Result_i* theResult, 
+              const std::string& theMeshName, 
+              VISU::Entity theEntity,
+              const std::string& theFieldName, 
+              CORBA::Long theTimeStampNumber,
+              bool theIsMemoryCheck);
+
+    //! Redefines VISU_ColoredPrs3d_i::Create
+    virtual
+    Storable* 
+    Create(const std::string& theMeshName, 
+          VISU::Entity theEntity,
+          const std::string& theFieldName, 
+          CORBA::Long theTimeStampNumber);
 
-    virtual void ToStream(std::ostringstream& theStr);
+    //! Redefines VISU_ColoredPrs3d_i::ToStream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    //! Redefines VISU_ColoredPrs3d_i::Restore
+    virtual
+    Storable* 
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
 
+    //! Redefines VISU_ColoredPrs3d_i::GetComment
+    virtual
+    const char* 
+    GetComment() const;
+
+    //! Redefines VISU_ColoredPrs3d_i::GenerateName
+    virtual
+    QString
+    GenerateName();
+
+    //! Redefines VISU_ColoredPrs3d_i::CreateActor
     virtual
     VISU_Actor* 
-    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    CreateActor();
 
-    virtual void UpdateActor(VISU_Actor* theActor) ;
+    //! Redefines VISU_ColoredPrs3d_i::UpdateActor
+    virtual
+    void
+    UpdateActor(VISU_Actor* theActor) ;
   };
 }
 
index cb6425f49db1ecf6c4f9ca6ef8a32aca6a1eff5c..439bb3a47c5d615ad984fb1ce4466170a62d7bb4 100644 (file)
@@ -51,6 +51,9 @@
 #include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
@@ -60,7 +63,7 @@
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -340,7 +343,7 @@ namespace VISU {
        for (int i = 0; i < clist.count(); i++) {
          SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
          if (aSPlot2dC->hasIO() &&
-             !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+             theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) {
            if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC);
            theView->eraseCurve(aSPlot2dC);
          }
@@ -352,7 +355,7 @@ namespace VISU {
        for (int i = 0; i < clist.count(); i++) {
          SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
          if (aSPlot2dC->hasIO() &&
-             !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+             theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) {
            if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);
            aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
            aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
@@ -401,7 +404,7 @@ namespace VISU {
        for (int i = 0; i < clist.count(); i++) {
          SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
          if (aSPlot2dC->hasIO() &&
-             !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+             theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) {
            if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC);
            aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
            aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
@@ -446,17 +449,38 @@ namespace VISU {
     }
   }
 
-  VISU_Actor* GetActor (VISU::Prs3d_i* thePrs3d, SVTK_ViewWindow* theVTKFrame)
+
+  //----------------------------------------------------------------------------
+  struct TIsSamePrs3d
   {
-    vtkActorCollection *anActColl = theVTKFrame->getRenderer()->GetActors();
-    anActColl->InitTraversal();
-    while (vtkActor *anActor = anActColl->GetNextActor())
-      if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
-       if (thePrs3d == anVISUActor->GetPrs3d())
-         return anVISUActor;
-    return NULL;
+    VISU::Prs3d_i* myPrs3d;
+
+    TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
+      myPrs3d(thePrs3d)
+    {}
+    
+    bool
+    operator()(VISU_Actor* theActor) 
+    {
+      return theActor->GetPrs3d() == myPrs3d;
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  VISU_Actor* 
+  FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d)
+  {
+    if(!thePrs3d)
+      return NULL;
+
+    vtkRenderer* aRenderer = theViewWindow->getRenderer();
+    vtkActorCollection* anActors = aRenderer->GetActors();
+    return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
   }
 
+
+  //----------------------------------------------------------------------------
   struct TDeleteActorsEvent: public SALOME_Event
   {
     VISU::Curve_i* myPrs;
@@ -530,7 +554,7 @@ namespace VISU {
              for (int i = 0; i < clist.count(); i++) {
                 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
                  if (cu->hasIO() &&
-                     strcmp(cu->getIO()->getEntry(), myPrs->GetEntry()) == 0) {
+                     myPrs->GetEntry() == cu->getIO()->getEntry()) {
                    vf->eraseCurve(cu);
                  }
                }
index 2fc2255891c7b332c9c70c364e2cac40378fe238..2d489972b81d4318e7bc08ccbd84c0093dfad82e 100644 (file)
@@ -73,7 +73,7 @@ namespace VISU {
   VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL);
   void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
 
-  VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
+  VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d);
 
   void DeleteActors (VISU::Prs3d_i* thePrs);
   void DeleteActors (VISU::Curve_i* thePrs);
index abb6ad9b1da7a637298e46840812e009d8867c7c..7b03bad4bc3400edbf98557d0d77560c14d0c151 100644 (file)
@@ -1286,7 +1286,7 @@ namespace VISU {
           }
         }
         if (!aCStudy) return;
-       _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1());
+       _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry());
        if (TableSO) {
          _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
          for (; Iter->More(); Iter->Next()) {
@@ -1557,40 +1557,36 @@ namespace VISU {
   {
     class TEvent: public SALOME_Event
     {
-      SUIT_ViewWindow* myVW;
+      SUIT_ViewWindow* myViewWindow;
     public:
       TEvent(SUIT_ViewWindow* theViewWindow):
-       myVW(theViewWindow)
+       myViewWindow(theViewWindow)
       {}
       virtual void Execute()
       {
-       SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(myVW);
-       vtkRenderer* Renderer = vf->getRenderer();
-       vtkActorCollection* theActors = Renderer->GetActors();
-       theActors->InitTraversal();
-       while (vtkActor *anAct = theActors->GetNextActor()) {
+       SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myViewWindow);
+       vtkRenderer* aRenderer = aViewWindow->getRenderer();
+       vtkActorCollection* anActors = aRenderer->GetActors();
+       anActors->InitTraversal();
+       while (vtkActor *anAct = anActors->GetNextActor()) {
          if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
-           VISU::Prs3d_i* aPrs3d  = anActor->GetPrs3d();
-           if (anActor->GetVisibility() && aPrs3d) {
-             aPrs3d->Update();
-             aPrs3d->UpdateActor(anActor);
-           }
+           if (anActor->GetVisibility()) 
+             anActor->UpdateFromFactory();
          }
        }
-       RepaintView(myVW);
+       RepaintView(myViewWindow);
       }
     };
 
-    SUIT_ViewWindow* aVW = GetViewWindow();
-    if (aVW)
-      ProcessVoidEvent(new TEvent(aVW));
+    if (SUIT_ViewWindow* aViewWindow = GetViewWindow())
+      ProcessVoidEvent(new TEvent(aViewWindow));
   }
 
-  bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+  bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
   {
     MESSAGE("View3D_i::SaveViewParams()");
 
-    if (!theViewManager || !theName)
+    if (!theViewManager || theName == "")
       return false;
 
     _PTR(Study) aCStudy;
@@ -1602,8 +1598,8 @@ namespace VISU {
     if (!aCStudy)
       return false;
 
-    if (strcmp(theName, "") != 0) {
-      std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
+    if (theName != "") {
+      std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName.c_str(), "VISU");
       _PTR(GenericAttribute) anAttr;
       int iEnd = aList.size();
       for (int i = 0; i < iEnd; i++) {
@@ -1623,7 +1619,12 @@ namespace VISU {
     }
     _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
     string aSComponentEntry = aSComponent->GetID();
-    string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "",
+    string anEntry = CreateAttributes(aCStudy, 
+                                     aSComponentEntry.c_str(), 
+                                     "", 
+                                     "", 
+                                     theName, 
+                                     "",
                                      ToString(theViewManager->getActiveView()).c_str());
     return true;
   }
@@ -1631,10 +1632,10 @@ namespace VISU {
   class TSaveViewParamsEvent: public SALOME_Event
   {
     SUIT_ViewManager* myViewMgr;
-    const char*       myName;
+    std::string       myName;
   public:
     TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
-                         const char*       theName):
+                         const std::string& theName):
       myViewMgr(theViewManager),
       myName(theName)
     {}
@@ -1647,12 +1648,12 @@ namespace VISU {
     TResult myResult;
   };
 
-  CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
+  CORBA::Boolean View3D_i::SaveViewParams (const char* theViewParamsName)
   {
-    return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName));
+    return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theViewParamsName));
   }
 
-  bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+  bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
   {
     _PTR(Study) aCStudy;
     if (SUIT_Study* aSStudy = theViewManager->study()) {
@@ -1690,10 +1691,10 @@ namespace VISU {
   class TRestoreViewParamsEvent: public SALOME_Event
   {
     SUIT_ViewManager* myViewMgr;
-    const char*       myName;
+    std::string       myName;
   public:
     TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
-                            const char*       theName):
+                            const std::string& theName):
       myViewMgr(theViewManager),
       myName(theName)
     {}
@@ -1706,9 +1707,9 @@ namespace VISU {
     TResult myResult;
   };
 
-  CORBA::Boolean View3D_i::RestoreViewParams (const char* theName)
+  CORBA::Boolean View3D_i::RestoreViewParams (const char* theViewParamsName)
   {
-    return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
+    return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theViewParamsName));
   }
 
   void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
@@ -2194,7 +2195,7 @@ namespace VISU {
        if (!aPrs) {
          myError = "Corrupted presentation";
        } else {
-         VISU_Actor* anActor = VISU::GetActor(aPrs, vw);
+         VISU_Actor* anActor = VISU::FindActor(vw, aPrs);
          if (!anActor) {
            myError = "No actor found. Display the presentation at first.";
          } else {
index 2000ab7996f67b4ef75be90a93f26bd154069916..0c1cf1f0398deaf704dc975a7fd91ef1a2692660 100644 (file)
@@ -278,12 +278,12 @@ namespace VISU
     static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
 
     static  bool           SaveViewParams (SUIT_ViewManager* theViewManager,
-                                           const char* theName);
-    virtual CORBA::Boolean SaveViewParams (const char* theName);
+                                           const std::string& theName);
+    virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName);
 
     static  bool           RestoreViewParams (SUIT_ViewManager* theViewManager,
-                                              const char* theName);
-    virtual CORBA::Boolean RestoreViewParams (const char* theName);
+                                              const std::string& theName);
+    virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName);
 
     static QString GenerateViewParamsName();
 
index 98950247707cd814aad0d40a6d22ce854d9f6c5e..6f1cc70aaa194e78842ccc33ef1aebe1dc88340f 100644 (file)
@@ -42,7 +42,7 @@ SWIG_DEF = libVISU_Swig.i
 EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \
        visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \
        visu_table.py visu_big_table.py visu_view.py visu_delete.py \
-       visu_swig_test.py visu_split_views.py \
+       visu_swig_test.py visu_split_views.py visu_change_input.py visu_cache.py \
        VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \
        VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py
 EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py
index 0f79ad0b790fcafcb919fc867320d0d254790c95..22d96130db12c92ff26cbd8ff10216770e6c19ec 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "VISU_Convertor.hxx"
 #include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -48,15 +49,11 @@ ScalarMap::ScalarMap(Convertor* theConvertor, const char* theMeshName, int theEn
   : myScalarMap(NULL)
 {
   if(VISU_Convertor* aConvertor = theConvertor->GetImpl()){
-    VISU::PIDMapper anIDMapper = 
+    VISU::PUnstructuredGridIDMapper anIDMapper = 
       aConvertor->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
-    VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
-    if(aDataSet){
+    if(anIDMapper){
       myScalarMap = VISU_ScalarMapPL::New();
-      myScalarMap->SetInput(aDataSet);
-      myScalarMap->Build();
-      myScalarMap->Init();
-      myScalarMap->SetSourceRange();
+      myScalarMap->SetUnstructuredGridIDMapper(anIDMapper);
     }
   }
 }
@@ -93,8 +90,6 @@ void View3D::Display(ScalarMap* theScalarMap){
     VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
     aScalarBar->SetLookupTable(aScalarMap->GetBarTable());
     
-    aScalarMap->Build();
-    
     myRen->AddActor(anActor);
     myRen->AddActor2D(aScalarBar);
     myRen->ResetCameraClippingRange();
index 15d5b7fe3907f0595d6c5a510fd73e5e4a02fd8e..7e7b0e713c106a3eb447341534ae77e9b9112e9b 100644 (file)
@@ -31,6 +31,7 @@ import SALOME
 import SALOME_Session_idl
 import SALOMEDS
 import SALOME_MED
+import SALOME_ModuleCatalog
 from omniORB import CORBA
 from string import *
 from time import sleep
@@ -77,7 +78,8 @@ def PublishComponent(theStudyDocument):
 
         aSComponent = aStudyBuilder.NewComponent(aComponentDataType);
         aName = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributeName")
-        aModuleCatalog = myNamingService.Resolve("/Kernel/ModulCatalog");
+        aModuleCatalogObj = myNamingService.Resolve("/Kernel/ModulCatalog");
+        aModuleCatalog = aModuleCatalogObj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
         aComponent = aModuleCatalog.GetComponent(aComponentDataType);
         if aComponent != None:
             aComponentUserName = aComponent._get_componentusername()
index af6f65ed3c64c79544a322719643adde544aa733..b1b3ec4e82cd8d9160f535d620cba7d624660d5c 100644 (file)
 
 #include "VVTK_ViewWindow.h"
 
-VVTK_Viewer::
-VVTK_Viewer()
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+#include "VISU_Actor.h"
+#include "SVTK_View.h"
+#include "SVTK_Prs.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+//---------------------------------------------------------------
+VVTK_Viewer
+::VVTK_Viewer()
 {
 }
 
-VVTK_Viewer::
-~VVTK_Viewer() 
+//---------------------------------------------------------------
+VVTK_Viewer
+::~VVTK_Viewer() 
 {
 }
 
-//==========================================================
+//---------------------------------------------------------------
 SUIT_ViewWindow*
-VVTK_Viewer::
-createView( SUIT_Desktop* theDesktop )
+VVTK_Viewer
+::createView( SUIT_Desktop* theDesktop )
 {
   TViewWindow* aViewWindow = new TViewWindow (theDesktop);
   aViewWindow->Initialize(this);
@@ -44,3 +55,69 @@ createView( SUIT_Desktop* theDesktop )
 
   return aViewWindow;
 }
+
+//---------------------------------------------------------------
+void
+VVTK_Viewer
+::Display(const SALOME_VTKPrs* thePrs)
+{
+  // try do downcast object
+  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>(thePrs)){
+    if(aPrs->IsNull())
+      return;
+    if(vtkActorCollection* aCollection = aPrs->GetObjects()){
+      aCollection->InitTraversal();
+      while(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(aCollection->GetNextActor())){
+       if(!anActor->GetFactory()->GetActiveState())
+         continue;
+       QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+       for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+         if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+           if(SVTK_View* aView = aViewWindow->getView()){
+             aView->Display(anActor, false);
+           }
+         }
+       }
+      }
+    }
+  }
+}
+
+//---------------------------------------------------------------
+namespace VVTK
+{
+  struct TIsOneActorVisibleAction
+  {
+    bool& myResult;
+    TIsOneActorVisibleAction(bool& theResult): 
+      myResult(theResult)
+    {
+      myResult = false;
+    }
+    void
+    operator()(SALOME_Actor* theActor)
+    {
+      if(!myResult)
+       myResult = theActor->GetVisibility();
+    }
+  };
+}
+
+//---------------------------------------------------------------
+bool
+VVTK_Viewer
+::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+      bool aResult;
+      VVTK::TIsOneActorVisibleAction anAction(aResult);
+      SVTK::ForEachIf<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),
+                                   SVTK::TIsSameIObject<SALOME_Actor>(theIO),
+                                   anAction);
+      return anAction.myResult;
+    }
+  
+  return false;
+}
index fb7ca0dc850002571d25c3100473aa69e2c50dad..35fefc2b43277b33863bdc668008ad8a7390b90b 100644 (file)
@@ -34,16 +34,41 @@ class VVTK_EXPORT VVTK_Viewer : public SVTK_Viewer
 
 public:
   typedef VVTK_ViewWindow TViewWindow;
-  static QString Type() { return "VVTK"; }
+
+  static
+  QString
+  Type() 
+  { 
+    return "VVTK"; 
+  }
 
   VVTK_Viewer();
-  virtual ~VVTK_Viewer();
+
+  virtual
+  ~VVTK_Viewer();
 
   //! See #SUIT_ViewModel::createView
-  virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+  virtual
+  SUIT_ViewWindow* 
+  createView(SUIT_Desktop*);
 
   //! See SUIT_ViewModel::getType
-  virtual QString getType() const { return Type(); }
+  virtual
+  QString 
+  getType() const 
+  { 
+    return Type(); 
+  }
+
+  //! See #SALOME_View::Display( const SALOME_Prs* )
+  virtual
+  void
+  Display(const SALOME_VTKPrs* thePrs); 
+
+  //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
+  virtual
+  bool
+  isVisible(const Handle(SALOME_InteractiveObject)& theIO);
 };
 
 #endif
index b0d70802dba05899c2066d7fb39b3024644007f4..a7512e886c9ca1872e79e69f084524fc9ef05364 100755 (executable)
@@ -227,6 +227,8 @@ VVTK_ViewWindow
            bool theIsHighlight, 
            bool theIsUpdate ) 
 {
+  if(GetSelector()->AddIObject(theIO))
+    GetSelector()->EndPickCallback();
   myView1->highlight( theIO, theIsHighlight, theIsUpdate );
   myView2->highlight( theIO, theIsHighlight, theIsUpdate );
 }