]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
PR: merge from V1_0_4b1 mergefrom_trunk_01Feb04
authorprascle <prascle>
Sun, 1 Feb 2004 20:38:25 +0000 (20:38 +0000)
committerprascle <prascle>
Sun, 1 Feb 2004 20:38:25 +0000 (20:38 +0000)
101 files changed:
INSTALL
bin/VERSION
doc/html/INPUT/doxyfile
doc/html/INPUT/sources/static/tree.js
idl/VISU_Gen.idl
src/CONVERTOR/Makefile.in
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.cxx
src/CONVERTOR/VISU_Convertor.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_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/OBJECT/Makefile.in
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_MeshAct.cxx
src/PIPELINE/Makefile.in
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_CutLinesPL.cxx
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_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_UsedPointsFilter.cxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx
src/VISUGUI/Makefile.in
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.h
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.h
src/VISUGUI/VisuGUI_InitMeshDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.h
src/VISUGUI/VisuGUI_MagnitudeDlg.cxx
src/VISUGUI/VisuGUI_MagnitudeDlg.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_Selection.h
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.h
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_TimeAnimation.h
src/VISUGUI/VisuGUI_VectorsDlg.cxx
src/VISUGUI/VisuGUI_VectorsDlg.h
src/VISU_I/Makefile.in
src/VISU_I/VISUConfig.cc
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_CorbaMedConvertor.cxx
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_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
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_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_PrsObject_i.cc
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_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_SWIG/Makefile.in
src/VISU_SWIG/batchmode_visu_table.py
src/VISU_SWIG/visu.py
src/VISU_SWIG/visu_big_table.py
src/VISU_SWIG/visu_med.py
src/VISU_SWIG/visu_prs_example.py
src/VISU_SWIG/visu_table.py

diff --git a/INSTALL b/INSTALL
index 0433cf121970741bd1640f79dbe16f133a48ba1d..1e30dd5bbaeddb95d722cf4a9fb516acf3db3e37 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-This is the version 1.3.0 of VISU
+This is the version 1.4.0 of VISU
 Compatible with :
-       - KERNEL 1.3.0
-       - MED 1.3.0
+       - KERNEL 1.4.0
+       - MED 1.4.0
index b7a46ecf00b450955bd11b8103d48e0b5419e49d..fc5321c0611834437ae4d62395ed67a651fc289c 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - VISU VERSION: 1.3.0
+THIS IS SALOME - VISU VERSION: 1.4.0
index 340e445ebd566cffa75041242482dde541e0ef1d..ea9d33baaaab43346576e110637920b7f49bcb30 100755 (executable)
@@ -3,7 +3,7 @@
 #---------------------------------------------------------------------------
 # General configuration options
 #---------------------------------------------------------------------------
-PROJECT_NAME           = "SALOME - VISU - v.1.3.0"
+PROJECT_NAME           = "SALOME - VISU - v.1.4.0"
 PROJECT_NUMBER         = id#1.1
 OUTPUT_DIRECTORY       = ../
 OUTPUT_LANGUAGE        = English
index 9028d79032645894a2eef2df70f12aead8f3e7f2..e0ae6c3d2105891a8523bc2a0e67d9eff297e2ac 100755 (executable)
@@ -1,4 +1,4 @@
-foldersTree = gFld("<b>SALOME v.1.3.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.1.4.0 </b>", "", "")
      insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
 
 aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
index 5d62ff55c198ccaaa88c0ce6a9f569a9ec6d7e89..77957a23b8a90412950ba4917300cb19cd23189a 100644 (file)
 */
 
 #ifndef __VISU_GEN__
-#define __VISU_GEN__
-
-#include "SALOME_Exception.idl"
-#include "SALOME_Component.idl"
-#include "SALOMEDS.idl"
-#include "SALOMEDS_Attributes.idl"
-#include "MED.idl"
-
-/*!
-  The main package of interfaces of the post-processing module %VISU.
-*/
+#define __VISU_GEN__ 
+#include "SALOME_Exception.idl" 
+#include "SALOME_GenericObj.idl"
+#include "SALOME_Component.idl" 
+#include "SALOMEDS.idl" 
+#include "SALOMEDS_Attributes.idl" 
+#include "MED.idl" 
+/*! 
+  The main package of interfaces of the post-processing module %VISU. 
+*/ 
 module VISU {
-  //-------------------------------------------------------
-  typedef string IdType;
-/*!
- This enumeration contains a set of elements defining the type of the scaling, which
-can be applied on different presentations.
-*/
-  enum Scaling{ LINEAR, /*!< Linear type of scaling. */
-               LOGARITHMIC /*!< Logarithmic type of scaling. */
-             };
-  enum Entity{ NODE, EDGE, FACE, CELL};
-/*!
- This enumeration contains a set of elements defining the type of the %VISU object.
-*/
-   enum VISUType{ TNONE,
-                 TCURVE, TTABLE, TCONTAINER, TMESH, TSCALARMAP,
-                 TISOSURFACE, TDEFORMEDSHAPE, TCUTPLANES, TCUTLINES, TVECTORS, TSTREAMLINES,
-                  TVISUGEN, TVIEWMANAGER, TRESULT,
-                 TXYPLOT, TTABLEVIEW, TVIEW3D,
-                 TENTITY, TFAMILY, TGROUP, TFIELD, TTIMESTAMP,
-                  TALL};
+  //------------------------------------------------------- 
+  typedef string IdType; 
+/*! 
+ This enumeration contains a set of elements defining the type of the scaling, which 
+can be applied on different presentations. 
+*/ 
+  enum Scaling{ LINEAR, /*!< Linear type of scaling. */ 
+               LOGARITHMIC /*!< Logarithmic type of scaling. */ 
+             }; 
+/*! 
+ This enumeration contains a set of elements defining the type of the %entity (topological units) constituting a mesh. 
+*/ 
+  enum Entity{ NODE, /*!< Node corresponds to a geometrical point. */
+               EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
+              FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
+              CELL  /*!< Cell is a volumic element of a mesh */
+              };
+/*!
+ This enumeration contains a set of elements defining the type of the %VISU object. This enumeration is used for navigation between a set of %VISU interfaces.
+*/
+   enum VISUType{ TNONE, /*!< Not a %VISU object */
+                 TCURVE, /*!< Curve line object for construction of 2D XY plots */
+                 TTABLE, /*!< Table containing numerical data */
+                 TCONTAINER, /*!< Container object used for storing a set of curve lines */
+                 TMESH, /*!< Meshing object */
+                 TSCALARMAP, /*!< Scalarmap 3D presentation object */
+                 TISOSURFACE, /*!< Iso surface 3D presentation object */
+                 TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
+                 TCUTPLANES, /*!< Cut planes 3D presentation object */
+                 TCUTLINES, /*!< Cut lines 3D presentation object */
+                 TVECTORS, /*!< Vectors 3D presentation object */
+                 TSTREAMLINES, /*!< Streamlines 3D presentation object */
+                  TVISUGEN, /*!< %VISU generator used for performing operations with different %VISU objects */
+                 TVIEWMANAGER, /*!< View manager used for performing operations with different views */
+                 TRESULT, /*!< The data on which different presentations are based */
+                 TXYPLOT, /*!< 2D XY plot consisting of one or several curve lines */
+                 TTABLEVIEW, /*!< Table view is used for displaying data tables */
+                 TVIEW3D, /*!< 3D view is used for displaying 3D graphical presentations */
+                 TENTITY, /*!< An element composing a mesh: node, edge, face or cell */
+                 TFAMILY, /*!< The whole mesh can be divided into one or several submeshes, called families, which are defined by the user. Each family in its turn is composed of entities of a definite type. */
+                 TGROUP, /*!< A group of families */
+                 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. */
+                  TALL
+                 };
   interface Base {
 /*!
    Returns ID of the object.
@@ -53,7 +80,7 @@ can be applied on different presentations.
 Returns the type of the presentable object
 */
     VISUType GetType();
-  };   
+  };
 /*! \brief Presentable object interface
 
 Presentable object interface is the root class of all presentable objects.
@@ -68,10 +95,12 @@ Presentation parameters of the %Table view.
   interface Table : PrsObject {
 /*!
 Sets the title of the table.
+\param theTitle String parameter defining the title of this table.
 */
     void SetTitle(in string theTitle);
 /*!
 Gets the title of the table.
+\return A string value containing the title of the table.
 */
     string GetTitle();
 /*!
@@ -82,18 +111,25 @@ Gets the title of the table.
                     };
 /*!
 Sets orientation of the table.
+\param theOrientation This input parameter defines the orientation of the table. It is taken from
+the <VAR>Orientation</VAR> enumeration.
 */
     void SetOrientation(in Orientation theOrientation);
 /*!
 Gets orientation of the table.
+\return Orientation of the table. The returned value will correspond to one of the elements the <VAR>Orientation</VAR> enumeration.
+
 */
     Orientation GetOrientation();
  /*!
-Gets the number of rows of the table
+Gets the number of rows of the table.
+\return Long value corresponding to the number of rows of the table
  */
     long GetNbRows();
  /*!
-Gets the number of columns of the table
+Gets the number of columns of the table.
+\return Long value corresponding to the number of columns of the table
+
  */
     long GetNbColumns();
   };
@@ -106,35 +142,52 @@ It can be used for presentation of a set of curves using a combined presentation
   interface Curve : PrsObject{
 /*!
 Sets the title of the curve.
+\param theTitle This string parameter defines the title of this curve.
 */
     void SetTitle(in string theTitle);
 /*!
 Gets the title of the curve.
+\return String value corresponding to the title of the curve.
 */
     string GetTitle();
 /*!
 Sets the color of the curve.
+\param theColor The color of the curve. This parameter is taken from the <VAR>Orientation</VAR> enumeration.
+
 */
     void SetColor(in SALOMEDS::Color theColor);
 /*!
 Gets the color of the curve.
+\return Color of the curve. The returned value will correspond to one of the elements the <VAR>Color</VAR> enumeration.
+
 */
     SALOMEDS::Color GetColor();
  /*!
  This enumeration contains a set of elements defining the presentation type of markers (data points) with help of
 which the curve is constructed on the graphics.
 */
-    enum MarkerType{ NONE, CIRCLE, RECTANGLE, DIAMOND,
-                     DTRIANGLE, UTRIANGLE, LTRIANGLE, RTRIANGLE,
-                     CROSS, XCROSS };
+    enum MarkerType{ NONE,
+                     CIRCLE,
+                    RECTANGLE,
+                    DIAMOND,
+                     DTRIANGLE,
+                    UTRIANGLE,
+                    LTRIANGLE,
+                    RTRIANGLE,
+                     CROSS,
+                    XCROSS
+                    };
 /*!
 Sets the presentation type of markers (data points) with help of
 which the curve is constructed on the graphics.
+\param theType This parameter defines the type of marker with help of which the curve is constructed on the graphics. It is taken from <VAR>MarkerType</VAR> enumeration.
 */
     void SetMarker(in MarkerType theType);
 /*!
 Gets the presentation type of markers (data points) with help of
 which the curve is constructed on the graphics.
+\return The type of marker with help of which the curve is constructed on the graphics. The returned value will correspond to one of the elements the <VAR>MarkerType</VAR> enumeration.
+
 */
     MarkerType GetMarker();
 /*!
@@ -144,34 +197,42 @@ which the curve is constructed on the graphics.
     enum LineType{ VOIDLINE, SOLIDLINE, DASHLINE, DOTLINE, DASHDOTLINE, DASHDOTDOTLINE};
 /*!
 Sets the type of presentation of curve lines on the graphics.
+\param theType This parameter defines the type of presentation of curve lines on the graphics.
+\param theLineWidth Long value defining the width of the curve line.
 */
     void SetLine(in LineType theType, in long theLineWidth);
 /*!
 Gets the type of representation of curve lines on the graphics.
+\return The type of representation of curve lines on the graphics.
 */
     LineType GetLine();
 
 /*!
 Gets the width of the curve line.
+\return Long value corresponding to the width of the curve line.
 */
     long GetLineWidth();
   };
 //-------------------------------------------------------
-/*! \brief The %Container presentable object interface
-This interface contains a set of methods used for management of a group of curves
-which are stored in the container.
+/*! \brief %Container presentable object interface
+
+This class is provided in order to create one presentation using several presentable objects.
+This can provide a combination of a set of curves to display them in XY plot view.
 */
   interface Container : PrsObject{
 /*!
 Adds a curve into the container.
+\param theCurve The added curve.
 */
     void AddCurve(in Curve theCurve);
 /*!
 Removes a curve from the container.
+\param theCurve The removed curve.
 */
     void RemoveCurve(in Curve theCurve);
 /*!
 Gets the number of curves which are stored in the container.
+\return A long value corresponding to the number of curves which are stored in the container.
 */
     long GetNbCurves();
 /*!
@@ -185,11 +246,9 @@ Removes all curves from the container.
 
 This is a root class for all 3D presentations, which can be displayed in %VISU module.
 */
-    interface Prs3d : PrsObject{
-/*! Kills a 3D presentation.
-*/
-      void Destroy();
-    };
+  interface Prs3d : PrsObject, SALOME::GenericObj{
+    //interface Prs3d : PrsObject{
+  };
 /*!
  This enumeration contains a set of elements defining the
  type of presentation of the mesh.
@@ -204,11 +263,15 @@ This is a root class for all 3D presentations, which can be displayed in %VISU m
                          };
 /*! \brief Interface of the mesh.
 
-This interface manages the presentation parameters of the mesh.
+Manages presentation parameters of a 3D presentation of a mesh.
+This object can be used for presentation of set of curves using Container class.
+
 */
     interface Mesh : Prs3d{
 /*!
 Sets the color of mesh cells.
+\param theColor The color of the cells. This parameter is taken from <VAR>Color</VAR> enumeration.
+
 */
     void SetCellColor(in SALOMEDS::Color theColor);
 /*!
@@ -217,6 +280,8 @@ Gets the color of mesh cells.
     SALOMEDS::Color GetCellColor();
 /*!
 Sets the color of mesh nodes.
+\param theColor The color of the nodes. This parameter is taken from <VAR>Color</VAR> enumeration.
+
 */
     void SetNodeColor(in SALOMEDS::Color theColor);
 /*!
@@ -226,6 +291,8 @@ Gets the color of mesh nodes.
 
 /*!
 Sets the color of mesh links.
+\param theColor The color of the links. This parameter is taken from <VAR>Color</VAR> enumeration.
+
 */
     void SetLinkColor(in SALOMEDS::Color theColor);
 /*!
@@ -233,69 +300,84 @@ Gets the color of mesh links.
 */
     SALOMEDS::Color GetLinkColor();
 /*!
-Sets the type of representation of the mesh.
+Sets the type of representation of a mesh.
+\param theType The of representation of a mesh. This parameter is taken from <VAR>PresentationType</VAR> enumeration.
 */
     void SetPresentationType(in PresentationType theType);
 /*!
 Gets the type of representation of the mesh.
+\return The type of representation of the mesh.
 */
     PresentationType GetPresentationType();
   };
   //-------------------------------------------------------
-/*! \brief Interface of the %Scalar Map presentation
+/*! \brief Interface of the %Scalar Map
+
+This interface is responsable for coloring of 3D field presentations according the scalar values applied to different cells.
+As well it contains presentation parameters of the scalar bar. The scalar bar is displayed
+along with each colored field presentation and serves for consulting the correspondance
+between colors and data values.
 
-This interface contains presentation parameters of the ScalarMap presentation
 */
   interface ScalarMap : Prs3d{
-    void SetScalarMode(in long theScaling);
+/*! Sets the method of coloring of the elements composing a 3D presentation.
+*/
+    void SetScalarMode(in long theScalarMode);
+/*! Gets the method of coloring of the elements composing a 3D presentation.
+*/
     long GetScalarMode();
+/*!
+Sets the type of scaling of the values reflected by the scalar bar.
+\param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
+*/
     void SetScaling(in Scaling theScaling);
 /*!
 Gets the type of scaling of the values reflected by this presentation.
 */
     Scaling GetScaling();
 /*!
-Sets scalar range - min and max boundaries of this presentable object.
-\param theMin  Min boundary of this presentable object.
-\param theMax  Max boundary of this presentable object.
+Sets scalar range - min and max boundaries of the scalar bar.
+\param theMin  Min boundary of the scalar bar.
+\param theMax  Max boundary of the scalar bar.
 */
     void SetRange(in double theMin, in double theMax);
 /*!
- Gets the min boundary of this presentable object.
+ Gets the min boundary of the scalar bar.
 */
     double GetMin();
 /*!
- Gets the max boundary of this presentable object.
+ Gets the max boundary of the scalar bar.
 */
     double GetMax();
 
-/*! %Orientation of this presentable object. */
+/*! %Orientation of the scalar bar. */
     enum Orientation{
-                     HORIZONTAL, /*!< Horizontal orientation of this presentable object.*/
-                       VERTICAL  /*!< Vertical orientation of this presentable object.*/
+                     HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
+                       VERTICAL  /*!< Vertical orientation of the scalar bar.*/
                     };
 /*!
- Sets the type of orientation of this presentable object.
+ Sets the type of orientation of the scalar bar.
+ \param theOrientation This parameter defines the orientation of the scalar bar. It is taken from the <VAR>Orientaton</VAR> enumeration.
 */
-    void SetOrientation(in Orientation theOrientation);
+    void SetBarOrientation(in Orientation theOrientation);
 /*!
- Gets the type of orientation of this presentable object.
+ Gets the type of orientation of the scalar bar.
 */
-    Orientation GetOrientation();
+    Orientation GetBarOrientation();
 
-/*! \brief Position of this presentable object.
+/*! \brief Position of the scalar bar.
 
-Sets the position of this presentable object origin on the screen.
+Sets the position of the scalar bar origin on the screen.
 \param X   Horizontal position. The value can be between 0 and 1.
 \param Y   Vertical position. The value can be between 0 and 1.
 */
     void SetPosition(in double X, in double Y);
 /*!
-  Gets horizontal position of this presentable object origin.
+  Gets horizontal position of the scalar bar origin.
 */
     double GetPosX();
 /*!
-  Gets vertical position of this presentable object origin.
+  Gets vertical position of the scalar bar origin.
 */
     double GetPosY();
 /*! \brief Size of this presentable object.
@@ -307,36 +389,44 @@ Sets the size of the scalar bar.
     void SetSize(in double theWidth, in double theHeight);
 /*!
 Gets the width of this presentable object.
+\return A double value corresponding to the width of this presentable object.
 */
     double GetWidth();
 /*!
 Gets the height of this presentable object.
+\return A double value corresponding to the height of this presentable object.
 */
     double GetHeight();
 /*!
 Sets the number of colors which will be used for presentation of this presentable object.
+\param theNbColors A long value defining the number of colors.
 */
     void SetNbColors(in long theNbColors);
 /*!
-Gets the number of colors which will be used for presentation of this presentable object.
+Gets the number of colors which will be used for visualization of this presentable object.
+\return A long value corresponding to the number of colors which will be used for visualization of this presentable object.
 */
     long GetNbColors();
 /*!
-Sets the number of labels which will be used for indication of the gradation
- of this presentable object.
+Sets the number of labels which will be used for indication of color gradation
+ of the scalar bar.
+ \param theNbLabels A long value defining the number of labels.
 */
     void SetLabels(in long theNbLabels);
 /*!
-Gets the number of labels which will be used for indication of the gradation
- of this presentable object.
+Gets the number of labels which will be used for indication of color gradation
+ of the scalar bar.
+ \return A long value corresponding to the number of labels which will be used for indication of color gradation
+ of the scalar bar.
 */
     long GetLabels();
 /*!
-Sets the title of this presentable object. For scalar bar by default - the name of the selected result is used.
+Sets the title of the scalar bar. By default - the name of the selected result is used.
+\param theName String parameter defining the name of the scalar bar.
 */
     void SetTitle(in string theName);
 /*!
-Gets the title of this presentable object.
+Gets the title of the scalar bar.
 */
     string GetTitle();
   };
@@ -348,17 +438,27 @@ Presentation parameters of the deformed shape presentation.
   interface DeformedShape : ScalarMap{
 /*!
 Sets the scale of the presentatable object.
+\param theScale Double value defining the scale of this presentable object.
 */
     void SetScale(in double theScale);
 /*!
 Gets the scale of the presentatable object.
 */
     double GetScale();
-
+/*! This boolean method returns True if this deformed shape presentation is colored.
+*/
     boolean IsColored();
+/*! Shows this presentation in colored mode.
+\param theColored If this boolean parameter is True this presentable object will be shown in colored mode.
+*/
     void ShowColored(in boolean theColored);
-
+/*! Gets the color of this presentable object.
+\return The color of this presentable object.
+*/
     SALOMEDS::Color GetColor();
+/*! Sets the color of this presentation.
+\param theColor The color of this presentation. This parameter is taken from the <VAR>Color</VAR> enumeration.
+*/
     void SetColor(in SALOMEDS::Color theColor);
   };
   //-------------------------------------------------------
@@ -370,25 +470,38 @@ which will be cutted by the borders of the mesh.
 */
   interface CutPlanes : ScalarMap{
 /*!
- This enumeration contains a set of elements defining the orientation in 3D space
+ This enumeration contains a set of elements defining the type of orientation in 3D space
  of the cut planes.
 */
-    enum Orientation {XY, YZ, ZX};
+    enum Orientation {XY, /*!< The object is located in the plane formed by X and Y axis. */
+                      YZ, /*!< The object is located in the plane formed by Y and Z axis. */
+                     ZX}; /*!< The object is located in the plane formed by Z and X axis. */
 /*!
 Sets the type of orientation in 3D space of cut planes presentation.
+\param theOrientation This parameter defines the type of orientation of cut planes in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
+\param theXAngle The angle of rotation of the cut planes around the first axis of the chosen orientation.
+\param theXAngle The angle of rotation of the cut planes around the second axis of the chosen orientation.
 */
-    void SetOrientationType(in Orientation theNb);
+    void SetOrientation(in Orientation theOrientation, in double theXAngle, in double theYAngle);
 /*!
 Gets the type of orientation in 3D space of cut planes presentation.
 */
     Orientation GetOrientationType();
 /*!
+Gets rotation angle of the cut plane presentation around the first axis of the chosen orientation.
+*/
+    double GetRotateX();
+/*!
+Gets rotation angle of the cut plane presentation around the second axis of the chosen orientation.
+*/
+    double GetRotateY();
+/*!
 Sets the displacement of the cut planes in 3D space.
 
 \param theDisp This parameter defines position of the cut planes
 in 3D space. It varies from 0 to 1. If the chosen value is 0.5, the cut planes
 will be evenly located regarding each other; in other words, the distance between all
-of them will equal. If the value is higher or lower than 0.5, the planes will be displaced
+of them will be equal. If the value is higher or lower than 0.5, the planes will be displaced
 to one or another side.
 */
     void SetDisplacement(in double theDisp);
@@ -397,12 +510,15 @@ Gets the displacement of the cut planes in 3D space.
 */
     double GetDisplacement();
 /*!
-Sets the position of a definite cut plane
+Sets the position of a definite cut plane.
+\param thePlaneNumber The number of this cut plane.
+\param thePlanePosition The position of this cut plane.
 */
      void SetPlanePosition(in long thePlaneNumber, in double thePlanePosition);
 
 /*!
-Sets the position of the choosen plane to default value
+Sets the position of the choosen plane to default value.
+\param thePlaneNumber The number of this cut plane.
 */
      void SetDefault(in long thePlaneNumber);
 
@@ -413,120 +529,219 @@ Gets the position of the choosen plane
     double GetPlanePosition(in long thePlaneNumber);
 
 /*!
-Determines whether the choosen plane has default position
+Determines whether the choosen plane has default position.
+\param thePlaneNumber The number of this cut plane.
 */
 
     boolean IsDefault(in long thePlaneNumber);
 
 /*!
 Sets the number of cut planes.
+\param theNb The number of cut planes.
 */
     void SetNbPlanes(in long theNb);
 /*!
 Gets the number of cut planes.
 */
     long GetNbPlanes();
-/*! Rotation around X-axis.
-Sets rotation angle of the cut plane presentation.
-*/
-    void SetRotateX(in double theAngle);
-/*! Rotation around X-axis.
-Gets rotation angle of the cut plane presentation.
-*/
-    double GetRotateX();
-/*! Rotation around Y-axis.
-Sets rotation angle of the cut plane presentation.
-*/
-    void SetRotateY(in double theAngle);
-/*! Rotation around Y-axis.
-Sets rotation angle of the cut plane presentation.
-*/
-    double GetRotateY();
   };
   //-------------------------------------------------------
-/*! \brief Cut lines interface
+/*! \brief Cut lines presentation.
+
+Presentation parameters of a Cut lines presentation.
+Cut Lines is a type of presentation which displays colored cells with applied scalar values on the mesh where lines are placed.
+The procedure of construction of a Cut Lines presentation reuses the algorithm of creation of Cut Planes presentation and consists of two steps:
+
+   1. From Cut Planes presentation one plane is taken and it is used as base plane for construction of cut lines.
+   2. This plane is cut by a regular array of planes. The result of this operation is a regular array of lines in space,  belonging to the same plane and having the same orientation. They are located inside or on the mesh.
 
-Presentation parameters of Cut lines presentation.
 */
   interface CutLines : ScalarMap{
 
-    void SetOrientationType(in CutPlanes::Orientation theNb);
-    void SetOrientationType2(in CutPlanes::Orientation theNb);
+    /*!
+      Sets the type of orientation in 3D space of the base plane of a cut lines presentation.
+      \param theOrientation The orientation of the base plane in 3D space.
+\param theXAngle The angle of rotation of the base plane around the first axis of the chosen orientation.
+\param theXAngle The angle of rotation of the base plane around the second axis of the chosen orientation.
+
+    */
+    void SetOrientation(in CutPlanes::Orientation theOrientation, in double theXAngle, in double theYAngle);
+    /*!
+      Sets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
+      \param theOrientation This parameter defines the type of orientation of the cutting planes in 3D space. It is taken from the <VAR>Orientation</VAR> enumeration.
+\param theXAngle The angle of rotation of the cutting planes around the first axis of the chosen orientation.
+\param theXAngle The angle of rotation of the cutting planes around the second axis of the chosen orientation.
 
+    */
+    void SetOrientation2(in CutPlanes::Orientation theOrientation, in double theXAngle, in double theYAngle);
+/*!
+      Gets the type of orientation in 3D space of the base plane of a cut lines presentation.
+
+*/
     CutPlanes::Orientation GetOrientationType();
+/*!
+      Gets the type of orientation in 3D space of the cutting planes of a cut lines presentation.
+*/
     CutPlanes::Orientation GetOrientationType2();
+/*!
+Gets rotation angle of the base plane around the first axis of the chosen orientation.
+*/
+    double GetRotateX();
+/*!
+Gets rotation angle of the cutting planes around the first axis of the chosen orientation.
+*/
+    double GetRotateX2();
 
+/*!
+Gets rotation angle of the base plane around the second axis of the chosen orientation.
+*/
+    double GetRotateY();
+/*!
+Gets rotation angle of the cutting planes around the second axis of the chosen orientation.
+*/
+    double GetRotateY2();
+
+/*!
+Sets the displacement of the base plane of the cut lines presentation in 3D space.
+
+\param theDisp This parameter defines position of the base plane
+in 3D space. It varies from 0 to 1.
+*/
     void SetDisplacement(in double theDisp);
+/*!
+Sets the displacement of the cutting planes of the cut lines presentation in 3D space.
+
+\param theDisp This parameter defines position of the cutting planes
+in 3D space. It varies from 0 to 1.
+*/
+
     void SetDisplacement2(in double theDisp);
 
+/*!
+Gets the displacement of the base plane of the cut lines presentation in 3D space.
+*/
     double GetDisplacement();
+/*!
+Gets the displacement of the cutting planes of the cut lines presentation in 3D space.
+*/
     double GetDisplacement2();
-
+/*! Sets the position of the base plane in 3D space.
+\param thePlanePosition A double value defining the position of the base plane in 3D space.
+*/
     void SetBasePlanePosition(in double thePlanePosition);
+/*! Gets the position of the base plane in 3D space.
+*/
     double GetBasePlanePosition();
+/*! Sets the position of one of cutting planes in 3D space.
+\param thePlaneNumber A long value defining the order number of this cutting plane.
+\param thePlanePosition A double value defining the position of the base plane in 3D space.
+*/
 
     void SetLinePosition(in long thePlaneNumber, in double thePlanePosition);
+/*! Gets the position of one of cutting planes in 3D space.
+\param thePlaneNumber A long value defining the order number of this cutting plane.
+*/
+
     double GetLinePosition(in long thePlaneNumber);
 
+/*! Sets the position of the base plane to default value.
+*/
     void SetDefault();
+/*!
+Determines whether the base plane has default position.
+\return True if the base plane has default position.
+*/
     boolean IsDefault();
 
+/*!
+Sets the position of the choosen cutting plane to default value.
+\param thePlaneNumber The number of this cutting plane.
+*/
+
     void SetDefaultPosition(in long thePlaneNumber);
-    boolean IsDefaultPosition(in long thePlaneNumber);
+/*!
+Determines whether the choosen cutting plane has default position.
+\param thePlaneNumber The number of this cutting plane.
+\return True if this cutting plane has default position.
+*/
 
+    boolean IsDefaultPosition(in long thePlaneNumber);
+/*!
+Sets the number of cut lines.
+\param theNb The number of cut lines.
+*/
     void SetNbLines(in long theNb);
+/*!
+Gets the number of cut lines.
+*/
     long GetNbLines();
-
-    void SetRotateX(in double theAngle);
-    void SetRotateX2(in double theAngle);
-
-    double GetRotateX();
-    double GetRotateX2();
-
-    void SetRotateY(in double theAngle);
-    void SetRotateY2(in double theAngle);
-
-    double GetRotateY();
-    double GetRotateY2();
   };
   /*! \brief Interface of the stream lines representation
+
   This interface contains presentation parameters of
   stream lines presentations.
+<BR>Stream lines is a type of presentation transforming into lines the cells with vectors having most similar direction.
+A stream line can be thought of as the path that a massless particle takes in a vector field. Streamlines are used to convey the structure of a vector field.
+Usually streamlines are created to explore the most interesting features in the field.
   */
   interface StreamLines : DeformedShape{
+/*! This enumerations contains a set of elements necessary
+for definition of direction of the stream lines.
+
+*/
     enum Direction{ FORWARD,
                    BACKWARD,
                    BOTH
     };
-
-    void SetDirection(in Direction theDirection);
-    Direction GetDirection();
-
-    void SetStepLength(in double theStep);
-    double GetStepLength();
-
-    void SetPropagationTime(in double theTime);
-    double GetPropagationTime();
-
-    void SetIntegrationStep(in double theStep);
+/*! Sets the parameters of the stream lines presentation.
+\param theIntStep Inegration step is a parameter of smoothness of the stream lines. This parameter defines the accuracy of construction of the streamlines. A smaller value of this parameter allows to construct smoother streamlines (at the cost of more computation time).
+\param thePropogationTime This parameter controls the maximum length of the stream line (measured in units of time).
+\param theStepLength This parameter defines the size of the output line segments that make up the streamline (which is represented as a polyline).
+\param thePrs3d The source presentation. The points of the field located on this source presentation
+ will serve as starting points for generation of stream lines.
+ \note If this parameter is not defined, your stream lines presentation will be generated on all points of the field.
+\param thePercents This parameter defines the quantity of points of the field (from 0 to 100%) which will be used as starting points for construction of the stream lines. Thus, the value of this parameter can vary from 0 to 1.
+\param theDirection Direction of the stream lines.(Forward, Backward or Both)
+\return True if all parameters are properly set.
+*/
+    boolean SetParams(in double theIntStep,
+                  in double thePropogationTime,
+                  in double theStepLength,
+                  in Prs3d thePrs3d,
+                  in double thePercents,
+                  in Direction theDirection);
+/*! Gets the value of integration step of the stream lines presentation.
+*/
     double GetIntegrationStep();
-
-    void SetSource(in Prs3d thePrs3d);
+/*! Gets the value of propagation time of the stream lines presentation.
+*/
+    double GetPropagationTime();
+/*! Gets the value of step length of the stream lines presentation.
+*/
+    double GetStepLength();
+/*! Returns the source presentation used for generation of the stream lines.
+*/
     Prs3d GetSource();
-
-    void SetUsedPoints(in double thePercents);
+/*! Gets the quantity of points of the field used as starting points for generation of the stream lines presentation.
+*/
     double GetUsedPoints();
+/*! Returns the direction of the stream lines.
+*/
+    Direction GetDirection();
   };
 
 
-/*! \brief Interface of the isometric surface representation
+/*! \brief Interface of the isometric surface presentation
 
    This interface contains presentation parameters of
     isometric surface presentations.
+<BR>Iso surfaces presentation combines all equal scalar values on the cells and on the basis of them constructs
+isobaric surfaces, which form this presentation.
 */
   interface IsoSurfaces : ScalarMap{
 /*!
    Sets the number of isometric surfaces.
+\param theNb A long value defining the number of isometric surfaces which will be used for construction of this presentation.
 */
     void SetNbSurfaces(in long theNb);
 /*!
@@ -537,15 +752,16 @@ Presentation parameters of Cut lines presentation.
   //-------------------------------------------------------
 /*! \brief Interface of the vector presentation.
 
-This interface contains presentation parameters of the vector.
+This interface contains presentation parameters of vector presentations.
 */
   interface Vectors : DeformedShape{
 /*!
-Sets the width of the line of the vector.
+Sets the width of the lines of the vectors.
+\param theWidth A double value defining the width of the lines of the vectors.
 */
     void SetLineWidth(in double theWidth);
 /*!
-Gets the width of the line of the vector.
+Gets the width of the lines of the vectors.
 */
     double GetLineWidth();
 /*!
@@ -558,6 +774,8 @@ Gets the width of the line of the vector.
                   };
 /*!
 Sets the type of representation of the vector head.
+\param theType This parameter defines the type of representation of the vector head.
+This value is taken from the <VAR>GlyphType</VAR> enumeration.
 */
     void SetGlyphType(in GlyphType theType);
 /*!
@@ -574,6 +792,8 @@ Gets the type of representation of the vector head.
                  };
 /*!
 Sets the position of the vector head.
+\param thePos This parameter defines the position of the vector head.
+This value is taken from the <VAR>GlyphPos</VAR> enumeration.
 */
     void SetGlyphPos(in GlyphPos thePos);
 /*!
@@ -582,50 +802,141 @@ Gets the position of the vector head.
     GlyphPos GetGlyphPos();
   };
   //-------------------------------------------------------
+/*! \brief %Animation class
+
+This class provides a set of methods used for:<br>
+<ul>
+    <li> generating different animations on the basis of a field,
+    <li> setting the parameters of the animations,
+    <li> playing these animations in the %VISU module.
+</ul>
+\note
+<BR><B>Field</B> represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept.
+<BR><B>Time stamp</B> represents a subfield: the results of calculations are taken in one definite moment.
+*/
+
   interface Animation : Base{
+/*! Defines the field which will be used as a base for generation of the animation.
+\param theObject The %SObject corresponding to the field.
+*/
     void addField(in SALOMEDS::SObject theObject);
-
+/*! Generates presentations on the basis of the field.
+\param theFieldNum The number of the field, which will be used as the basis for construction of the presentation.
+*/
     void generatePresentations(in long theFieldNum);
+/*! Generates a set of frames from the created by the method <VAR>generatePresentations</VAR>3D presentations. A sequence of these frames will be
+transformed into an animation.
+\return  True, if the frames have been successfully generated.
+*/
     boolean generateFrames();
+/*! Clears the view before starting an animation.
+*/
     void clearView();
 
+/*! \name Playback of an animation:
+*/
+/*@{*/
+
+/*! Starts an animation.
+*/
     void startAnimation();
+/*! Stops an animation.
+*/
     void stopAnimation();
 
+/*! Forwards to the next frame.
+*/
     void nextFrame();
+/*! Returns to the previous frame.
+*/
     void prevFrame();
+/*! Returns to the first frame of the animation.
+*/
     void firstFrame();
+/*! Forwards to the last frame of the animation.
+*/
     void lastFrame();
+/*!  Passes to a definite frame of the animation.
+\param theFrame A long value defining the number of the frame.
+*/
     void gotoFrame(in long theFrame);
+/*@}*/
 
+/*! Gets the number of time stamps (subfields) contained in the given field.
+*/
     long getNbFields();
+/*! Gets the number of generated frames
+*/
     long getNbFrames();
+/*! Returns True, if the animation is currently running.
+*/
     boolean isRunning();
+/*! Returns the number of the current frame.
+*/
     long getCurrentFrame();
-
+/*!
+*/
     ScalarMap getPresentation(in long theField, in long theFrame);
-
+/*! Sets the type of presentation (vectors, deformed shape etc.) which will be generated by the method <VAR>generatePresentations</VAR>.
+*/
     void setPresentationType(in long theFieldNum, in VISUType theType);
+/*! Gets the type of presentation (vectors, deformed shape etc.) which will
+be generated by the method <VAR>generatePresentations</VAR>.
+*/
     VISUType getPresentationType(in long theFieldNum);
 
+/*! Sets the speed of the animation.
+\param theSpeed The speed of the animation. The value varies from 1 to 99.
+*/
     void setSpeed(in long theSpeed);
+/*!  Gets the speed of the animation.
+*/
     long getSpeed();
-
+/*! Ruturns True, if playback of the animation is proportional.
+This option allows to render your animation with proportional periods of time between every frame (not depending on the time stamps).
+*/
     boolean isProportional();
+/*! Sets the range of the animation. The range is defined on the basis of
+the time stamps of the field which have been used for generation of the animation. This method allows to bound the range of generated frames.
+If this method is not used, the animation will be generated on the basis of all time stamps contained in the field.
+/param theMin The value of the first time stamp which will be used for generation of the animation.
+/param theMax The value of the last time stamp which will be used for generation of the animation.
 
+*/
     void setAnimationRange(in double theMin, in double theMax);
+/*! Gets the number of the first time stamp which will be used for generation of the animation.
+*/
     double getMinRange();
+/*! Gets the number of the last time stamp which will be used for generation of the animation.
+*/
     double getMaxRange();
+/*! Returns True if the range of the animation has been defined by the method <VAR>setAnimationRange</VAR>. Otherwise
+the animation will be generated on the basis of all time stamps contained in the field.
+*/
     boolean isRangeDefined();
-
+/*! Saves all the frames composing the animation into a definite directory.
+\param thePath The directory where all the frames will be saved.
+*/
     void dumpTo(in string thePath);
 
+/*! Returns True, if the playback of the animation is cycling.
+*/
     boolean isCycling();
-
+/*! Gets the first time stamp of the field defined at the input of the animation.
+\note This method is used if animation range is <b>NOT</b> defined.
+*/
     double getMinTime();
+/*! Gets the last time stamp of the field defined at the input of the animation.
+\note This method is used if animation range is <b>NOT</b> defined.
+*/
     double getMaxTime();
-
+/*! Sets proprtional playback of the animation. This option allows to render your animation with proportional periods of time between every frame (not depending on the time stamps).
+\param theProp If this boolean parameter is True, playback of your animation will be set as proportional.
+*/
     void setProportional(in boolean theProp);
+/*! Sets cycling playback of the animation. The number of cycles can be infinite, untill you use <VAR>startAnimation</VAR> method.
+\param theCycle If this boolean parameter is True, playback of your animation will be set as cycling.
+*/
     void setCycling(in boolean theCycle);
   };
 
@@ -634,7 +945,10 @@ Gets the position of the vector head.
 This interface serves for inner representation of data generated in other sources. (MED object or file)
 This data is needed for further construction of graphical presentations.
 */
-  interface Result : Base {
+  interface Result : Base, SALOME::GenericObj{
+    //interface Result : Base{
+/*! Reads all data from the corresponding sources. By default the data is loaded on demand.
+*/
     boolean BuildAll();
   };
   //-------------------------------------------------------
@@ -647,10 +961,14 @@ post-processing presentations from given %Result and %Table object reference, us
 provided by %ViewManager.
 */
    interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base{
+/*! Sets a definite study to be current.
+*/
      void SetCurrentStudy(in SALOMEDS::Study theStudy);
+/*! Gets the current study.
+*/
      SALOMEDS::Study GetCurrentStudy();
 /*!
-    Gets the %ViewManager which is used for creation of
+    Gets the %View Manager which is used for creation of
     post-processing presentations.
 */
     ViewManager GetViewManager();
@@ -660,10 +978,24 @@ Imports tables from a file and create TableAttribute in Sudy
 */
     SALOMEDS::SObject ImportTables(in string theFileName);
 /*!
-Imports data from a file.
+Export table to a file
+*/
+     boolean ExportTableToFile(in SALOMEDS::SObject theTable, in string theFileName);
+
+/*!
+Imports data from a file. The access to this file will be conserved outside of the application.
+\param theFileName String parameter defining the name of the file from which the data will
+be imported.
 */
     Result ImportFile(in string theFileName);
 /*!
+Imports data from a file. The access to this file will closed.
+\param theFileName String parameter defining the name of the file from which the data will
+be imported.
+*/
+
+    Result CopyAndImportFile(in string theFileName);
+/*!
 Imports data from a %MED object.
 */
     Result ImportMed(in SALOMEDS::SObject theMedSObject);
@@ -672,13 +1004,30 @@ Imports data from a %MED field.
 */
     Result ImportMedField(in SALOME_MED::FIELD theField);
 /*!
-Creates a %Mesh on the basis of the data generated in other sources (MED object or file).
+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)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined
 */
     Mesh MeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity);
+/*!
+Creates on the basis of a family a mesh  which will
+be composed of geometrical elements, corresponding to the type of cells (node, edge, face or cell) of this family.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theEntity Type of entity where the field is defined.
+
+*/
     Mesh FamilyMeshOnEntity(in Result theResult, in string theMeshName, in Entity theEntity, in string theFamilyName);
+/*!
+Creates a mesh on the basis of a group of families.
+\param theResult   Data generated in other sources. (MED object or file)
+\param theMeshName  One of the meshes presented in MED file
+\param theGroupName Name of the group.
+*/
     Mesh GroupMesh(in Result theResult, in string theMeshName, in string theGroupName);
 /*!
-Creates a scalar bar presentation.
+Creates a scalar map presentation.
 \param theResult   Data generated in other sources. (MED object or file)
 \param theMeshName  One of the meshes presented in MED file
 \param theEntity Type of entity where the field is defined
@@ -722,7 +1071,7 @@ Creates an stream lines presentation.
 \param theEntity Type of entity where the field is defined
 \param theFieldName  Group of data attributed to the %MESH. The data can be scalar or vector.
 \param theIteration  Number of iteration on the field
-*/    
+*/
     StreamLines StreamLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, in double theIteration);
 
 /*!
@@ -747,6 +1096,8 @@ Creates a presentation of cut lines.
 
 /*!
 Creates a table presentation.
+\param theTableEntry The entry of the table which will be displayed.
+
 */
     Table CreateTable(in string theTableEntry);
 /*!
@@ -760,7 +1111,9 @@ Creates a curve on the basis of points, whose values are taken from the table.
 Creates a presentation form containing an array of references to the curves.
 */
      Container CreateContainer();
-
+/*! Creates an animation in the 3D view.
+\param theView3d The 3D view, where the animation will be rendered.
+*/
      Animation CreateAnimation(in View3D theView3d);
   };
 /*! \brief %View interface
@@ -772,6 +1125,7 @@ Creates a presentation form containing an array of references to the curves.
   interface View: Base{
 /*!
 Sets the title of the %View frame.
+\param theTitle String parameter defining the title of the %View frame.
 */
     void SetTitle(in string theTitle);
 /*!
@@ -780,6 +1134,7 @@ Gets the title of the %View frame.
     string GetTitle();
 /*!
 Sets background color of the %View frame.
+\param theColor Background color defined in <VAR>SALOMEDS::Color</VAR> enumeration.
 */
     void SetBackground(in SALOMEDS::Color theColor);
 /*!
@@ -808,15 +1163,18 @@ Displays all presentations (presentable objects) in the %view.
     void DisplayAll();
 /*!
 Removes a definite presentation (presentable object) from the %view.
+\param thePrsObj The presentation (presentable object) which should be deleted.
 */
     void Erase(in PrsObject thePrsObj);
 /*!
 Displays a definite presentation (presentable object) in the %view.
+\param thePrsObj The presentation (presentable object) which should be displayed.
 */
     void Display(in PrsObject thePrsObj);
 /*!
 Allows to display only a definite presentation (presentable object) in the %view.
 All other presentations are removed from the %view.
+\param thePrsObj The presentation (presentable object) which should be displayed.
 */
     void DisplayOnly(in PrsObject thePrsObj);
 /*!
@@ -826,6 +1184,8 @@ Updates the view.
 
 /*!
 Saves the view.
+\param theFileName The name of the file where the view will be saved.
+\return True, if the view have been saved successfully.
 */
     boolean SavePicture(in string theFileName);
   };
@@ -910,12 +1270,15 @@ Removes the scaling of the view.
 */
     void RemoveScale();
 /*!
-Returns True if the view parameters have been created, False if the parameters have been modified.
+Saves view parameters.
+\return True if the view parameters have been created, False if the parameters have been modified.
+\param theName The name under which the view parameters will be saved.
 */
     boolean SaveViewParams(in string theName);
-/*!
-Returns True if the view parameters have been found and applied to the view,
+/*! Restores view parameters.
+\return True if the view parameters have been found and applied to the view,
 False if the parameters with this name don't exist.
+\param theName The name of the view parameters which will be restored.
 */
     boolean RestoreViewParams(in string theName);
   };
@@ -932,7 +1295,7 @@ This interface is used for creation of a view necessary for presentation of a ta
 
 
   //-------------------------------------------------------
-/*! \brief Interface of the XY plot view
+/*! \brief Interface of the 2D plot view
 
 This interface is used for creation of a view necessary for presentation of a XY plot generated on the basis
 of one or several curve lines.
@@ -951,28 +1314,66 @@ This enumeration contains a set of elements determining the type of the curve li
 will be displayed in your XY plot.
 */
     enum CurveType { POINTS, MULTYLINE, SPLINE};
+/*! Sets the type of the curve lines.
+\param theType The type of the curve lines taken from <VAR>CurveType</VAR> enumeration.
+*/
     void SetCurveType(in CurveType theType);
-    CurveType GetCurveType();
 
+/*! Gets the type of the curve lines.
+
+*/
+    CurveType GetCurveType();
+/*! Sets the size of the markers (data points) with help of
+which the curve is constructed on the graphics.
+\param theSize Long value defining the size of the markers.
+*/
     void SetMarkerSize(in long theSize);
+/*! Gets the size of the markers (data points) with help of
+which the curve is constructed on the graphics.
+*/
     long GetMarkerSize();
-
+/*! Enable/disables X-axis grid of the 2D plot.
+*/
     void EnableXGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor);
+
+/*! Enable/disables Y-axis grid of the 2D plot.
+*/
     void EnableYGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor);
 
+/*! Sets horizontal scaling of the 2D plot.
+\param theScaling Type of scaling taken from <VAR>Scaling</VAR> enumeration.
+*/
     void SetHorScaling(in Scaling theScaling);
+/*! Gets the type horizontal scaling of the 2D plot.
+*/
     Scaling GetHorScaling();
+/*! Sets vertical scaling of the 2D plot.
+\param theScaling Type of scaling taken from <VAR>Scaling</VAR> enumeration.
+*/
     void SetVerScaling(in Scaling theScaling);
+/*! Gets the type vertical scaling of the 2D plot.
+*/
     Scaling GetVerScaling();
 
+/*! Sets the title of the X-axis of the plot.
+\param theTitle String value defining the title of the X-axis of the plot.
+*/
     void SetXTitle(in string theTitle);
+/*! Gets the title of the X-axis of the plot.
+*/
     string GetXTitle();
-
+/*! Sets the title of the Y-axis of the plot.
+\param theTitle String value defining the title of the X-axis of the plot.
+*/
     void SetYTitle(in string theTitle);
+/*! Gets the title of the Y-axis of the plot.
+*/
     string GetYTitle();
-
+/*! Shows/hides the legend (description) of the 2D plot.
+*/
     void ShowLegend(in boolean theShowing);
-
+/*! Shrinks and enlarges the 2D plot to fit the 2D viewer.
+*/
     void FitAll();
   };
 
@@ -993,16 +1394,31 @@ will be displayed in your XY plot.
     View GetCurrentView();
 /*! \brief Creation of a 3d %View.
 
- Returns an object reference to the newly created 3d %View.
+ Returns an object reference to the newly created 3D %View.
 */
     View3D Create3DView();
+/*! \brief Creation of a Table %View.
+
+ Returns an object reference to the newly created Table %View.
+*/
 
     TableView CreateTableView(in Table theTable);
 
+/*! \brief Creation of a 2D plot %View.
+
+ Returns an object reference to the newly created 2D plot %View.
+*/
+
     XYPlot CreateXYPlot();
 
+/*! Deletes a definite view.
+\param theView The view which should be deleted.
+*/
     void Destroy(in View theView);
 
+/*! Runs a cycle of events in GUI (desktop).
+\note This method is one-way.
+*/
     void ProcessEvents();
  };
 };
index d5b5d3912bc1ef3800b992e4f72626e6a0ec3c66..2473978cb01aa64aa00b27c05f8ea0e8d6b046d2 100644 (file)
@@ -32,12 +32,12 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-EXPORT_HEADERS = VISU_Convertor.hxx  VISU_Convertor_impl.hxx
+EXPORT_HEADERS = VISU_Convertor.hxx  VISU_Convertor_impl.hxx  VISU_ConvertorUtils.hxx  VISU_ExtractUnstructuredGrid.hxx
 
 # Libraries targets
 
 LIB = libVisuConvertor.la
-LIB_SRC = VISU_Convertor.cxx VISU_Convertor_impl.cxx VISU_ConvertorUtils.cxx \
+LIB_SRC = VISU_Convertor.cxx VISU_Convertor_impl.cxx VISU_ConvertorUtils.cxx VISU_ExtractUnstructuredGrid.cxx \
        VISU_MedConvertor.cxx VISU_DatConvertor.cxx 
 
 # Executables targets
@@ -47,6 +47,6 @@ BIN_SRC =
 CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(MED2_INCLUDES) $(QT_INCLUDES) \
        -I${KERNEL_ROOT_DIR}/include/salome
 LDFLAGS+= $(VTK_LIBS) $(MED2_LIBS) $(HDF5_LIBS) $(QT_LIBS) \
-        -L${KERNEL_ROOT_DIR}/lib/salome
+       -L${KERNEL_ROOT_DIR}/lib/salome
 
 @CONCLUDE@
index c8b2e55a5171c080a522c27e5d49cf5de39eec52..4afe4b27cd4f550ac73540c5a48625a29914132f 100644 (file)
@@ -25,6 +25,7 @@
 //  Module : VISU
 
 #include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <fstream>     
 #include <strstream>
@@ -44,10 +45,11 @@ static int MYDEBUG = 0;
 
 void parseFile(const char* theFileName) throw(std::runtime_error&){
   try{
-    cout<<"'"<<theFileName<<"'...";
+    cout<<"'"<<theFileName<<"'...\n";
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
-    const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+    //aCon->GetSize();
     //return;
+    const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
@@ -57,48 +59,51 @@ void parseFile(const char* theFileName) throw(std::runtime_error&){
       //Import fields
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
-       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-         const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField& aField = aFieldMapIter->second;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
-         for(; aValFieldIter != aValField.end(); aValFieldIter++){
-           int aTimeStamp = aValFieldIter->first;
-           aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-         }
-       }
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       VISU::TFieldMap::const_reverse_iterator aFieldMapIter = aFieldMap.rbegin();
+       for(; aFieldMapIter != aFieldMap.rend(); aFieldMapIter++){
+         const string& aFieldName = aFieldMapIter->first;
+         const VISU::TField& aField = aFieldMapIter->second;
+         const VISU::TField::TValField& aValField = aField.myValField;
+         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         for(; aValFieldIter != aValField.end(); aValFieldIter++){
+           int aTimeStamp = aValFieldIter->first;
+           aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+           //goto OK;
+         }
+       }
       }
+      //continue;
       //Importing groups
       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-       const string& aGroupName = aGroupMapIter->first;
-       aCon->GetMeshOnGroup(aMeshName,aGroupName);
+       const string& aGroupName = aGroupMapIter->first;
+       aCon->GetMeshOnGroup(aMeshName,aGroupName);
       }
       //Import families
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       //aCon->GetMeshOnEntity(aMeshName,anEntity);
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
-       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-         const string& aFamilyName = aFamilyMapIter->first;
-         aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
-       }
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       //aCon->GetMeshOnEntity(aMeshName,anEntity);
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+         const string& aFamilyName = aFamilyMapIter->first;
+         aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+       }
       }
       //Import mesh on entity
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       aCon->GetMeshOnEntity(aMeshName,anEntity);
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       aCon->GetMeshOnEntity(aMeshName,anEntity);
       }
     }
+  OK:
     cout<<"OK"<<endl;
   }catch(std::runtime_error& exc){
     MESSAGE("Follow exception was accured in file:"<<theFileName<<"\n"<<exc.what());
index 82f2463dbc06b5f78cd7bcdc0bf0e8515d112f86..c9dbdb411965af4cae63cf3fa3e6e7890203226b 100644 (file)
@@ -27,8 +27,6 @@
 #include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
-#include <vtkUnstructuredGridWriter.h>
-
 using namespace std;
 
 #ifdef _DEBUG_
@@ -46,29 +44,20 @@ extern "C" {
   }
 }
 
-void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
-//  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
-//  //aWriter->DebugOn();
-//  //aWriter->SetFileType(VTK_BINARY);
-//  aWriter->SetFileName(theFileName.c_str());
-//  aWriter->SetInput(theDataSet);
-//  //aWriter->Print(cout);
-//  aWriter->Write();
-//  aWriter->Delete();
-}
-
 namespace VISU{
-  TVtkCellInfoMap aVtkCellInfoMap;
-  static int INIT = (
-                    aVtkCellInfoMap[VTK_VERTEX] = TVtkCellInfo("VTK_VERTEX",1),
-                    aVtkCellInfoMap[VTK_LINE] = TVtkCellInfo("VTK_LINE",2),
-                    aVtkCellInfoMap[VTK_TRIANGLE] = TVtkCellInfo("VTK_TRIANGLE",3),
-                    aVtkCellInfoMap[VTK_QUAD] = TVtkCellInfo("VTK_QUAD",4),
-                    aVtkCellInfoMap[VTK_TETRA] = TVtkCellInfo("VTK_TETRA",4),
-                    aVtkCellInfoMap[VTK_HEXAHEDRON] = TVtkCellInfo("VTK_HEXAHEDRON",8),
-                    aVtkCellInfoMap[VTK_WEDGE] = TVtkCellInfo("VTK_WEDGE",6),
-                    aVtkCellInfoMap[VTK_PYRAMID] = TVtkCellInfo("VTK_PYRAMID",5),
-                    1);
+  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;
+    }
+  }
 
   pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
     throw(std::runtime_error&)
@@ -97,7 +86,7 @@ namespace VISU{
          int tmp = aSubMeshOnCellType.size();
          aNbCells += tmp;
          int aVtkType = aSubMeshIter->first;
-         int aVtkSize = aVtkCellInfoMap[aVtkType].mySize;
+         int aVtkSize = GetNbOfPoints(aVtkType);
          aCellsSize += tmp*(aVtkSize+1);
        }
       }
@@ -125,7 +114,7 @@ namespace VISU{
     if(aFamilyMapIter == aFamilyMap.end())
       throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
     const VISU::TFamily& aFamily = aFamilyMapIter->second;
-       return &aFamily;
+    return &aFamily;
   }
   
   TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
index 490ae99fcbe406962895fb00957d2ea0f80d6701..65d2d6a32288896fc05027f94f4db47c488048f7 100644 (file)
@@ -1,4 +1,4 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
+//  VISU CONVERTOR :
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
@@ -33,7 +33,6 @@
 #include <iterator>
 #include <list>
 #include <map>
-#include <memory>
 #include <numeric>
 #include <set>
 #include <utility>
 #include <string>
 #include <stdexcept>
 
-#ifndef MESSAGE
-#define MESSAGE(msg) std::cout<<msg<<endl
-#endif
-
-#include <vtkUnstructuredGrid.h>
-#include <vtkSystemIncludes.h>
 #include <vtkPoints.h>
+#include <vtkSystemIncludes.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkMergeDataObjectFilter.h>
+#include <vtkFieldDataToAttributeDataFilter.h>
 
-namespace VISU{
-  class TVtkCellInfo{
-  public:
-    TVtkCellInfo() {}
-    TVtkCellInfo(const char* theName, vtkIdType theSize) : 
-      myName(theName), mySize(theSize) {}
-    const char* myName;
-    vtkIdType mySize;
-  };
-  typedef std::map<vtkIdType,TVtkCellInfo> TVtkCellInfoMap;
-  extern TVtkCellInfoMap aVtkCellInfoMap;
+#include "VISU_ExtractUnstructuredGrid.hxx"
+
+#include <vtkSmartPointer.h>
 
+namespace VISU{
   enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
-  template <class _Tp> class vtk_ptr {
-  private:
-    _Tp* _M_ptr;
-  public:
-    typedef _Tp element_type;
-    explicit vtk_ptr(_Tp* __p = 0) : _M_ptr(__p) {}
-    vtk_ptr(const vtk_ptr& __a) : _M_ptr(0) {}
-    vtk_ptr(vtk_ptr& __a) : _M_ptr(__a.release()) {}
-    vtk_ptr& operator=(const vtk_ptr& __a) { return *this;}
-    vtk_ptr& operator=(vtk_ptr& __a) {
-      if (&__a != this) {
-       if(_M_ptr) _M_ptr->Delete(); 
-       _M_ptr = __a.release();
-      }
-      return *this;
-    }
-    ~vtk_ptr() { 
-      if(_M_ptr) _M_ptr->Delete(); 
-      _M_ptr = 0;
-    }
-    _Tp& operator*() const { return *_M_ptr;}
-    _Tp* operator->() const { return _M_ptr;}
-    _Tp* get() const { return _M_ptr;}
-    _Tp* release() {
-      _Tp* __tmp = _M_ptr;
-      _M_ptr = 0;
-      return __tmp;
-    }
-    void reset(_Tp* __p = 0) {
-      if(_M_ptr) _M_ptr->Delete();
-      _M_ptr = __p;
-    }
-  };
-  typedef vtk_ptr<vtkUnstructuredGrid> TVTKSource;
-  typedef vtk_ptr<vtkPoints> TVTKPoints;
 
+  typedef vtkSmartPointer<vtkPoints> TVTKPoints;
+  typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
+  typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
+  typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
+  typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
   typedef std::set<std::string> TBindGroups;
 
   struct TFamily{
@@ -115,17 +75,20 @@ namespace VISU{
   typedef std::map<std::string,TFamily> TFamilyMap;
 
   struct TField{
+    TVTKExtractFilter myExtractFilter;
     vtkIdType myId;
     std::string myName;
     TEntity myEntity;
     std::string myMeshName;
-    vtkIdType myNbComp, myNbValField, myDataSize;
+    vtkIdType myNbComp, myNbValField, myDataSize, myIsTrimmed;
     typedef std::vector<float> TValForCellsWithType;
     typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
     typedef std::pair<double,std::string> TTime;
     typedef std::vector<std::string> TCompNames;
     typedef std::vector<std::string> TUnitNames;
     struct TValForTime{
+      TVTKAttribyteFilter myAttribyteFilter;
+      TVTKMergetFilter myMergeFilter;
       TVTKSource myStorage;
       vtkIdType myId;
       std::string myMeshName;
@@ -135,16 +98,26 @@ namespace VISU{
       TTime myTime;
       TValForCells myValForCells;
       TValForTime() : myNbComp(0) {}
+      ~TValForTime() { 
+       if(myMergeFilter.GetPointer())
+         myMergeFilter->UnRegisterAllOutputs();
+       if(myAttribyteFilter.GetPointer())
+         myAttribyteFilter->UnRegisterAllOutputs();
+      }
     };
     typedef std::map<vtkIdType,TValForTime> TValField;
     TValField myValField;
     TCompNames myCompNames;
     TUnitNames myUnitNames;
-    TField() : myNbComp(0), myNbValField(0), myDataSize(0) {}
+    TField() : myNbComp(0), myNbValField(0), myDataSize(0), myIsTrimmed(0) {}
     void ShallowCopy(const TField& aField);
+    ~TField() { 
+      if(myExtractFilter.GetPointer())
+       myExtractFilter->UnRegisterAllOutputs();
+    }
   };
   typedef std::map<std::string,TField> TFieldMap;
-
   struct TMeshOnEntity{
     TVTKSource myStorage;
     std::string myMeshName;
@@ -209,23 +182,23 @@ public:
 
   virtual VISU_Convertor* Build() throw (std::runtime_error&) = 0;
   virtual const VISU::TMeshMap& GetMeshMap() throw(std::runtime_error&);
-
+  virtual float GetSize() throw (std::runtime_error&) = 0;
 
   virtual TOutput* GetMeshOnEntity(const std::string& theMeshName, 
                                   const VISU::TEntity& theEntity,
                                   const std::string& theFamilyName = "")
     throw(std::runtime_error&) = 0;
-  virtual vtkIdType GetMeshOnEntitySize(const std::string& theMeshName, 
-                                       const VISU::TEntity& theEntity,
-                                       const std::string& theFamilyName = "")
+  virtual float GetMeshOnEntitySize(const std::string& theMeshName, 
+                                   const VISU::TEntity& theEntity,
+                                   const std::string& theFamilyName = "")
     throw (std::runtime_error&) = 0;
   
   
   virtual TOutput* GetMeshOnGroup(const std::string& theMeshName, 
                                  const std::string& theGroupName)
     throw(std::runtime_error&) = 0;
-  virtual vtkIdType GetMeshOnGroupSize(const std::string& theMeshName, 
-                                      const std::string& theGroupName)
+  virtual float GetMeshOnGroupSize(const std::string& theMeshName, 
+                                  const std::string& theGroupName)
     throw(std::runtime_error&) = 0;
   
 
@@ -234,14 +207,14 @@ public:
                                      const std::string& theFieldName,
                                      int theStampsNum)
     throw(std::runtime_error&) = 0;
-  virtual vtkIdType GetTimeStampSize(const std::string& theMeshName, 
-                                    const VISU::TEntity& theEntity,
-                                    const std::string& theFieldName,
-                                    int theStampsNum)
+  virtual float GetTimeStampSize(const std::string& theMeshName, 
+                                const VISU::TEntity& theEntity,
+                                const std::string& theFieldName,
+                                int theStampsNum)
     throw(std::runtime_error&) = 0;
-  virtual vtkIdType GetFieldOnMeshSize(const std::string& theMeshName, 
-                                      const VISU::TEntity& theEntity,
-                                      const std::string& theFieldName)
+  virtual float GetFieldOnMeshSize(const std::string& theMeshName, 
+                                  const VISU::TEntity& theEntity,
+                                  const std::string& theFieldName)
     throw(std::runtime_error&) = 0;
   virtual const VISU::TField& GetField(const std::string& theMeshName, 
                                       VISU::TEntity theEntity, 
index 22cb5b2f68edf7d3848b3cb2e4893408b62d2d94..60c0a962eaa5172b61971d28ec7ac855998960a6 100644 (file)
@@ -24,7 +24,8 @@
 //  Author : Alexey PETROV
 //  Module : VISU
 
-#include "VISU_Convertor_impl.hxx"
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <vtkCellType.h>
 
index bc6dcad716908079253a29601c3de6a409e74e43..80ad171f09aa489b7a0395c682f0c8d36ee4e8ae 100644 (file)
@@ -33,12 +33,24 @@ extern "C"{
 
 #include <fstream>     
 #include <strstream>   
+#include <string>
 
 #include <vtkCellType.h>
 
 #include <qstring.h>
 #include <qfileinfo.h>
 
+#ifndef MESSAGE
+#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
+
+#undef EXCEPT
+#define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
+
+#undef EXCEPTION
+#define EXCEPTION(msg) EXCEPT(msg).latin1()
+
+#endif
+
 template<class T> std::string dtos(const std::string& fmt, T val){
   static QString aString;
   aString.sprintf(fmt.c_str(),val);
index 8f6ed718c8b525d776c91fd5b71ac67a4aa1d0d5..81a76c9779548384b70d96f4637c817d6dc47e73 100644 (file)
@@ -25,6 +25,7 @@
 //  Module : VISU
 
 #include "VISU_Convertor_impl.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <vtkIdList.h>
 #include <vtkCellType.h>
 #include <vtkUnsignedCharArray.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
+#include <vtkCellLinks.h>
+
+#include <vtkMergeDataObjectFilter.h>
+
+#include <vtkUnstructuredGridWriter.h>
 
 #include <qstring.h>
 #include <qfileinfo.h>
 
 using namespace std;
 
+static float ERR_SIZE_CALC = 1.00;
+
+static int MYVTKDEBUG = 0;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -51,6 +61,349 @@ static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
+void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
+  //vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+  //if(MYVTKDEBUG) aWriter->DebugOn();
+  ////aWriter->SetFileType(VTK_BINARY);
+  //aWriter->SetFileName(theFileName.c_str());
+  //aWriter->SetInput(theDataSet);
+  //aWriter->Write();
+  //aWriter->Delete();
+}
+
+namespace{
+  void GetPoints(VISU::TVTKSource& theStorage, VISU::TMesh& theMesh) 
+    throw (std::runtime_error&)
+  {
+    vtkPoints* aPoints = theMesh.myPoints.GetPointer();
+    if(!aPoints){
+      aPoints = vtkPoints::New();
+      if(MYVTKDEBUG) aPoints->DebugOn();
+      const VISU::TMesh::TPointsCoord& anArray = theMesh.myPointsCoord;
+      vtkIdType iEnd = theMesh.myPointsCoord.size();
+      vtkIdType aNbPoints = iEnd / theMesh.myDim;
+      aPoints->SetNumberOfPoints(aNbPoints);
+      if(MYDEBUG) 
+       MESSAGE("GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
+      switch(theMesh.myDim) {
+      case 1:
+       for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
+         aPoints->SetPoint(j,anArray[i],0.0,0.0);
+       break;
+      case 2:
+       for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
+         aPoints->SetPoint(j,anArray[i],anArray[i+1],0.0);
+       break;
+      case 3: 
+       for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
+         aPoints->SetPoint(j,anArray[i],anArray[i+1],anArray[i+2]);
+       break;
+      }
+      theMesh.myPoints = aPoints;
+    }
+    theStorage->SetPoints(aPoints);
+  }
+  
+  
+  inline void PrintCells(int& theStartId,
+                        vtkCellArray* theConnectivity, 
+                        const VISU::TMeshOnEntity::TConnect& theVector)
+  {
+    vtkIdList *anIdList = vtkIdList::New();
+    int kEnd = theVector.size();
+    anIdList->SetNumberOfIds(kEnd);
+    for(int k = 0; k < kEnd; k++)
+      anIdList->SetId(k,theVector[k]);
+    theConnectivity->InsertNextCell(anIdList);
+    anIdList->Delete();
+  }
+
+  void GetCellsOnEntity(VISU::TVTKSource& theStorage,
+                       const VISU::TMeshOnEntity& theMeshOnEntity, 
+                       const string& theFamilyName) 
+    throw (std::runtime_error&)
+  {
+    //Check on existing family
+    const VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
+    bool isFamilyPresent = (pFamily != NULL);
+    const VISU::TFamily& aFamily = *pFamily;
+    //Main part of code
+    pair<int,int> aCellsDim = theMeshOnEntity.GetCellsDims(theFamilyName);
+    int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
+    vtkCellArray* aConnectivity = vtkCellArray::New();
+    aConnectivity->Allocate(aCellsSize,0);
+    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+    aCellTypesArray->SetNumberOfComponents(1);
+    aCellTypesArray->SetNumberOfTuples(aNbCells);
+    if(MYDEBUG) MESSAGE("GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
+    const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
+    VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+    for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+      const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+      int aVtkType = aCellsConnIter->first;
+      if(MYDEBUG) 
+       MESSAGE("GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+      if(!isFamilyPresent)
+       for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
+         PrintCells(i,aConnectivity,anArray[k]);
+         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
+       }
+      else{
+       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+       if(aSubMesh.empty()) 
+         throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
+       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+       if(aSubMeshIter == aSubMesh.end()) continue;
+       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+       if(MYDEBUG) 
+         MESSAGE("GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
+       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
+       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
+         PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
+         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
+       }
+      }
+    }
+    vtkIdType *pts = 0, npts = 0;
+    vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    aCellLocationsArray->SetNumberOfComponents(1);
+    aCellLocationsArray->SetNumberOfTuples(aNbCells);
+    aConnectivity->InitTraversal();
+    for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
+      aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+    theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    if(MYVTKDEBUG) aConnectivity->DebugOn();
+    aCellLocationsArray->Delete();
+    aCellTypesArray->Delete();
+    aConnectivity->Delete();
+  } 
+  
+  
+  void GetCellsOnGroup(VISU::TVTKSource& theStorage,
+                      const VISU::TMesh& theMesh,
+                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
+    throw (std::runtime_error&)
+  {
+    //Calculate dimentions of the group
+    int aNbCells = 0, aCellsSize = 0;
+    VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
+    for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+      const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+      const string& aFamilyName = aFamilyAndEntity.first;
+      const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+      const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
+      pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(aFamilyName);
+      aNbCells += aCellsDim.first;
+      aCellsSize += aCellsDim.second;
+    }
+    vtkCellArray* aConnectivity = vtkCellArray::New();
+    aConnectivity->Allocate(aCellsSize,0);
+    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+    aCellTypesArray->SetNumberOfComponents(1);
+    aCellTypesArray->SetNumberOfTuples(aNbCells);
+    aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
+    for(int i = 0, j = 0; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+      const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+      const string& aFamilyName = aFamilyAndEntity.first;
+      const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+      const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
+      const VISU::TFamily& aFamily = *(VISU::GetFamily(aMeshOnEntity,aFamilyName));
+      const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
+      VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+      for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+       const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+       int aVtkType = aCellsConnIter->first;
+       if(MYDEBUG) 
+         MESSAGE("GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+       if(aSubMesh.empty()) 
+         throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
+       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+       if(aSubMeshIter == aSubMesh.end()) continue;
+       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+       if(MYDEBUG) 
+         MESSAGE("GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
+       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
+       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
+         PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
+         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
+       }
+      }
+    }
+    vtkIdType *pts = 0, npts = 0;
+    vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    aCellLocationsArray->SetNumberOfComponents(1);
+    aCellLocationsArray->SetNumberOfTuples(aNbCells);
+    aConnectivity->InitTraversal();
+    for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
+      aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+    theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    aCellLocationsArray->Delete();
+    aCellTypesArray->Delete();
+    aConnectivity->Delete();
+  } 
+  
+  
+  void InitProfile(VISU::TVTKExtractFilter& theFilter,
+                  const VISU::TMeshOnEntity& theMeshOnEntity, 
+                  const VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&)
+  {
+    const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
+    const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
+    VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+    for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+      const vtkIdType& aCellType = aCellsConnIter->first;
+      if(aValForCells.find(aCellType) == aValForCells.end())
+       theFilter->RemoveCellsWithType(aCellType);
+    }
+  }
+
+
+  void GetValsOnTimeStamp(vtkFloatArray *theFloatArray, 
+                         const vtkIdType& theNumberOfTuples,
+                         const std::string& theFieldName,
+                         const VISU::TField& theField,
+                         const VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&)
+  {
+    //theFloatArray->DebugOn();
+    theFloatArray->SetNumberOfTuples(theNumberOfTuples);
+    theFloatArray->SetName(theFieldName.c_str());
+    if(MYDEBUG) MESSAGE("GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
+    const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
+    VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
+    for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
+      const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
+      int iEnd = anArray.size()/theField.myNbComp;
+      int aVtkType = aValForCellsIter->first;
+      if(MYDEBUG) MESSAGE("GetValsOnTimeStamp -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
+      switch(theField.myNbComp) {
+      case 1:
+       for (int i = 0; i < iEnd; i++) 
+         theFloatArray->SetTuple1(k++,anArray[i]);
+       break;
+      case 2:
+       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*2)
+         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
+       break;
+      case 3:
+       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*3)
+         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
+       break;
+      case 4:
+       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
+         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+2],0.0);
+       break;
+      case 6:
+       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
+         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+2],anArray[ji+5]);
+       break;
+      default:
+       throw std::runtime_error(EXCEPTION("GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!"));
+      }
+    }
+  }
+
+  string GenerateFieldName(const VISU::TField& theField,
+                          const VISU::TField::TValForTime& theValForTime)
+  {
+    const VISU::TField::TTime& aTime = theValForTime.myTime;
+    string aFieldName = theField.myMeshName + ", " + theField.myName + ": " + 
+      VISU_Convertor::GenerateName(aTime);
+    return aFieldName;
+  }
+
+  void GetTimeStamp(VISU::TVTKSource& theStorage,
+                   const VISU::TMesh& theMesh,
+                   const VISU::TMeshOnEntity& theMeshOnEntity, 
+                   const VISU::TField& theField, 
+                   const VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&)
+  {
+    int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
+    string aFieldName = GenerateFieldName(theField,theValForTime);
+    if(MYDEBUG) 
+      MESSAGE("GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
+             "; aNumberOfTuples = "<<aNumberOfTuples);
+
+    vtkDataSetAttributes* aDataSetAttributes;
+    switch(theField.myEntity){
+    case VISU::NODE_ENTITY : 
+      aDataSetAttributes = theStorage->GetPointData();
+      break;
+    default: 
+      aDataSetAttributes = theStorage->GetCellData();
+    }
+
+    vtkFloatArray *aFloatArray = vtkFloatArray::New();
+    switch(theField.myNbComp) {
+    case 1:
+      aFloatArray->SetNumberOfComponents(1);
+      aDataSetAttributes->SetScalars(aFloatArray);
+      break;
+    default:
+      aFloatArray->SetNumberOfComponents(3);
+      aDataSetAttributes->SetVectors(aFloatArray);
+    }
+
+    GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+  }
+
+  void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
+                   VISU::TVTKMergetFilter& theMergeFilter,
+                   VISU::TVTKExtractFilter& theExtractFilter,
+                   const VISU::TMesh& theMesh,
+                   const VISU::TMeshOnEntity& theMeshOnEntity, 
+                   const VISU::TField& theField, 
+                   const VISU::TField::TValForTime& theValForTime)
+    throw (std::runtime_error&)
+  {
+    int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
+    string aFieldName = GenerateFieldName(theField,theValForTime);
+    if(MYDEBUG) 
+      MESSAGE("GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
+             "; aNumberOfTuples = "<<aNumberOfTuples);
+
+    vtkDataObject* aDataObject = vtkDataObject::New();
+    theMergeFilter->SetDataObject(aDataObject);
+    aDataObject->Delete();
+
+    theMergeFilter->SetInput(theExtractFilter->GetOutput());
+    theAttribyteFilter->SetInput(theMergeFilter->GetOutput());
+
+    switch(theField.myEntity){
+    case VISU::NODE_ENTITY : 
+      theMergeFilter->SetOutputFieldToPointDataField();
+      theAttribyteFilter->SetInputFieldToPointDataField();
+      theAttribyteFilter->SetOutputAttributeDataToPointData();
+      break;
+    default: 
+      theMergeFilter->SetOutputFieldToCellDataField();
+      theAttribyteFilter->SetInputFieldToCellDataField();
+      theAttribyteFilter->SetOutputAttributeDataToCellData();
+    }
+
+    vtkFloatArray *aFloatArray = vtkFloatArray::New();
+    switch(theField.myNbComp) {
+    case 1:
+      aFloatArray->SetNumberOfComponents(1);
+      theAttribyteFilter->SetScalarComponent(0,aFieldName.c_str(),0);
+      break;
+    default:
+      aFloatArray->SetNumberOfComponents(3);
+      theAttribyteFilter->SetVectorComponent(0,aFieldName.c_str(),0);
+      theAttribyteFilter->SetVectorComponent(1,aFieldName.c_str(),1);
+      theAttribyteFilter->SetVectorComponent(2,aFieldName.c_str(),2);
+    }
+
+    vtkFieldData* aFieldData = aDataObject->GetFieldData();
+    aFieldData->AddArray(aFloatArray);
+    aFloatArray->Delete();
+
+    GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+  }
+}
 
 VISU_Convertor_impl::VISU_Convertor_impl() {
   myIsDone = false;
@@ -81,20 +434,39 @@ VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName,
     pSource = &(aMeshOnEntity.myStorage);
   VISU::TVTKSource& aSource = *pSource;
   //Main part of code
-  if(aSource.get() == NULL){
-    aSource.reset(TOutput::New());
-    LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
-    GetPoints(aSource,aMesh);
-    GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
-    if(MYDEBUGWITHFILES){
-      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-      string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
-      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
-      aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
-      VISU::WriteToFile(aSource.get(),aFileName);
+  try{
+    if(aSource.GetPointer() == NULL){
+      aSource = TOutput::New();
+      aSource->Delete();
+      if(MYVTKDEBUG) aSource->DebugOn();
+      LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
+      GetPoints(aSource,aMesh);
+      GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
+      if(MYDEBUGWITHFILES){
+       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
+       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
+       VISU::WriteToFile(aSource.GetPointer(),aFileName);
+      }
+    }
+    if(MYVTKDEBUG){
+      GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
+      vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
+      aDataSet->Update();
+      MESSAGE("GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
+      MESSAGE("GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
+      MESSAGE("GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
+      MESSAGE("GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
+      aDataSet->BuildLinks();
+      MESSAGE("GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
+      MESSAGE("GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
     }
+  }catch(...){
+    aSource = vtkSmartPointerBase();
+    throw;
   }
-  return aSource.get();
+  return aSource.GetPointer();
 }
 
 VISU_Convertor::TOutput* 
@@ -113,20 +485,26 @@ VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName,
   const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
   VISU::TVTKSource& aSource = aGroup.myStorage;
   //Main part of code
-  if(aSource.get() == NULL){
-    aSource.reset(TOutput::New());
-    LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
-    GetPoints(aSource,aMesh);
-    GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
-    if(MYDEBUGWITHFILES){
-      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-      string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
-      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
-      aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
-      VISU::WriteToFile(aSource.get(),aFileName);
+  try{
+    if(aSource.GetPointer() == NULL){
+      aSource = TOutput::New();
+      aSource->Delete();
+      LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
+      GetPoints(aSource,aMesh);
+      GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
+      if(MYDEBUGWITHFILES){
+       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
+       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
+       VISU::WriteToFile(aSource.GetPointer(),aFileName);
+      }
     }
+  }catch(...){
+    aSource = vtkSmartPointerBase();
+    throw;
   }
-  return aSource.get();
+  return aSource.GetPointer();
 }
 
 VISU_Convertor::TOutput* 
@@ -149,306 +527,175 @@ VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName,
                theFieldName,pField,theStampsNum,pValForTime);
   VISU::TMesh& aMesh = *pMesh;
   VISU::TMeshOnEntity& aMeshOnEntity = *pMeshOnEntity;
-  VISU::TMeshOnEntity& aVTKMeshOnEntity = *pVTKMeshOnEntity;
   VISU::TField& aField = *pField;
   VISU::TField::TValForTime& aValForTime = *pValForTime;
+  VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime.myAttribyteFilter;
   VISU::TVTKSource& aSource = aValForTime.myStorage;
+  TOutput* anOutput = NULL;
   //Main part of code
-  if(aSource.get() == NULL){
-    aSource.reset(TOutput::New());
-    LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
-    try{
-      LoadMeshOnEntity(aVTKMeshOnEntity);
-    }catch(std::runtime_error& exc){
-      aVTKMeshOnEntity = aMeshOnEntity;
-      MESSAGE("Follow exception was accured :\n"<<exc.what());
-    }catch(...){
-      aVTKMeshOnEntity = aMeshOnEntity;
-      MESSAGE("Unknown exception was accured!");
-    }
-    GetMeshOnEntity(aVTKMeshOnEntity.myMeshName,aVTKMeshOnEntity.myEntity);
-    aSource->ShallowCopy(aVTKMeshOnEntity.myStorage.get());
-    GetField(aSource,aMesh,aVTKMeshOnEntity,aField,aValForTime);
-    if(MYDEBUGWITHFILES){
-      string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-      string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-      string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
-      aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
-      VISU::WriteToFile(aSource.get(),aFileName);
-    }
-  }
-  return aSource.get();
-}
-
-inline void PrintCells(int& theStartId,
-                      vtkCellArray* theConnectivity, 
-                      const VISU::TMeshOnEntity::TConnect& theVector)
-{
-  vtkIdList *anIdList = vtkIdList::New();
-  int kEnd = theVector.size();
-  anIdList->SetNumberOfIds(kEnd);
-  for(int k = 0; k < kEnd; k++){
-    anIdList->SetId(k,theVector[k]);
-    //anIdList->InsertNextId(theVector[k]);
-  }
-  theConnectivity->InsertNextCell(anIdList);
-  anIdList->Delete();
-}
-
-void VISU_Convertor_impl::GetCellsOnEntity(VISU::TVTKSource& theStorage,
-                                          const VISU::TMeshOnEntity& theMeshOnEntity, 
-                                          const string& theFamilyName) 
-  const throw (std::runtime_error&)
-{
-  //Check on existing family
-  const VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-  bool isFamilyPresent = (pFamily != NULL);
-  const VISU::TFamily& aFamily = *pFamily;
-  //Main part of code
-  pair<int,int> aCellsDim = theMeshOnEntity.GetCellsDims(theFamilyName);
-  int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
-  vtkCellArray* aConnectivity = vtkCellArray::New();
-  //vtkIdType *anIdArray = aConnectivity->WritePointer(0,aCellsSize);
-  aConnectivity->Allocate(aCellsSize,0);
-  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-  aCellTypesArray->SetNumberOfComponents(1);
-  aCellTypesArray->SetNumberOfTuples(aNbCells);
-  if(MYDEBUG) MESSAGE("GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
-  const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
-  VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-  for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-    const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
-    int aVtkType = aCellsConnIter->first;
-    if(MYDEBUG) MESSAGE("GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-    if(!isFamilyPresent)
-      for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
-       PrintCells(i,aConnectivity,anArray[k]);
-       aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       //aCellTypesArray->InsertNextValue((unsigned char)aVtkType);
-      }
+  try{
+    if(aSource.GetPointer())
+      return aSource.GetPointer();
+    else if(anAttribyteFilter.GetPointer())
+      return anAttribyteFilter->GetUnstructuredGridOutput();
     else{
-      const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
-      if(aSubMesh.empty()) throw std::runtime_error("GetCells >> There is no elements on the family !!!");
-      VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
-      if(aSubMeshIter == aSubMesh.end()) continue;
-      const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-      if(MYDEBUG) MESSAGE("GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-      VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
-      for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
-       PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
-       aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       //aCellTypesArray->InsertNextValue((unsigned char)aVtkType);
+      LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
+
+      VISU::TVTKExtractFilter& anExtractFilter = aField.myExtractFilter;
+      if(anExtractFilter.GetPointer() == NULL){
+       anExtractFilter = VISU_ExtractUnstructuredGrid::New();
+       anExtractFilter->Delete();
+       //anExtractFilter->DebugOn();
+       try{
+         LoadMeshOnEntity(*pVTKMeshOnEntity);
+       }catch(std::runtime_error& exc){
+         pVTKMeshOnEntity = pMeshOnEntity;
+         MESSAGE("Follow exception was accured :\n"<<exc.what());
+       }catch(...){
+         pVTKMeshOnEntity = pMeshOnEntity;
+         MESSAGE("Unknown exception was accured!");
+       }
+       GetMeshOnEntity(pVTKMeshOnEntity->myMeshName,pVTKMeshOnEntity->myEntity);
+       
+       anExtractFilter->SetInput(pVTKMeshOnEntity->myStorage.GetPointer());
+       ::InitProfile(anExtractFilter,*pMeshOnEntity,aValForTime);
+      }      
+      if(!anExtractFilter->IsRemoving()){
+       aSource = TOutput::New();
+       aSource->Delete();
+       aSource->ShallowCopy(pVTKMeshOnEntity->myStorage.GetPointer());
+       ::GetTimeStamp(aSource,aMesh,*pVTKMeshOnEntity,aField,aValForTime);
+       anOutput = aSource.GetPointer();
+      }else{
+       anAttribyteFilter = vtkFieldDataToAttributeDataFilter::New();
+       anAttribyteFilter->Delete();
+       //anAttribyteFilter->DebugOn();
+       
+       VISU::TVTKMergetFilter& aMergeFilter = aValForTime.myMergeFilter;
+       aMergeFilter = vtkMergeDataObjectFilter::New();
+       aMergeFilter->Delete();
+       //aMergeFilter->DebugOn();
+
+       ::GetTimeStamp(anAttribyteFilter,aMergeFilter,anExtractFilter,
+                      aMesh,*pVTKMeshOnEntity,aField,aValForTime);
+       anOutput = anAttribyteFilter->GetUnstructuredGridOutput();
       }
-    }
-  }
-  vtkIdType *pts = 0, npts = 0;
-  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-  aCellLocationsArray->SetNumberOfComponents(1);
-  aCellLocationsArray->SetNumberOfTuples(aNbCells);
-  aConnectivity->InitTraversal();
-  for(int i=0; aConnectivity->GetNextCell(npts,pts); i++){
-    aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
-    //aCellLocationsArray->InsertNextValue(aConnectivity->GetTraversalLocation(npts));
-  }
-  theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
-} 
-
-
-void VISU_Convertor_impl::GetCellsOnGroup(VISU::TVTKSource& theStorage,
-                                         const VISU::TMesh& theMesh,
-                                         const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
-  const throw (std::runtime_error&)
-{
-  //Calculate dimentions of the group
-  int aNbCells = 0, aCellsSize = 0;
-  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-    const string& aFamilyName = aFamilyAndEntity.first;
-    const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-    const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
-    pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(aFamilyName);
-    aNbCells += aCellsDim.first;
-    aCellsSize += aCellsDim.second;
-  }
-  vtkCellArray* aConnectivity = vtkCellArray::New();
-  //vtkIdType *anIdArray = aConnectivity->WritePointer(0,aCellsSize);
-  aConnectivity->Allocate(aCellsSize,0);
-  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-  aCellTypesArray->SetNumberOfComponents(1);
-  aCellTypesArray->SetNumberOfTuples(aNbCells);
-  aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-  for(int i = 0, j = 0; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-    const string& aFamilyName = aFamilyAndEntity.first;
-    const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-    const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
-    const VISU::TFamily& aFamily = *(VISU::GetFamily(aMeshOnEntity,aFamilyName));
-    const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
-    VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-    for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-      const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
-      int aVtkType = aCellsConnIter->first;
-      if(MYDEBUG) MESSAGE("GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-      const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
-      if(aSubMesh.empty()) throw std::runtime_error("GetCells >> There is no elements on the family !!!");
-      VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
-      if(aSubMeshIter == aSubMesh.end()) continue;
-      const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-      if(MYDEBUG) MESSAGE("GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-      VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
-      for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
-       PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
-       aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       //aCellTypesArray->InsertNextValue((unsigned char)aVtkType);
+      if(MYDEBUGWITHFILES){
+       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+       string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       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);
+       vtkUnstructuredGrid *aDataSet = anAttribyteFilter->GetUnstructuredGridOutput();
+       aDataSet->Update();
+       if(theEntity == VISU::NODE_ENTITY)
+         MESSAGE("GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
+       else
+         MESSAGE("GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
+       MESSAGE("GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
       }
     }
+  }catch(...){
+    aSource = vtkSmartPointerBase();
+    anAttribyteFilter = vtkSmartPointerBase();
+    throw;
   }
-  vtkIdType *pts = 0, npts = 0;
-  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-  aCellLocationsArray->SetNumberOfComponents(1);
-  aCellLocationsArray->SetNumberOfTuples(aNbCells);
-  aConnectivity->InitTraversal();
-  for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++){
-    aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
-    //aCellLocationsArray->InsertNextValue(aConnectivity->GetTraversalLocation(npts));
-  }
-  theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
-} 
-
-
-void VISU_Convertor_impl::GetPoints(VISU::TVTKSource& theStorage, const VISU::TMesh& theMesh) 
-  const throw (std::runtime_error&)
-{
-  vtkPoints* aPoints = theMesh.myPoints.get();
-  if(!aPoints){
-    aPoints = vtkPoints::New();
-    const VISU::TMesh::TPointsCoord& anArray = theMesh.myPointsCoord;
-    vtkIdType iEnd = theMesh.myPointsCoord.size();
-    vtkIdType aNbPoints = iEnd / theMesh.myDim;
-    aPoints->SetNumberOfPoints(aNbPoints);
-    if(MYDEBUG) 
-      MESSAGE("GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
-    switch(theMesh.myDim) {
-    case 1:
-      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
-       aPoints->SetPoint(j,anArray[i],0.0,0.0);
-      break;
-    case 2:
-      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
-       aPoints->SetPoint(j,anArray[i],anArray[i+1],0.0);
-      break;
-    case 3: 
-      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
-       aPoints->SetPoint(j,anArray[i],anArray[i+1],anArray[i+2]);
-      break;
-    }
-  }
-  theStorage->SetPoints(aPoints);
-}
-
-void VISU_Convertor_impl::GetField(VISU::TVTKSource& theStorage,
-                                  const VISU::TMesh& theMesh,
-                                  const VISU::TMeshOnEntity& theMeshOnEntity, 
-                                  const VISU::TField& theField, 
-                                  const VISU::TField::TValForTime& theValForTime)
-  const throw (std::runtime_error&)
-{
-  if(MYDEBUG) MESSAGE("GetField - aTime = "<<theValForTime.myId<<"; theField.myName = "<<theField.myName);
-  int aNumberOfTuples;
-  vtkDataSetAttributes* aDataSetAttributes;
-  switch(theField.myEntity) {
-  case VISU::NODE_ENTITY : 
-    {
-      int aNbPoints = theMesh.myPointsCoord.size()/theMesh.myDim;
-      aNumberOfTuples = aNbPoints;
-      aDataSetAttributes = theStorage->GetPointData();
-      break;
-    }
-  default: 
-    {
-      pair<int,int> aCellsDim = theMeshOnEntity.GetCellsDims();
-      int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
-      aNumberOfTuples = aNbCells;
-      aDataSetAttributes = theStorage->GetCellData();
-    }
-  }
-  vtkFloatArray *aFloatArray = vtkFloatArray::New();
-  switch(theField.myNbComp) {
-  case 1:
-    aFloatArray->SetNumberOfComponents(1);
-    aDataSetAttributes->SetScalars(aFloatArray);
-    break;
-  default:
-    aFloatArray->SetNumberOfComponents(3);
-    aDataSetAttributes->SetVectors(aFloatArray);
-  }
-  aFloatArray->SetNumberOfTuples(aNumberOfTuples);
-  //const VISU::TField::TTime& aTime = theValForTime.myTime;
-  //string aFieldName = theField.myMeshName + ", " + theField.myName + ": " + GenerateName(aTime);
-  //aFloatArray->SetName(aFieldName.c_str());
-  if(MYDEBUG) MESSAGE("GetField - aNumberOfTuples = "<<aNumberOfTuples);
-  const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
-  VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
-  for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
-    const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
-    int iEnd = anArray.size()/theField.myNbComp;
-    int aVtkType = aValForCellsIter->first;
-    if(MYDEBUG) MESSAGE("GetField -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
-    switch(theField.myNbComp) {
-    case 1:
-      for (int i = 0; i < iEnd; i++) 
-       aFloatArray->SetTuple1(k++,anArray[i]);
-      break;
-    case 2:
-      for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*2)
-       aFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
-      break;
-    case 3:
-      for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*3)
-       aFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
-      break;
-    default:
-      throw std::runtime_error("GetField - There is algorithm for representation the field !!!");
-    }
-  }
+  return anOutput;
 }
 
-
 void VISU_Convertor_impl::FindMesh(const string& theMeshName, VISU::TMesh*& theMesh)
   throw (std::runtime_error&)
 {
   GetMeshMap();
   if(myMeshMap.find(theMeshName) == myMeshMap.end())
-    throw std::runtime_error("FindMesh >> There is no mesh with the name!!!");
+    throw std::runtime_error(EXCEPT("FindMesh >> There is no mesh with the name - '%1'!!!").
+                            arg(theMeshName.c_str()).latin1());
   theMesh = &myMeshMap[theMeshName];
 }
 
 
-void VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName, VISU::TMesh*& theMesh,
-                                          const VISU::TEntity& theEntity, VISU::TMeshOnEntity*& theMeshOnEntity,
-                                          const string& theFamilyName, VISU::TFamily*& theFamily)
+void VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName, 
+                                          VISU::TMesh*& theMesh,
+                                          const VISU::TEntity& theEntity, 
+                                          VISU::TMeshOnEntity*& theMeshOnEntity,
+                                          const string& theFamilyName, 
+                                          VISU::TFamily*& theFamily)
   throw (std::runtime_error&)
 {
   FindMesh(theMeshName,theMesh);
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
   if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
-    throw std::runtime_error("FindMeshOnEntity >> There is no mesh on the entity!!!");
+    throw std::runtime_error(EXCEPT("FindMeshOnEntity >> There is no mesh on the entity - %1!!!").
+                            arg(int(theEntity)).latin1());
   theMeshOnEntity = &aMeshOnEntityMap[theEntity];
   theFamily = VISU::GetFamily(*theMeshOnEntity,theFamilyName);
 }
 
 
-vtkIdType VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName, 
-                                                  const VISU::TEntity& theEntity,
-                                                  const std::string& theFamilyName)
+float VISU_Convertor_impl::GetSize() throw (std::runtime_error&){
+  float aResult = 0.0;
+  const VISU::TMeshMap& aMeshMap = GetMeshMap();
+  VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+  for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+    const string& aMeshName = aMeshMapIter->first;
+    const VISU::TMesh& aMesh = aMeshMapIter->second;
+    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+    //Import fields
+    aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+      const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+      const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+      VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+      for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+       const string& aFieldName = aFieldMapIter->first;
+       const VISU::TField& aField = aFieldMapIter->second;
+       const VISU::TField::TValField& aValField = aField.myValField;
+       VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+       for(; aValFieldIter != aValField.end(); aValFieldIter++){
+         int aTimeStamp = aValFieldIter->first;
+         aResult += GetTimeStampSize(aMeshName,anEntity,aFieldName,aTimeStamp);
+       }
+      }
+      //Importing groups
+      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+      for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+       const string& aGroupName = aGroupMapIter->first;
+       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;
+       aResult += GetMeshOnEntitySize(aMeshName,anEntity,aFamilyName);
+      }
+      //Import mesh on entity
+      aResult += GetMeshOnEntitySize(aMeshName,anEntity);
+    }
+  }
+  if(MYDEBUG)
+    MESSAGE("GetSize - aResult = "<<float(aResult));
+  return aResult;
+}
+
+
+float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName, 
+                                              const VISU::TEntity& theEntity,
+                                              const std::string& theFamilyName)
   throw (std::runtime_error&)
 {
   VISU::TMesh* pMesh = NULL;
   VISU::TFamily* pFamily = NULL;
   VISU::TMeshOnEntity* pMeshOnEntity = NULL;
   FindMeshOnEntity(theMeshName,pMesh,theEntity,pMeshOnEntity,theFamilyName,pFamily);
-  vtkIdType aResult = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
+  vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
   vtkIdType aNbCells, aCellsSize;
   if(!pFamily){
     aNbCells = pMeshOnEntity->myNbCells;
@@ -457,10 +704,26 @@ vtkIdType VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshNam
     aNbCells = pFamily->myNbCells;
     aCellsSize = pFamily->myCellsSize;
   }
-  //that is Connectivity + (Types + Locations + Links)
-  aResult += aCellsSize*sizeof(vtkIdType) + 
-    aNbCells*(sizeof(char) + sizeof(int) + (sizeof(short) + sizeof(vtkIdType)));
-  if(MYDEBUG) cout<<"VISU_Convertor_impl::GetMeshOnEntitySize = "<<aResult<<endl;
+  vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  vtkIdType aTypesSize = aNbCells*sizeof(char);
+  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+  vtkIdType aLinksSize = pMesh->myNbPoints * 
+    (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
+  aLinksSize = 0;
+  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+  if(MYDEBUG){
+    if(MYVTKDEBUG){
+      MESSAGE("GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
+      MESSAGE("GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
+      MESSAGE("GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
+      MESSAGE("GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
+      MESSAGE("GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
+    }
+    MESSAGE("GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
+           "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+  }
+  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -473,21 +736,38 @@ void VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName, VISU::
   VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
   VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
   if(aGroupMapIter == aGroupMap.end())
-    throw std::runtime_error("FindMeshOnGroup >> There is no the group in the mesh!!!");
+    throw std::runtime_error(EXCEPT("FindMesh >> There is no the group in the mesh!!! - '%1'").arg(theGroupName.c_str()).latin1());
   theGroup = &aGroupMapIter->second;
 }
 
 
-vtkIdType VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName, 
-                                                 const std::string& theGroupName)
+float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName, 
+                                             const std::string& theGroupName)
   throw (std::runtime_error&)
 {
   VISU::TMesh* pMesh = NULL;
   VISU::TGroup* pGroup = NULL;
   FindMeshOnGroup(theMeshName,pMesh,theGroupName,pGroup);
-  vtkIdType aResult = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
-  aResult += pGroup->myCellsSize*sizeof(vtkIdType);
-  if(MYDEBUG) cout<<"VISU_Convertor_impl::GetMeshOnGroupSize = "<<aResult<<endl;
+  vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
+  vtkIdType aNbCells = pGroup->myNbCells, aCellsSize = pGroup->myCellsSize;
+  vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
+  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+  vtkIdType aLinksSize = pMesh->myNbPoints * 
+    (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
+  aLinksSize = 0;
+  vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+  if(MYDEBUG){
+    if(MYVTKDEBUG){
+      MESSAGE("GetMeshOnGroupSize - aPointsSize = "<<float(aPointsSize));
+      MESSAGE("GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<float(aConnectivityAndTypesSize));
+      MESSAGE("GetMeshOnGroupSize - aLocationsSize = "<<float(aLocationsSize));
+      MESSAGE("GetMeshOnGroupSize - aLinksSize = "<<float(aLinksSize));
+    }
+    MESSAGE("GetMeshOnGroupSize - aResult = "<<float(aResult)<<"; theMeshName = '"
+           <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+  }
+  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -505,21 +785,24 @@ void VISU_Convertor_impl::FindField(const string& theMeshName, VISU::TMesh*& the
   theMeshOnEntity = pMeshOnEntity;
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
   if(theEntity == VISU::NODE_ENTITY){
-    if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) == aMeshOnEntityMap.end())
-      throw std::runtime_error("FindField >> There is no mesh on CELL_ENTITY!!!");
-    pMeshOnEntity = &aMeshOnEntityMap[VISU::CELL_ENTITY];
+    if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
+      pMeshOnEntity = &aMeshOnEntityMap[VISU::CELL_ENTITY];
+    else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end())
+      pMeshOnEntity = &aMeshOnEntityMap[VISU::FACE_ENTITY];
+    else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end())
+      pMeshOnEntity = &aMeshOnEntityMap[VISU::EDGE_ENTITY];
   }
   theVTKMeshOnEntity = pMeshOnEntity;
   VISU::TFieldMap& aFieldMap = theMeshOnEntity->myFieldMap;
   if(aFieldMap.find(theFieldName) == aFieldMap.end())
-    throw std::runtime_error("FindField >> There is no field on the mesh!!!");
+    throw std::runtime_error(EXCEPTION("FindField >> There is no field on the mesh!!!"));
   theField = &aFieldMap[theFieldName];
 }
 
 
-vtkIdType VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName, 
-                                                 const VISU::TEntity& theEntity,
-                                                 const std::string& theFieldName)
+float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName, 
+                                             const VISU::TEntity& theEntity,
+                                             const std::string& theFieldName)
   throw(std::runtime_error&)
 {
   VISU::TMesh* pMesh = NULL;
@@ -527,10 +810,15 @@ vtkIdType VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName
   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
   FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
            theFieldName,pField);
-  
-  vtkIdType aResult = GetMeshOnEntitySize(theMeshName,theEntity);
-  aResult += pField->myDataSize*sizeof(float)*pField->myNbValField;
-  if(MYDEBUG) cout<<"VISU_Convertor_impl::GetFieldOnMeshSize = "<<aResult<<endl;
+  float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
+  float aFieldOnMeshSize = float(pField->myDataSize*sizeof(float)*pField->myNbValField * ERR_SIZE_CALC);
+  float aResult = aMeshSize + aFieldOnMeshSize;
+  if(MYDEBUG){
+    if(MYVTKDEBUG)
+      MESSAGE("GetFieldOnMeshSize - aFieldOnMeshSize = "<<float(aFieldOnMeshSize));
+    MESSAGE("GetFieldOnMeshSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
+           "'; theEntity = "<<theEntity<<"; theFieldName = '"<<theFieldName<<"'");
+  }
   return aResult;
 }
 
@@ -546,15 +834,15 @@ void VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName, VISU::TM
   FindField(theMeshName,theMesh,theEntity,theMeshOnEntity,theVTKMeshOnEntity,theFieldName,theField);
   VISU::TField::TValField& aValField = theField->myValField;
   if(aValField.find(theStampsNum) == aValField.end())
-    throw std::runtime_error("FindTimeStamp >> There is no field with the timestamp!!!");
+    throw std::runtime_error(EXCEPTION("FindTimeStamp >> There is no field with the timestamp!!!"));
   theValForTime = &aValField[theStampsNum];
 }
 
 
-vtkIdType VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName, 
-                                               const VISU::TEntity& theEntity,
-                                               const std::string& theFieldName,
-                                               int theStampsNum)
+float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName, 
+                                           const VISU::TEntity& theEntity,
+                                           const std::string& theFieldName,
+                                           int theStampsNum)
   throw (std::runtime_error&)
 {
   VISU::TMesh* pMesh = NULL;
@@ -563,10 +851,15 @@ vtkIdType VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName,
   VISU::TField::TValForTime* pValForTime = NULL;
   FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
                theFieldName,pField,theStampsNum,pValForTime);
-
-  vtkIdType aResult = GetMeshOnEntitySize(theMeshName,theEntity);
-  aResult += pField->myDataSize*sizeof(float);
-  if(MYDEBUG) cout<<"VISU_Convertor_impl::GetTimeStampSize = "<<aResult<<endl;
+  float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
+  float aTimeStampSize = float(pField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
+  float aResult = aMeshSize + aTimeStampSize;
+  if(MYDEBUG){
+    if(MYVTKDEBUG)
+      MESSAGE("GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
+    MESSAGE("GetTimeStampSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
+           "; theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+  }
   return aResult;
 }
 
@@ -574,7 +867,7 @@ vtkIdType VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName,
 const VISU::TField& 
 VISU_Convertor_impl::GetField(const string& theMeshName, 
                              VISU::TEntity theEntity, 
-                             const string& theFieldName) 
+                             const string& theFieldName) 
   throw (std::runtime_error&)
 {
   VISU::TMesh* pMesh = NULL;
index 9ea6d9d8da49e6dcee8e3740d903569cdf40fded..cd1518916a1c77dc67ec7ad3f7be8749e000eb91 100644 (file)
@@ -19,74 +19,34 @@ extern "C"{
 #include <qfileinfo.h>
 
 class VISU_Convertor_impl: public VISU_Convertor{
-private:
-  void GetPoints(VISU::TVTKSource& theStorage, 
-                const VISU::TMesh& theMesh) 
-    const throw (std::runtime_error&);
-  void GetCellsOnEntity(VISU::TVTKSource& theStorage,
-                       const VISU::TMeshOnEntity& theMeshOnEntity, 
-                       const std::string& theFamilyName) 
-    const throw (std::runtime_error&);
-  void GetCellsOnGroup(VISU::TVTKSource& theStorage,
-                      const VISU::TMesh& theMesh,
-                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
-    const throw (std::runtime_error&);
-  void GetField(VISU::TVTKSource& theStorage,
-               const VISU::TMesh& theMesh,
-               const VISU::TMeshOnEntity& theMeshOnEntity, 
-               const VISU::TField& theField, 
-               const VISU::TField::TValForTime& theValForTime) 
-    const throw (std::runtime_error&);
-
+public:
+  virtual float GetSize() throw (std::runtime_error&);
 
-protected:
-  void FindMesh(const std::string& theMeshName, VISU::TMesh*& theMesh)
-    throw(std::runtime_error&);
-  void FindMeshOnEntity(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                       const VISU::TEntity& theEntity, VISU::TMeshOnEntity*& theMeshOnEntity,
-                       const std::string& theFamilyName, VISU::TFamily*& theFamily)
+  virtual float GetMeshOnEntitySize(const std::string& theMeshName, 
+                                   const VISU::TEntity& theEntity,
+                                   const std::string& theFamilyName = "")
     throw (std::runtime_error&);
 
-  void FindMeshOnGroup(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                      const std::string& theGroupName, VISU::TGroup*& theGroup)
-    throw (std::runtime_error&);
-
-  void FindField(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                const VISU::TEntity& theEntity, 
-                VISU::TMeshOnEntity*& theMeshOnEntity,
-                VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                const std::string& theFieldName, VISU::TField*& theField)
-    throw (std::runtime_error&);
-  void FindTimeStamp(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                    const VISU::TEntity& theEntity, 
-                    VISU::TMeshOnEntity*& theMeshOnEntity,
-                    VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                    const std::string& theFieldName, VISU::TField*& theField,
-                    int theStampsNum, VISU::TField::TValForTime*& theValForTime)
-    throw (std::runtime_error&);
-
-
-public:
-  virtual vtkIdType GetMeshOnEntitySize(const std::string& theMeshName, 
-                                       const VISU::TEntity& theEntity,
-                                       const std::string& theFamilyName = "")
-    throw (std::runtime_error&);
-  virtual vtkIdType GetMeshOnGroupSize(const std::string& theMeshName, 
-                                      const std::string& theGroupName)
+  virtual float GetMeshOnGroupSize(const std::string& theMeshName, 
+                                  const std::string& theGroupName)
     throw(std::runtime_error&);
-  virtual vtkIdType GetTimeStampSize(const std::string& theMeshName, 
-                                    const VISU::TEntity& theEntity,
-                                    const std::string& theFieldName,
-                                    int theStampsNum)
+
+  virtual float GetTimeStampSize(const std::string& theMeshName, 
+                                const VISU::TEntity& theEntity,
+                                const std::string& theFieldName,
+                                int theStampsNum)
     throw(std::runtime_error&);
-  virtual vtkIdType GetFieldOnMeshSize(const std::string& theMeshName, 
-                                      const VISU::TEntity& theEntity,
-                                      const std::string& theFieldName)
+
+  virtual float GetFieldOnMeshSize(const std::string& theMeshName, 
+                                  const VISU::TEntity& theEntity,
+                                  const std::string& theFieldName)
     throw(std::runtime_error&);
+
   virtual const VISU::TField& GetField(const std::string& theMeshName, 
                                       VISU::TEntity theEntity, 
                                       const std::string& theFieldName)
     throw(std::runtime_error&);
+
   virtual const VISU::TField::TValForTime& GetTimeStamp(const std::string& theMeshName, 
                                                        const VISU::TEntity& theEntity,
                                                        const std::string& theFieldName,
@@ -95,28 +55,63 @@ public:
 
 public:
   VISU_Convertor_impl();
+
   virtual ~VISU_Convertor_impl();
+
   virtual VISU_Convertor* Build() throw (std::runtime_error&) { return this;};
+
   virtual TOutput* GetMeshOnEntity(const std::string& theMeshName, 
                                   const VISU::TEntity& theEntity,
                                   const std::string& theFamilyName = "")
     throw(std::runtime_error&);
+
   virtual TOutput* GetMeshOnGroup(const std::string& theMeshName, 
                                  const std::string& theGroupName)
     throw(std::runtime_error&);
+
   virtual TOutput* GetTimeStampOnMesh(const std::string& theMeshName, 
                                      const VISU::TEntity& theEntity,
                                      const std::string& theFieldName,
                                      int theStampsNum)
     throw(std::runtime_error&);
 
- protected:
+protected:
+  void FindMesh(const std::string& theMeshName, VISU::TMesh*& theMesh)
+    throw(std::runtime_error&);
+
+  void FindMeshOnEntity(const std::string& theMeshName, VISU::TMesh*& theMesh,
+                       const VISU::TEntity& theEntity, VISU::TMeshOnEntity*& theMeshOnEntity,
+                       const std::string& theFamilyName, VISU::TFamily*& theFamily)
+    throw (std::runtime_error&);
+
+  void FindMeshOnGroup(const std::string& theMeshName, VISU::TMesh*& theMesh,
+                      const std::string& theGroupName, VISU::TGroup*& theGroup)
+    throw (std::runtime_error&);
+
+  void FindField(const std::string& theMeshName, VISU::TMesh*& theMesh,
+                const VISU::TEntity& theEntity, 
+                VISU::TMeshOnEntity*& theMeshOnEntity,
+                VISU::TMeshOnEntity*& theVTKMeshOnEntity,
+                const std::string& theFieldName, VISU::TField*& theField)
+    throw (std::runtime_error&);
+
+  void FindTimeStamp(const std::string& theMeshName, VISU::TMesh*& theMesh,
+                    const VISU::TEntity& theEntity, 
+                    VISU::TMeshOnEntity*& theMeshOnEntity,
+                    VISU::TMeshOnEntity*& theVTKMeshOnEntity,
+                    const std::string& theFieldName, VISU::TField*& theField,
+                    int theStampsNum, VISU::TField::TValForTime*& theValForTime)
+    throw (std::runtime_error&);
+
+protected:
   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
                               const std::string& theFamilyName = "")
     throw (std::runtime_error&) = 0;
+
   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
                              const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
     throw (std::runtime_error&) = 0;
+
   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
                              VISU::TMeshOnEntity& theMeshOnEntity, 
                              VISU::TField& theField, 
@@ -124,27 +119,4 @@ public:
     throw (std::runtime_error&) = 0;
 };
 
-template<class T> std::string dtos(const std::string& fmt, T val){
-  static QString aString;
-  aString.sprintf(fmt.c_str(),val);
-  return aString.latin1();
-}
-
-extern "C"{
-  int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
-  int getNbMedNodes(int theMedType);
-  int med2vtkCellType(int theMedType);
-  int vtk2medCellType(int theVtkType);
-  int getIdMedType(int medType);
-}
-
-struct Med2vtk {
-  med_geometrie_element medType;
-  const char *medName;
-  int medNbNodes;
-  int vtkType;
-  const char *vtkName;
-  int vtkNbNodes;
-};
-extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
 #endif
index 9587f53f9c48aaf8517fe0c34b0ff291b3379ec9..ab1e1026099b0db74674acd7f62b841498dc2e80 100644 (file)
 
 
 #include "VISU_MedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
 #include <valarray>    
 #include <vtkCellType.h>
+
 #define USER_INTERLACE MED_FULL_INTERLACE
 
 using namespace std;
@@ -38,6 +41,7 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
+
 static med_err ret = 0;
 
 typedef map<VISU::TEntity,med_entite_maillage> TVisu2MedEntity;
@@ -118,6 +122,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
   MedFile aMedFile(myFileInfo.absFilePath());
   med_idt fid = aMedFile.GetFid();
   med_int iMeshEnd = MEDnMaa(fid);  //Get number of meshes
+  if (iMeshEnd < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnMaa(...)"));
   if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "<<iMeshEnd<<"; myFileInfo = "<<myFileInfo.filePath());
   for(int iMesh = 1; iMesh <= iMeshEnd; iMesh++){
     med_int aMeshDim;
@@ -168,7 +173,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
            ret = MEDnoeudsLire(fid,aMeshName,aMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
                                &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
                                &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
-           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDnoeudsLire(...)");
+           if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnoeudsLire(...)"));
            for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
              if(num_fam_elem[iNumElem] != 0){
                aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
@@ -199,7 +204,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
          ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
                                &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
                                &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
-         if (ret < 0) throw std::runtime_error("ImportInfo >> MEDelementsLire(...)");
+         if (ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDelementsLire(...)"));
          for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
            if(num_fam_elem[iNumElem] != 0){
              aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
@@ -224,7 +229,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
       ret = MEDfamInfo(fid,aMeshName,aFamInd,aFamilyName,&aFamilyNum,
                       &anAttId[0],&anAttVal[0],&anAttDesc[0],&aNbAttrib,
                       &aGroupNames[0],&aNbGroup);
-      if(ret < 0) throw std::runtime_error("ImportInfo >> MEDfamInfo");
+      if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDfamInfo"));
       if(0 && MYDEBUG) 
        MESSAGE("ImportInfo - aFamilyNum = "<<aFamilyNum<<"; aNbGroup = "<<aNbGroup);
       if(aFamily2EntityMap.find(aFamilyNum) == aFamily2EntityMap.end()) {
@@ -301,17 +306,17 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
   }
   //Reading information about fields
   med_int iFieldEnd = MEDnChamp(fid,0);
-  if (iFieldEnd < 0) throw std::runtime_error("ImportChamps >> MEDnChamp(fid,0)");
+  if (iFieldEnd < 0) throw std::runtime_error(EXCEPTION("ImportChamps >> MEDnChamp(fid,0)"));
   if(MYDEBUG) MESSAGE("ImportInfo - iFieldEnd = "<<iFieldEnd);
   for(med_int iField = 1; iField <= iFieldEnd; iField++){
     med_int ncomp = MEDnChamp(fid,iField);
-    if(ncomp < 0) throw std::runtime_error("ImportChamps >> MEDnChamp(fid,i)");
+    if(ncomp < 0) throw std::runtime_error(EXCEPTION("ImportChamps >> MEDnChamp(fid,i)"));
     valarray<char> aCompNames('\0',ncomp*MED_TAILLE_PNOM + 1);
     valarray<char> aUnitNames('\0',ncomp*MED_TAILLE_PNOM + 1);
     char name_field[MED_TAILLE_NOM + 1] = "";
     med_type_champ type_field;
     if(MEDchampInfo(fid,iField,name_field,&type_field,&aCompNames[0],&aUnitNames[0],ncomp) < 0)
-      throw std::runtime_error(string("ImportInfo >> MEDchampInfo(...)"));
+      throw std::runtime_error(EXCEPTION("ImportInfo >> MEDchampInfo(...)"));
     //if(type_field != MED_REEL64) continue; //There is some problem in reading INTXX values
     TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
     for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++) {
@@ -323,7 +328,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
       for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
        med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
        med_int iTimeStampEnd = MEDnPasdetemps(fid,name_field,aMedEntity,aGeom);
-       if(iTimeStampEnd < 0) throw std::runtime_error("ImportInfo >> MEDnPasdetemps(...)");
+       if(iTimeStampEnd < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnPasdetemps(...)"));
        if(iTimeStampEnd > 0) {
          for(med_int iTimeStamp = 1; iTimeStamp <= iTimeStampEnd; iTimeStamp++) {
            char aMeshName[MED_TAILLE_NOM+1] = "";
@@ -332,9 +337,9 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
            med_float dt = 0;
            ret = MEDpasdetempsInfo(fid,name_field,aMedEntity,aGeom,iTimeStamp,
                                    aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
-           if(ret < 0) throw std::runtime_error("ImportInfo >> MEDpasdetempsInfo(...) < 0");
+           if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDpasdetempsInfo(...) < 0"));
            if(myMeshMap.find(aMeshName) == myMeshMap.end())
-             throw std::runtime_error("ImportInfo >> MEDpasdetempsInfo(...)");
+             throw std::runtime_error(EXCEPTION("ImportInfo >> MEDpasdetempsInfo(...)"));
            VISU::TMesh &aMesh = myMeshMap[aMeshName];
            VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
            VISU::TFieldMap::iterator aFieldMapIter = aMeshOnEntity.myFieldMap.find(name_field);
@@ -376,7 +381,7 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) {
            aValForTime.myMeshName = aField.myMeshName;
            aValForTime.myNbComp = aField.myNbComp;
            aValForTime.myTime = VISU::TField::TTime(dt,dt_unit);
-           if(MYDEBUG && iGeomElem == 0
+           if(MYDEBUG) 
              MESSAGE("ImportInfo -\t aValForTime.myTime = "<<dt<<", "<<dt_unit);
          }
        }
@@ -475,7 +480,7 @@ int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, cons
     med_geometrie_element typgeo = (med_geometrie_element)0; //MED_POINT1
     med_connectivite typco = (med_connectivite)0; //MED_NOD
     med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
-    if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> MEDnEntMaa(...)");
+    if (iNumElemEnd <= 0) throw std::runtime_error(EXCEPTION("LoadPoints >> MEDnEntMaa(...)"));
     if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
     med_repere rep;
     med_booleen iname_elem, inum_elem;
@@ -487,18 +492,18 @@ int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, cons
     ret = MEDnoeudsLire(fid,aMeshName,theMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
                        &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
                        &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
-    if(ret < 0) throw std::runtime_error("LoadPoints >> MEDnoeudsLire(...)");
+    if(ret < 0) throw std::runtime_error(EXCEPTION("LoadPoints >> MEDnoeudsLire(...)"));
     if(!isPointsLoaded){
       VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
       aPointsCoord.resize(iNumElemEnd*theMesh.myDim);
       if(MYDEBUG) MESSAGE("LoadPoints - Filling coordinates of the mesh - inum_elem = "<<inum_elem);
-      inum_elem = MED_FAUX; // It is workaround
+      inum_elem = MED_FAUX; // It is workaround 
       if(inum_elem == MED_FAUX)
        for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
          for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
            aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
       else
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
+       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
          for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
            aPointsCoord[num_elem[iNumElem2Dim]] = coord[iNumElem2Dim];
       if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
@@ -520,7 +525,7 @@ int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, cons
     throw std::runtime_error(exc.what());
   }catch(...){
     theMesh.myPointsCoord.clear();
-    throw std::runtime_error("Unknown exception !!!");
+    throw std::runtime_error(EXCEPTION("Unknown exception !!!"));
   }
   return 0;
 }
@@ -556,6 +561,14 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
              "; iGeomElemEnd = "<<iGeomElemEnd<<"; theFamilyName = '"<<theFamilyName<<"'");
     VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
     int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+    valarray<med_int>  num_node(aNbPoints);
+    med_booleen inum_node = 
+      med_booleen(MEDnumLire(fid,aMeshName,&num_node[0],aNbPoints,MED_NOEUD,med_geometrie_element(0)) >= 0);
+    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - inum_node = "<<inum_node);
+    map<med_int,med_int> node_map;
+    if(inum_node) 
+      for(int i = 0; i < aNbPoints; i++) 
+       node_map[num_node[i]-1] = i;
     for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
       int medId = getIdMedType(aGeomElemVector[iGeomElem]);
       int nbMedNodes = med2vtk[medId].medNbNodes;
@@ -574,7 +587,7 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
        ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
                              &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
                              &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
-       if (ret < 0) throw std::runtime_error("LoadCellsOnEntity >> MEDelementsLire(...)");
+       if (ret < 0) throw std::runtime_error(EXCEPTION("LoadCellsOnEntity >> MEDelementsLire(...)"));
        if(!isCellsLoaded){
          VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
          aConnForCellType.resize(iNumElemEnd);
@@ -582,9 +595,12 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
          for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
            VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
            anArray.resize(nbVtkNodes);
-           for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
-             aConnect[k] = conn[kj+k] - 1;
-           }
+           if(inum_node)
+             for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++)
+               aConnect[k] = node_map[conn[kj+k]-1];
+           else
+             for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++)
+               aConnect[k] = conn[kj+k] - 1;
            switch(aMedType){
            case MED_TETRA4 :
            case MED_TETRA10 :
@@ -606,11 +622,9 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
                anArray[k] = aConnect[k];
            }
            for (int k = 0; k < nbVtkNodes; k++) 
-             if(anArray[k] < 0 || aNbPoints <= anArray[k]){
-               static QString aString;
-               aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d](%d) < 0",aNbPoints,iNumElem,k,anArray[k]);
-               throw std::runtime_error(aString.latin1());
-             }
+             if(anArray[k] < 0 || aNbPoints <= anArray[k])
+               throw std::runtime_error(EXCEPT("ImportCells >> aNbPoints(%1) <= anArray[%2][%3](%4) < 0").
+                                        arg(aNbPoints).arg(iNumElem).arg(k).arg(anArray[k]).latin1());
          }
        }
        //Filling aFamily SubMesh
@@ -628,67 +642,93 @@ int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity
     throw std::runtime_error(exc.what());
   }catch(...){
     theMeshOnEntity.myCellsConn.clear();
-    throw std::runtime_error("Unknown exception !!!");
+    throw std::runtime_error(EXCEPTION("Unknown exception !!!"));
   }
   return 0;
 }
 
 int VISU_MedConvertor::LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
-                                const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+                                VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
      throw (std::runtime_error&)
 {
   //Check on loading already done
   if(!theValForTime.myValForCells.empty()) return 0;
   //Main part of code
   med_int ncomp = MEDnChamp(fid,theField.myId);
-  if(ncomp < 0) throw std::runtime_error("LoadField >> MEDnChamp(fid,i)");
+  if(ncomp < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDnChamp(fid,i)"));
   valarray<char> comp('\0',ncomp*MED_TAILLE_PNOM + 1);
   valarray<char> unit('\0',ncomp*MED_TAILLE_PNOM + 1);
   char aFieldName[MED_TAILLE_NOM + 1] = "";
+  char aMeshName[MED_TAILLE_NOM+1] = "";
+  strcpy(aMeshName,theValForTime.myMeshName.c_str());
   med_type_champ type_field;
   if(MEDchampInfo(fid,theField.myId,aFieldName,&type_field,&comp[0],&unit[0],ncomp) < 0)
-    throw std::runtime_error(string("LoadField >> MEDchampInfo(...)"));
+    throw std::runtime_error(EXCEPTION("LoadField >> MEDchampInfo(...)"));
   int iGeomElemEnd;
   med_geometrie_element* aGeomElemVector;
   const VISU::TEntity& anEntity = theField.myEntity;
   GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
   med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
-  if(MYDEBUG) {
-    MESSAGE("LoadField - aFieldName = '"<<aFieldName<<"'; anEntity = "<<anEntity<<"; iGeomElemEnd = "<<iGeomElemEnd);
-    MESSAGE("LoadField - ncomp = "<<ncomp<<"; type_field = "<<type_field<<"; myId = "<<theValForTime.myId);
+  const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
+  if(MYDEBUG){
+    MESSAGE("LoadField - aMeshName = '"<<aMeshName<<"' aFieldName = '"<<aFieldName<<"'; anEntity = "<<anEntity);
+    MESSAGE("LoadField - iGeomElemEnd = "<<iGeomElemEnd<<"; ncomp = "<<ncomp<<"; type_field = "<<type_field);
   }
   for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
-    med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
+    const med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
     med_int iTimeStampEnd = MEDnPasdetemps(fid,aFieldName,aMedEntity,aGeom);
-    if(iTimeStampEnd > 0) {
-      char aMeshName[MED_TAILLE_NOM+1] = "";
+    //Checking for accordance between the mesh and the field data
+    med_int iNumElemEnd = 0;
+    if(aMedEntity == MED_NOEUD)
+      iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,med_geometrie_element(0),med_connectivite(0));
+    else
+      iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aGeom,MED_NOD);
+    int medId = getIdMedType(aGeomElemVector[iGeomElem]);
+    int aVtkType = med2vtk[medId].vtkType;
+    if(iTimeStampEnd <= 0){
+      if(iNumElemEnd > 0){
+       if(!theField.myIsTrimmed){
+         theField.myIsTrimmed = true;
+         theField.myDataSize -= iNumElemEnd*theField.myNbComp;
+       }
+       //throw std::runtime_error(EXCEPT("VISU_MedConvertor::LoadField - There is no the data "
+       //                              "for cells with type %1 of the mesh !!!").
+       //                       arg(med2vtk[medId].medName).latin1());
+      }
+    }else{
       med_int ngauss = 0, numdt = 0, numo = 0;
       char dt_unit[MED_TAILLE_PNOM+1] = "";
       med_float dt = 0;
       ret = MEDpasdetempsInfo(fid,aFieldName,aMedEntity,aGeom,theValForTime.myId,
                              aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
-      if(ret < 0) throw std::runtime_error("LoadField >> MEDpasdetempsInfo(...)");
+      if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDpasdetempsInfo(...)"));
       med_int nval = MEDnVal(fid,aFieldName,aMedEntity,aGeom,numdt,numo);
-      if (nval <= 0) throw std::runtime_error("LoadField >> MEDnVal(...) - nval <= 0");
+      if(nval <= 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDnVal(...) - nval <= 0"));
       else{
-       //Checking for accordance between the mesh and the field on number of geomterical elements 
-       int aVtkType = med2vtkCellType(aGeom);
-       const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
-       VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
-       if(aCellsConnIter == aCellsConn.end()) throw std::runtime_error("LoadField - There is no the geom. elem. on the mesh !!!");
-       const VISU::TMeshOnEntity::TConnForCellType aConnForCellType = aCellsConnIter->second;
-       if(aConnForCellType.size() != nval) throw std::runtime_error("LoadField - Size of values and size of mesh not equal !!!");
-       if(MYDEBUG) MESSAGE("LoadField - aGeom = "<<aGeom<<"; nval = "<<nval<<"; iTimeStampEnd = "<<iTimeStampEnd);
+       //Checking for accordance between the mesh and the field data
+       if(iNumElemEnd <= 0) 
+         throw std::runtime_error(EXCEPTION("LoadField - There is no the geom. elem. on the mesh !!!"));
+       static int aMaxNbGaussPts = 52;  // the workaround for broken files
+       if(ngauss > aMaxNbGaussPts) ngauss = 1;
+       if(iNumElemEnd*ngauss != nval) 
+         throw std::runtime_error(EXCEPT("LoadField - Size of values (%1) and size of mesh (%2) not equal !!!").
+                                  arg(nval).arg(iNumElemEnd*ngauss).latin1());
        VISU::TField::TValForCellsWithType &anArray = theValForTime.myValForCells[aVtkType];
        int jEnd = theField.myNbComp*nval;
-       anArray.resize(jEnd);
+       int kEnd = jEnd/ngauss;
+       anArray.resize(kEnd);
        char pflname[MED_TAILLE_NOM + 1] = "";
        switch(type_field){
        case MED_REEL64 : {
          valarray<med_float> valr(jEnd);
          ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
                             pflname,aMedEntity,aGeom,numdt,numo);
-         for (med_int j = 0; j < jEnd; j++) anArray[j] = valr[j];
+         if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDchampLire(...)"));
+         for (med_int k = 0, j = 0; k < kEnd; k++, j += ngauss){
+           for (med_int iGauss = 0; iGauss < ngauss; iGauss++)
+             anArray[k] = valr[j+iGauss];
+           anArray[k] /= ngauss;
+         }
          break;
        }
        //case MED_INT64 : //valarray<long long> valr(jEnd);
@@ -697,13 +737,19 @@ int VISU_MedConvertor::LoadField(const med_idt& fid, const VISU::TMeshOnEntity&
          valarray<med_int> valr(jEnd);
          ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
                             pflname,aMedEntity,aGeom,numdt,numo);
-         for (med_int j = 0; j < jEnd; j++) anArray[j] = valr[j];
+         if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDchampLire(...)"));
+         for (med_int k = 0, j = 0; k < kEnd; k++, j += ngauss){
+           for (med_int iGauss = 0; iGauss < ngauss; iGauss++)
+             anArray[k] = valr[j+iGauss];
+           anArray[k] /= ngauss;
+         }
          break;
        }
-         default :
-           throw std::runtime_error("LoadField >> Value of med_type_champ for the field is wrong !!!");
+       default :
+         throw std::runtime_error(EXCEPTION("LoadField >> Value of med_type_champ for the field is wrong !!!"));
        }
-       if(ret < 0) throw std::runtime_error("ChampLire >> MEDchampLire(...)");
+       if(MYDEBUG) MESSAGE("LoadField - aGeom = "<<aGeom<<"; nval = "<<nval<<"; ngauss = "<<ngauss
+                           <<"; iTimeStampEnd = "<<iTimeStampEnd<<"; pflname = '"<<pflname<<"'");
       }
     }
   }
index 742b085207776ffbd5e2dca054ac4493d4521c05..4549b2582a4712f86a85e51de86439bd7b13553a 100644 (file)
@@ -43,7 +43,7 @@ protected:
                        const std::string& theFamilyName = "")
     throw (std::runtime_error&);
   int LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+               VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
     throw (std::runtime_error&);
 };
 
index 310b27250ca343566f4db82207576831dc428737..229ffeea7f87c852af54a683b7ff3b873a854275 100644 (file)
@@ -45,12 +45,9 @@ LIB_CLIENT_IDL =
 BIN = 
 BIN_SRC        =
 
-CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) \
+CPPFLAGS+= $(OCC_INCLUDES) $(VTK_INCLUDES) \
        -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=$(VTK_LIBS) -lSalomeObject \
-       -lVisuPipeLine -L${KERNEL_ROOT_DIR}/lib/salome
-
-%_moc.cxx: %.h
-       $(MOC) $< -o $@
+LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lVisuPipeLine \
+       -L${KERNEL_ROOT_DIR}/lib/salome
 
 @CONCLUDE@
index 6a2ccc1087e0a5583857781406e14788ddffdc7e..62d1477847b6d2a1f5d4c30c6ff49620677ed32e 100644 (file)
 #include "VISU_Actor.h"
 #include "VISU_PipeLine.hxx"
 #include "SALOME_PassThroughFilter.h"
+#include "utilities.h"
  
 // VTK Includes
 #include <vtkProperty.h>
 #include <vtkDataSetMapper.h>
 #include <vtkShrinkPolyData.h>
+#include <vtkGeometryFilter.h>
 #include <vtkObjectFactory.h>
 
 using namespace std;
 
+static int MYVTKDEBUG = 0;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
 //=======================================================================
 
 vtkStandardNewMacro(VISU_Actor);
 
 VISU_Actor::VISU_Actor(){
+  SetDebug(MYVTKDEBUG);
   myIsShrunk = false;
   myIsShrinkable = false;
   myParent = this;
@@ -65,7 +78,9 @@ VISU_Actor::VISU_Actor(){
 }
 
 VISU_Actor::~VISU_Actor(){
+  SALOME_Actor::SetProperty(NULL);
   HighlightProperty->Delete();
+  if(myPipeLine) myPipeLine->UnRegister(this);
 }
 
 void VISU_Actor::setIO(const Handle(SALOME_InteractiveObject)& theIO){
@@ -86,18 +101,21 @@ void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) throw(std::runtime_erro
     vtkMapper *aMapper = myPipeLine->GetMapper();
     vtkDataSet *aDataSet = aMapper->GetInput();
     if(!aDataSet)
-      throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data");
+      throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data !!!");
     aDataSet->Update();
     static float eps = VTK_LARGE_FLOAT * 0.1 ;
     if(aDataSet->GetLength() > eps)
-      throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large");
+      throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
     if(!aDataSet->GetNumberOfCells())
       throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
-    SetShrinkable(aDataSet->GetNumberOfCells() > 10);
-
+    //Bug SAL4221:  Mesh with less than 10 cells : shrink mode disable
+    //SetShrinkable(aDataSet->GetNumberOfCells() > 10);
+    SetShrinkable(true);
+    //Now, we use vtkShrinkPolyData (not vtkShrinkFilter), 
+    //and the class there is no such limitation.
+    
     vtkDataSetMapper* aNewMapper = vtkDataSetMapper::New();
     aNewMapper->SetInput(aDataSet);
-    aMapper->ShallowCopy(aMapper);
     SetMapper(aNewMapper);
     aNewMapper->Delete();
   }
@@ -107,6 +125,26 @@ void VISU_Actor::SetParent(VISU_Actor* theParent){
   myParent = theParent;
 }
 
+void VISU_Actor::SetRepresentation(int theMode) { 
+  int aRepresent = GetRepresentation();
+  SALOME_Actor::SetRepresentation(theMode);
+  if(GetMapper() && GetMapper()->GetInput()){
+    vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
+    aGeometryFilter->SetInput(GetMapper()->GetInput());
+    vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
+    aPolyData->Update();
+    static int INCMEMORY = 7;
+    float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
+    int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
+    if(MYDEBUG) MESSAGE("SetRepresentation - aSize = "<<aSize<<"; isPoss = "<<isPoss);
+    aPolyData->Delete();
+    if(!isPoss){
+      SALOME_Actor::SetRepresentation(aRepresent);
+      throw std::runtime_error("SetRepresentation >> There is no enough memory !!!");
+    }
+  }
+}
+
 void VISU_Actor::SetShrinkable(bool theIsShrinkable){
   myIsShrinkable = theIsShrinkable;
 }
index 1d8b34186b12f9ddacae59e858be6293772da2e9..88f4e26d28f5233933b79587c460823ec8902fe3 100644 (file)
@@ -75,6 +75,8 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
   virtual void SetShrinkable(bool theIsShrinkable);
   virtual bool GetShrinkable() { return myIsShrinkable;}
 
+  virtual void SetRepresentation(int theMode);
+
   virtual bool IsShrunk() { return myIsShrunk;}
   virtual void SetShrink(float theFactor = 0.8); 
   virtual void UnShrink(); 
index eb9203b91d3d000e3f93565f6b7d43802a50a810..416e0673de4077392e6d2d5717f38773c36a842f 100644 (file)
@@ -164,13 +164,17 @@ void VISU_MeshAct::SetRepresentation(int theMode){
   mySurfaceActor->VisibilityOff();
   myEdgeActor->VisibilityOff();
   myNodeActor->VisibilityOff();
+  myEdgeActor->PickableOff();
+  myNodeActor->PickableOff();
   switch(theMode){
   case 0: //POINTS
     myNodeActor->VisibilityOn();
+    myNodeActor->PickableOn();
     break;
   case 1: //WIREFRAME
     myEdgeActor->VisibilityOn();
     myEdgeActor->SetRepresentation(1);
+    myEdgeActor->PickableOn();
     break;
   case 2: //SURFACE
     mySurfaceActor->VisibilityOn();
@@ -178,6 +182,7 @@ void VISU_MeshAct::SetRepresentation(int theMode){
   case 3: //INSIDEFRAME
     myEdgeActor->VisibilityOn();
     myEdgeActor->SetRepresentation(3);
+    myEdgeActor->PickableOn();
     break;
   case 4: //SURFACEFRAME
     myEdgeActor->VisibilityOn();
index 7cdd24fbe23f89a56a4830cacf7d50b03476a090..81cbfc2698eaeb5534baf90bfade135e828787a1 100644 (file)
@@ -60,6 +60,6 @@ BIN_SRC       =
 
 CPPFLAGS+= $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
 LDFLAGS+= $(VTK_LIBS) -lSalomeVTKFilter -lVisuConvertor \
-        -L${KERNEL_ROOT_DIR}/lib/salome
+       -L${KERNEL_ROOT_DIR}/lib/salome
 
 @CONCLUDE@
index 1b5181a6e71c9ff583b58cabaa1001e61e760281..f89dc7ef9375aa9c6641d1a0210f0eb49de1b365 100644 (file)
@@ -34,7 +34,7 @@
 #include "VISU_VectorsPL.hxx"
 #include "VISU_StreamLinesPL.hxx"
 
-typedef VISU_StreamLinesPL TPresent;
+typedef VISU_ScalarMapPL TPresent;
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -107,6 +107,7 @@ int main(int argc, char** argv){
          aPresent->SetInput(aDataSet);
          aPresent->Build();
          aPresent->Init();
+         aPresent->SetSourceRange();
          //aPresent->SetPartDefault(0);
          //aPresent->SetScalarMin(0.01);
          //aPresent->SetScaling(VTK_SCALE_LOG10);
index 367139faf2fd350fc966431e407a823da1738127..21b5004f6b690caee57f7ef3ea621cf650455019 100644 (file)
@@ -39,12 +39,11 @@ VISU_CutLinesPL::VISU_CutLinesPL(){}
 void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
   VISU_CutPlanesPL::ShallowCopy(thePipeLine);
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
-    SetPlaneOrientation(aPipeLine->GetPlaneOrientation(1),1);
+    SetOrientation(aPipeLine->GetPlaneOrientation(1),
+                  aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
     SetDisplacement(aPipeLine->GetDisplacement(1),1);
     SetDefault(); 
     if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition());
-    SetRotateX(aPipeLine->GetRotateX(1),1);
-    SetRotateY(aPipeLine->GetRotateY(1),1);
   }
 }
 
index a6cb0665877de8c077a48367cc21ea1ec8c13f5c..2cbdba5744354669518e4c04c10124b18db17737 100644 (file)
@@ -50,13 +50,12 @@ VISU_CutPlanesPL::~VISU_CutPlanesPL(){
 void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
   VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
-    SetPlaneOrientation(aPipeLine->GetPlaneOrientation());
+    SetOrientation(aPipeLine->GetPlaneOrientation(),
+                  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));
-    SetRotateX(aPipeLine->GetRotateX());
-    SetRotateY(aPipeLine->GetRotateY());
   }
 }
 
@@ -150,14 +149,28 @@ void VISU_CutPlanesPL::GetBoundProject(float BoundPrj[3], const float BoundBox[6
   BoundPrj[2] = BoundPrj[1] - BoundPrj[0];
 }
 
-void VISU_CutPlanesPL::SetRotateX(float theAng, int theNum){
+
+void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, 
+                                     float theXAng, float theYAng, int theNum)
+{ 
+  myBasePlane[theNum] = theOrient;
+  switch(myBasePlane[theNum]){
+  case XY: myAng[theNum][0] = theXAng; break;
+  case YZ: myAng[theNum][1] = theXAng; break;
+  case ZX: myAng[theNum][2] = theXAng; break;
+  }
   switch(myBasePlane[theNum]){
-  case XY: myAng[theNum][0] = theAng; break;
-  case YZ: myAng[theNum][1] = theAng; break;
-  case ZX: myAng[theNum][2] = theAng; break;
+  case XY: myAng[theNum][1] = theYAng; break;
+  case YZ: myAng[theNum][2] = theYAng; break;
+  case ZX: myAng[theNum][0] = theYAng; break;
   }
 }
 
+
+const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){ 
+  return myBasePlane[theNum];
+}
+
 float VISU_CutPlanesPL::GetRotateX(int theNum){
   switch(myBasePlane[theNum]){
   case XY: return myAng[theNum][0];
@@ -166,14 +179,6 @@ float VISU_CutPlanesPL::GetRotateX(int theNum){
   }
 }
 
-void VISU_CutPlanesPL::SetRotateY(float theAng, int theNum){
-  switch(myBasePlane[theNum]){
-  case XY: myAng[theNum][1] = theAng; break;
-  case YZ: myAng[theNum][2] = theAng; break;
-  case ZX: myAng[theNum][0] = theAng; break;
-  }
-}
-
 float VISU_CutPlanesPL::GetRotateY(int theNum){
   switch(myBasePlane[theNum]){
   case XY: return myAng[theNum][1];
index 73b42cdffdfaff8ddfc253d685654de55f01b4d8..094c9463b34fe179e0b2be47ff41c28b3c051c15 100644 (file)
@@ -44,11 +44,13 @@ public:
   virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
 
   enum PlaneOrientation {XY, YZ, ZX};
-  virtual const PlaneOrientation& GetPlaneOrientation(int theNum = 0) { return myBasePlane[theNum];}
-  virtual void SetPlaneOrientation(const PlaneOrientation& theOrient, int theNum = 0) { 
-    myBasePlane[theNum] = theOrient;
-  }
+  virtual void SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, 
+                             float theXAng, float theYAng, int theNum = 0);
 
+  virtual const PlaneOrientation& GetPlaneOrientation(int theNum = 0);
+  virtual float GetRotateX(int theNum = 0);
+  virtual float GetRotateY(int theNum = 0);
+  
   virtual float GetDisplacement(int theNum = 0) { return myDisplacement[theNum];}
   virtual void SetDisplacement(float theDisp, int theNum = 0) { myDisplacement[theNum] = theDisp;}
 
@@ -58,11 +60,6 @@ public:
   virtual void SetPartDefault(int thePartNumber);
   virtual int IsPartDefault(int thePartNumber);
 
-  virtual void SetRotateX(float theAngle, int theNum = 0);
-  virtual float GetRotateX(int theNum = 0);
-  virtual void SetRotateY(float theAngle, int theNum = 0);
-  virtual float GetRotateY(int theNum = 0);
-      
   virtual void SetNbParts(int theNb);
   virtual int GetNbParts(){ return myNbParts;}
     
index e125c4f98fd20727ac805137e2c17e11a5797fcc..9b200331a11350a366748ed4aa4ae466eb48accf 100644 (file)
@@ -41,10 +41,15 @@ vtkStandardNewMacro(VISU_DeformedShapePL);
 
 VISU_DeformedShapePL::VISU_DeformedShapePL(){
   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){
@@ -92,7 +97,7 @@ void VISU_DeformedShapePL::Init(){
 }
 
 VISU_ScalarMapPL::THook* VISU_DeformedShapePL::DoHook(){
-  VISU::CellDataToPoint(myWarpVector,myInput,myFieldTransform);
+  VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,myInput,myFieldTransform);
   return myWarpVector->GetOutput();
 }
 
index f555faef6e6491d47246ebc9425fc6a4c2f0c5a3..9c2f95a703e043f81b1352e7c0166c12c1d623ce 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "VISU_ScalarMapPL.hxx"
 
+class vtkCellDataToPointData;
 class SALOME_Transform;
 class vtkWarpVector;
 
@@ -55,8 +56,9 @@ public:
 protected:
   virtual THook* DoHook();
 
-  vtkWarpVector *myWarpVector;
   float myScaleFactor;
+  vtkWarpVector *myWarpVector;
+  vtkCellDataToPointData* myCellDataToPointData;
 };
 
 
index 0b3f78595054571e00556ba720df1e3483060dce..683f8d6fc736b4bba25fb883ab78ccc87876757c 100644 (file)
@@ -24,6 +24,9 @@
 //  Module : VISU
 
 #include "VISU_Extractor.hxx"   
+#include "VISU_PipeLineUtils.hxx"
+
+#include <sstream>     
 
 #include <vtkObjectFactory.h>
 #include <vtkUnstructuredGrid.h>
@@ -33,7 +36,7 @@
 
 using namespace std;
 
-#ifdef DEBUG
+#ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
@@ -46,7 +49,8 @@ VISU_Extractor::VISU_Extractor(){
   myScalarMode = 0;
 }
 
-VISU_Extractor::~VISU_Extractor() {}
+VISU_Extractor::~VISU_Extractor(){
+}
 
 void VISU_Extractor::SetScalarMode(int theScalarMode){
   if(myScalarMode != theScalarMode){
@@ -62,7 +66,9 @@ execute(int theNbComp, int theScalarMode, TypeData* theInputData, TypeData* theO
   if ( !inVectors || theNbComp < 1 ) 
     return; 
   vtkFloatArray *newScalars = vtkFloatArray::New();
-  //newScalars->SetName(inVectors->GetName());
+  ostringstream aName;
+  aName<<inVectors->GetName();  aName<<", ";  aName<<theScalarMode;
+  newScalars->SetName(aName.str().c_str());
   newScalars->SetNumberOfComponents(1);
   newScalars->SetNumberOfTuples(theNbComp);
   for (int ptId = 0; ptId < theNbComp; ptId++) {
index 6889b7a92dab68ccc3c06e380f07fcab3b21ec23..7ab876d63a8060d742296b72f53ee63852f470dc 100644 (file)
@@ -33,7 +33,6 @@ class VTK_EXPORT VISU_Extractor : public vtkPointSetToPointSetFilter{
 public:
   vtkTypeMacro(VISU_Extractor,vtkPointSetToPointSetFilter);
   static VISU_Extractor *New();
-  ~VISU_Extractor();
 
   virtual int GetScalarMode(){ return myScalarMode;}
   virtual void SetScalarMode(int theScalarMode = 0);
@@ -41,6 +40,7 @@ public:
 protected:
   VISU_Extractor();
   VISU_Extractor(const VISU_Extractor&);
+  ~VISU_Extractor();
 
   virtual void Execute();
 
index ea239eb2f19f123330d43b39a5300b3648c4867f..2bb7f974f4802b2d9309b4777c3a7b5f3f35a478 100644 (file)
@@ -39,7 +39,9 @@ VISU_FieldTransform::VISU_FieldTransform(){
   myTransform = NULL;
 }
 
-VISU_FieldTransform::~VISU_FieldTransform() {}
+VISU_FieldTransform::~VISU_FieldTransform() {
+  SetSpaceTransform(NULL);
+}
 
 
 void VISU_FieldTransform::Update(){
@@ -84,6 +86,7 @@ void VISU_FieldTransform::SetScalarMax(float theValue){
   SetScalarRange(aScalarRange);
 }
 
+
 template<typename TypeData> void
 ExecVectors(VISU_FieldTransform::TTransformFun theFunction, 
            SALOME_Transform* theTransform,
@@ -103,15 +106,25 @@ ExecVectors(VISU_FieldTransform::TTransformFun theFunction,
     aScale[1] = theTransform->GetScale()[1];
     aScale[2] = theTransform->GetScale()[2];
   }
-  for (int ptId = 0; ptId < theNbComponent; ptId++) {
-    V = inVectors->GetTuple3(ptId);
-    vMag = vtkMath::Norm(V);
-    vMag = ((*theFunction)(vMag) - aScalarRange[0]) / aDelta * theScalarRange[1] / vMag;
-    if(vMag <= 0.0) vMag = 0.0;
-    v[0] = V[0]*vMag*aScale[0];
-    v[1] = V[1]*vMag*aScale[1];
-    v[2] = V[2]*vMag*aScale[2];
-    newVectors->SetTuple3(ptId, v[0], v[1], v[2]);
+  if(theFunction == &(VISU_FieldTransform::Ident)){
+    for (int ptId = 0; ptId < theNbComponent; ptId++) {
+      V = inVectors->GetTuple3(ptId);
+      v[0] = V[0]*aScale[0];
+      v[1] = V[1]*aScale[1];
+      v[2] = V[2]*aScale[2];
+      newVectors->SetTuple3(ptId, v[0], v[1], v[2]);
+    }
+  }else{
+    for (int ptId = 0; ptId < theNbComponent; ptId++) {
+      V = inVectors->GetTuple3(ptId);
+      vMag = vtkMath::Norm(V);
+      vMag = ((*theFunction)(vMag) - aScalarRange[0]) / aDelta * theScalarRange[1] / vMag;
+      if(vMag <= 0.0) vMag = 0.0;
+      v[0] = V[0]*vMag*aScale[0];
+      v[1] = V[1]*vMag*aScale[1];
+      v[2] = V[2]*vMag*aScale[2];
+      newVectors->SetTuple3(ptId, v[0], v[1], v[2]);
+    }
   }
   theOutputData->SetVectors(newVectors);
   newVectors->Delete();
index ecd27659f5064ba8483d24a877f61452aec6dfc9..b6bbb6433a3d70ece89a5f7db1ef39a60b7808bd 100644 (file)
 
 #include <vtkContourFilter.h>
 
-VISU_IsoSurfacesPL* VISU_IsoSurfacesPL::New(){
-  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_IsoSurfacesPL");
-  if(ret) return (VISU_IsoSurfacesPL*)ret;
-  return new VISU_IsoSurfacesPL;
-} 
+vtkStandardNewMacro(VISU_IsoSurfacesPL);
 
 VISU_IsoSurfacesPL::VISU_IsoSurfacesPL(){
   myContourFilter = vtkContourFilter::New();
+  myCellDataToPointData = vtkCellDataToPointData::New();
 }
 
 VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){
+  myContourFilter->UnRegisterAllOutputs();
   myContourFilter->Delete();
+
+  myCellDataToPointData->UnRegisterAllOutputs();
+  myCellDataToPointData->Delete();
 }
 
 void VISU_IsoSurfacesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
@@ -100,7 +101,7 @@ VISU_ScalarMapPL::THook* VISU_IsoSurfacesPL::DoHook(){
 
 
 void VISU_IsoSurfacesPL::Update(){
-  VISU::CellDataToPoint(myContourFilter,myInput,myFieldTransform);
+  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,myInput,myFieldTransform);
   SetMapScale();
 
   VISU_ScalarMapPL::Update();
index 6eeb4564efe85dabfef9900ee1af0ee5d02e0f5a..68732e377d1abe0688041a5e0aadd98301a7a84e 100644 (file)
@@ -30,6 +30,7 @@
 #include "VISU_ScalarMapPL.hxx"
 
 class vtkContourFilter;
+class vtkCellDataToPointData;
 
 class VISU_IsoSurfacesPL : public VISU_ScalarMapPL{
 protected:
@@ -58,6 +59,7 @@ public:
 protected:
   int myNbParts;
   float myRange[2];
+  vtkCellDataToPointData* myCellDataToPointData;
   vtkContourFilter *myContourFilter;
 };
 
index d4354e35bed350edc3bc6a5d6071abc8c3b456b7..e128b7083f4cf28fbfb4dec3f1d4c111d41c36bc 100644 (file)
 
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
+#include <limits.h>
 
 #include <vtkObjectFactory.h>
 #include <vtkDataSetMapper.h>
 #include <vtkUnstructuredGrid.h>
 
+static int MYVTKDEBUG = 0;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -43,11 +48,14 @@ static int MYDEBUGWITHFILES = 0;
 VISU_PipeLine::VISU_PipeLine(){
   myMapper = TMapper::New();
   myInput = NULL;
+  SetDebug(MYVTKDEBUG);
 }
 
 VISU_PipeLine::~VISU_PipeLine(){
-  myMapper->Delete();
+  if(MYDEBUG) MESSAGE("~VISU_PipeLine - myInput = "<<myInput->GetReferenceCount());
   SetInput(NULL);
+  myMapper->RemoveAllInputs();
+  myMapper->Delete();
 }
 
 void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
@@ -57,13 +65,14 @@ void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
 }
 
 void VISU_PipeLine::SetInput(TInput* theInput){
-  if (myInput != theInput){
+  if(myInput != theInput){
     if (myInput != NULL) myInput->UnRegister(this);
     myInput = theInput;
-    if (myInput != NULL) {
+    if(myInput != NULL){
       myInput->Register(this);
       myInput->Update();
-    }
+    }else
+      myMapper->SetInput(NULL);
     Modified();
   }
 }
@@ -84,23 +93,25 @@ void VISU_PipeLine::Update(){
 }
 
 
-size_t VISU_PipeLine::CheckAvailableMemory(const size_t& theSize){
+int VISU_PipeLine::CheckAvailableMemory(const float& theSize){
   try{
-    char *aCheck = new char[theSize];
+    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)
-      cout<<"VISU_PipeLine::CheckAvailableMemory("<<theSize<<") - cannot alloacate such amount of memory!!!\n";
+      MESSAGE("CheckAvailableMemory("<<theSize<<") - cannot alloacate such amount of memory!!!");
     return aCheck != NULL;
     //return theSize < 1000*1024*1024;
   }catch(...){
     if(MYDEBUG)
-      cout<<"VISU_PipeLine::CheckAvailableMemory("<<theSize<<") - unexpected exception was caught!!!\n";
+      MESSAGE("CheckAvailableMemory("<<theSize<<") - unexpected exception was caught!!!");
   }
   return 0;
 }
 
 
-size_t VISU_PipeLine::GetAvailableMemory(size_t theSize, size_t theMinSize){
+float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize){
   while(!CheckAvailableMemory(theSize))
     if(theSize > theMinSize)
       theSize /= 2;
index 21a8b24d4b2ecb8e39f69f528b87e8f685d5914f..1a55be8eb25f94920ac807473e1d2a08424ef12f 100644 (file)
@@ -55,9 +55,9 @@ public:
   virtual void Init() = 0;
   virtual void Update();
 
-  static size_t CheckAvailableMemory(const size_t& theSize);
-  static size_t GetAvailableMemory(size_t theSize = 16*1024*1024, 
-                                  size_t theMinSize = 1024*1024);
+  static int CheckAvailableMemory(const float& theSize);
+  static float GetAvailableMemory(float theSize = 16*1024*1024.0,
+                                 float theMinSize = 1024*1024.0);
 protected:
   virtual void Build() = 0;
   
index a624239981f1a414c357893b5c237b2978d09cb1..df7c8219ec87a2b871fb97f06b51f06749939fac 100644 (file)
 
 #include <vtkMath.h>
 
+#ifndef MESSAGE
+#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
+
+#undef EXCEPT
+#define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
+
+#undef EXCEPTION
+#define EXCEPTION(msg) EXCEPT(msg).latin1()
+
+#endif
+
 namespace VISU{
   void Mul(const float A[3], float b, float C[3]); // C = A * b
   void Sub(const float A[3], const float B[3], float C[3]); // C = A - B
 
-  template<class TItem> void CellDataToPoint(TItem* theTItem, vtkDataSet* theDataSet,
+  template<class TItem> void CellDataToPoint(TItem* theTItem, 
+                                            vtkCellDataToPointData *theFilter,
+                                            vtkDataSet* theDataSet,
                                             VISU_FieldTransform *theFieldTransform)
   {
     if(theDataSet->GetCellData()->GetNumberOfArrays()){
-      vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
-      aFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      aFilter->PassCellDataOn();
-      theTItem->SetInput(aFilter->GetUnstructuredGridOutput());
-      aFilter->Register(theTItem);
-      aFilter->Delete();
+      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theFilter->PassCellDataOn();
+      theTItem->SetInput(theFilter->GetUnstructuredGridOutput());
     }else
       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
   }
 
-  template<class TItem> void ToCellCenters(TItem* theTItem, vtkDataSet* theDataSet,
+  template<class TItem> void ToCellCenters(TItem* theTItem, 
+                                          vtkCellCenters *theFilter,
+                                          vtkDataSet* theDataSet,
                                           VISU_FieldTransform *theFieldTransform)
   {
     if(theDataSet->GetCellData()->GetNumberOfArrays()){
-      vtkCellCenters *aCenters = vtkCellCenters::New(); // for vectors on cells
-      aCenters->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      aCenters->VertexCellsOn();
-      theTItem->SetInput(aCenters->GetOutput());
-      aCenters->Register(theTItem);
-      aCenters->Delete();
+      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theFilter->VertexCellsOn();
+      theTItem->SetInput(theFilter->GetOutput());
     }else
       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
   }
index 5025d98ec9b6a10f25da8fce87e58358f6e6b5a7..d7b7b4a6f43f1a7d7cbd8344423b7d25774c7725 100644 (file)
@@ -40,6 +40,7 @@ vtkStandardNewMacro(VISU_ScalarMapPL);
 
 VISU_ScalarMapPL::VISU_ScalarMapPL(){
   myFieldTransform = VISU_FieldTransform::New();
+  //myFieldTransform->DebugOn();
 
   myMapperTable = VISU_LookupTable::New();
   myMapperTable->SetScale(VTK_SCALE_LINEAR);
@@ -50,13 +51,16 @@ VISU_ScalarMapPL::VISU_ScalarMapPL(){
   myBarTable->SetHueRange(0.667,0.0);
 
   myExtractor = VISU_Extractor::New();
+  //myExtractor->DebugOn();
 }
 
 
 VISU_ScalarMapPL::~VISU_ScalarMapPL(){
+  myFieldTransform->UnRegisterAllOutputs();
   myFieldTransform->Delete();
   myMapperTable->Delete();;
   myBarTable->Delete();
+  myExtractor->UnRegisterAllOutputs();
   myExtractor->Delete();
 }
 
@@ -156,8 +160,6 @@ void VISU_ScalarMapPL::Update() {
   myMapper->SetLookupTable(myMapperTable);   
   myMapper->SetScalarRange(aScalarRange);
 
-  myFieldTransform->Update();
-
   VISU_PipeLine::Update();
 }
 
index fabf699384ec74d8e8c1147d45d3f875a3738bf2..f219d4a3ce9373255265ae874b469c24c7fc47bd 100644 (file)
 #include "VISU_UsedPointsFilter.hxx"
 #include "SALOME_GeometryFilter.h"
 
+#include <algo.h>
+
+#include <vtkCell.h>
 #include <vtkPointSet.h>
 #include <vtkStreamLine.h>
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
 
-static float EPS = 1.0e-20;
-int VISU_StreamLinesPL::myMaxIncrementMemorySize = 64;
-
-void SetStreamerSource(vtkStreamer *theStreamer, vtkPointSet* theDataSet, float thePercents){
-  theDataSet->Update();
-  VISU_UsedPointsFilter* anUsedPointsFilter = VISU_UsedPointsFilter::New();
-  anUsedPointsFilter->SetInput(theDataSet);
-  anUsedPointsFilter->SetPercentsOfUsedPoints(thePercents);
-  theStreamer->SetSource(anUsedPointsFilter->GetOutput());
-  anUsedPointsFilter->Register(theStreamer);
-  anUsedPointsFilter->Delete();
-}
+static float EPS = 1.0e-7;
+static float aMinNbOfSteps = 1.0E+2;
+static float aMaxNbOfSteps = 1.0E+3;
+static float aCoeffOfIntStep = 1.0E+1;
 
 
 vtkStandardNewMacro(VISU_StreamLinesPL);
 
 VISU_StreamLinesPL::VISU_StreamLinesPL(){
   myStream = vtkStreamLine::New();
+  myCenters = vtkCellCenters::New();
   myGeomFilter = SALOME_GeometryFilter::New();
+  myPointsFilter = VISU_UsedPointsFilter::New();
+  myPercents = 0.3;
   mySource = NULL;
 }
 
 VISU_StreamLinesPL::~VISU_StreamLinesPL(){
-  myStream->Delete();
+  myPointsFilter->UnRegisterAllOutputs();
+  myPointsFilter->Delete();
+
+  myCenters->UnRegisterAllOutputs();
+  myCenters->Delete();
+
+  myGeomFilter->UnRegisterAllOutputs();
   myGeomFilter->Delete();
-  SetSource(NULL);
+
+  myStream->UnRegisterAllOutputs();
+  myStream->Delete();
 }
 
 void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
   VISU_DeformedShapePL::ShallowCopy(thePipeLine);
-  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
+  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine))
+    SetParams(aPipeLine->GetIntegrationStep(),
+             aPipeLine->GetPropagationTime(),
+             aPipeLine->GetStepLength(),
+             aPipeLine->GetSource(),
+             aPipeLine->GetUsedPoints(),
+             aPipeLine->GetDirection());
+}
+
 
-    //Order of setting of the values are important 
-    SetUsedPoints(aPipeLine->GetUsedPoints());
-    SetSource(aPipeLine->GetSource());
+float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, 
+                                                float thePropogationTime, float thePercents)
+{
+  static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2;
+  static float aStreamArraySize = aStreamPointSize*1024; // == 69632
 
-    SetDirection(aPipeLine->GetDirection());
+  float aNbCells = thePercents*theNbOfPoints*2.0;
+  float aNbPointsPerCell = thePropogationTime/theStepLength;
+  float aCellsSize = aNbCells*(1+aNbPointsPerCell);
+  float aPointsSize = aCellsSize*3.0*sizeof(float);
 
-    //Order of setting of the values are important 
-    SetIntegrationStep(aPipeLine->GetIntegrationStep());
-    SetPropagationTime(aPipeLine->GetPropagationTime());
-    SetStepLength(aPipeLine->GetStepLength());
+  float aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  float aTypesSize = aNbCells*sizeof(char);
+  float aLocationsSize = aNbCells*sizeof(int);
+  float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+  float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
+
+  float anAssignedDataSize = aCellsSize*4.0*sizeof(float);
+  float anOutputDataSetSize = aMeshSize + anAssignedDataSize;
+
+  float aResult = aStreamArraySize*aNbCells + anOutputDataSetSize;
+  return aResult;
+}
+
+int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, 
+                                          float& thePropogationTime, float& thePercents)
+{
+  static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
+  vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
+  float aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
+  int isPoss = CheckAvailableMemory(aSize);
+  if(!isPoss){
+    float aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime);
+    float aMinStepLength = GetMinStepLength(theDataSet);
+    float aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
+    for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){
+      float aStepLength = theStepLength + aDeltaStepLength;
+      if(aStepLength < aMaxStepLength) theStepLength = aStepLength;
+      else if(aStepChanged){
+       aStepLength = aMaxStepLength;
+       aStepChanged = 0;
+      }
+      float aPercents = thePercents /= aPercentsDecrease;
+      if(aPercents*aNbOfPoints > 1) thePercents = aPercents;
+      else if(aPerecentsChanged) {
+       thePercents = 1.1 / aNbOfPoints;
+       aPerecentsChanged = 0;
+      }
+      aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
+      if(CheckAvailableMemory(aSize)){
+       isPoss = i;
+       break;
+      }
+    }
   }
+  if(MYDEBUG) MESSAGE("FindPossibleParams - aSize = "<<aSize<<"; isPoss = "<<isPoss);
+  return isPoss;
 }
 
-void VISU_StreamLinesPL::SetSource(vtkPointSet* theSource){
-  if (mySource != NULL) mySource->UnRegister(this);
-  mySource = theSource;
-  if (mySource != NULL) mySource->Register(this);
-  if(myInput && myInput->GetCellData()->GetNumberOfArrays()){
-    vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
-    aFilter->SetInput(myFieldTransform->GetUnstructuredGridOutput());
-    aFilter->PassCellDataOn();
-    myStream->SetInput(aFilter->GetOutput());
-    aFilter->Register(myStream);
-    aFilter->Delete();
-    vtkCellCenters *centers = vtkCellCenters::New(); // for vectors on cells
-    centers->SetInput(myFieldTransform->GetUnstructuredGridOutput());
-    centers->VertexCellsOn();
-    mySource = mySource? mySource: centers->GetOutput();
-    SetStreamerSource(myStream,mySource,myPercents);
-    centers->Register(myStream);
-    centers->Delete();
-  }else{
-    myStream->SetInput(myFieldTransform->GetUnstructuredGridOutput());
-    mySource = mySource? mySource: myFieldTransform->GetUnstructuredGridOutput();
-    SetStreamerSource(myStream,mySource,myPercents);
+
+int VISU_StreamLinesPL::SetParams(float theIntStep, 
+                                 float thePropogationTime,
+                                 float theStepLength,
+                                 vtkPointSet* theSource, 
+                                 float thePercents,            
+                                 int theDirection,
+                                 int isOnlyTry)
+{
+  vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->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);
+  if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
+    mySource = theSource;
+    myPercents = thePercents;
+    if(myInput->GetCellData()->GetNumberOfArrays()){
+      myCenters->SetInput(aDataSet);
+      myCenters->VertexCellsOn();
+      aDataSet = myCenters->GetOutput();
+    }
+    myPointsFilter->SetInput(aDataSet);
+    myPointsFilter->SetPercentsOfUsedPoints(thePercents);
+    aDataSet = myPointsFilter->GetOutput();
+    myStream->SetSource(aDataSet);
+    myStream->SetIntegrationStepLength(theIntStep);
+    myStream->SetMaximumPropagationTime(thePropogationTime);
+    myStream->SetStepLength(theStepLength);
+    myStream->SetSavePointInterval(theIntStep*aMinNbOfSteps);
+    myStream->SetIntegrationDirection(theDirection);
+    myStream->Modified();
+    Modified();
   }
-  myStream->Modified();
-  Modified();
+  return isAccepted;
 }
 
 
-float VISU_StreamLinesPL::GetMaxIntegrationStep(vtkPointSet* theDataSet) {
-  if(!theDataSet) return 0.0;
-  theDataSet->Update();
-  float* aBounds = theDataSet->GetBounds();
-  float aMaxSizeY = aBounds[3] - aBounds[2];
-  float aMaxSizeZ = aBounds[5] - aBounds[4];
-  float aMinMax = aBounds[1] - aBounds[0];
-  if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
-  if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
-  return aMinMax / 2.0;
-} 
+vtkPointSet* VISU_StreamLinesPL::GetSource() {
+  return mySource;
+}
+
+float VISU_StreamLinesPL::GetUsedPoints() { 
+  return myPercents;
+}
+
+vtkDataSet* VISU_StreamLinesPL::GetStreamerSource(){
+  return myStream->GetSource();
+}
+
+float VISU_StreamLinesPL::GetVelocityCoeff(){
+  return GetVelocityCoeff(myExtractor->GetOutput());
+}
+
+float VISU_StreamLinesPL::GetVelocityCoeff(vtkPointSet* theDataSet){
+  float* aScalarRange = theDataSet->GetScalarRange();
+  return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
+}
+
+
+int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){
+  float aStepLength = GetBaseStepLength(theDataSet);
+  float aBasePropTime = GetBasePropagationTime(theDataSet);
+  VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
+  aPointsFilter->SetInput(theDataSet);
+  vtkPointSet* aDataSet = aPointsFilter->GetOutput();
+  aDataSet->Update();
+  int aRes = FindPossibleParams(aDataSet,aStepLength,aBasePropTime,thePercents);
+  aPointsFilter->UnRegisterAllOutputs();
+  aPointsFilter->Delete();
+  return aRes;
+}
+
 
-float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet) {
-  if(!theDataSet) return 0.0;
+float VISU_StreamLinesPL::GetIntegrationStep(){
+  return myStream->GetIntegrationStepLength();
+}
+float VISU_StreamLinesPL::GetStepLength() { 
+  return myStream->GetStepLength();
+}
+float VISU_StreamLinesPL::GetPropagationTime() { 
+  return myStream->GetMaximumPropagationTime();
+}
+int VISU_StreamLinesPL::GetDirection(){
+  return myStream->GetIntegrationDirection();
+}
+
+
+float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) {
+  if(!theDataSet) return -1.0;
   float aVolume = 1.0, tmp;
   int degree = 0;
   theDataSet->Update();
@@ -138,112 +250,144 @@ float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet) {
     }
   }
   if (degree < 1) return 0.0; // absolutely empty object
-  unsigned long aSize = 1024*theDataSet->GetActualMemorySize();
-  // we have to use no more, than myMaxIncrementMemorySize*aSize amount of memory
-  unsigned long aRealSize = GetAvailableMemory(myMaxIncrementMemorySize*aSize);
-  if(MYDEBUG) cout<<"GetMinIntegrationStep - GetActualMemorysize() = "<<aRealSize<<"; "<<aSize<<endl;
+  float anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
+  float aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
+  thePercents = 1.0;
+  vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
+  float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
+  float aRealSize = GetAvailableMemory(aSize);
   float anAverageVolume = aVolume / aRealSize; 
   float aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
   return aStep;
 }
+float VISU_StreamLinesPL::GetMinIntegrationStep(){ 
+  return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
+}
 
-float VISU_StreamLinesPL::GetBasePropagationTime(vtkPointSet* theDataSet) {
-  if(!theDataSet) return 0.0;
+
+float VISU_StreamLinesPL::GetMaxIntegrationStep(vtkPointSet* theDataSet) {
+  if(!theDataSet) return -1.0;
   theDataSet->Update();
-  float* aScalarRange = theDataSet->GetScalarRange();
-  return theDataSet->GetLength()/fabs(aScalarRange[1] + aScalarRange[0])*2.0;
+  float aLength = theDataSet->GetLength();
+  float* aBounds = theDataSet->GetBounds();
+  float aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
+  float aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
+  float aMinMax = (aBounds[1] - aBounds[0])/aLength;
+  if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
+  if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
+  return aMinMax*aLength/2.0;
+} 
+float VISU_StreamLinesPL::GetMaxIntegrationStep(){ 
+  return GetMaxIntegrationStep(myExtractor->GetOutput());
 }
 
-
-int VISU_StreamLinesPL::GetDirection(){
-  return myStream->GetIntegrationDirection();
+float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){ 
+  theDataSet->Update();
+  float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+  float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+  float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
+  float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
+  if(aMinMax > anIntegrationStep) 
+    anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
+  if(aMinIntegrationStep > anIntegrationStep) 
+    anIntegrationStep = aMinIntegrationStep;
+  return anIntegrationStep;
 }
-void VISU_StreamLinesPL::SetDirection(int theDirection){
-  myStream->SetIntegrationDirection(theDirection);
-  Modified();
+
+float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){ 
+  theDataSet->Update();
+  float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+  float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+  if(aMinIntegrationStep > theStep)
+    theStep = aMinIntegrationStep;
+  if(aMaxIntegrationStep < theStep)
+    theStep = aMaxIntegrationStep;
+  return theStep;
 }
 
 
-float VISU_StreamLinesPL::GetPropagationTime() { 
-  return myStream->GetMaximumPropagationTime();
+float VISU_StreamLinesPL::GetMinPropagationTime(vtkPointSet* theDataSet){
+  if(!theDataSet) return -1.0;
+  return GetMinStepLength(theDataSet);
 }
-void VISU_StreamLinesPL::SetPropagationTime(float theTime) { 
-  if(myStream->GetMaximumPropagationTime() == theTime) return;
-  myStream->SetMaximumPropagationTime(theTime);
-  Modified();
+float VISU_StreamLinesPL::GetMinPropagationTime(){
+  return GetMinPropagationTime(myExtractor->GetOutput());
 }
 
+float VISU_StreamLinesPL::GetMaxPropagationTime(vtkPointSet* theDataSet){
+  if(!theDataSet) return -1.0;
+  return GetBasePropagationTime(theDataSet)*aMinNbOfSteps;
+}
+float VISU_StreamLinesPL::GetMaxPropagationTime(){
+  return GetMaxPropagationTime(myExtractor->GetOutput());
+}
 
-float VISU_StreamLinesPL::GetIntegrationStep(){
-  return myStream->GetIntegrationStepLength();
+float VISU_StreamLinesPL::CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet){
+  float aMinPropagationTime = GetMinPropagationTime(theDataSet);
+  float aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
+  if(aMinPropagationTime > thePropagationTime)
+    thePropagationTime = aMinPropagationTime;
+  if(aMaxPropagationTime < thePropagationTime)
+    thePropagationTime = aMaxPropagationTime;
+  return thePropagationTime;
 }
-float VISU_StreamLinesPL::SetIntegrationStep(float theStep){ 
-  if(myStream->GetIntegrationStepLength() == theStep) return theStep;
-  myExtractor->Update();
-  vtkPointSet* aDataSet = GetSource();
-  aDataSet->Update();
-  float anIntegrationStep = theStep;
-  float aMinIntegrationStep = GetMinIntegrationStep(aDataSet);
-  float aMaxIntegrationStep = GetMaxIntegrationStep(aDataSet);
-  if(aMinIntegrationStep < anIntegrationStep && anIntegrationStep < aMaxIntegrationStep){
-    myStream->SetIntegrationStepLength(theStep);
-    Modified();
-  }else{
-    anIntegrationStep = aMaxIntegrationStep / 10.0;
-    float aMinMax = aDataSet->GetLength()/myInput->GetNumberOfPoints();
-    if(aMinMax > anIntegrationStep) 
-      anIntegrationStep = (anIntegrationStep*9.0+aMinMax)/10.0;
-    if(aMinIntegrationStep > anIntegrationStep) 
-      anIntegrationStep = aMinIntegrationStep;
-  }
-  return anIntegrationStep;
+float VISU_StreamLinesPL::GetBasePropagationTime(vtkPointSet* theDataSet){
+  if(!theDataSet) return -1.0;
+  theDataSet->Update();
+  float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
+  return aPropagationTime;
+}
+float VISU_StreamLinesPL::GetBasePropagationTime(){ 
+  return GetBasePropagationTime(myExtractor->GetOutput());
 }
 
 
-float VISU_StreamLinesPL::GetStepLength() { 
-  return myStream->GetStepLength();
+float VISU_StreamLinesPL::GetMinStepLength(vtkPointSet* theDataSet){
+  static float aNbOfStepsOfIntStep = 1.0E+1;
+  float anIntStep = GetMinIntegrationStep(theDataSet);
+  float aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet);
+  return aStepLength;
 }
-float VISU_StreamLinesPL::GetMinStepLength(float theIntegrationStep){
-  return theIntegrationStep*2.0;
+float VISU_StreamLinesPL::GetMinStepLength(){
+  return GetMinStepLength(myExtractor->GetOutput());
+}
+
+float VISU_StreamLinesPL::GetMaxStepLength(vtkPointSet* theDataSet){
+  float aStepLength = GetBasePropagationTime(theDataSet);
+  return aStepLength;
 }
-float VISU_StreamLinesPL::GetMaxStepLength(float thePropagationTime){
-  return thePropagationTime/100.0;
+float VISU_StreamLinesPL::GetMaxStepLength(){
+  return GetMaxStepLength(myExtractor->GetOutput());
 }
-float VISU_StreamLinesPL::CorrectStepLength(float theStep, float theIntegrationStep, float thePropagationTime){
-  float aMinStep = GetMinStepLength(theIntegrationStep);
+
+float VISU_StreamLinesPL::CorrectStepLength(float theStep, vtkPointSet* theDataSet){
+  float aMinStep = GetMinStepLength(theDataSet);
   if(theStep < aMinStep) theStep = aMinStep;
-  float aMaxStep = GetMaxStepLength(thePropagationTime);
+  float aMaxStep = GetMaxStepLength(theDataSet);
   if(theStep > aMaxStep) theStep = aMaxStep;
   return theStep;
 }
-float VISU_StreamLinesPL::SetStepLength(float theStep){
-  if(myStream->GetStepLength() == theStep) return theStep;
-  float aStepLength = CorrectStepLength(theStep,GetIntegrationStep(),GetPropagationTime());
-  if(aStepLength == theStep){
-    myStream->SetStepLength(theStep);
-    Modified();
-  }
+float VISU_StreamLinesPL::GetBaseStepLength(vtkPointSet* theDataSet){
+  static float anAvgNbOfSteps = 1.0E+2;
+  float aPropagationTime = GetBasePropagationTime(theDataSet);
+  float aStepLength = aPropagationTime/anAvgNbOfSteps;
+  aStepLength = CorrectStepLength(aStepLength,theDataSet);
   return aStepLength;
 }
 
 
 void VISU_StreamLinesPL::Init(){
   VISU_ScalarMapPL::Init();
-
-  SetDirection(VTK_INTEGRATE_BOTH_DIRECTIONS);
-  vtkPointSet* aDataSet = myExtractor->GetOutput();                                                    
-  //Order of setting of the values are important 
-  myPercents = 0.3;
-  SetSource(NULL);
-
-  SetIntegrationStep(SetIntegrationStep(GetMaxIntegrationStep(aDataSet)/10.0));
-  SetPropagationTime(GetBasePropagationTime(aDataSet));
-  SetStepLength(SetStepLength(GetPropagationTime()/20.));
+  vtkPointSet* aDataSet = myExtractor->GetOutput();
+  float anIntStep = GetBaseIntegrationStep(aDataSet);
+  float aPropagationTime = GetBasePropagationTime(aDataSet);
+  float aStepLength = GetBaseStepLength(aDataSet);
+  SetParams(anIntStep,aPropagationTime,aStepLength);
 }
 
 VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){
-  SetSource(NULL);
   myInput->Update();
+  VISU::CellDataToPoint(myStream,myCellDataToPointData,myInput,myFieldTransform);
   float *aBounds = myInput->GetBounds();
   myGeomFilter->SetExtent(aBounds);
   myGeomFilter->ExtentClippingOn();
index ab56a0411544bb7cf293cfaf3280495e101ae5c2..6e9bc4138fc3e8ca0743ad22ad855c1ed6545189 100644 (file)
@@ -31,7 +31,9 @@
 #include <vtkStreamLine.h>
 
 class vtkPointSet;
+class vtkCellCenters;
 class SALOME_GeometryFilter;
+class VISU_UsedPointsFilter;
 
 class VISU_StreamLinesPL : public VISU_DeformedShapePL{
 protected:
@@ -43,27 +45,32 @@ public:
   virtual ~VISU_StreamLinesPL();
   virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
 
-  virtual int GetDirection();
-  virtual void SetDirection(int theDirection);
-
-  virtual float GetStepLength();
-  virtual float SetStepLength(float theStep);
-
+  virtual int SetParams(float theIntStep, 
+                       float thePropogationTime,
+                       float theStepLength,
+                       vtkPointSet* theSource = NULL, 
+                       float thePercents = 0.3,
+                       int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS,
+                       int isOnlyTry = false);
+  virtual vtkPointSet* GetSource();
+  virtual float GetUsedPoints();
+  virtual float GetIntegrationStep();
   virtual float GetPropagationTime();
-  virtual void SetPropagationTime(float theTime);
+  virtual float GetStepLength();
+  virtual int GetDirection();
 
-  virtual float GetIntegrationStep();
-  virtual float SetIntegrationStep(float theStep);
+  virtual vtkDataSet* GetStreamerSource();
+  virtual float GetVelocityCoeff();
 
-  virtual void SetSource(vtkPointSet* theSource);
-  virtual vtkPointSet* GetSource() {return mySource;}
+  virtual float GetMaxIntegrationStep();
+  virtual float GetMinIntegrationStep();
 
-  virtual void SetUsedPoints(float thePercents) { myPercents = thePercents;}
-  virtual float GetUsedPoints() { return myPercents;}
+  virtual float GetMinStepLength();
+  virtual float GetMaxStepLength();
 
-  virtual float GetMaxIntegrationStep(){ return GetMaxIntegrationStep(GetSource());}
-  virtual float GetMinIntegrationStep(){ return GetMinIntegrationStep(GetSource());}
-  virtual float GetBasePropagationTime(){ return GetBasePropagationTime(GetSource());};
+  virtual float GetMinPropagationTime();
+  virtual float GetMaxPropagationTime();
+  virtual float GetBasePropagationTime();
 
 public:
   virtual THook* DoHook();
@@ -72,22 +79,40 @@ public:
   virtual void SetMapScale(float theMapScale = 1.0);
 
 public:
-  static int myMaxIncrementMemorySize;
-
-  static float GetMinStepLength(float theIntegrationStep);
-  static float GetMaxStepLength(float thePropagationTime);
-  static float CorrectStepLength(float theStep, float theIntegrationStep, float thePropagationTime);
-
   static float GetMaxIntegrationStep(vtkPointSet* theDataSet);
-  static float GetMinIntegrationStep(vtkPointSet* theDataSet);
+  static float GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3);
+  static float GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3);
+  
+  static float GetMinPropagationTime(vtkPointSet* theDataSet);
+  static float GetMaxPropagationTime(vtkPointSet* theDataSet);
   static float GetBasePropagationTime(vtkPointSet* theDataSet);
 
+  static float GetMinStepLength(vtkPointSet* theDataSet);
+  static float GetMaxStepLength(vtkPointSet* theDataSet);
+  static float GetBaseStepLength(vtkPointSet* theDataSet);
+
+  static float GetVelocityCoeff(vtkPointSet* theDataSet);
+
+  static int IsPossible(vtkPointSet* theDataSet, float thePercents = 0.3);
+
 protected:
+  static float GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, 
+                                     float thePropogationTime, float thePercents = 0.3);
+  static int FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, 
+                               float& thePropogationTime, float& thePercents);
+  
+  static float CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents = 0.3);
+  static float CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet);
+  static float CorrectStepLength(float theStep, vtkPointSet* theDataSet);
+
   vtkStreamLine* myStream;
   vtkPointSet* mySource;
+  vtkCellCenters* myCenters;
   SALOME_GeometryFilter *myGeomFilter;
+  VISU_UsedPointsFilter *myPointsFilter;
   float myPercents;
 };
 
 
 #endif
index 9e2e261211f8ebbea0d298f72ea5f2a662088388..6c52da23b33269b32e4d29fe4116231572fd4952 100644 (file)
@@ -43,7 +43,7 @@ static int MYDEBUG = 0;
 vtkStandardNewMacro(VISU_UsedPointsFilter);
 
 VISU_UsedPointsFilter::VISU_UsedPointsFilter(){
-  PercentsOfUsedPoints = 0.1;
+  PercentsOfUsedPoints = 1.0;
 }
 
 VISU_UsedPointsFilter::~VISU_UsedPointsFilter(){}
@@ -52,6 +52,8 @@ void VISU_UsedPointsFilter::Execute(){
   vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
   anOutput->GetPointData()->CopyAllOff();
   anOutput->GetCellData()->CopyAllOff();
+  anOutput->CopyStructure(anInput);
+
   vtkPoints* aPoints = vtkPoints::New();
   vtkIdType aCellSize = anInput->GetMaxCellSize();
   vtkIdList *anIdList = vtkIdList::New(); 
@@ -61,18 +63,15 @@ void VISU_UsedPointsFilter::Execute(){
     if(anIdList->GetNumberOfIds() > 0)
       aPoints->InsertNextPoint(anInput->GetPoint(i));
   }
-  static float EPS = 1E-5;
-  if(PercentsOfUsedPoints < EPS){
-    anOutput->SetPoints(aPoints);
-  }else{
-    vtkPoints* aNewPoints = vtkPoints::New();
-    iEnd = aPoints->GetNumberOfPoints();
+  vtkPoints* aNewPoints = vtkPoints::New();
+  iEnd = aPoints->GetNumberOfPoints();
+  if (PercentsOfUsedPoints > 0){
     vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
     if(anOffset < 1) anOffset = 1;
     for(vtkIdType i = 0; i < iEnd; i += anOffset)
       aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
-    anOutput->SetPoints(aNewPoints);
-    aNewPoints->Delete();
   }
+  anOutput->SetPoints(aNewPoints);
+  aNewPoints->Delete();
   aPoints->Delete();
 }
index 786f7ec069a39870981bad7f1501f6a25ef0225f..ddb703b5afaa80c3a888148004e9b7144fb9568c 100644 (file)
@@ -39,11 +39,32 @@ vtkStandardNewMacro(VISU_VectorsPL);
 
 VISU_VectorsPL::VISU_VectorsPL(){
   myGlyph = vtkGlyph3D::New();
+
+  myGlyphSource = vtkGlyphSource2D::New();
+  myConeSource = vtkConeSource::New();
+  myLineSource = vtkLineSource::New();
+
+  myCenters = vtkCellCenters::New();
   myTransformFilter = SALOME_TransformFilter::New();
 }
 
 VISU_VectorsPL::~VISU_VectorsPL(){
+  myGlyph->UnRegisterAllOutputs();
   myGlyph->Delete();
+
+  myCenters->UnRegisterAllOutputs();
+  myCenters->Delete();
+
+  myGlyphSource->UnRegisterAllOutputs();
+  myGlyphSource->Delete();
+
+  myConeSource->UnRegisterAllOutputs();
+  myConeSource->Delete();
+
+  myLineSource->UnRegisterAllOutputs();
+  myLineSource->Delete();
+
+  myTransformFilter->UnRegisterAllOutputs();
   myTransformFilter->Delete();
 }
 
@@ -86,7 +107,7 @@ void VISU_VectorsPL::Init(){
 
 
 VISU_ScalarMapPL::THook* VISU_VectorsPL::DoHook(){
-  VISU::ToCellCenters(myTransformFilter,myInput,myFieldTransform);
+  VISU::ToCellCenters(myTransformFilter,myCenters,myInput,myFieldTransform);
   myGlyph->SetInput(myTransformFilter->GetOutput());
   myGlyph->SetVectorModeToUseVector();
   myGlyph->SetScaleModeToScaleByVector();
@@ -98,44 +119,54 @@ VISU_ScalarMapPL::THook* VISU_VectorsPL::DoHook(){
 void VISU_VectorsPL::Update(){
   switch (myTypeGlyph) {
   case ARROW: {
-    vtkGlyphSource2D *aGlyphSource = vtkGlyphSource2D::New();
-    aGlyphSource->SetGlyphTypeToArrow();
-    aGlyphSource->SetFilled(0);
-    if(myPosGlyph == TAIL)
-      aGlyphSource->SetCenter(0.5, 0.0, 0.0);
-    else if(myPosGlyph == HEAD)
-      aGlyphSource->SetCenter(-0.5, 0.0, 0.0);
-    myGlyph->SetSource(aGlyphSource->GetOutput());
-    aGlyphSource->Register(myGlyph);
-    aGlyphSource->Delete();
+    myGlyphSource->SetGlyphTypeToArrow();
+    myGlyphSource->SetFilled(0);
+    switch (myPosGlyph) {
+    case TAIL:
+      myGlyphSource->SetCenter(0.5, 0.0, 0.0);
+      break;
+    case HEAD:
+      myGlyphSource->SetCenter(-0.5, 0.0, 0.0);
+      break;
+    case CENTER:
+      myGlyphSource->SetCenter(0.0, 0.0, 0.0);
+    }
+//     if(myPosGlyph == TAIL)
+//       myGlyphSource->SetCenter(0.5, 0.0, 0.0);
+//     else if(myPosGlyph == HEAD)
+//       myGlyphSource->SetCenter(-0.5, 0.0, 0.0);
+    myGlyph->SetSource(myGlyphSource->GetOutput());
   }
     break;
   case CONE2:
   case CONE6: {
-    vtkConeSource *aGlyphSource = vtkConeSource::New(); //by default
     if (myTypeGlyph == CONE2)
-      aGlyphSource->SetResolution(3);
+      myConeSource->SetResolution(3);
     else
-      aGlyphSource->SetResolution(7);
-    aGlyphSource->SetHeight(1.0);
-    aGlyphSource->SetRadius(.1);
-    
-    if(myPosGlyph == TAIL)
-      aGlyphSource->SetCenter(0.5, 0.0, 0.0);
-    else if(myPosGlyph == HEAD)
-      aGlyphSource->SetCenter(-0.5, 0.0, 0.0);
+      myConeSource->SetResolution(7);
+    myConeSource->SetHeight(1.0);
+    myConeSource->SetRadius(.1);
     
-    myGlyph->SetSource(aGlyphSource->GetOutput());
-    aGlyphSource->Register(myGlyph);
-    aGlyphSource->Delete();
+    switch (myPosGlyph) {
+    case TAIL:
+      myConeSource->SetCenter(0.5, 0.0, 0.0);
+      break;
+    case HEAD:
+      myConeSource->SetCenter(-0.5, 0.0, 0.0);
+      break;
+    case CENTER:
+      myConeSource->SetCenter(0.0, 0.0, 0.0);
+    }
+//     if(myPosGlyph == TAIL)
+//       myConeSource->SetCenter(0.5, 0.0, 0.0);
+//     else if(myPosGlyph == HEAD)
+//       myConeSource->SetCenter(-0.5, 0.0, 0.0);
+    myGlyph->SetSource(myConeSource->GetOutput());
   }
     break;
   case NONE:
   default: {
-    vtkLineSource *aGlyphSource = vtkLineSource::New(); 
-    myGlyph->SetSource(aGlyphSource->GetOutput());
-    aGlyphSource->Register(myGlyph);
-    aGlyphSource->Delete();
+    myGlyph->SetSource(myLineSource->GetOutput());
   }
   }
 
index 81a1f33b5d3cacf2b45418c0021bd00ae3dd5db4..e4af6d6280fefa3aa1184c213075b323cc4c36f1 100644 (file)
 
 class SALOME_TransformFilter;
 class SALOME_Transform;
+class vtkCellCenters;
+
+class vtkGlyphSource2D;
+class vtkConeSource;
+class vtkLineSource;
+
 class vtkGlyph3D;
 
 class VISU_VectorsPL : public VISU_DeformedShapePL{
@@ -68,6 +74,12 @@ protected:
   GlyphType myTypeGlyph;
   GlyphPos myPosGlyph;
   vtkGlyph3D *myGlyph;
+
+  vtkGlyphSource2D *myGlyphSource;
+  vtkLineSource *myLineSource;
+  vtkConeSource *myConeSource;
+
+  vtkCellCenters* myCenters;
   SALOME_TransformFilter *myTransformFilter;
 };
 
index 08bae36a990b67bb119ecce6f980c9d6c1252c4e..3744c066a2df406882073e64f1dc4fe452e25e0f 100644 (file)
@@ -33,9 +33,6 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-EXPORT_PYSCRIPTS = \
-       VisuGUI.py
-
 # header files 
 EXPORT_HEADERS= \
                 VisuGUI_NonIsometricDlg.h
@@ -47,48 +44,37 @@ PO_FILES = \
 # Libraries targets
 LIB = libVISUGUI.la
 LIB_SRC =      VisuGUI.cxx \
-               VisuGUI_CellsResultsDlg.cxx \
-               VisuGUI_PointsResultsDlg.cxx \
                VisuGUI_Selection.cxx \
-               VisuGUI_PhaseDlg.cxx \
-               VisuGUI_PhaseMagnitudeDlg.cxx \
                VisuGUI_MagnitudeDlg.cxx \
-               VisuGUI_PartialScaDlg.cxx \
                VisuGUI_IsoSurfacesDlg.cxx \
                VisuGUI_CursorDlg.cxx \
                VisuGUI_VectorsDlg.cxx \
                VisuGUI_CutPlanesDlg.cxx \
-               VisuGUI_SelVectCompDlg.cxx \
                VisuGUI_ScalarBarDlg.cxx \
                VisuGUI_SweepPrefDlg.cxx \
-               VisuGUI_VisuAsDlg.cxx \
                VisuGUI_NonIsometricDlg.cxx \
                 VisuGUI_StreamLinesDlg.cxx \
                 VisuGUI_TimeAnimation.cxx \
                VisuGUI_CutLinesDlg.cxx \
-               VisuGUI_FileDlg.cxx
+               VisuGUI_FileDlg.cxx \
+               VisuGUI_EditContainerDlg.cxx
 
 LIB_MOC = \
                VisuGUI.h \
-               VisuGUI_CellsResultsDlg.h \
-               VisuGUI_PointsResultsDlg.h \
-               VisuGUI_PhaseDlg.h \
-               VisuGUI_PhaseMagnitudeDlg.h \
                VisuGUI_MagnitudeDlg.h \
-               VisuGUI_PartialScaDlg.h \
                VisuGUI_IsoSurfacesDlg.h \
                VisuGUI_CursorDlg.h \
                VisuGUI_VectorsDlg.h \
                VisuGUI_CutPlanesDlg.h \
-               VisuGUI_SelVectCompDlg.h \
                VisuGUI_ScalarBarDlg.h \
                VisuGUI_SweepPrefDlg.h \
-               VisuGUI_VisuAsDlg.h \
                VisuGUI_NonIsometricDlg.h \
                 VisuGUI_StreamLinesDlg.h \
                 VisuGUI_TimeAnimation.h \
                VisuGUI_CutLinesDlg.h \
-               VisuGUI_FileDlg.h
+               VisuGUI_FileDlg.h \
+               VisuGUI_EditContainerDlg.h \
+               VisuGUI_Selection.h
 
 LIB_CLIENT_IDL = SALOME_Exception.idl \
                 VISU_Gen.idl \
@@ -106,13 +92,11 @@ LIB_SERVER_IDL =
 CPPFLAGS +=  -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \
        $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
        -I${KERNEL_ROOT_DIR}/include/salome
-
 CXXFLAGS +=  -ftemplate-depth-32 $(OCC_CXXFLAGS) \
        -I${KERNEL_ROOT_DIR}/include/salome
 
-
 LDFLAGS += $(MED2_LIBS) $(HDF5_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
-       -lVisuObject -lVISUEngine -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome -L${KERNEL_ROOT_DIR}/lib/salome
+       -lVisuObject -lVISUEngine -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
 
 
 @CONCLUDE@
index 23a04a9d9b0840cfcb1e07e263a17dce9c788c13..64003b6bd46239282d160b54b451753aa4f206a1 100644 (file)
@@ -28,7 +28,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
+"PO-Revision-Date: 2003-10-07 11:25+0400\n"
 "Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
 "Content-Type: text/plain; charset=iso-8859-1\n"
 
@@ -141,70 +141,6 @@ msgstr "OK"
 msgid "VisuGUI_MagnitudeDlg::VISU_MEN_PHASE"
 msgstr "Magnitude"
 
-#: VisuGUI_PartialScaDlg.cxx:43
-msgid "VisuGUI_PartialScaDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_PartialScaDlg.cxx:30
-msgid "VisuGUI_PartialScaDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_PartialScaDlg.cxx:37
-msgid "VisuGUI_PartialScaDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_PartialScaDlg.cxx:76
-msgid "VisuGUI_PartialScaDlg::Max :"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:81
-msgid "VisuGUI_PartialScaDlg::Min :"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:49
-msgid "VisuGUI_PartialScaDlg::Min an Max limits of scalar Display"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:20
-msgid "VisuGUI_PartialScaDlg::MyDialog"
-msgstr "Partial Scalar"
-
-#: VisuGUI_PhaseDlg.cxx:43
-msgid "VisuGUI_PhaseDlg::VISU_BUT_CANCEL"
-msgstr "Cancel"
-
-#: VisuGUI_PhaseDlg.cxx:30
-msgid "VisuGUI_PhaseDlg::VISU_BUT_HELP"
-msgstr "Help"
-
-#: VisuGUI_PhaseDlg.cxx:37
-msgid "VisuGUI_PhaseDlg::VISU_BUT_OK"
-msgstr "OK"
-
-#: VisuGUI_PhaseDlg.cxx:54
-msgid "VisuGUI_PhaseDlg::VISU_MEN_PHASE"
-msgstr "Phase"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:83
-msgid "VisuGUI_PhaseMagnitudeDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:70
-msgid "VisuGUI_PhaseMagnitudeDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:77
-msgid "VisuGUI_PhaseMagnitudeDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:57
-msgid "VisuGUI_PhaseMagnitudeDlg::Magnitude :"
-msgstr ""
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:52
-msgid "VisuGUI_PhaseMagnitudeDlg::Phase :"
-msgstr ""
-
 #: VisuGUI_VectorsDlg.cxx:47
 msgid "VisuGUI_VectorsDlg::&Cancel"
 msgstr "Cancel"
@@ -279,10 +215,13 @@ msgstr "MED Files ( *.med )"
 msgid "BUT_CLOSE"
 msgstr "Close"
 
-msgid "VisuGUI_ScalarBarDlg::WRN_LOGARITHMIC_RANGE"
+msgid "BUT_CANCEL"
+msgstr "&Cancel"
+
+msgid "WRN_LOGARITHMIC_RANGE"
 msgstr "Logarithmic scaling: use imposed range values > 0"
 
-msgid "VisuGUI_ScalarBarDlg::WRN_LOGARITHMIC_FIELD_RANGE"
+msgid "WRN_LOGARITHMIC_FIELD_RANGE"
 msgstr "Logarithmic scaling: field range contains negative values, use imposed range instead"=======
 msgid "TXT_ORIENTATION"
 msgstr "Orientation"
@@ -330,7 +269,7 @@ msgid "WRN_NO_AVAILABLE_DATA"
 msgstr "No Available data in selection"
 
 msgid "ERR_CANT_BUILD_PRESENTATION"
-msgstr "The presentation can't be built"
+msgstr "The object can't be built"
 
 msgid "ERR_CANT_CREATE_ACTOR"
 msgstr "Can't create actor for this presentation"
@@ -355,3 +294,31 @@ msgstr "Source type"
 
 msgid "MSG_NO_ANIMATIONDATA"
 msgstr "There is no data for animation"
+
+msgid "LBL_SHOW_PREVIEW"
+msgstr "Show preview"
+
+msgid "LBL_GENERATE_TABLE"
+msgstr "Generate Data Table"
+
+msgid "LBL_GENERATE_CURVES"
+msgstr "Generate Curves"
+
+msgid "TIT_TEXT_PREF"
+msgstr "Text property"
+
+msgid "LBL_BOLD"
+msgstr "Bold"
+
+msgid "LBL_ITALIC"
+msgstr "Italic"
+
+msgid "LBL_SHADOW"
+msgstr "Shadow"
+
+msgid "LBL_TITLE"
+msgstr "Title"
+
+msgid "LBL_LABELS"
+msgstr "Labels"
+
index 9073b28a20b634ed505b6f1151c8b88c3236f446..36e79fe1ccab28c314631bc7d5587d216ec27075 100644 (file)
 #include "VISU_Actor.h"
 #include "VISU_MeshAct.h"
 
-#include "VisuGUI_PhaseDlg.h"
 #include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_PhaseMagnitudeDlg.h"
-#include "VisuGUI_PartialScaDlg.h"
 #include "VisuGUI_CursorDlg.h"
 #include "VisuGUI_ScalarBarDlg.h"
 #include "VisuGUI_SweepPrefDlg.h"
 #include "VisuGUI_VectorsDlg.h"
 #include "VisuGUI_IsoSurfacesDlg.h"
 #include "VisuGUI_StreamLinesDlg.h"
+#include "VisuGUI_EditContainerDlg.h"
 #include "VisuGUI_TimeAnimation.h"
 
 #include "VisuGUI_Selection.h"
-#include "VisuGUI_VisuAsDlg.h"
-#include "VisuGUI_SelVectCompDlg.h"
 #include "VisuGUI_NonIsometricDlg.h"
 
 #include "SALOMEGUI_ImportOperation.h"
 #include <qthread.h>
 #include <qlistbox.h>
 #include <qcombobox.h>
+#include <qregexp.h> 
 
 //VRV: porting on Qt 3.0.5
 #if QT_VERSION >= 0x030005
@@ -168,7 +165,7 @@ private:
 };
 
 static VisuGUI MYVISUGUI;
-static VisuGUI *visuGUI = &MYVISUGUI;
+VisuGUI *visuGUI = &MYVISUGUI;
 
 VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
   VISU::VISU_Gen_i::GetVisuGenImpl()->SetCurrentStudy(GetStudyDocument());
@@ -337,26 +334,10 @@ void RepaintCurrentView(){
   if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()) vf->Repaint();
 }
 
-/**
- * Returns selected sclalar mode or -1 if it was cancelled
- */
-int GetScalarMode(VISU::Result_i* theResult, const char* theFieldName){
-  int aScalarMode = 0;
-//  const VISU::TField* aField = theResult->GetInput()->GetField(theFieldName);
-//  if(aField->myNbComp > 1){
-//    VisuGUI_SelVectCompDlg* SelCompDlg = new VisuGUI_SelVectCompDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
-//    if(SelCompDlg->exec()){
-//     aScalarMode = SelCompDlg->whatIsChecked();
-//    } else {
-//     aScalarMode = -1;
-//    }
-//    delete SelCompDlg;
-//  }
-  return aScalarMode;
-}  
-
-
-VisuGUI::VisuGUI(){}
+
+VisuGUI::VisuGUI(){    
+  mySelectionDlg = 0;
+}
 
 /* ==================================================================================== */
 /* ==================================================================================== */
@@ -395,21 +376,6 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
     SALOMEDS::AttributeIOR_var     anIOR;
     
     switch (theCommandID){
-      /* ======================================================================================== */
-      /* Define Selection Mode                                                                   */
-      /* ======================================================================================== */
-    case 101:
-    case 102:
-    case 103:
-    case 104:
-      {
-       QApplication::setOverrideCursor( Qt::waitCursor );
-       int mode  = theCommandID - 100; // Point, Edge, Cell, Actor     
-       parent->SetSelectionMode( mode );
-       QApplication::restoreOverrideCursor();
-      }
-      break;
-      
       /* ======================================================================================== */
       /* Import Table from file                                                                  */
       /* ======================================================================================== */
@@ -425,9 +391,14 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
       /* Import Mesh from MED, DAT file                                                                  */
       /* ======================================================================================== */
 
+    case 111:
+      {
+       visuGUI->CopyAndImportFile();
+       break;
+      }
     case 112:
       {
-       visuGUI->ImportFromFile();
+       visuGUI->ImportFile();
        break;
       }
 
@@ -473,45 +444,8 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
       visuGUI->CreateStreamLines();
       break;
 
-      /* ======================================================================================================================= */
-      /* View Scalar Animation (Animation/scalar)                                                                               */
-      /* With Phase                                                                                                             */
-      /* ======================================================================================================================= */
-
-      //case 4021 :
-      //case 4022 :
-      //case 4023 :
-
-      /* ========================================================================================================================= */
-      /* Selection - Cell  by number                                                                                              */
-      /* ========================================================================================================================= */
-
     case 4111 :
-      visuGUI->SelectCell();
-      break;
-
-      /* ========================================================================================================================= */
-      /* Selection - Cell - information attribute                                                                                 */
-      /* ========================================================================================================================= */
-
-    case 4112 :
-      visuGUI->InfoOnCell();
-      break;
-
-      /* ========================================================================================================================= */
-      /* Selection - Point - information number                                                                                           */
-      /* ========================================================================================================================= */
-
-    case 4121 :
-      visuGUI->SelectPoint();
-      break;
-
-      /* ========================================================================================================================= */
-      /* Selection - Point - information attribute                                                                                */
-      /* ========================================================================================================================= */
-
-    case 4122 :
-      visuGUI->InfoOnPoint();
+      visuGUI->SelectionInfo();
       break;
 
       /* ========================================================================================================================= */
@@ -722,6 +656,18 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
 }
 
 
+void VisuGUI::SelectionInfo() {
+  if (mySelectionDlg) {
+    mySelectionDlg->close(true);
+    mySelectionDlg = 0;
+  }
+  mySelectionDlg = new VisuGUI_SelectionDlg();
+  mySelectionDlg->show();
+}
+
+
+
+
 /* ********************************************************************************** */
 /* Function ShowTrihedron                                                             */
 /* ********************************************************************************** */
@@ -749,6 +695,8 @@ VisuGUI::~VisuGUI(){
 /* ********************************************************************************** */
 
 void VisuGUI::ChangeViewer(int theType){
+  if(theType < 0 ) 
+    GetActiveStudy()->unHighlightAll();
   if(vtkRenderer *aRen = GetRenderer()){
     vtkActor *anActor;
     vtkActorCollection *anActColl = aRen->GetActors();
@@ -873,7 +821,7 @@ void VisuGUI::DisplayPrs() {
   CORBA::Object_var anObject = GetSelectedObj(&anIO);
   if ( !CORBA::is_nil( anObject ) ) {
     // is it Prs3d object ?
-    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
     if(aPrsObject){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Prs3d object");
       UpdateViewer(aPrsObject);
@@ -885,21 +833,21 @@ void VisuGUI::DisplayPrs() {
       return;
     }
     // is it Curve ?
-    VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
+    VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
     if(aCurve){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Curve object");
       PlotCurve(aCurve, VISU::eDisplay );
       return;
     }
     // is it Container ?
-    VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
+    VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
     if(aContainer){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
       PlotContainer(aContainer, VISU::eDisplay );
       return;
     }
     // is it Table ?
-    VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
+    VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
     if(aTable){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
       PlotTable(aTable, VISU::eDisplay );
@@ -917,8 +865,8 @@ void VisuGUI::DisplayOnlyPrs() {
   CORBA::Object_var anObject = GetSelectedObj();
   if ( !CORBA::is_nil( anObject ) ) {
     // is it Prs3d object ?
-    PortableServer::Servant aServant = VISU::GetServant(anObject);
-    if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant)){
+    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+    if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Prs3d object");
       UpdateViewer(aPrsObject, true);
       VTKViewer_ViewFrame* vf = GetVtkViewFrame();
@@ -926,13 +874,13 @@ void VisuGUI::DisplayOnlyPrs() {
        vf->getRenderer()->ResetCameraClippingRange();
        vf->Repaint();
       }
-    }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant)){
+    }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Curve object");
       PlotCurve(aCurve, VISU::eDisplayOnly );
-    }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant)){
+    }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in())){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Container object");
       PlotContainer(aContainer, VISU::eDisplayOnly );
-    }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant)){
+    }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant.in())){
       if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Table object");
       PlotTable(aTable, VISU::eDisplayOnly );
     }
@@ -948,7 +896,7 @@ void VisuGUI::ErasePrs() {
   CORBA::Object_var anObject = GetSelectedObj();
   if ( !CORBA::is_nil( anObject ) ) {
     // is it Prs3d object ?
-    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
     if(aPrsObject){
       if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Prs3d object");
       ErasePrs(aPrsObject);
@@ -958,19 +906,19 @@ void VisuGUI::ErasePrs() {
       }
     }
     // is it Curve ?
-    VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
+    VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
     if(aCurve){
       if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Curve object");
       PlotCurve(aCurve, VISU::eErase );
     }
     // is it Container ?
-    VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
+    VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
     if(aContainer){
       if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Container object");
       PlotContainer(aContainer, VISU::eErase );
     }
     // is it Table ?
-    VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
+    VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
     if(aTable){
       if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Table object");
       PlotTable(aTable, VISU::eErase );
@@ -997,7 +945,7 @@ void VisuGUI::DisplayManyPrs()
        CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
        if ( !CORBA::is_nil( aCORBAObject ) ) {
          // is it Prs3d object ?
-         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
          if(aPrsObject){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Prs3d object");
            UpdateViewer(aPrsObject);
@@ -1010,21 +958,21 @@ void VisuGUI::DisplayManyPrs()
            continue;
          }
          // is it Curve ?
-         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
          if(aCurve){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs: Curve object");
            PlotCurve(aCurve, VISU::eDisplay );
            continue;
          }
          // is it Container ?
-         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
          if(aContainer){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Container object");
            PlotContainer(aContainer, VISU::eDisplay );
            continue;
          }
          // is it Table ?
-         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
          if(aTable){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Table object");
            PlotTable(aTable, VISU::eDisplay );
@@ -1055,7 +1003,7 @@ void VisuGUI::DisplayOnlyManyPrs() {
        CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
        if ( !CORBA::is_nil( aCORBAObject ) ) {
          // is it Prs3d object ?
-         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
          if(aPrsObject){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Prs3d object");
            UpdateViewer(aPrsObject, aFirstElem);
@@ -1069,7 +1017,7 @@ void VisuGUI::DisplayOnlyManyPrs() {
            continue;
          }
          // is it Curve ?
-         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
          if(aCurve){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs: Curve object");
            if (aFirstElem) {
@@ -1080,7 +1028,7 @@ void VisuGUI::DisplayOnlyManyPrs() {
            continue;
          }
          // is it Container ?
-         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
          if(aContainer){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Container object");
            if (aFirstElem) {
@@ -1091,7 +1039,7 @@ void VisuGUI::DisplayOnlyManyPrs() {
            continue;
          }
          // is it Table ?
-         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
          if(aTable){
            if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Table object");
            if (aFirstElem) {
@@ -1128,7 +1076,7 @@ void VisuGUI::EraseManyPrs()
        CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
        if ( !CORBA::is_nil( aCORBAObject ) ) {
          // is it Prs3d object ?
-         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
          if(aPrsObject){
            if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Prs3d object");
            ErasePrs(aPrsObject);
@@ -1139,21 +1087,21 @@ void VisuGUI::EraseManyPrs()
            continue;
          }
          // is it Curve ?
-         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
          if(aCurve){
            if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Curve object");
            PlotCurve(aCurve, VISU::eErase );
            continue;
          }
          // is it Container ?
-         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
          if(aContainer){
            if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Container object");
            PlotContainer(aContainer, VISU::eErase );
            continue;
          }
          // is it Table ?
-         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+         VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
          if(aTable){
            if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Table object");
            PlotTable(aTable, VISU::eErase );
@@ -1173,6 +1121,7 @@ void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
   QApplication::setOverrideCursor(Qt::waitCursor);
   try{
     thePrs->Update();
+    //UpdateViewer(thePrs); Avoid unnessary settings of visibility on for thePrs
     for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
       if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
        QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
@@ -1181,9 +1130,22 @@ void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
            thePrs->UpdateActor(anActor);
       }
   }catch(std::runtime_error& ex){
+    QApplication::restoreOverrideCursor();
+    INFOS(ex.what());
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
                            tr ("ERR_CANT_BUILD_PRESENTATION"), 
-                           tr ("VISU_BUT_OK") ); 
+                           tr ("VISU_BUT_OK") );
+    for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
+      if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
+       QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
+       if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)) {
+         if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)) {
+           aViewFrame->RemoveActor(anActor);
+           anActor->Delete();
+         }
+       }
+      }
+    return;
   }
   QApplication::restoreOverrideCursor();
 }
@@ -1200,13 +1162,14 @@ void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
        DlgName* aDlg = new DlgName(); \
         aDlg->initFromPrsObject(aPrsObject); \
        if ( aDlg->exec() )  { \
-         aDlg->storeToPrsObject(aPrsObject); \
+         if(!(aDlg->storeToPrsObject(aPrsObject))){ \
+           delete aDlg; \
+            return; \
+          } \
          RecreateActor(aPrsObject); \
-         /*RepaintCurrentView();*/ \
          if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) { \
            if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { \
                  vf->getRenderer()->ResetCameraClippingRange(); \
-                vf->onViewFitAll(); \
                 vf->Repaint(); \
              }\
          } \
@@ -1225,17 +1188,96 @@ void VisuGUI::EditPrs() {
   case VISU::TSCALARMAP: // ScalarMap 18
     EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
     break;
-
+    
   case VISU::TDEFORMEDSHAPE: // Deformed Shape 28
     EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
     break;
-
+    
   case VISU::TCUTPLANES: // Cut planes 42
-    EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
+    //EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
+    {
+      VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
+      if (aPrsObject) {
+       VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false);
+        aDlg->initFromPrsObject(aPrsObject);
+       aDlg->show();
+       myActiveDialogBox = aDlg;      
+//     if ( aDlg->exec() )  {
+//       if(!(aDlg->storeToPrsObject(aPrsObject))){
+//         delete aDlg;
+//             return;
+//           }
+//       RecreateActor(aPrsObject);
+//       if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
+//         if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+//                  vf->getRenderer()->ResetCameraClippingRange();
+//              vf->Repaint();
+//           }
+//       }
+//     }
+//     delete aDlg;
+      }
+    }
     break;
 
   case VISU::TCUTLINES: // Cut planes 42
-    EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
+    //EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
+    {
+      VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d); 
+      if (aPrsObject) { 
+       VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(false); 
+        aDlg->initFromPrsObject(aPrsObject); 
+       aDlg->show();
+       myActiveDialogBox = aDlg;
+//     if ( aDlg->exec() )  { 
+//       aDlg->storeToPrsObject(aPrsObject); 
+//       RecreateActor(aPrsObject); 
+//       if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) { 
+//         if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { 
+//           vf->getRenderer()->ResetCameraClippingRange(); 
+//           vf->Repaint(); 
+//         }
+//       }
+//       // Remove old Table
+//       SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+//       SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(aPrsObject->GetEntry());
+//       if(!aSObject->_is_nil()) {
+//         SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+//         SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+//         for ( ;aIter->More(); aIter->Next()) {
+//           SALOMEDS::SObject_var aTblObj = aIter->Value();
+//           if (!aTblObj->_is_nil()) {
+//             SALOMEDS::GenericAttribute_var anAttr;
+//             if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+//               aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
+//               break;
+//             }
+//           }
+//         }
+//         if (aDlg->isGenerateTable()) {
+//           GetVisuGen()->CreateTable(aSObject->GetID());
+//           if (aDlg->isGenerateCurves()) {
+//             SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+//             SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+//             SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+//             for ( ;aIter->More(); aIter->Next()) {
+//               SALOMEDS::SObject_var aTblObj = aIter->Value();
+//               if (!aTblObj->_is_nil()) {
+//                 SALOMEDS::GenericAttribute_var anAttr;
+//                 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+//                   CreatePlot(aTblObj);
+//                 }
+//               }
+
+//             }
+//           }
+//         }
+//         GetActiveStudy()->updateObjBrowser();
+//       }
+//     } 
+//     delete aDlg; 
+      } 
+    } 
     break;
 
   case VISU::TISOSURFACE: // Iso surfaces
@@ -1247,6 +1289,7 @@ void VisuGUI::EditPrs() {
 
   case VISU::TSTREAMLINES:
     EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
+    break;
   default: 
     return;        
   }
@@ -1259,40 +1302,6 @@ void VisuGUI::EditPrs() {
 }
 
 
-//=====================================================================================
-// function : EditScalarBar()
-// purpose  :
-//=====================================================================================
-void VisuGUI::EditScalarBar() {
-  VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
-  VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
-  if (aPrsObject) {
-    VisuGUI_ScalarBarDlg* aDlg = new VisuGUI_ScalarBarDlg(false);
-    aDlg->initFromPrsObject(aPrsObject);
-    if ( aDlg->exec() )  {
-      aDlg->storeToPrsObject(aPrsObject);
-      RecreateActor(aPrsObject);
-      
-      VTKViewer_ViewFrame* vf = GetVtkViewFrame();
-      if (vf)
-       {
-         vf->Repaint();
-         
-         Handle(SALOME_InteractiveObject) anIO;
-         CORBA::Object_var anObject = GetSelectedObj(&anIO);
-         if ( !CORBA::is_nil( anObject ) ) 
-           vf->highlight(anIO, 1);
-       }
-      
-      if (aDlg->isToSave())
-       aDlg->storeToResources();
-    }
-    delete aDlg;
-  }
-  
-}
-
-
 //=====================================================================================
 // function : CreateMesh()
 // purpose  :
@@ -1338,7 +1347,7 @@ void VisuGUI::CreateMesh() {
   Utils_Timer timer;
   timer.Start();
 #endif
-  VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));
+  VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
   if(aComment == "ENTITY"){
     VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
     if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
@@ -1362,7 +1371,7 @@ void VisuGUI::CreateMesh() {
   QApplication::restoreOverrideCursor();
   VISU::Mesh_i* pPresent = NULL;
   if(!CORBA::is_nil(aMesh)) 
-    pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
+    pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
   if (pPresent == NULL) {
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
                            tr ("ERR_CANT_BUILD_PRESENTATION"), 
@@ -1387,6 +1396,7 @@ void VisuGUI::CreateMesh() {
       //GetActiveStudy()->updateObjBrowser(); //not necessary
       GetDesktop()->putInfo("Ready");
     }catch(std::runtime_error& exc){
+      INFOS(exc.what());
       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
                              tr ("ERR_CANT_CREATE_ACTOR"), 
                              tr ("VISU_BUT_OK") ); 
@@ -1444,7 +1454,7 @@ void VisuGUI::CreateManyMesh(){
     QApplication::restoreOverrideCursor();
     if(CORBA::is_nil(aMesh)) return;
     
-    VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
+    VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
     try{
       VISU_Actor *anActor = pPresent->CreateActor();
       if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
@@ -1453,6 +1463,7 @@ void VisuGUI::CreateManyMesh(){
       }
       GetDesktop()->putInfo("Ready");
     }catch(std::runtime_error& exc){
+      INFOS(exc.what());
     }
   }
 }
@@ -1522,9 +1533,9 @@ void VisuGUI::MakeShrink() {
 VISU::Prs3d_i* VisuGUI::GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO) {
   CORBA::Object_var anObject = GetSelectedObj(theIO);
   if(CORBA::is_nil(anObject)) return NULL;
-  PortableServer::Servant aServant = VISU::GetServant(anObject);
-  if(!aServant) return NULL;
-  return dynamic_cast<VISU::Prs3d_i*>(aServant);
+  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+  if(!aServant.in()) return NULL;
+  return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
 }
 
 void VisuGUI::ChageColor() {
@@ -1580,7 +1591,7 @@ void VisuGUI::PlotTable( VISU::Table_i* table, int theDisplaying )
        if( !CORBA::is_nil( childObject ) ) {
          CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
          if( !CORBA::is_nil( aCurve ) ) {
-           VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
+           VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
            Plot2d_Curve* plotCurve = 0;
            for ( int i = 0; i < clist.count(); i++ ) {
              if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
@@ -1766,7 +1777,7 @@ void VisuGUI::ShowTable() {
     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 ) );
+       VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
        if ( table ) {
          SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
        }
@@ -1789,6 +1800,7 @@ void VisuGUI::ShowTable() {
   dlg->show();
 }
 
+
 /*!
   Slot : opens Table view : for Table object or SObject with table attribute selected
 */
@@ -1807,7 +1819,7 @@ void VisuGUI::CreateTable() {
       SALOMEDS::GenericAttribute_var anAttr;
       if(!aCutLines->_is_nil() ||
         aSObject->FindAttribute( anAttr, "AttributeTableOfInteger") ||
-        aSObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ){
+        aSObject->FindAttribute( anAttr, "AttributeTableOfReal" ){
        GetVisuGen()->CreateTable(aSObject->GetID());
        GetActiveStudy()->updateObjBrowser();
       }
@@ -1815,6 +1827,65 @@ void VisuGUI::CreateTable() {
   }
 }
 
+
+/*!
+  Slot : deletes SObject with all subobjects
+*/
+void VisuGUI::DeleteObject() {
+  SALOMEDS::Study_var aStudy = GetStudyDocument();
+  if (checkLock(aStudy)) return;
+
+  SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
+  if( aSel->IObjectCount() !=1 )
+    return;
+  Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
+  if (anIO->hasEntry()){
+    SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+    if(!aSObject->_is_nil()){
+      SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
+      // There is a transaction
+      aStudyBuilder->NewCommand();
+      CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
+      if(!CORBA::is_nil(anObj)){
+       VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+       if(!CORBA::is_nil(aBase)){
+         VISU::VISUType aType = aBase->GetType();
+         switch (aType){
+         case VISU::TRESULT:{
+           SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+           for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
+             SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+             CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+             if(CORBA::is_nil(aChildObj)) continue;
+             VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
+             if(CORBA::is_nil(aPrs3d)) continue;
+             VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
+             DeletePresentation(pPrs3d);
+           }
+           break;
+         }}
+       }
+      }
+      aStudyBuilder->RemoveObjectWithChildren(aSObject);
+      aStudyBuilder->CommitCommand();
+      GetActiveStudy()->unHighlightAll();
+      GetActiveStudy()->updateObjBrowser(true);
+    }
+  }
+}
+
+
+/*!
+  Slot : deletes empty container
+*/
+void VisuGUI::CreatePlot2dView() {
+  if (checkLock(GetStudyDocument())) return;
+  GetVisuGen()->CreateContainer();
+  GetActiveStudy()->updateObjBrowser( true );
+}
+
+
+
 /*!
   Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
 */
@@ -1830,7 +1901,7 @@ void VisuGUI::PlotData() {
       // 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 ) );
+       VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
        if ( table ) {
          SALOMEDS::GenericAttribute_var anAttr;
          SALOMEDS::AttributeName_var    aName;
@@ -1854,12 +1925,12 @@ void VisuGUI::PlotData() {
                if ( horIndex >= 0 && verIndices.count() > 0 ) { 
                  CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
                  if( !CORBA::is_nil( aContainer ) ) {
-                   VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( 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()->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
                        if( !CORBA::is_nil( aNewCurve ) ) {
-                         VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aNewCurve ) );
+                         VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
                          if ( pCrv ) {
                            bool isAuto;
                            int  marker, line, lineWidth;
@@ -1906,8 +1977,9 @@ void VisuGUI::PlotData() {
       
     // check if Table SObject is selected
     SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
-    if ( !SO->_is_nil() && ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
-                            SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
+    if ( !SO->_is_nil() && 
+        ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
+          SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
       // get name of SObject
       if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
        aName = SALOMEDS::AttributeName::_narrow( anAttr );
@@ -1925,14 +1997,14 @@ void VisuGUI::PlotData() {
            CORBA::Object_var aTable = GetVisuGen()->CreateTable( SO->GetID() );
            CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
            if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
-             VISU::Table_i*     pTable     = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
-             VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( 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()->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
                  if( !CORBA::is_nil( aNewCurve ) ) {
-                   VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aNewCurve ) );
+                   VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
                    if ( pCrv ) {
                      bool isAuto;
                      int  marker, line, lineWidth;
@@ -1952,8 +2024,7 @@ void VisuGUI::PlotData() {
              }
            }
          }
-       }
-        else {
+       } else {
          // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
          if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
            Plot2d_CurveContainer container;
@@ -1968,9 +2039,42 @@ void VisuGUI::PlotData() {
        }
       }
       delete dlg;
+    } 
+  }
+}
+
+
+void VisuGUI::CreatePlot(SALOMEDS::SObject_var theTableSO) {
+  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::AttributeName_var    aName;
+
+  if ( !theTableSO->_is_nil() && 
+       ( theTableSO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
+        theTableSO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
+    CORBA::Object_var aTable = VISU::SObjectToObject(theTableSO);
+    CORBA::Object_var aContainer = GetVisuGen()->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 = 2; i <= pTable->GetNbRows(); i++ ) {
+         CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), 1, i );
+         if( !CORBA::is_nil( aNewCurve ) ) {
+           VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aNewCurve).in() );
+           if ( pCrv ) {
+             pContainer->AddCurve( pCrv->_this() );
+           }
+         }
+       }
+       GetActiveStudy()->updateObjBrowser( true );
+       PlotContainer( pContainer, VISU::eDisplay );
+      }
     }
   }
 }
+
+
 /*!
   Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
 */
@@ -1987,7 +2091,7 @@ void VisuGUI::CurveProperties() {
     // 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 ) );
+      VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
       if ( curve && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
        SALOMEGUI_SetupCurveDlg* dlg = new SALOMEGUI_SetupCurveDlg( QAD_Application::getDesktop() );    
        dlg->setLine( (int)curve->GetLine(), curve->GetLineWidth() );
@@ -2045,7 +2149,7 @@ void VisuGUI::ClearContainer() {
     // 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 ) );
+      VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
       if ( container && container->GetNbCurves() > 0 && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
        container->Clear();
        GetActiveStudy()->updateObjBrowser();
@@ -2054,9 +2158,38 @@ void VisuGUI::ClearContainer() {
   }
 }
 
+/*!
+  Slot : Edit container contents : for Container object selected
+*/
+void VisuGUI::EditContainer() {
+  CORBA::Object_var anObject = GetSelectedObj();
+  if(CORBA::is_nil(anObject)) 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;
+  
+  VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg();
+  aDlg->initFromPrsObject(aContainer);
+  if (aDlg->exec()) {
+    aDlg->storeToPrsObject(aContainer);
+    GetActiveStudy()->updateObjBrowser( true );
+  }
+  delete aDlg;
+}
+
 
 void VisuGUI::DeletePrs() {
+  SALOMEDS::Study_var aStudy = GetStudyDocument();
+  if (checkLock(aStudy)) return;
+  
+  // There is a transaction
+  SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
+  aStudyBuilder->NewCommand();
+
   DeletePresentation(GetSelectedPrs3d());
+
+  aStudyBuilder->CommitCommand();
 }
 
 
@@ -2267,7 +2400,7 @@ void VisuGUI::Rename() {
       // Curve object
       CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
       if( !CORBA::is_nil( aCurve ) ) {
-       curve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
+       curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
       }
     }
   }
@@ -2312,7 +2445,7 @@ void VisuGUI::RenameTable() {
       // Table object
       CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
       if( !CORBA::is_nil( aTable ) ) {
-       table = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+       table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
       }
     }
   }
@@ -2359,7 +2492,7 @@ void VisuGUI::RenameContainer() {
       // Curve object
       CORBA::Object_ptr aContainer = VISU::Container::_narrow( anObject );
       if( !CORBA::is_nil( aContainer ) ) {
-       container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ) );
+       container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
       }
     }
   }
@@ -2463,99 +2596,7 @@ void VisuGUI::CopyPresentation(){
   GetActiveStudy()->updateObjBrowser();
 }
 
-//=====================================================================================
-// function : InfoOnPoint() [ slot ] 
-// purpose  :
-//=====================================================================================
-void VisuGUI::InfoOnPoint(){
-  GetInfo(SelectionPoint,&(VisuGUI_Selection::PickingPoint));
-}
-
-//=====================================================================================
-// function : InfoOnCell() [ slot ] 
-// purpose  :
-//=====================================================================================
-void VisuGUI::InfoOnCell(){
-  GetInfo(SelectionCell,&(VisuGUI_Selection::PickingCell));
-}
-
-void VisuGUI::GetInfo(int theSelectionMode, TGetInfoFun theGetInfoFun){
-  SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
-  if ( aSel->SelectionMode() == theSelectionMode ){
-    Handle(SALOME_InteractiveObject) anIO;
-    if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
-      TColStd_MapOfInteger aMapIndex;
-      aSel->GetIndex(anIO,aMapIndex);
-      TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
-      if(anIter.More()){
-       vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput();
-       (*theGetInfoFun)(GetActiveStudy(), aDataSet, anIter.Key());
-       return;
-      }
-    }
-    QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
-                         tr ("VISU_WARNING"),
-                         tr ("WRN_NO_AVAILABLE_DATA"),
-                         tr ("VISU_BUT_OK"));
-  }else
-    QAD_MessageBox::warn1( GetDesktop(), 
-                          tr ("WARNING"),
-                          tr ("ERR_WRONG_SELECTION_MODE"),
-                          tr ("VISU_BUT_OK") );
-}
-
-//=====================================================================================
-// function : SelectPoint() [ slot ] 
-// purpose  :
-//=====================================================================================
-void VisuGUI::SelectPoint(){
-  Select(SelectionPoint,&vtkDataSet::GetNumberOfPoints,"Point selection","Point number:");
-}
-
-//=====================================================================================
-// function : SelectCell() [ slot ] 
-// purpose  :
-//=====================================================================================
-void VisuGUI::SelectCell(){
-  Select(SelectionCell,&vtkDataSet::GetNumberOfCells,"Cell selection","Cell number:");
-}
 
-void VisuGUI::Select(int theSelectionMode, TSelectFun theSelectFun, 
-                    const char* theTitle, const char* theRequest)
-{
-  SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
-  if(aSel->SelectionMode() == theSelectionMode){
-    Handle(SALOME_InteractiveObject) anIO;
-    if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
-      bool ok = FALSE;
-      int anIndex = 0;
-      TColStd_MapOfInteger aMapIndex;
-      aSel->GetIndex(anIO,aMapIndex);
-      TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
-      if(anIter.More()) anIndex = anIter.Key();
-      int anId = SALOMEGUI_SetValueDlg::getInteger( tr(theTitle),
-                                                   tr(theRequest), 
-                                                   anIndex,
-                                                   &ok, 
-                                                   GetDesktop());
-      if(!ok) return;
-      vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput();
-      int aMaxId = (aDataSet->*theSelectFun)();
-      if(0 <= anId && anId < aMaxId){
-       VisuGUI_Selection::Highlight( GetActiveStudy(), anIO, anId );
-       return;
-      }
-    }
-    QAD_MessageBox::warn1(QAD_Application::getDesktop(), 
-                         tr ("VISU_WARNING"),
-                         tr ("WRN_NO_AVAILABLE_DATA"),
-                         tr ("VISU_BUT_OK"));
-  }else
-    QAD_MessageBox::warn1( GetDesktop(), 
-                          tr ("WARNING"),
-                          tr ("ERR_WRONG_SELECTION_MODE"),
-                          tr ("VISU_BUT_OK") );
-}
 
 //=====================================================================================
 // function : DefinePopup()
@@ -2681,6 +2722,8 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
   int isViewer = (theParent.compare("ObjectBrowser") != 0), initId = isViewer? 800: 900;
   QAD_ResourceMgr* rmgr = parent->createResourceManager();
 
+  bool aIsLocked = isStudyLocked( GetActiveStudy()->getStudyDocument() );
+  
   bool isVTKViewer = (GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK);
   thePopup->clear();
   SALOME_Selection* aSelection = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
@@ -2707,7 +2750,7 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
       }
     }
     else if ( selMode == homoPresentable ) {
-      thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));    
+      if (!aIsLocked) thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));    
     }
     else if ( selMode == homoAnimatable ) {
       thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
@@ -2725,30 +2768,33 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
       if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup - VISU object :: "<<aType);
       switch (aType) {
       case VISU::TVISUGEN:
-       thePopup->insertItem("Import From File", visuGUI, SLOT(ImportFromFile()));
+       thePopup->insertItem("Import MED", visuGUI, SLOT(ImportFile()));
+       thePopup->insertItem("Import TABLE", visuGUI, SLOT(ImportTablesFromFile()));
+       thePopup->insertItem("Create Plot2d View", visuGUI, SLOT(CreatePlot2dView()));
        break;
 
       case VISU::TRESULT:
-       //thePopup->insertItem("Create Mesh", visuGUI, SLOT(CreateMesh()));    
-       //thePopup->insertItem("Export To File", visuGUI, SLOT(ExportToFile()));    
-       //thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+       if (!aIsLocked) thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
        break;
        
       case VISU::TTABLE:
-       thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
+       if (!aIsLocked) thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
        thePopup->insertItem( "Show Table",    visuGUI, SLOT( ShowTable() ) );
-       thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
+       if (!aIsLocked) thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
+       thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
+       thePopup->insertSeparator();
        if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
          if ( GetNbChildren( aSObject, false ) > 0 ) {
-           thePopup->insertItem( "Display",      visuGUI, SLOT( DisplayPrs() ) );
            thePopup->insertItem( "Erase",        visuGUI, SLOT( ErasePrs () ) );
+           thePopup->insertItem( "Display",      visuGUI, SLOT( DisplayPrs() ) );
            thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
          }
        }
+       thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
        break;
  
       case VISU::TCURVE:
-       if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
+       if ( !aIsLocked ) {
          thePopup->insertItem( "Properties", visuGUI, SLOT( CurveProperties() ) );
          thePopup->insertItem( "Rename...", visuGUI, SLOT(Rename()));
        }
@@ -2762,28 +2808,43 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
        break;
 
       case VISU::TCONTAINER:
-       if( !CORBA::is_nil( anObject ) ) {
-         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 ) );
-           if ( container && container->GetNbCurves() > 0 ) {
-             if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
-               thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
-               thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
-             }
-             if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
-               thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
-               thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
-               thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
-             }
-           }
-         }
+//     if( !CORBA::is_nil( anObject ) ) {
+//       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 ) {
+//           if ( !aIsLocked ) {
+//             thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
+//             thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
+//             if (container->GetNbCurves() > 0)
+//               thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
+//           }
+//           if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
+//             thePopup->insertSeparator();
+//             thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
+//             thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
+//             thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
+//           }
+//         }
+//       }
+//     }
+       if ( !aIsLocked ) {
+         thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
+         thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
+         thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
        }
+       if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
+         thePopup->insertSeparator();
+         thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
+         thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
+         thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
+       }
+       if ( !aIsLocked ) thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
        break;
 
       default: // Presentation
        {
-         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+         VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
          if (aPrsObject) {
            if (isVTKViewer) {
              // Add Presentation menu
@@ -2858,15 +2919,28 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
                thePopup->insertSeparator();
              }
            }
-           thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
+           if ( !aIsLocked ) thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
            if (aType != VISU::TMESH) {
-             if (aType != VISU::TSCALARMAP)
-               thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
-             thePopup->insertItem("Edit Scalar Bar...", visuGUI, SLOT(EditScalarBar()));
+             //if (aType != VISU::TSCALARMAP)
+             if ( !aIsLocked ) thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
              
-             if (aType == VISU::TCUTLINES)
-               thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) ); 
-
+             if (aType == VISU::TCUTLINES) {
+               // Check: Does it has living children (tables)
+               SALOMEDS::ChildIterator_var aIter = 
+                 GetActiveStudy()->getStudyDocument()->NewChildIterator( aSObject );
+               bool isPresent = false;
+               for ( ;aIter->More(); aIter->Next()) {
+                 SALOMEDS::SObject_var aTblObj = aIter->Value();
+                 isPresent = !aTblObj->_is_nil();
+                 if (isPresent) {
+                   SALOMEDS::GenericAttribute_var    anAttr;
+                   isPresent = aTblObj->FindAttribute(anAttr, "AttributeName");
+                   if (isPresent) break; // We have at least a one child
+                 }
+               }
+               if ((!isPresent) && (!aIsLocked) )
+                 thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
+             }
              thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
              
            }
@@ -2875,19 +2949,8 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
                   ( aType == VISU::TMESH      || 
                     aType == VISU::TSCALARMAP || 
                     aType == VISU::TDEFORMEDSHAPE ) ) {
-               thePopup->insertSeparator();
-               TColStd_MapOfInteger aMapIndex;
-               aSelection->GetIndex(anIO,aMapIndex);
-               if ( aSelection->SelectionMode() == SelectionPoint ) {
-                 if(aMapIndex.Extent() == 1) 
-                   thePopup->insertItem("Results at Point", visuGUI, SLOT(InfoOnPoint()));
-                 thePopup->insertItem("Select a Point",   visuGUI, SLOT(SelectPoint()));
-               }
-               else if ( aSelection->SelectionMode() == SelectionCell) {
-                 if(aMapIndex.Extent() == 1) 
-                   thePopup->insertItem("Results on Cell", visuGUI, SLOT(InfoOnCell()));
-                 thePopup->insertItem("Select a Cell",  visuGUI, SLOT(SelectCell()));
-               }
+               thePopup->insertSeparator();
+               thePopup->insertItem("Selection info...",   visuGUI, SLOT(SelectionInfo()));
              }
              thePopup->insertSeparator();
              
@@ -2899,8 +2962,8 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
              
              thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
            }
-           if (aType != VISU::TMESH) {
-             thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+           thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+           if ((aType != VISU::TMESH) && (!aIsLocked)) {
              thePopup->insertSeparator();
              thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
            }
@@ -2930,16 +2993,18 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
        case VISU::TENTITY:
        case VISU::TFAMILY:
        case VISU::TGROUP: 
-         thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));    
+         if ( !aIsLocked )thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));    
          break;
        case VISU::TVIEW3D: 
-         if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { 
-           // Available only for VTK viewer
-           thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
-           thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
+         if ( !aIsLocked ) {
+           if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { 
+             // Available only for VTK viewer
+             thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
+             thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
+           }
+           thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
+           thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
          }
-         thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
-         thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
          break;
        case VISU::TFIELD:
          if ((getValue(aSObject, "myNbTimeStamps").toLong() > 1) && isVTKViewer)
@@ -2973,11 +3038,14 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
           aSObject->FindAttribute( anAttr, "AttributeTableOfReal" )){
          thePopup->insertItem( "Show Table",    visuGUI, SLOT(ShowTable()));
          thePopup->insertItem( "Create Curves", visuGUI, SLOT(PlotData()));
+         thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
          return false;
        }
        aSObject = aSObject->GetFather();
+       if(aSObject->_is_nil()) return false;
        aSObject->FindAttribute(anAttr, "AttributeName");
        SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+       if(aName->_is_nil()) return false;
        CORBA::String_var aValue = aName->Value();
        //if(strcmp(aValue.in(),"MEDMESH") == 0)
        //  thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
@@ -3017,7 +3085,7 @@ void VisuGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
   
   CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
   if(!CORBA::is_nil(anObject)) {
-    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+    VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
     if ( !aPrsObject ) {
       if(MYDEBUG) MESSAGE("The object is not VISU::Prs3d_i");
       return;
@@ -3029,6 +3097,7 @@ void VisuGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
        if(VTKViewer_ViewFrame* vf = GetVtkViewFrame())
          vf->AddActor(SelectedActor);
       }catch(std::runtime_error& exc){
+       INFOS(exc.what());
       }
   }else
     if(MYDEBUG) MESSAGE("CORBA::is_nil(anObject) = true");
@@ -3340,7 +3409,7 @@ VISU::Result_i* VisuGUI::CreatePresent(SALOMEDS::SObject_var theField, VISU::Res
   CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
   if(CORBA::is_nil(anObject)) return NULL;
   theResult = VISU::Result::_narrow(anObject);
-  VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
+  VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
   if(pResult == NULL)
     QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                          tr ("WRN_NO_AVAILABLE_DATA"),
@@ -3355,14 +3424,12 @@ PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
   VISU::Result_var aResult; \
   VISU::Result_i* pResult = CreatePresent(theField,aResult); \
   if(pResult != NULL){ \
-    if(PRSTYPE::IsPossible(pResult,theMeshName,(VISU::Entity)theEntity,theFieldName,theTimeId)){ \
-      QApplication::setOverrideCursor( Qt::waitCursor ); \
-      CORBA::Object_var anObject =  \
-       GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
-      QApplication::restoreOverrideCursor(); \
-      if(!CORBA::is_nil(anObject))  \
-         return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject)); \
-    } \
+    QApplication::setOverrideCursor( Qt::waitCursor ); \
+    CORBA::Object_var anObject =  \
+      GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
+    QApplication::restoreOverrideCursor(); \
+    if(!CORBA::is_nil(anObject))  \
+      return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject).in()); \
   } \
   QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
                          tr ("ERR_CANT_BUILD_PRESENTATION"), \
@@ -3402,14 +3469,13 @@ bool FNAME(SALOMEDS::SObject_var theField) { \
     if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){ \
       DLGNAME* aDlg = new DLGNAME(); \
       aDlg->initFromPrsObject(pPresent); \
-      if (aDlg->exec()) { \
-        aDlg->storeToPrsObject(pPresent); \
+      if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) { \
+        delete aDlg; \
       } else { \
         DeletePresentation(pPresent); \
         delete aDlg; \
         return false; \
       } \
-      delete aDlg; \
     } \
     CreateActor(pPresent); \
     return true; \
@@ -3421,16 +3487,122 @@ BUILDPRS(VISU::ScalarMap_i, CreateScalarMapPrs, VisuGUI::CreateScalarMap, VisuGU
 BUILDPRS(VISU::DeformedShape_i, CreateDeformedShapePrs, VisuGUI::CreateDeformedShape, VisuGUI_MagnitudeDlg);
 BUILDPRS(VISU::Vectors_i, CreateVectorsPrs, VisuGUI::CreateVectors, VisuGUI_VectorsDlg);
 BUILDPRS(VISU::IsoSurfaces_i, CreateIsoSurfacesPrs, VisuGUI::CreateIsoSurfaces, VisuGUI_IsoSurfacesDlg);
-BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
-BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
+//BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
+//BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
 BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines, VisuGUI_StreamLinesDlg);
 
 
+bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) { 
+  VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); 
+  bool isExist; 
+  QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); 
+  if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false; 
+  QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); 
+  QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
+  QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); 
+  QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+  Utils_Timer timer;
+  if(MYCHECKTIME) timer.Start();
+  VISU::CutPlanes_i* pPresent = 
+    CreateCutPlanesPrs(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt());
+  if(MYCHECKTIME) {
+    timer.Stop();
+    cout<<"BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT\n";
+    timer.Show();
+  }
+  if (pPresent) {
+    QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
+    if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
+      VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(true, false);
+      aDlg->initFromPrsObject(pPresent);
+      aDlg->show();
+      myActiveDialogBox = aDlg;      
+//       if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) {
+//         delete aDlg;
+//       } else {
+//         DeletePresentation(pPresent);
+//         delete aDlg;
+//         return false;
+//       }
+//     }
+//     CreateActor(pPresent);
+      return true;
+    }
+  }
+  return false;
+}
+
+bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) { 
+  VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); 
+  bool isExist; 
+  QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); 
+  if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false; 
+  QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); 
+  QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); 
+  QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); 
+  QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); 
+  Utils_Timer timer; 
+  if(MYCHECKTIME) timer.Start(); 
+  VISU::CutLines_i* pPresent = CreateCutLinesPrs(theField,aMeshName,
+                                    (VISU::Entity)anEntity.toInt(),
+                                    aFieldName,aTimeStampId.toInt()); 
+  if(MYCHECKTIME) { 
+    timer.Stop(); 
+    cout<<"BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg) - CREATE PRSOBJECT\n"; 
+    timer.Show(); 
+  } 
+  if (pPresent) { 
+    QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d"); 
+    if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){ 
+      VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(true); 
+      aDlg->initFromPrsObject(pPresent); 
+      aDlg->show();
+      myActiveDialogBox = aDlg;
+      return true;
+//       if (aDlg->exec()) { 
+//         aDlg->storeToPrsObject(pPresent);
+//     if (aDlg->isGenerateTable()) {
+//       GetVisuGen()->CreateTable(pPresent->GetEntry());
+//       if (aDlg->isGenerateCurves()) {
+//         SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+//         SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(pPresent->GetEntry());
+//         if(!aSObject->_is_nil()) {
+//           SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+//           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+//           for ( ;aIter->More(); aIter->Next()) {
+//             SALOMEDS::SObject_var aTblObj = aIter->Value();
+//             if (!aTblObj->_is_nil()) {
+//               SALOMEDS::GenericAttribute_var anAttr;
+//               if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+//                 CreatePlot(aTblObj);
+//               }
+//             }
+//           }
+//         }
+//       }
+//       GetActiveStudy()->updateObjBrowser();  
+//     }
+//       } else { 
+//         DeletePresentation(pPresent); 
+//         delete aDlg; 
+//         return false; 
+//       } 
+//       delete aDlg; 
+//     } 
+//     CreateActor(pPresent); 
+//     return true; 
+    } 
+  }
+  return false; 
+}
+
+
 
 /* ======================================================================================== */
 /* Global Method to import tables from file */
 /* ======================================================================================== */
 void VisuGUI::ImportTablesFromFile(){
+  if (checkLock(GetActiveStudy()->getStudyDocument())) return;
   QStringList flt;
   flt.append( "Files (*.xls *.txt *.tab)" );
   flt.append( "All Files (*.*)" );
@@ -3470,12 +3642,85 @@ void VisuGUI::ImportTablesFromFile(){
     }
     GetActiveStudy()->updateObjBrowser(); //update Object browser
   }
-}
+} 
+
+void VisuGUI::ExportTableToFile() 
+{
+  QAD_Study *aQADStudy = VisuGUI::GetActiveStudy();
+  SALOME_Selection* aSel = SALOME_Selection::Selection (  aQADStudy -> getSelection() );
+
+  if( aSel->IObjectCount() > 0 ) {
+    const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
+    if(anIO->hasEntry()){
+      SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
+      SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID(anIO->getEntry());
+      if(CORBA::is_nil(aSObj))  return; 
+
+      QString aTitle;
+      SALOMEDS::GenericAttribute_var anAttr;
 
+      if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") && 
+         !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+       aSObj = aSObj->GetFather(); //if the current SObject is a table title
+                                   // we take a father contaning the table 
+       if (!CORBA::is_nil(aSObj)) {
+         if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") && 
+             !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger"))
+           return;
+       }
+       else return;
+      }
+      if (CORBA::is_nil(anAttr)) return;
+
+      SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+      if (!CORBA::is_nil(aTabAttr)) 
+       aTitle  = aTabAttr->GetTitle(); //get table title in order to have default name of the file 
+      else {
+       SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
+       if (!CORBA::is_nil(aTabAttr))
+         aTitle  = aTabAttr->GetTitle(); //get table title in order to have default name of the file 
+       else return;
+      }
+      aTitle.simplifyWhiteSpace();
+      QStringList flt;
+      flt.append("Table Files (*.xls)");
+      
+      QAD_FileDlg *aDlg = new QAD_FileDlg(QAD_Application::getDesktop(), false, true, true);
+      aDlg -> setCaption("Export Table To File");
+      aDlg -> setDir( getVisuOutputDir() );
+      aDlg -> setFilters(flt);
+      aDlg -> setSelection(aTitle.replace(QRegExp(" "), "_"));
+      aDlg -> exec();
+      QString aFile = aDlg -> selectedFile();
+      delete aDlg;
+
+      if(!aFile.isEmpty()){
+       QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
+       QString aDir = QAD_Tools::getDirFromPath(aFile);
+       QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
+       
+       try {
+         GetVisuGen() -> ExportTableToFile(aSObj, aFile.latin1());
+         QAD_Application::getDesktop()->putInfo(aFile+" exported.");
+       } catch(...) {
+         QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                                tr ("ERR_ERROR_DURING_EXPORT"),
+                                tr ("VISU_BUT_OK") );
+       } 
+      } 
+    }
+  }
+}
 /* ======================================================================================== */
 /* Global Method to import mesh results in MED and DAT format                               */
 /* ======================================================================================== */
-void VisuGUI::ImportFromFile(){
+void VisuGUI::ImportFile(){
+  VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::ImportFile);
+}
+void VisuGUI::CopyAndImportFile(){
+  VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::CopyAndImportFile);
+}
+void VisuGUI::ImportFromFile(TImportFun theImportFun){
   if (checkLock(GetActiveStudy()->getStudyDocument())) return;
   QStringList flt;
   //flt.append( "Exportable Files (*.med *.dat)" );
@@ -3500,20 +3745,24 @@ void VisuGUI::ImportFromFile(){
     if(aFileInfo.extension(false) == "med"){
       QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
       bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
-      
-      if (VisuGUI_FileDlg::IsBuild)
-       {
-         aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
-         if(!CORBA::is_nil(aResult.in())) aResult->BuildAll();  
-       }
-      else
-       {
-         QAD_CONFIG->addSetting( "Visu:BuildResult", false );
-         aResult=GetVisuGen()->ImportFile( aFileInfo.filePath() );
-         QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
-       }
+      if (VisuGUI_FileDlg::IsBuild){
+       aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
+       if(!CORBA::is_nil(aResult.in())) 
+         if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
+           if(!pResult->IsPossible())
+             QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                                     tr ("ERR_CANT_BUILD_PRESENTATION"),
+                                     tr ("VISU_BUT_OK") );
+           else
+             aResult->BuildAll();  
+         }
+      }else{
+       QAD_CONFIG->addSetting( "Visu:BuildResult", false );
+       //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
+       aResult=GetVisuGen()->ImportFile(aFileInfo.filePath());     // APO: 18/12/03 - fix crash on Linux RedHat 7.1
+       QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
+      }
     }
-    
 #ifdef CHECKTIME
     timer.Stop();
     cout<<"VisuGUI::ImportFromFile() - IMPORT FILE\n";
@@ -3537,7 +3786,7 @@ void VisuGUI::ImportFromFile(){
 void VisuGUI::ExportToFile(){
   CORBA::Object_var anObject = GetSelectedObj();
   if(CORBA::is_nil(anObject)) return;
-  VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject));
+  VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in());
   if(aBase != NULL && aBase->GetType() == VISU::TRESULT){
     QStringList flt;
     flt.append( "Dat Files (*.dat)" );
@@ -3634,6 +3883,7 @@ VISU_Actor* VisuGUI::UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly){
     anVISUActor = thePrs->CreateActor();
     vf->AddActor(anVISUActor);
   }catch(std::runtime_error& exc){
+    INFOS(exc.what());
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                            tr ("ERR_CANT_VISUALIZE_OBJECT"),
                            tr ("VISU_BUT_OK") );
@@ -3671,13 +3921,15 @@ void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
   for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
     if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
       QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
-      if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
+      if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)){
        if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
          aViewFrame->RemoveActor(anActor);
          anActor->Delete();
        }
+       aViewFrame->unHighlightAll();
+      }
     }
-  thePrs->Destroy();
+  thePrs->RemoveFromStudy(); 
   GetActiveStudy()->updateObjBrowser(); //update Object browser
 }
 
@@ -3685,6 +3937,7 @@ void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
  * Creates new actor of presentation
  */
 void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
+  if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
   if (!thePrs) return;
   QApplication::setOverrideCursor( Qt::waitCursor );
   if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
@@ -3696,6 +3949,7 @@ void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
       VISU_Actor* aActor = thePrs->CreateActor();
       vf->AddActor(aActor);
     }catch(std::runtime_error& exc){
+      INFOS(exc.what());
       QApplication::restoreOverrideCursor();
       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                              tr ("WRN_CANT_VISUALIZE_PRS"),
index 1c97bbb96f97614dfac859d45e980b0b078225b6..ec5677ecfe48815464334e57808846660771b2a8 100644 (file)
@@ -45,6 +45,7 @@ class VTKViewer_ViewFrame;
 class VISU_Actor;
 class VISU_MeshAct;
 class VISU_ScalarMapAct;
+class VisuGUI_SelectionDlg;
 
 #include <vtkDataSet.h>
 class vtkRenderer;
@@ -98,6 +99,9 @@ class VisuGUI : public QObject{
   enum CameraOrient {e3D, eFront, eLeft, eTop};
   static CameraOrient SetFitAll( VTKViewer_ViewFrame* vf);
 
+  typedef VISU::Result_ptr (VISU::VISU_Gen_i::* TImportFun)(const char*);
+  void ImportFromFile(TImportFun theImportFun);
+
   bool CreateScalarMap(SALOMEDS::SObject_var theField);
   static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField, 
                                               const char* theMeshName, VISU::Entity theEntity, 
@@ -127,14 +131,7 @@ class VisuGUI : public QObject{
                                                   const char* theMeshName, VISU::Entity theEntity, 
                                                   const char* theFieldName, int theTimeId);
   bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
-
-  typedef void (*TGetInfoFun)(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
-  void GetInfo(int theSelectionMode, TGetInfoFun theGetInfoFun);
-
-  typedef int (vtkDataSet::* TSelectFun)();
-  void Select(int theSelectionMode, TSelectFun theSelectFun, 
-             const char* theTitle, const char* theRequest);
-  
   static void ShowTrihedron(bool Show);
   static void ChangeViewer(int theType);
             
@@ -156,9 +153,9 @@ class VisuGUI : public QObject{
   static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
   static int checkHomoSelection();
   
-  VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
-  bool IsDisplayed(VISU::Prs3d_i* thePrs);
-  void ErasePrs(VISU::Prs3d_i* thePrs);
+  static VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
+  static bool IsDisplayed(VISU::Prs3d_i* thePrs);
+  static void ErasePrs(VISU::Prs3d_i* thePrs);
   
   static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
   static void RecreateActor(VISU::Prs3d_i* thePrs);
@@ -174,7 +171,9 @@ class VisuGUI : public QObject{
   void         EmitSignalCloseAllDialogs();
   QDialog*     GetActiveDialogBox();
   void         SetActiveDialogBox(QDialog* aDlg);
-  
+
+  void CreatePlot(SALOMEDS::SObject_var theTableSO);
+
 // ----------------------------------------
 // All method of standard EXPORT
 // ----------------------------------------
@@ -200,8 +199,13 @@ class VisuGUI : public QObject{
                                         QAD_StudyFrame* studyFrame);
   public slots:
   void ImportTablesFromFile();
-  void ImportFromFile();
+  void ExportTableToFile();
+
+  void ImportFile();
+  void CopyAndImportFile();
+
   void ExportToFile();
+
   void CreateMesh();
   void CreateScalarMap();
   void CreateDeformedShape();
@@ -211,15 +215,16 @@ class VisuGUI : public QObject{
   void CreateCutLines();
   void CreateStreamLines();
   void CreateManyMesh();
+  void CreatePlot2dView();
   
   void DisplayPrs();
   void DisplayOnlyPrs();
   void ErasePrs();
   void EditPrs();
-  void EditScalarBar();
   void DisplayManyPrs();
   void DisplayOnlyManyPrs();
   void EraseManyPrs();
+  void EditContainer();
   
   void MakeSurfaceframe();
   void MakeInsideframe();
@@ -235,6 +240,7 @@ class VisuGUI : public QObject{
   
   void ShowTable();
   void CreateTable();
+  void DeleteObject();
   void PlotData();
   void CurveProperties();
   void ClearContainer();
@@ -255,15 +261,12 @@ class VisuGUI : public QObject{
   void DeleteViewParams();
   void CopyPresentation();
 
-  void InfoOnPoint();
-  void InfoOnCell();
+  void SelectionInfo();
 
-  void SelectPoint();
-  void SelectCell();
-  
 private :
   QDialog* myActiveDialogBox;
   int myState ;
+  VisuGUI_SelectionDlg* mySelectionDlg;
   
 signals:
   void SignalDeactivateActiveDialog();
index 11b76c9a4d3cc6fbd915f1ea09b62942633cc1fe..b8d69724c6bb96f53e7c033be6359d7f6ab320f0 100644 (file)
 
 #include "VisuGUI_CutLinesDlg.h"
 #include "VISU_CutLines_i.hh"
+#include "VisuGUI.h"
+#include "VISU_PipeLine.hxx"
+#include "VTKViewer_ViewFrame.h"
+#include "VISU_CutLinesPL.hxx"
+#include "VISU_Gen_i.hh"
 
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
 #include <qtabwidget.h>
 #include <qhgroupbox.h>
 
+#include <vtkRenderer.h>
+#include <vtkAppendPolyData.h>
+#include <vtkDataSetMapper.h>
+
 using namespace std;
 
-VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
-    : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+extern VisuGUI *visuGUI;
+
+#include  "QAD_RightFrame.h"
+#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
+
+bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
+bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
+
+VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
+    : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), 
+      myPreviewActor(0),
+      myStudy(QAD_Application::getDesktop()->getActiveStudy())
 {
+  myStudyFrame = myStudy -> getActiveStudyFrame();
   setCaption( "Cut Lines Definition" );
   setSizeGripEnabled( true );
+  myIsCreation = theIsCreation;
   
   QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
   aMainLayout->setSpacing(5);
@@ -78,8 +99,29 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
   myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
   myPosSpn->setValue( 0.5 );  
   aPlaneLayout->addWidget( aPosBox );
+
+  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
+  myPreviewCheck->setChecked(false);
+  aPlaneLayout->addWidget( myPreviewCheck );
+
+  myCreateTable = new QCheckBox(tr("LBL_GENERATE_TABLE"), aPlanePane);
+  myCreateTable->setChecked(MYGenerateTable);
+  aPlaneLayout->addWidget( myCreateTable );
+
+  QHBox* aCheckPane = new QHBox(aPlanePane);
+  QLabel* aLbl = new QLabel("   ", aCheckPane);
+  aCheckPane->setStretchFactor(aLbl, 0);
+  myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
+  aCheckPane->setStretchFactor(aCheckPane, 0);
+  myCurvesCheck->setChecked(MYGenerateCurve);
+  myCurvesCheck->setEnabled(MYGenerateTable);
+  QLabel* aLbl2 = new QLabel("   ", aCheckPane);
+  aCheckPane->setStretchFactor(aLbl2, 1);
+  aPlaneLayout->addWidget( aCheckPane );
+
   aPlaneLayout->addStretch();
 
+
   aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
   
   // Number of lines
@@ -138,13 +180,20 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
  
   aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
 
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabPane->addTab(myScalarPane, "Scalar Bar");
+
   aMainLayout->addWidget(aTabPane);
 
   // Dialog buttons
   QHBox* aBtnBox = new QHBox(this);
+  aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  aBtnBox->setLineWidth( 1 );
   QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout(); 
   aBtnLayout->setAutoAdd( false );
   aBtnLayout->setSpacing( 5 );
+  aBtnLayout->setMargin( 11 );
 
   QPushButton* aOkBtn = new QPushButton(tr( "VISU_BUT_OK" ),  aBtnBox);
   aOkBtn->setAutoDefault( TRUE );
@@ -153,7 +202,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
  
   aBtnLayout->addStretch();
   
-  QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+  QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
   aBtnLayout->addWidget(aCloseBtn);
    
   aMainLayout->addWidget(aBtnBox);
@@ -168,10 +217,19 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
   connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
   connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
   connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
+  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+  connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
+  connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+  connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+  connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+  connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+  connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
+  connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
 
   connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
   connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
-
+  connect( myStudy, SIGNAL(closed()),  this, SLOT( reject() ) );
+  connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
 }
 
 /*!
@@ -179,11 +237,16 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
 */
 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
 {
+  deletePlanes();
   if(myCutLines) delete myCutLines; 
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->Repaint();  
 }
 
 //------------------------------------------------------------------------------
 void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
+  myPrs = thePrs;
+  myScalarPane->initFromPrsObject(thePrs);
 
   myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
   myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
@@ -202,21 +265,24 @@ void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
   myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
   myCBSetDef->setChecked(thePrs->IsDefault());
   DrawTable();
+
+  // Draw Preview
+  if (myPreviewCheck->isChecked()) {
+    createPlanes();
+  }
 }
 
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
-  
-  thePrs->SetOrientationType(getOrientaion());
-  thePrs->SetRotateX(myRotXSpn->value()*PI/180.);
-  thePrs->SetRotateY(myRotYSpn->value()*PI/180.);
+int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
+
+  myScalarPane->storeToPrsObject(thePrs);
+
+  thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
   thePrs->SetDisplacement(myPosSpn->value());
   thePrs->SetNbLines((int)myNbSpn->value());
  
-  thePrs->SetOrientationType2(getOrientaion(false));
-  thePrs->SetRotateX2(myRotXSpn2->value()*PI/180.);
-  thePrs->SetRotateY2(myRotYSpn2->value()*PI/180.);
+  thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
   thePrs->SetDisplacement2(myPosSpn2->value());
   
   if (!myCBSetDef->isChecked())
@@ -225,12 +291,42 @@ void VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
   
   for (int i = 0; i < (int)myNbSpn->value(); ++i) 
     {
-      if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
-       thePrs->SetLinePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
+      if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
+       thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
       else thePrs->SetDefaultPosition(i);
     }
+  return 1;
+}
+
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutLinesDlg::createPlanes() {
+  if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+  if (myCutLines == NULL) return;
+  if (myPreviewActor != 0) return;
+
+  vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  aPlaneMapper->ScalarVisibilityOff();
+
+  myPreviewActor = SALOME_Actor::New();
+  myPreviewActor->PickableOff();
+  myPreviewActor->SetMapper(aPlaneMapper);
+  aPlaneMapper->Delete();
+  GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutLinesDlg::deletePlanes() {
+  if (myPreviewActor == 0) return;
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->RemoveActor(myPreviewActor);
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
 }
 
+
 //------------------------------------------------------------------------------
 void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
   for (int i = 0; i < mySelPlane2->count(); i++)
@@ -242,25 +338,26 @@ void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
     myRotXLbl->setText( tr("LBL_ROT_X"));
     myRotYLbl->setText( tr("LBL_ROT_Y"));
     ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);    
-    onCutSelect(1);
+    onCutSelect(1, false);
     break;
   case 1:
     myRotXLbl->setText( tr("LBL_ROT_Y"));
     myRotYLbl->setText( tr("LBL_ROT_Z"));
     ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);    
-    onCutSelect(2);
+    onCutSelect(2, false);
     break;
   case 2:
     myRotXLbl->setText( tr("LBL_ROT_Z"));
     myRotYLbl->setText( tr("LBL_ROT_X"));
     ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
-    onCutSelect(0);
+    onCutSelect(0, false);
   }
-  setBaseDefault();
+  setBaseDefault(false);
+  DrawTable();
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onCutSelect(int theId) {
+void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
   switch (theId) {
   case 0:
     myRotXLbl2->setText( tr("LBL_ROT_X"));
@@ -274,24 +371,41 @@ void VisuGUI_CutLinesDlg::onCutSelect(int theId) {
     myRotXLbl2->setText( tr("LBL_ROT_Z"));
     myRotYLbl2->setText( tr("LBL_ROT_X"));
   }
-  DrawTable();
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+      myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+      myCutLines->SetDisplacement2(myPosSpn2->value());
+      myCutLines->GetPL()->Update();
+      deletePlanes();
+      createPlanes();  
+      vf->Repaint();  
+    }
+  }
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setBaseDefault() {
-
+void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
   if (!hasInit) return;
   
   if ( myCBSetDef->isChecked() )
     {
       if (!myCutLines->IsDefault()) myCutLines->SetDefault();
-      myCutLines->SetOrientationType(getOrientaion());
+      myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
       myCutLines->SetDisplacement(myPosSpn->value());
-      myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
+      float aPos = myCutLines->GetBasePlanePosition();
+      myBasePlanePos->setText( QString::number(aPos) );
       myBasePlanePos->setEnabled(false);
+      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+       if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+         myCutLines->SetBasePlanePosition(aPos);
+         myCutLines->GetPL()->Update();
+         deletePlanes();
+         createPlanes();  
+         vf->Repaint();  
+       }
+      }
     }
   else myBasePlanePos->setEnabled(true);   
-
 }
 
 //------------------------------------------------------------------------------
@@ -301,76 +415,78 @@ void VisuGUI_CutLinesDlg::DrawTable()
 
   int aNbRows = myPosTable->numRows();
   int aNbPlanes = (int)myNbSpn->value();  
-  
-  if (aNbRows>0)
-    for (int i = 0; i < aNbRows; ++i) 
-      {
-       if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
-         myCutLines->SetLinePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
-      }
-  
+     
+  myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+
   myCutLines->SetNbLines(aNbPlanes);
   myCutLines->SetDisplacement2(myPosSpn2->value());
-  myCutLines->SetOrientationType2(getOrientaion(false));
+  myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
 
-  if (aNbRows < aNbPlanes)
-    {
-      if (aNbRows == 0) myPosTable->setNumRows(aNbPlanes);
-      else myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
-      
-      QHeader *vh = myPosTable->verticalHeader();
-      QString str;
-
-      for (int i = aNbRows; i < myPosTable->numRows(); ++i) 
-       {
-         QLineEdit *editline = new QLineEdit( myPosTable );
-         editline->setValidator(mydvalidator);
-         myPosTable->setCellWidget( i, 0, editline );
-                 
-         QCheckBox *checkbox = new QCheckBox( myPosTable );
-         myPosTable->setCellWidget(i, 1, checkbox );
-         connect(checkbox , SIGNAL( clicked() ), this , SLOT( setDefault() ) );
-         
-         str = str.setNum(i+1);
-         str.prepend ("Plane# ");
-         vh->setLabel( i, str );
-       }
+  if (aNbRows>0)
+    for (int i = 0; i < aNbRows; ++i) {
+      QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+      if (aItem == 0) break;
+      if (!aItem->isChecked())
+       myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
     }
-  else if (aNbRows > aNbPlanes)
-    for (int i = aNbRows-1; myPosTable->numRows() != aNbPlanes; --i )
-      myPosTable->removeRow(i);
   
-  for (int i = 0; i < myPosTable->numRows(); ++i) 
-    {
-      ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutLines->GetLinePosition(i)) );
-      
-      if (myCutLines->IsDefaultPosition(i)) 
-       {
-         ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
-       }
+  if (aNbPlanes > aNbRows)
+    myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+  else if (aNbPlanes < aNbRows)
+    myPosTable->setNumRows(aNbPlanes);
+
+  int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+  for (int i = 0; i<aMin; i++) {
+    myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
+    ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
+  }
+
+  QHeader *vh = myPosTable->verticalHeader();
+  QString str("Plane# %1");
+  for (int i=aMin; i<aNbPlanes; i++) {
+    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable, 
+                                                            QTableItem::OnTyping, 
+                                                            QString::number(myCutLines->GetLinePosition(i)));
+    aEditItem->setReplaceable(false);
+    aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
+    myPosTable->setItem(i, 0, aEditItem);
+
+    QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+    aCheck->setChecked(myCutLines->IsDefaultPosition(i));
+    aCheck->setReplaceable(false);
+    myPosTable->setItem(i, 1, aCheck);
+    
+    vh->setLabel( i, str.arg(i+1) );
+  }
+  // Update preview
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (myPreviewCheck->isChecked()) {
+      myCutLines->GetPL()->Update();
+      deletePlanes();
+      createPlanes();
+      vf->Repaint();
     }
+  }
 }
 
 //------------------------------------------------------------------------------
 void VisuGUI_CutLinesDlg::setDefault(int all)
 {
+  myPosTable->setCurrentCell(-1, 1);
+  myPosTable->clearSelection();
   if (all == 0) return;
-
   if (all == 1)
     for (int i = 0; i < (int)myNbSpn->value(); ++i) 
-      ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
-  
-  for (int i = 0; i < (int)myNbSpn->value(); ++i) 
-    {
-      if ( ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked() )
-       {
-         myCutLines->SetDefaultPosition(i);
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutLines->GetLinePosition(i)) );
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
-       }
-      else ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(true); 
-    }
+      ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
+       
+  for (int i = 0; i < (int)myNbSpn->value(); ++i) {
+    if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+      myCutLines->SetDefaultPosition(i);
+      myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
+      myPosTable->item( i, 0 )->setEnabled(false);
+    } else 
+      myPosTable->item( i, 0 )->setEnabled(true); 
+  }
 }
 
 //------------------------------------------------------------------------------
@@ -432,3 +548,176 @@ void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation  o
     onCutSelect(2);
   }
 }
+
+
+void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
+  if (theCol == 0) {
+    QString aTxt = myPosTable->text(theRow, 0);
+    bool isChanged = !aTxt.isEmpty();
+    ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      if (myPreviewCheck->isChecked()) {
+       //Update Preview
+       myCutLines->SetLinePosition( theRow, aTxt.toDouble());
+       myCutLines->GetPL()->Update();
+       deletePlanes();
+       createPlanes();
+       vf->Repaint();
+      }
+    }
+  } else {
+    bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+    if (isDefault) {
+      myCutLines->SetDefaultPosition(theRow);
+      myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
+
+      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+       if (myPreviewCheck->isChecked()) {
+         //Update Preview
+         myCutLines->GetPL()->Update();
+         deletePlanes();
+         createPlanes();
+         vf->Repaint();
+       }
+      }
+    }
+    myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+  }
+}
+
+
+void VisuGUI_CutLinesDlg::accept() {
+  MYGenerateTable = myCreateTable->isChecked();
+  MYGenerateCurve = myCurvesCheck->isChecked();
+  if (myScalarPane->check()) {
+    storeToPrsObject(myPrs);
+    if (myIsCreation) {
+      if (isGenerateTable()) {
+       visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
+       if (isGenerateCurves()) {
+         SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+         SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+         if(!aSObject->_is_nil()) {
+           SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+           for ( ;aIter->More(); aIter->Next()) {
+             SALOMEDS::SObject_var aTblObj = aIter->Value();
+             if (!aTblObj->_is_nil()) {
+               SALOMEDS::GenericAttribute_var anAttr;
+               if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+                 visuGUI->CreatePlot(aTblObj);
+               }
+             }
+           }
+         }
+       }
+      }
+      if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+       visuGUI->CreateActor(myPrs);
+       GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
+      }
+    } else {
+      visuGUI->RecreateActor(myPrs); 
+      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) { 
+       if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { 
+         vf->getRenderer()->ResetCameraClippingRange(); 
+         vf->Repaint(); 
+       }
+      }
+      // Remove old Table
+      SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+      SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+      if(!aSObject->_is_nil()) {
+       SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+       SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+       for ( ;aIter->More(); aIter->Next()) {
+         SALOMEDS::SObject_var aTblObj = aIter->Value();
+         if (!aTblObj->_is_nil()) {
+           SALOMEDS::GenericAttribute_var anAttr;
+           if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+             aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
+             break;
+           }
+         }
+       }
+       if (isGenerateTable()) {
+         visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
+         if (isGenerateCurves()) {
+           SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+           SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+           for ( ;aIter->More(); aIter->Next()) {
+             SALOMEDS::SObject_var aTblObj = aIter->Value();
+             if (!aTblObj->_is_nil()) {
+               SALOMEDS::GenericAttribute_var anAttr;
+               if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+                 visuGUI->CreatePlot(aTblObj);
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+    myStudy->updateObjBrowser();  
+    QDialog::accept();
+  }
+}
+
+void VisuGUI_CutLinesDlg::reject() {
+  if (myIsCreation) {
+    visuGUI->DeletePresentation(myPrs); 
+    myStudy->updateObjBrowser();
+  }
+  QDialog::reject();
+}
+
+void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (thePreview) {
+      storeToPrsObject(myCutLines);
+      myCutLines->GetPL()->Update();
+      createPlanes();
+      vf->onViewFitAll();
+    } else {
+      deletePlanes();
+      vf->Repaint();
+    }
+  }
+}
+
+void VisuGUI_CutLinesDlg::onRotation(double theValue) {
+  if (myCutLines == NULL) return;
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (myPreviewCheck->isChecked()) {
+      myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+      myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+      myCutLines->GetPL()->Update();
+      deletePlanes();
+      createPlanes();  
+      vf->Repaint();  
+    }
+  }
+}
+
+void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
+  if (myCutLines == NULL) return;
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (myPreviewCheck->isChecked()) {
+      myCutLines->SetBasePlanePosition(theValue.toDouble());
+      myCutLines->GetPL()->Update();
+      deletePlanes();
+      createPlanes();  
+      vf->Repaint();  
+    }
+  }
+}
+
+void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
+  if (theFrame != myStudyFrame) 
+    reject();
+}
+
+
+
index 9911d8da8ad2c24b60cd220cff05941ae0b4dd18..d9f3d9b95f937042b4f5ad08dd28b9787b03e505 100644 (file)
 #ifndef VISUGUI_CUTLINESDLG_H
 #define VISUGUI_CUTLINESDLG_H
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_CutPlanesDlg.h"
 
-#include <qdialog.h>
 #include <qhbuttongroup.h>
-#include <qlineedit.h>
-#include <qcheckbox.h>
 #include <qvalidator.h>
-#include <qtable.h>
-
-#include "SALOMEconfig.h"
-#include CORBA_CLIENT_HEADER(VISU_Gen)
 
 namespace VISU{
   class CutLines_i;
@@ -32,20 +25,36 @@ class VisuGUI_CutLinesDlg: public QDialog
     Q_OBJECT
 
 public:
-    VisuGUI_CutLinesDlg();
+    VisuGUI_CutLinesDlg(bool theIsCreation);
     ~VisuGUI_CutLinesDlg();
 
     void initFromPrsObject(VISU::CutLines_i* thePrs);
-    void storeToPrsObject(VISU::CutLines_i* thePrs);
+    int storeToPrsObject(VISU::CutLines_i* thePrs);
+
+    bool isGenerateTable() { return myCreateTable->isChecked(); }
+    bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
+
+protected slots:
+  void accept();
+  void reject();
 
 private slots:
   void onPlaneSelect(int theId);
-  void onCutSelect(int theId);
-  void setBaseDefault();
+  void onCutSelect(int theId, bool theUpdate = true);
+  void setBaseDefault(bool theUpdate = true);
   void setDefault( int all = -1);
   void DrawTable();
-  
+  void onValueChanged(int theRow, int theCol);
+  void onPreviewCheck(bool thePreview);
+  void onRotation(double theValue);
+  void onPlanePos(const QString& theValue);
+  void onFrameActivated(QAD_StudyFrame* );
+
 private:
+  void createPlanes();
+  void deletePlanes();
+
+
   QHButtonGroup* mySelPlane;
   QAD_SpinBoxDbl* myRotXSpn;
   QAD_SpinBoxDbl* myRotYSpn;
@@ -54,6 +63,8 @@ private:
   QAD_SpinBoxDbl* myPosSpn;
   QLineEdit* myBasePlanePos;
   QCheckBox* myCBSetDef;
+  QCheckBox* myCreateTable;
+  QCheckBox* myCurvesCheck;
 
   QHButtonGroup* mySelPlane2;  
   QAD_SpinBoxDbl* myNbSpn;
@@ -68,10 +79,24 @@ private:
   QDoubleValidator *mydvalidator;
   VISU::CutLines_i* myCutLines;
 
+  VisuGUI_ScalarBarPane* myScalarPane;
+
   VISU::CutPlanes::Orientation  getOrientaion(bool IsBasePlane = true);
   void   setOrientation( const VISU::CutPlanes::Orientation orient);
   void   setOrientation2( const VISU::CutPlanes::Orientation orient);
+  SALOME_Actor* myPreviewActor;
+  QCheckBox* myPreviewCheck;
   
+  VISU::CutLines_i* myPrs;
+
+  QAD_Study *myStudy;
+  QAD_StudyFrame *myStudyFrame;
+
+  bool myIsCreation;
+
+  static bool MYGenerateTable;
+  static bool MYGenerateCurve;
 };
 #endif // VISUGUI_CUTLINESDLG_H
 
index 5b55f9cd2c0d9381bc544a61ca8eaa39f9b27308..00d56132d1f236ffd6e75224889674442d730784 100644 (file)
 
 #include "VisuGUI_CutPlanesDlg.h"
 #include "VISU_CutPlanes_i.hh"
+#include "VISU_CutPlanesPL.hxx"
+
+#include "VisuGUI.h"
+#include "VTKViewer_ViewFrame.h"
 
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
+#include "QAD_RightFrame.h"
 
 #include <qlayout.h>
 #include <qcheckbox.h>
 #include <qstring.h>
 #include <qvalidator.h>
 #include <qlineedit.h>
+#include <qtabwidget.h>
+
+#include <vtkRenderer.h>
+#include <vtkAppendPolyData.h>
+#include <vtkDataSetMapper.h>
+
+
+#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
 
 using namespace std;
 
-/*!
-  Constructor
-*/
-VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
-    : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
-  setCaption( tr( "Cut Planes Definition" ) );
-  setSizeGripEnabled( TRUE );
+extern VisuGUI *visuGUI;
 
+VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
+  :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
+{
   QGridLayout* TopLayout = new QGridLayout( this ); 
   TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
+  TopLayout->setMargin( 10 );
+
   QButtonGroup* SelPlane = new QButtonGroup( tr( "Orientation" ), this, "SelPlane" );
   SelPlane->setTitle( tr( "Orientation" ) );
   SelPlane->setColumnLayout(0, Qt::Vertical );
@@ -64,9 +73,9 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   SelPlaneLayout->setSpacing( 6 );
   SelPlaneLayout->setMargin( 11 );
 
-  RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
-  RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
   RBxy = new QRadioButton( tr( "// X-Y" ), SelPlane, "RBxy" );
+  RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
+  RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
   SelPlaneLayout->addWidget( RBxy, 0, 0 );
   SelPlaneLayout->addWidget( RByz, 0, 1 );
   SelPlaneLayout->addWidget( RBzx, 0, 2 );
@@ -80,13 +89,14 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   myPosTable = new QTable(this, "Positions of planes" );
   myPosTable->setMaximumHeight( 227 );
   myPosTable->setMinimumWidth( 294 );
-  //myPosTable->setGeometry( QRect( 11, 98, 289, 325 ) );
   myPosTable->setNumCols(2);
   myPosTable->setNumRows(0);
+  connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
   
   QHeader *th = myPosTable->horizontalHeader();
   th->setLabel( 0, "Position" );
   th->setLabel( 1, "Set default" );
+  th->setStyle("QStyle::CE_PushButton");
     
   QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
   GBrot->setColumnLayout(0, Qt::Vertical );
@@ -103,6 +113,7 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
   Rot1->setValue( 0 );
   Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
   GBrotLayout->addWidget( Rot1, 0, 1 );
 
   LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
@@ -111,35 +122,16 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
   Rot2->setValue( 0 );
   Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
   GBrotLayout->addWidget( Rot2, 1, 1 );
 
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  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 );
-
   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
   myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
 
-  th->setStyle("QStyle::CE_PushButton");
+  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
+  myPreviewCheck->setChecked(false);
+  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
 
-  // layouting
   TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 );
   TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 );
   TopLayout->addWidget( LabelPosi_3,   2, 0 );
@@ -148,41 +140,35 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   TopLayout->setRowStretch ( 3, 3 );
   TopLayout->addWidget(aPosLbl, 4, 0 );
   TopLayout->addWidget(myPosSpn, 4, 1 );
-  TopLayout->addMultiCellWidget( GroupButtons, 5, 5, 0, 1 );
+  TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
 
   // signals and slots connections
   connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
   connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) );
   connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
-  connect( RBzx, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
-  connect( RByz, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
-  connect( RBxy, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
   connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
 
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
-  myCutPlanes = NULL;
-
   // default values
+  myCutPlanes = NULL;
   hasInit = false;
   X1 = 0; X2 = 0;
   Y1 = 0; Y2 = 0;
   Z1 = 0; Z2 = 0;
   RByz->setChecked( true );
-  orientationChanged( 0 );
-}
+  
+} // End of Constructor
 
-/*!
-  Destructor
-*/
-VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
+
+VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
 {
-  if(myCutPlanes) delete myCutPlanes; 
+  deletePlanes();
+  if(myCutPlanes) myCutPlanes->Destroy();
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->Repaint();
 }
 
 
-void VisuGUI_CutPlanesDlg::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
+void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
   setNbPlanes(thePrs->GetNbPlanes());
   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
   setPlanePos(thePrs->GetOrientationType());
@@ -192,206 +178,390 @@ void VisuGUI_CutPlanesDlg::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
   myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
   myCutPlanes->SameAs(thePrs);
   DrawTable();
+
+  // Draw Preview
+  if (myPreviewCheck->isChecked()) {
+    createPlanes();
+  }
 }
 
-void VisuGUI_CutPlanesDlg::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+
+void VisuGUI_CutPlanesPane::createPlanes() {
+  if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+  if (myCutPlanes == NULL) return;
+  if (myPreviewActor != 0) return;
+
+  vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  aPlaneMapper->ScalarVisibilityOff();
+
+  myPreviewActor = SALOME_Actor::New();
+  myPreviewActor->PickableOff();
+  myPreviewActor->SetMapper(aPlaneMapper);
+  aPlaneMapper->Delete();
+  GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+}
+
+
+
+int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+  thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
   thePrs->SetNbPlanes(getNbPlanes());
-  thePrs->SetRotateX(getRotation1()*PI/180.);
-  thePrs->SetRotateY(getRotation2()*PI/180.);
-  thePrs->SetOrientationType(getOrientaion());
   thePrs->SetDisplacement(myPosSpn->value());
   for (int i = 0; i < getNbPlanes(); ++i) 
     {
-      if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
-       thePrs->SetPlanePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
+      if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
+       thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
       else thePrs->SetDefault(i);
     }
+  return 1;
 }
 
+
 /*!
   Called when orientation is changed
 */
-void VisuGUI_CutPlanesDlg::orientationChanged( int )
+void VisuGUI_CutPlanesPane::orientationChanged( int Id )
 {
-  if ( RBxy->isChecked() ) {
+  if ( Id == 0 ) { // RBxy->isChecked()
     LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
     LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
-  } else if ( RByz->isChecked() ) {
+  } else if ( Id == 1 ) { // RByz->isChecked()
     LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
     LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
   } else { 
     LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
     LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
   }
+  DrawTable();
 }
 
 
 
-/*!
-  Sets bounds ( must be called first )
-*/
-void VisuGUI_CutPlanesDlg::setBounds( const double x1, const double x2, 
-                                     const double y1, const double y2, 
-                                     const double z1, const double z2 )
-{
-  X1 = min( x1, x2 ); X2 = max( x1, x2 );
-  Y1 = min( y1, y2 ); Y2 = max( y1, y2 );
-  Z1 = min( z1, z2 ); Z2 = max( z1, z2 );
-  orientationChanged( 0 );
-}
-
-/*!
-  Sets nb of planes
-*/
-void VisuGUI_CutPlanesDlg::setNbPlanes( const int nbp )
-{
-  nbPlan->setValue( nbp );
-}
-
-/*!
-  Gets nb of planes
-*/
-int VisuGUI_CutPlanesDlg::getNbPlanes()
-{
-  return nbPlan->value();
-}
 
 /*!
   Sets planes orientation and position
 */
-void VisuGUI_CutPlanesDlg::setPlanePos( const VISU::CutPlanes::Orientation  orient/*, const double pos1, const double pos2 */)
+void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation  orient)
 {
   if ( orient == VISU::CutPlanes::XY )           // xy
-    RBxy->setChecked( true );
+    {
+      RBxy->setChecked( true );
+      orientationChanged( 0 );
+    }
   else if ( orient == VISU::CutPlanes::YZ )       // yz
-    RByz->setChecked( true );
+    {
+      RByz->setChecked( true );
+      orientationChanged( 1 );
+    }
   else                         // zx
-    RBzx->setChecked( true );
-  orientationChanged( 0 );
+   {
+     RBzx->setChecked( true );
+     orientationChanged( 2 );
+   }
+  
 }
 
-
 /*!
   Gets planes orientation
 */
-VISU::CutPlanes::Orientation VisuGUI_CutPlanesDlg::getOrientaion()
+VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
 {
   VISU::CutPlanes::Orientation orient;
   if ( RBxy->isChecked() )     // xy
     orient = VISU::CutPlanes::XY;
-  if ( RByz->isChecked() )     // yz
+  else if ( RByz->isChecked() )     // yz
     orient = VISU::CutPlanes::YZ;
-  if ( RBzx->isChecked() )     // zx
+  else if ( RBzx->isChecked() )     // zx
     orient = VISU::CutPlanes::ZX;
   return orient;
 }
 
-
 /*!
   Sets planes rotation
 */
-void VisuGUI_CutPlanesDlg::setRotation( const double r1, const double r2 )
+void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
 {
   Rot1->setValue( r1 );
   Rot2->setValue( r2 );
 }
 
-/*!
-  Gets plane rotation 1
-*/
-double VisuGUI_CutPlanesDlg::getRotation1()
-{
-  return Rot1->value();
-}
-
-/*!
-  Gets plane rotation 2
-*/
-double VisuGUI_CutPlanesDlg::getRotation2()
-{
-  return Rot2->value();
-}
-
 /*!
   Draw the table of planes positions
 */
 
-void VisuGUI_CutPlanesDlg::DrawTable()
+void VisuGUI_CutPlanesPane::DrawTable()
 {
+  if (myCutPlanes == NULL) return;
   if (!hasInit) return;
 
   int aNbRows = myPosTable->numRows();
   int aNbPlanes = getNbPlanes();  
-     
-  if (aNbRows>0)
-    for (int i = 0; i < aNbRows; ++i) 
-      {
-       if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
-         myCutPlanes->SetPlanePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
-      }
-  
+
+  myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
   myCutPlanes->SetNbPlanes(aNbPlanes);
   myCutPlanes->SetDisplacement(myPosSpn->value());
-  myCutPlanes->SetOrientationType(getOrientaion());
-
-  if (aNbRows < aNbPlanes)
-    {
-      if (aNbRows == 0) myPosTable->setNumRows(aNbPlanes);
-      else myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
-      
-      QHeader *vh = myPosTable->verticalHeader();
-      QString str;
-
-      QDoubleValidator *dvalidator = new QDoubleValidator(myPosTable);
-      dvalidator->setDecimals(32);
-
-      for (int i = aNbRows; i < myPosTable->numRows(); ++i) 
-       {
-         QLineEdit *editline = new QLineEdit( myPosTable );
-         editline->setValidator(dvalidator);
-         myPosTable->setCellWidget( i, 0, editline );
-                 
-         QCheckBox *checkbox = new QCheckBox( myPosTable );
-         myPosTable->setCellWidget(i, 1, checkbox );
-         connect(checkbox , SIGNAL( clicked() ), this , SLOT( setDefault() ) );
-         
-         str = str.setNum(i+1);
-         str.prepend ("Plane# ");
-         vh->setLabel( i, str );
-       }
+  if (aNbRows>0)
+    for (int i = 0; i < aNbRows; ++i) {
+      QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+      if (aItem == 0) break;
+      if (!aItem->isChecked())
+       myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
     }
-  else if (aNbRows > aNbPlanes)
-    for (int i = aNbRows-1; myPosTable->numRows() != aNbPlanes; --i )
-      myPosTable->removeRow(i);
   
-  for (int i = 0; i < myPosTable->numRows(); ++i) 
-    {
-      ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutPlanes->GetPlanePosition(i)) );
-      
-      if (myCutPlanes->IsDefault(i)) 
-       {
-         ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
-       }
+  if (aNbPlanes > aNbRows)
+    myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+  else if (aNbPlanes < aNbRows)
+    myPosTable->setNumRows(aNbPlanes);
+
+  int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+  for (int i = 0; i<aMin; i++) {
+    myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+    ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
+  }
+
+  QHeader *vh = myPosTable->verticalHeader();
+  QString str("Plane# %1");
+  for (int i=aMin; i<aNbPlanes; i++) {
+    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable, 
+                                                            QTableItem::OnTyping, 
+                                                            QString::number(myCutPlanes->GetPlanePosition(i)));
+    aEditItem->setReplaceable(false);
+    aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
+    myPosTable->setItem(i, 0, aEditItem);
+
+    QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+    aCheck->setChecked(myCutPlanes->IsDefault(i));
+    aCheck->setReplaceable(false);
+    myPosTable->setItem(i, 1, aCheck);
+    
+    vh->setLabel( i, str.arg(i+1) );
+  }
+
+  // Update preview
+  if (myPreviewCheck->isChecked()) {
+    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      myCutPlanes->GetPL()->Update();
+      deletePlanes();
+      createPlanes();
+      vf->Repaint();
     }
+  }
 }
 
-void VisuGUI_CutPlanesDlg::setDefault(int all)
+void VisuGUI_CutPlanesPane::setDefault(int all)
 {
+  myPosTable->setCurrentCell(-1, 1);
+  myPosTable->clearSelection();
   if (all == 0) return;
-
   if (all == 1)
     for (int i = 0; i < getNbPlanes(); ++i) 
-      ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
+      ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
        
-  for (int i = 0; i < getNbPlanes(); ++i) 
-    {
-      if ( ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked() )
-       {
-         myCutPlanes->SetDefault(i);
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutPlanes->GetPlanePosition(i)) );
-         ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
+  for (int i = 0; i < getNbPlanes(); ++i) {
+    if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+      myCutPlanes->SetDefault(i);
+      myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+      myPosTable->item( i, 0 )->setEnabled(false);
+    } else 
+      myPosTable->item( i, 0 )->setEnabled(true); 
+  }
+}
+
+void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
+  if (theCol == 0) {
+    QString aTxt = myPosTable->text(theRow, 0);
+    bool isChanged = !aTxt.isEmpty();
+    ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+    if (myPreviewCheck->isChecked()) {
+      //Update Preview
+      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+       myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
+       myCutPlanes->GetPL()->Update();
+       deletePlanes();
+       createPlanes();
+       vf->Repaint();
+      }
+    }
+  } else {
+    bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+    if (isDefault) {
+      myCutPlanes->SetDefault(theRow);
+      myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
+
+      if (myPreviewCheck->isChecked()) {
+       if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+         //Update Preview
+         myCutPlanes->GetPL()->Update();
+         deletePlanes();
+         createPlanes();
+         vf->Repaint();
        }
-      else ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(true); 
+      }
+    }
+    myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+  }
+}
+
+
+void VisuGUI_CutPlanesPane::deletePlanes() {
+  if (myPreviewActor == 0) return;
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->RemoveActor(myPreviewActor);
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
+}
+
+void VisuGUI_CutPlanesPane::onRotation(double theValue) {
+  if (myCutPlanes == NULL) return;
+  if (myPreviewCheck->isChecked()) {
+    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+      myCutPlanes->GetPL()->Update();
+      deletePlanes();
+      createPlanes();  
+      vf->Repaint();  
     }
+  }
+}
+
+
+void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (thePreview) {
+      storeToPrsObject(myCutPlanes);
+      myCutPlanes->GetPL()->Update();
+      createPlanes();
+      vf->onViewFitAll();
+    } else {
+      deletePlanes();
+      vf->Repaint();
+    }
+  }
+}
+
+
+
+
+//###################################################################
+
+
+
+/*!
+  Constructor
+*/
+VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
+  : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
+    myStudy(QAD_Application::getDesktop()->getActiveStudy())
+{
+  myStudyFrame = myStudy -> getActiveStudyFrame();
+  if (!theIsModal) {
+    setWFlags(getWFlags() | WDestructiveClose);
+  }
+  setCaption( tr( "Cut Planes Definition" ) );
+  setSizeGripEnabled( TRUE );
+  myIsCreation = theIsCreation;
+
+  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
+  TopLayout->setSpacing( 6 );
+  TopLayout->setMargin( 11 );
+  QTabWidget* aTabBox = new QTabWidget(this);
+  myCutPane = new  VisuGUI_CutPlanesPane(this, myStudy);
+  aTabBox->addTab(myCutPane, "Cut Planes");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+  TopLayout->addWidget(aTabBox);
+
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
+  GroupButtons->setTitle( tr( ""  ) );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  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 );
+
+  TopLayout->addWidget(GroupButtons);
+
+  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
+  connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+}
+
+
+void VisuGUI_CutPlanesDlg::accept() {
+  if (myScalarPane->check()) {
+    if (!isModal()) {
+      if (storeToPrsObject(myPrs)) {
+       if (myIsCreation) { 
+         if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+           visuGUI->CreateActor(myPrs);
+           GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
+         }
+       } else {
+         visuGUI->RecreateActor(myPrs);
+         if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+           if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+             vf->getRenderer()->ResetCameraClippingRange();
+             vf->Repaint();
+           }
+         }
+       }
+      } else {
+       if (myIsCreation) {
+         visuGUI->DeletePresentation(myPrs);
+       }
+      }
+    }
+    QDialog::accept();
+  }
+}
+
+void VisuGUI_CutPlanesDlg::reject() {
+  if (myIsCreation && (!isModal())) {
+    visuGUI->DeletePresentation(myPrs);
+    myStudy -> updateObjBrowser();
+  }
+  QDialog::reject();
+}
+
+void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
+  if (theFrame != myStudyFrame) 
+    reject();
+}
+
+VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg () {
+  reject();
+}
+
+
+//###################################################################
+
+
+
+QWidget* VisuGUI_NumEditItem::createEditor() const 
+{
+  QLineEdit *editline = new QLineEdit(text(), table()->viewport());
+  QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
+  dvalidator->setDecimals(32);
+  editline->setValidator(dvalidator);
+  return editline;
 }
index c26532fa627d03ef4548247716e554bdc22ef5f6..0651f73872fc2dd189f578a227153dc1275d013d 100644 (file)
 #define VISUGUI_CUTPLANESDLG_H
 
 #include "QAD_SpinBoxDbl.h"
+#include "QAD_StudyFrame.h"
+
 #include "VisuGUI_ScalarBarDlg.h"
+#include "VISU_CutPlanes_i.hh"
+#include <SALOME_Actor.h>
 
-#include <qdialog.h>
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
 #include <qradiobutton.h>
-#include <qspinbox.h>
 #include <qtable.h>
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(VISU_Gen)
-namespace VISU{
-  class CutPlanes_i;
-}
 
-class VisuGUI_CutPlanesDlg : public QDialog
-{ 
+
+class VisuGUI_CutPlanesPane : public QFrame
+{
     Q_OBJECT
 
 public:
-    VisuGUI_CutPlanesDlg();
-    ~VisuGUI_CutPlanesDlg();
+    VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study * theStudy);
+    ~VisuGUI_CutPlanesPane();
 
-    void setBounds( const double x1, const double x2, 
-                   const double y1, const double y2, 
-                   const double z1, const double z2 );
-    void   setNbPlanes( const int nbp );
-    int    getNbPlanes();
+    void   setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
+    int    getNbPlanes() {return nbPlan->value();}
     void   setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */);
     VISU::CutPlanes::Orientation  getOrientaion();
     void   setRotation( const double r1, const double r2 );
-    double getRotation1();
-    double getRotation2();
+    double getRotation1() {return Rot1->value();}
+    double getRotation2() {return Rot2->value();}
 
     void initFromPrsObject(VISU::CutPlanes_i* thePrs);
-    void storeToPrsObject(VISU::CutPlanes_i* thePrs);
-   
+    int storeToPrsObject(VISU::CutPlanes_i* thePrs);
+
 private:
+    void createPlanes();
+    void deletePlanes();
+
+
     QLabel* LabelRot1;
     QLabel* LabelRot2;
     QSpinBox* nbPlan;
@@ -81,16 +78,70 @@ private:
     QAD_SpinBoxDbl* myPosSpn;
     QTable* myPosTable;
     VISU::CutPlanes_i* myCutPlanes;  
+    QCheckBox* myPreviewCheck;
     double          X1, X2;
     double          Y1, Y2;
     double          Z1, Z2;
     bool hasInit;
+    QAD_Study* myStudy;
+
+    //vector<SALOME_Actor*> myPreviewActors;
+    SALOME_Actor* myPreviewActor;
 
 private slots:
     void editScalarBar();
     void orientationChanged( int );
     void DrawTable();
     void setDefault( int all = -1);
+    void onValueChanged(int theRow, int theCol);
+    void onRotation(double theValue);
+    void onPreviewCheck(bool thePreview);
 };
 
+
+
+class VisuGUI_CutPlanesDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal);
+    ~VisuGUI_CutPlanesDlg();
+
+    void initFromPrsObject(VISU::CutPlanes_i* thePrs)
+      {myPrs=thePrs; myScalarPane->initFromPrsObject(thePrs); myCutPane->initFromPrsObject(thePrs);}
+
+    int storeToPrsObject(VISU::CutPlanes_i* thePrs)
+      {return myScalarPane->storeToPrsObject(thePrs) && myCutPane->storeToPrsObject(thePrs);}
+   
+protected slots:
+  void accept();
+  void reject();
+  void onFrameActivated( QAD_StudyFrame* theFrame);
+
+private:
+    VisuGUI_CutPlanesPane* myCutPane;
+    VisuGUI_ScalarBarPane* myScalarPane;
+    VISU::CutPlanes_i* myPrs;
+    
+    bool myIsCreation;
+
+    QAD_Study  *myStudy;
+    QAD_StudyFrame *myStudyFrame;
+};
+
+
+class VisuGUI_NumEditItem: public QTableItem
+{
+  //    Q_OBJECT
+
+public:
+    VisuGUI_NumEditItem(QTable* table, EditType et, const QString& text ):
+      QTableItem(table, et, text) {};
+    ~VisuGUI_NumEditItem() {};
+
+    QWidget* createEditor() const;
+};
+
+
 #endif // VISUGUI_CUTPLANESDLG_H
index e2d50edaf36335588393725a26dac859ed2d3553..af7232f24aae991314a740921a899a14df0467b9 100644 (file)
@@ -1,4 +1,4 @@
-//  VISU VISUGUI : GUI of VISU component
+z//  VISU VISUGUI : GUI of VISU component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
index 5977d5eedade169bf1cba5ec63ed8ed146881563..45a6ac14cefa790ca7977961adb2193ec1278a13 100644 (file)
 
 #include <qlayout.h>
 #include <qvalidator.h>
+#include <qtabwidget.h>
+
 
 using namespace std;
 
-/*!
-  Constructor
-*/
-VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
-  : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane(QWidget* parent) 
+  : QVBox(parent)
 {
-  setCaption( tr( "Iso Surfaces Definition" ) );
-  setSizeGripEnabled( TRUE );
-  
-  QGridLayout* TopLayout = new QGridLayout( this ); 
-  TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
-  
-  QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
-  TopGroup->setColumnLayout(0, Qt::Vertical );
-  TopGroup->layout()->setSpacing( 0 );
-  TopGroup->layout()->setMargin( 0 );
-  QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+  QFrame* TopGroup = new QFrame( this, "TopGroup" );
+  TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  TopGroup->setLineWidth(1);
+
+  QGridLayout* TopGroupLayout = new QGridLayout(TopGroup);
   TopGroupLayout->setAlignment( Qt::AlignTop );
   TopGroupLayout->setSpacing( 6 );
   TopGroupLayout->setMargin( 11 );
 
+  QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
+  TopGroupLayout->addWidget( LabelNbr, 0, 0 );
+  NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
+  NbrIso->setValue( 1 );
+  TopGroupLayout->addWidget( NbrIso, 0, 1 );
+
   QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
-  TopGroupLayout->addWidget( LabelMin, 0, 0 );
+  TopGroupLayout->addWidget( LabelMin, 1, 0 );
   //MinIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1 );
   MinIso = new QLineEdit( TopGroup );
-  MinIso->setValidator( new QDoubleValidator(this) );  
+  MinIso->setValidator( new QDoubleValidator(TopGroup) );  
   MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MinIso->setMinimumSize( 70, 0 );
   LabelMin->setBuddy(MinIso);
-  TopGroupLayout->addWidget( MinIso, 0, 1 );
+  TopGroupLayout->addWidget( MinIso, 1, 1 );
 
   QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
-  TopGroupLayout->addWidget( LabelMax, 1, 0 );
+  TopGroupLayout->addWidget( LabelMax, 2, 0 );
   //MaxIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1);
   MaxIso = new QLineEdit( TopGroup );
-  MaxIso->setValidator( new QDoubleValidator(this) );
+  MaxIso->setValidator( new QDoubleValidator(TopGroup) );
   MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   MaxIso->setMinimumSize( 70, 0 );
   LabelMax->setBuddy(MaxIso);
-  TopGroupLayout->addWidget( MaxIso, 1, 1 );
+  TopGroupLayout->addWidget( MaxIso, 2, 1 );
   
-  CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
-  CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-  TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
-  CBUpdate->setChecked(true);
   
-  CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
-  CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-  TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
+//   CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
+//   CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
+//   TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
+//   CBUpdate->setChecked(false);
+  QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
+  TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
+  connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );   
   
-  QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
-  TopGroupLayout->addWidget( LabelNbr, 2, 0 );
-  NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
-  NbrIso->setValue( 1 );
-  TopGroupLayout->addWidget( NbrIso, 2, 1 );
+//   CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
+//   CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
+//   TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
+  
+}
+
+
+
+void VisuGUI_IsoSurfPane::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
+  NbrIso->setValue(thePrs->GetNbSurfaces());
+  MinIso->setText(QString::number(thePrs->GetSubMin()));
+  MaxIso->setText(QString::number(thePrs->GetSubMax()));
+//   switch(thePrs->GetScaling()){
+//   case VISU::LOGARITHMIC : 
+//     CBLog->setChecked(true);
+//     break;
+//   default:  
+//     CBLog->setChecked(false);
+//   }
+}
+
+int VisuGUI_IsoSurfPane::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
+  thePrs->SetNbSurfaces(NbrIso->value());
+  thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+  return 1;
+//   if (CBUpdate->isChecked())
+//     {
+//       thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+//       if (CBLog->isChecked())
+//     thePrs->SetScaling(VISU::LOGARITHMIC);
+//       else 
+//     thePrs->SetScaling(VISU::LINEAR);
+//    }
+}
+
+void VisuGUI_IsoSurfPane::onCBUpdate()
+{
+  //  if (CBUpdate->isChecked()) {
+  myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true);
+    //  }
+//     CBLog->setDisabled(false);
+//   else CBLog->setDisabled(true);
+}
+
+
+bool VisuGUI_IsoSurfPane::check() {
+  if (MinIso->text().toDouble() >= MaxIso->text().toDouble()) {
+    QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
+                          tr("MSG_MINMAX_VALUES"),
+                          tr("VISU_BUT_OK"));
+    return false;
+  } // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
+//           (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
+//     QAD_MessageBox::warn1( this,
+//                        tr("VISU_WARNING"),
+//                        tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
+//                        tr("VISU_BUT_OK"));
+//     return false;
+//   }
+  return true;
+}
+
+
+
+
+
+/*!
+  Constructor
+*/
+VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
+  : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  setCaption( tr( "Iso Surfaces Definition" ) );
+  setSizeGripEnabled( TRUE );
+  
+  QVBoxLayout* TopLayout = new QVBoxLayout(this);
+  TopLayout->setSpacing( 6 );
+  TopLayout->setMargin(11);
+  QTabWidget* aTabBox = new QTabWidget(this);
+  myIsoPane = new  VisuGUI_IsoSurfPane(this);
+  myIsoPane->setMargin( 5 );
+  aTabBox->addTab(myIsoPane, "Iso Surface");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myIsoPane->setScalarBarPane(myScalarPane);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+  TopLayout->addWidget(aTabBox);
   
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
@@ -116,68 +199,14 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
   buttonCancel->setAutoDefault( TRUE );
   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
   
-  TopLayout->addWidget( TopGroup,     0, 0 );
-  TopLayout->addWidget( GroupButtons, 1, 0 );
+  TopLayout->addWidget(GroupButtons);
   
   // signals and slots connections
   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-  connect( CBUpdate, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) ); 
-}
-
-/*!
-  Destructor
-*/
-VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
-{
-}
-
-void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
-  NbrIso->setValue(thePrs->GetNbSurfaces());
-  MinIso->setText(QString::number(thePrs->GetSubMin()));
-  MaxIso->setText(QString::number(thePrs->GetSubMax()));
-  switch(thePrs->GetScaling()){
-  case VISU::LOGARITHMIC : 
-    CBLog->setChecked(true);
-    break;
-  default:  
-    CBLog->setChecked(false);
-  }
-}
-
-void VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
-  thePrs->SetNbSurfaces(NbrIso->value());
-  thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
-  if (CBUpdate->isChecked())
-    {
-      thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
-      if (CBLog->isChecked())
-       thePrs->SetScaling(VISU::LOGARITHMIC);
-      else 
-       thePrs->SetScaling(VISU::LINEAR);
-    }
 }
 
 void VisuGUI_IsoSurfacesDlg::accept() {
-  
-  if (MinIso->text().toDouble() >= MaxIso->text().toDouble())
-    QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
-                          tr("MSG_MINMAX_VALUES"),
-                          tr("VISU_BUT_OK"));
-  else if ( CBUpdate->isChecked() && CBLog->isChecked() && (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) )
-    {
-      
-      QAD_MessageBox::warn1( this,
-                            tr("VISU_WARNING"),
-                            tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
-                            tr("VISU_BUT_OK"));
-    }
-  else QDialog::accept();
+  if (myIsoPane->check() && myScalarPane->check())  QDialog::accept();
 }
 
-void VisuGUI_IsoSurfacesDlg::onCBUpdate()
-{
-  if (CBUpdate->isChecked())
-    CBLog->setDisabled(false);
-  else CBLog->setDisabled(true);
-}
index 24e74cb8f8da10abb59e6e43ad0ca44f60d9c72b..158f1a12e7baf7d040b90090f3bf717d43027984 100644 (file)
@@ -29,6 +29,9 @@
 #ifndef VISUGUI_ISOSURFACESDLG_H
 #define VISUGUI_ISOSURFACESDLG_H
 
+#include "VisuGUI_ScalarBarDlg.h"
+#include "VISU_IsoSurfaces_i.hh"
+
 #include <qdialog.h>
 #include <qlabel.h>
 #include <qgroupbox.h>
 #include <qcheckbox.h>
 #include <qlineedit.h>
 
-namespace VISU{
-  class IsoSurfaces_i;
-}
+
+
+class VisuGUI_IsoSurfPane : public QVBox
+{
+    Q_OBJECT
+
+public:
+    VisuGUI_IsoSurfPane(QWidget* parent);
+    ~VisuGUI_IsoSurfPane() {};
+
+    void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
+    int storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
+
+    void setScalarBarPane(VisuGUI_ScalarBarPane* theScalarPane) {myScalarPane = theScalarPane;}
+    VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;}      
+
+    bool check();
+
+protected slots:
+  void onCBUpdate();
+   
+private:
+  QLineEdit* MinIso;
+  QLineEdit* MaxIso;
+  QSpinBox*  NbrIso;
+  //QCheckBox* CBUpdate;
+  VisuGUI_ScalarBarPane* myScalarPane;  
+  //  QCheckBox* CBLog;
+};
+
+
+
 
 class VisuGUI_IsoSurfacesDlg : public QDialog
 { 
@@ -47,21 +79,20 @@ class VisuGUI_IsoSurfacesDlg : public QDialog
 
 public:
     VisuGUI_IsoSurfacesDlg();
-    ~VisuGUI_IsoSurfacesDlg();
+    ~VisuGUI_IsoSurfacesDlg() {};
     
-    void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
-    void storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
+    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);}
     
 protected slots:
   void accept();
-  void onCBUpdate();
    
 private:
-  QLineEdit* MinIso;
-  QLineEdit* MaxIso;
-  QSpinBox*       NbrIso;
-  QCheckBox* CBUpdate;
-  QCheckBox* CBLog;
+ VisuGUI_IsoSurfPane*   myIsoPane;
+ VisuGUI_ScalarBarPane* myScalarPane;
 };
 
 #endif // VISUGUI_ISOSURFACESDLG_H
index c8f38d87995a5c088c8a29c81254cd1e861f1a36..71dad00edc5dbaca4c75a37deffda8dcf97cb112 100644 (file)
@@ -33,6 +33,7 @@
 #include "QAD_Desktop.h"
 
 #include <qlayout.h>
+#include <qtabwidget.h>
 
 using namespace std;
 
@@ -45,16 +46,19 @@ VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
   setCaption( tr( "Deformed Shape" ) );
   setSizeGripEnabled( TRUE );
 
-  QGridLayout* TopLayout = new QGridLayout( this ); 
+  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin( 11 );
   
-  QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
-  TopGroup->setColumnLayout(0, Qt::Vertical );
-  TopGroup->layout()->setSpacing( 0 );
-  TopGroup->layout()->setMargin( 0 );
-  QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
-  TopGroupLayout->setAlignment( Qt::AlignTop );
+  QTabWidget* aTabBox = new QTabWidget(this);
+  
+  QVBox* aBox = new QVBox(this);
+  aBox->setMargin( 11 );
+  QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
+  TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  TopGroup->setLineWidth(1);
+  QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
+  TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
   TopGroupLayout->setSpacing( 6 );
   TopGroupLayout->setMargin( 11 );
 
@@ -70,6 +74,12 @@ VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
   TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
   //if (!enableUM)
   //  UseMagn->hide();
+  aTabBox->addTab(aBox, "Deformed Shape");
+  
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");
+
 
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
@@ -90,30 +100,31 @@ VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
   buttonCancel->setAutoDefault( TRUE );
   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
   
-  TopLayout->addWidget( TopGroup,     0, 0 );
-  TopLayout->addWidget( GroupButtons, 1, 0 );
+  TopLayout->addWidget( aTabBox );
+  TopLayout->addWidget( GroupButtons );
 
   // signals and slots connections
   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
 }
 
-/*!
-  Destructor
-*/
-VisuGUI_MagnitudeDlg::~VisuGUI_MagnitudeDlg()
-{
-}
-
 
 void VisuGUI_MagnitudeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
+  myScalarPane->initFromPrsObject(thePrs);
   setFactor(thePrs->GetScale());
   UseMagn->setChecked(thePrs->IsColored());
 }
 
 
-void VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
+int VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
+  myScalarPane->storeToPrsObject(thePrs);
   thePrs->SetScale(getFactor());
   thePrs->ShowColored(isColored());
+  return 1;
+}
+
+
+void VisuGUI_MagnitudeDlg::accept() {
+  if (myScalarPane->check())  QDialog::accept();
 }
 
index 37c7609cccb765449c404fc69b0cc41af1d6fc73..8b4e7f6fb898a3e2d1f34dbd218ce44dcff37623 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef VISUGUI_MAGNITUDEDLG_H
 #define VISUGUI_MAGNITUDEDLG_H
 
+#include "VisuGUI_ScalarBarDlg.h"
+
 #include <qdialog.h>
 #include <qgroupbox.h>
 #include <qcheckbox.h>
@@ -47,7 +49,7 @@ class VisuGUI_MagnitudeDlg : public QDialog
 
 public:
     VisuGUI_MagnitudeDlg();
-    ~VisuGUI_MagnitudeDlg();
+    ~VisuGUI_MagnitudeDlg() {};
 
     double getFactor() 
       { return ScalFact->value(); }
@@ -58,11 +60,15 @@ public:
       { return UseMagn->isChecked(); }
 
     void initFromPrsObject(VISU::DeformedShape_i* thePrs);
-    void storeToPrsObject(VISU::DeformedShape_i* thePrs);
+    int storeToPrsObject(VISU::DeformedShape_i* thePrs);
 
+protected slots:
+  void accept();
+   
  private:
     QAD_SpinBoxDbl* ScalFact;
     QCheckBox* UseMagn;
+    VisuGUI_ScalarBarPane* myScalarPane;
 };
 
 #endif // VISUGUI_MAGNITUDEDLG_H
index 3a2691ce4986f6e8d4899447cd93c8f03f51220c..019d436c5eec857e35ad9e4636f1cc12d3605087 100644 (file)
 #include <limits.h>
 #include <qlayout.h>
 #include <qvalidator.h>
+#include <qcolordialog.h>
 
 using namespace std;
 
-/*!
-  Constructor
-*/
-VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
-    : QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+
+
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane(QWidget * parent, bool SetPref):
+  QVBox(parent)
 {
-  setName( "VisuGUI_ScalarBarDlg" );
-  setCaption( SetPref ? tr( "Scalar Bar Preferences" ) : tr( "Scalar Bar Properties" ) );
-  setSizeGripEnabled( TRUE );
-  
   myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.10;  myVerH = 0.80;
   myHorX = 0.20;  myHorY = 0.01;  myHorW = 0.60;  myHorH = 0.12;
-  Imin = 0.0; Imax = 0.0; Fmin = 0.0; Fmax = 0.0; Rmin = 0.0; Rmax = 0.0;
+  Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
   myRangeMode = -1;
-  
-  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
-  TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
+
+  setSpacing(6);
+  //setMargin(11);
 
   // Range ============================================================
   RangeGroup = new QButtonGroup( tr( "Scalar range" ), this, "RangeGroup" );
@@ -112,7 +107,7 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
   RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
 
-  TopLayout->addWidget( RangeGroup );
+  //TopLayout->addWidget( RangeGroup );
 
   // Colors and Labels ========================================================
   QGroupBox* ColLabGroup = new QGroupBox( tr( "Colors and labels" ), this, "ColLabGroup" );
@@ -141,7 +136,7 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
   ColLabGroupLayout->addWidget( LabelSpin,  0, 3);
 
-  TopLayout->addWidget( ColLabGroup );
+  //TopLayout->addWidget( ColLabGroup );
 
   // Orientation ==========================================================
   QButtonGroup* OrientGroup = new QButtonGroup( tr( "Orientation" ), this, "OrientGroup" );
@@ -159,7 +154,7 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   OrientGroupLayout->addWidget( RBvert, 0, 0 );
   OrientGroupLayout->addWidget( RBhori, 0, 1 );
   
-  TopLayout->addWidget( OrientGroup );
+  //  TopLayout->addWidget( OrientGroup );
 
   // Origin ===============================================================
   QGroupBox* OriginGroup = new QGroupBox( tr( "Origin" ), this, "OriginGroup" );
@@ -188,7 +183,7 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   OriginGroupLayout->addWidget( YLabel, 0, 2);
   OriginGroupLayout->addWidget( YSpin,  0, 3);
 
-  TopLayout->addWidget( OriginGroup );
+  //TopLayout->addWidget( OriginGroup );
 
   // Dimensions =========================================================
   QGroupBox* DimGroup = new QGroupBox( tr( "Dimensions" ), this, "DimGroup" );
@@ -217,63 +212,38 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
   DimGroupLayout->addWidget( HeightLabel, 0, 2);
   DimGroupLayout->addWidget( HeightSpin,  0, 3);
 
-  TopLayout->addWidget( DimGroup );
+  //TopLayout->addWidget( DimGroup );
 
   // Save check box ===========================================================
+  QHBox* aSaveBox = new QHBox(this);
   if ( !SetPref ) {
-    CBSave = new QCheckBox( tr( "Save as default values" ), this, "CBSave" );
-    TopLayout->addWidget( CBSave );
+    CBSave = new QCheckBox( tr( "Save as default values" ), aSaveBox, "CBSave" );
+    //TopLayout->addWidget( CBSave );
   }
   else {
     CBSave = 0;
   }
-
-  // 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 );
-
-  TopLayout->addWidget( GroupButtons );
+  myTextBtn = new QPushButton("Text properties...", aSaveBox);
+  myTextDlg = new VisuGUI_TextPrefDlg(this);
+  myTextDlg->setTitleVisible(!SetPref);
 
   // signals and slots connections ===========================================
   connect( RangeGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeRange( 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( buttonOk,     SIGNAL( clicked() ),      this, SLOT( accept() ) );
-  connect( buttonCancel, SIGNAL( clicked() ),      this, SLOT( reject() ) );
+  connect( myTextBtn,    SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
 
   changeRange( 0 );
   changeDefaults( 0 );
-}
-
-/*!
-  Destructor
-*/
-VisuGUI_ScalarBarDlg::~VisuGUI_ScalarBarDlg()
-{
+  myIsStoreTextProp = false;
 }
 
 
 /**
  * Initializes dialog box values from resources
  */
-void VisuGUI_ScalarBarDlg::initFromResources() {
+void VisuGUI_ScalarBarPane::initFromResources() {
   int sbCol=64,sbLab=5,orient=1;
   float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
   float sbVmin=0., sbVmax=0.;
@@ -357,9 +327,105 @@ void VisuGUI_ScalarBarDlg::initFromResources() {
     sbVmax=0.;
   }
   
-  setRange( sbVmin, sbVmax, 0.0, 0.0, sbRange );
+  setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
   setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 1);
   setScalarBarData( sbCol, sbLab );
+
+  QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
+  if (aIsBoldTitle.isEmpty())
+    myTextDlg->setBoldTitle(true);
+  else
+    myTextDlg->setBoldTitle(aIsBoldTitle.compare("true") == 0);
+
+  QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
+  if (aIsItalicTitle.isEmpty())
+    myTextDlg->setItalicTitle(true);
+  else
+    myTextDlg->setItalicTitle(aIsItalicTitle.compare("true") == 0);
+
+  QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
+  if (aIsShadowTitle.isEmpty())
+    myTextDlg->setShadowTitle(true);
+  else
+    myTextDlg->setShadowTitle(aIsShadowTitle.compare("true") == 0);
+
+  QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
+  if (!aTitFontType.isEmpty()) {
+    switch (aTitFontType.toInt()) {
+    case 0: myTextDlg->setTitleFont(VTK_ARIAL); break;
+    case 1: myTextDlg->setTitleFont(VTK_COURIER); break;
+    case 2: myTextDlg->setTitleFont(VTK_TIMES); break;
+    }
+  } else {
+    myTextDlg->setTitleFont(VTK_ARIAL);
+  }
+  float R,G,B;
+  QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
+  R = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
+  if (R > 1) R = 1;
+  if (R < 0) R = 0;
+  
+  QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
+  G = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
+  if (G > 1) G = 1;
+  if (G < 0) G = 0;
+  
+  QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
+  B = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
+  if (B > 1) B = 1;
+  if (B < 0) B = 0;
+
+  myTextDlg->setTitleColor(QColor((int)(R*255.),
+                                 (int)(G*255.),
+                                 (int)(B*255.)));
+  ///
+
+  QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
+  if (aIsBoldLabel.isEmpty())
+    myTextDlg->setBoldLabel(true);
+  else
+    myTextDlg->setBoldLabel(aIsBoldLabel.compare("true") == 0);
+
+  QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
+  if (aIsItalicLabel.isEmpty())
+    myTextDlg->setItalicLabel(true);
+  else
+    myTextDlg->setItalicLabel(aIsItalicLabel.compare("true") == 0);
+
+  QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
+  if (aIsShadowLabel.isEmpty())
+    myTextDlg->setShadowLabel(true);
+  else
+    myTextDlg->setShadowLabel(aIsShadowLabel.compare("true") == 0);
+
+  QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
+  if (!aLblFontType.isEmpty()) {
+    switch (aLblFontType.toInt()) {
+    case 0: myTextDlg->setLabelFont(VTK_ARIAL); break;
+    case 1: myTextDlg->setLabelFont(VTK_COURIER); break;
+    case 2: myTextDlg->setLabelFont(VTK_TIMES); break;
+    }
+  } else {
+    myTextDlg->setLabelFont(VTK_ARIAL);
+  }  
+  QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
+  R = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
+  if (R > 1) R = 1;
+  if (R < 0) R = 0;
+  
+  QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
+  G = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
+  if (G > 1) G = 1;
+  if (G < 0) G = 0;
+  
+  QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
+  B = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
+  if (B > 1) B = 1;
+  if (B < 0) B = 0;
+
+  myTextDlg->setLabelColor(QColor((int)(R*255.),
+                                 (int)(G*255.),
+                                 (int)(B*255.)));
 }
 
 
@@ -367,7 +433,7 @@ void VisuGUI_ScalarBarDlg::initFromResources() {
 /**
  * Stores dialog values to resources
  */
-void VisuGUI_ScalarBarDlg::storeToResources() {
+void VisuGUI_ScalarBarPane::storeToResources() {
   int orient = (RBvert->isChecked())? 1 : 0;
   float sbX1   = XSpin->value();
   float sbY1   = YSpin->value();
@@ -416,20 +482,75 @@ void VisuGUI_ScalarBarDlg::storeToResources() {
     QAD_CONFIG->addSetting("Visu:SBScaling", "LOGARITHMIC");
   else
     QAD_CONFIG->addSetting("Visu:SBScaling", "LINEAR");
+
+  ////
+
+  if (myIsStoreTextProp) {
+    if (myTextDlg->isBoldTitle()) 
+      QAD_CONFIG->addSetting("Visu:IsBoldTitle","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsBoldTitle","false");
+    
+    if (myTextDlg->isItalicTitle()) 
+      QAD_CONFIG->addSetting("Visu:IsItalicTitle","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsItalicTitle","false");
+    
+    if (myTextDlg->isShadowTitle()) 
+      QAD_CONFIG->addSetting("Visu:IsShadowTitle","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsShadowTitle","false");
+    
+    switch (myTextDlg->getTitleFont()) {
+    case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:TitFontType",0); break;
+    case VTK_COURIER: QAD_CONFIG->addSetting("Visu:TitFontType",1); break;
+    case VTK_TIMES: QAD_CONFIG->addSetting("Visu:TitFontType",2); break;
+    }
+    QColor aColor = myTextDlg->getTitleColor();
+    QAD_CONFIG->addSetting("Visu:TitleColorR", aColor.red()/255.);
+    QAD_CONFIG->addSetting("Visu:TitleColorG", aColor.green()/255.);
+    QAD_CONFIG->addSetting("Visu:TitleColorB", aColor.blue()/255.);
+    ///
+    
+    if (myTextDlg->isBoldLabel()) 
+      QAD_CONFIG->addSetting("Visu:IsBoldLabel","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsBoldLabel","false");
+    
+    if (myTextDlg->isItalicLabel()) 
+      QAD_CONFIG->addSetting("Visu:IsItalicLabel","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsItalicLabel","false");
+    
+    if (myTextDlg->isShadowLabel()) 
+      QAD_CONFIG->addSetting("Visu:IsShadowLabel","true");
+    else
+      QAD_CONFIG->addSetting("Visu:IsShadowLabel","false");
+    
+    switch (myTextDlg->getLabelFont()) {
+    case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:LblFontType",0); break;
+    case VTK_COURIER: QAD_CONFIG->addSetting("Visu:LblFontType",1); break;
+    case VTK_TIMES: QAD_CONFIG->addSetting("Visu:LblFontType",2); break;
+    }
+    aColor = myTextDlg->getLabelColor();
+    QAD_CONFIG->addSetting("Visu:LabelColorR", aColor.red()/255.);
+    QAD_CONFIG->addSetting("Visu:LabelColorG", aColor.green()/255.);
+    QAD_CONFIG->addSetting("Visu:LabelColorB", aColor.blue()/255.);
+  }
 }
 
 
 /**
  * Initialise dialog box from presentation object
  */
-void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
+void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   initFromResources();
   myModeCombo->setCurrentItem(thePrs->GetScalarMode());
   setPosAndSize( thePrs->GetPosX(), 
                 thePrs->GetPosY(), 
                 thePrs->GetWidth(), 
                 thePrs->GetHeight(), 
-                thePrs->GetOrientation());
+                thePrs->GetBarOrientation());
   switch(thePrs->GetScaling()){
   case VISU::LOGARITHMIC : 
     setLogarithmic(true);
@@ -441,22 +562,43 @@ void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   thePrs->GetScalarMapPL()->GetSourceRange(aRange);
   Rmin = aRange[0]; Rmax = aRange[1];
   setRange( thePrs->GetMin(), thePrs->GetMax(), 
-           0.0, 0.0, thePrs->IsRangeFixed() );
+           /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
   setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
   bool isScalarMode = (thePrs->GetField()->myNbComp > 1);
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
+
+  myTextDlg->setTitleText(QString(thePrs->GetTitle()));
+
+  myTextDlg->setBoldTitle(thePrs->IsBoldTitle());
+  myTextDlg->setItalicTitle(thePrs->IsItalicTitle());
+  myTextDlg->setShadowTitle(thePrs->IsShadowTitle());
+  myTextDlg->setTitleFont(thePrs->GetTitFontType());
+  float R, G, B;
+  thePrs->GetTitleColor(&R, &G, &B);
+  myTextDlg->setTitleColor(QColor((int)(R*255.),
+                                 (int)(G*255.),
+                                 (int)(B*255.)));
+
+  myTextDlg->setBoldLabel(thePrs->IsBoldLabel());
+  myTextDlg->setItalicLabel(thePrs->IsItalicLabel());
+  myTextDlg->setShadowLabel(thePrs->IsShadowLabel());
+  myTextDlg->setLabelFont(thePrs->GetLblFontType());
+  thePrs->GetLabelColor(&R, &G, &B);
+  myTextDlg->setLabelColor(QColor((int)(R*255.),
+                                 (int)(G*255.),
+                                 (int)(B*255.)));
 }
 
 
 /**
  * Store values to presentation object
  */
-void VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
+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->SetOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+  thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
   if(isLogarithmic()) 
     thePrs->SetScaling(VISU::LOGARITHMIC); 
   else
@@ -471,6 +613,30 @@ void VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
   thePrs->SetLabels(LabelSpin->value());
    
   if (isToSave()) storeToResources();
+
+  if (myIsStoreTextProp) {
+    thePrs->SetTitle(myTextDlg->getTitleText().latin1());
+
+    thePrs->SetBoldTitle(myTextDlg->isBoldTitle());
+    thePrs->SetItalicTitle(myTextDlg->isItalicTitle());
+    thePrs->SetShadowTitle(myTextDlg->isShadowTitle());
+    thePrs->SetTitFontType(myTextDlg->getTitleFont());
+    QColor aTitColor = myTextDlg->getTitleColor();
+    thePrs->SetTitleColor(aTitColor.red()/255., 
+                         aTitColor.green()/255.,
+                         aTitColor.blue()/255.);
+
+    thePrs->SetBoldLabel(myTextDlg->isBoldLabel());
+    thePrs->SetItalicLabel(myTextDlg->isItalicLabel());
+    thePrs->SetShadowLabel(myTextDlg->isShadowLabel());
+    thePrs->SetLblFontType(myTextDlg->getLabelFont());
+    QColor aLblColor = myTextDlg->getLabelColor();
+    thePrs->SetLabelColor(aLblColor.red()/255., 
+                         aLblColor.green()/255.,
+                         aLblColor.blue()/255.);
+  }
+  
+  return 1;
 }
 
 
@@ -478,7 +644,7 @@ void VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
 /*!
   Called when orientation is changed
 */
-void VisuGUI_ScalarBarDlg::changeDefaults( int )
+void VisuGUI_ScalarBarPane::changeDefaults( int )
 {
   if ( RBvert->isChecked() ) {
     XSpin->setValue( myVerX );
@@ -497,7 +663,7 @@ void VisuGUI_ScalarBarDlg::changeDefaults( int )
 /*!
   Called when Range mode is changed
 */
-void VisuGUI_ScalarBarDlg::changeRange( int )
+void VisuGUI_ScalarBarPane::changeRange( int )
 {
   int mode = -1;
   if ( RBFrange->isChecked() )
@@ -534,7 +700,7 @@ void VisuGUI_ScalarBarDlg::changeRange( int )
 /*!
   Called when X,Y position is changed
 */
-void VisuGUI_ScalarBarDlg::XYChanged( double )
+void VisuGUI_ScalarBarPane::XYChanged( double )
 {
   QAD_SpinBoxDbl* snd = (QAD_SpinBoxDbl*)sender();
   if ( snd == XSpin ) {
@@ -548,9 +714,9 @@ void VisuGUI_ScalarBarDlg::XYChanged( double )
 /*!
   Sets default values and range mode
 */
-void VisuGUI_ScalarBarDlg::setRange( double imin, double imax, double fmin, double fmax, bool sbRange )
+void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
 {
-  Imin = imin; Imax = imax; Fmin = fmin; Fmax = fmax;
+  Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
   if ( RBIrange->isChecked() ) {
     MinEdit->setText( QString::number( Imin ) );
     MaxEdit->setText( QString::number( Imax ) );
@@ -570,7 +736,7 @@ void VisuGUI_ScalarBarDlg::setRange( double imin, double imax, double fmin, doub
 /*!
   Sets size and position
 */
-void VisuGUI_ScalarBarDlg::setPosAndSize( double x, double y, double w, double h, bool vert )
+void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
 {
   if ( vert ) {
     myVerX = x;
@@ -592,7 +758,7 @@ void VisuGUI_ScalarBarDlg::setPosAndSize( double x, double y, double w, double h
 /*!
   Sets colors and labels number
 */
-void VisuGUI_ScalarBarDlg::setScalarBarData( int colors, int labels ) 
+void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels ) 
 {
   ColorSpin->setValue( colors );
   LabelSpin->setValue( labels );
@@ -601,7 +767,7 @@ void VisuGUI_ScalarBarDlg::setScalarBarData( int colors, int labels )
 /*!
   Gets orientation
 */
-int  VisuGUI_ScalarBarDlg::getOrientation() 
+int  VisuGUI_ScalarBarPane::getOrientation() 
 {
   if (RBvert->isChecked() )
     return  1;
@@ -609,106 +775,12 @@ int  VisuGUI_ScalarBarDlg::getOrientation()
     return 0;
 }
 
-/*!
-  Gets Scalar Bar's x position
-*/
-double VisuGUI_ScalarBarDlg::getX()
-{
-  return XSpin->value();
-}
-
-/*!
-  Gets Scalar Bar's y position
-*/
-double VisuGUI_ScalarBarDlg::getY()
-{
-  return YSpin->value();
-}
-
-/*!
-  Gets Scalar Bar's width
-*/
-double VisuGUI_ScalarBarDlg::getWidth()
-{
-  return WidthSpin->value();
-}
-
-/*!
-  Gets Scalar Bar's height
-*/
-double VisuGUI_ScalarBarDlg::getHeight()
-{
-  return HeightSpin->value();
-}
-
-/*!
-  Gets Scalar Bar's number of colors
-*/
-int VisuGUI_ScalarBarDlg::getNbColors()
-{
-  return ColorSpin->value();
-}
-
-/*!
-  Gets Scalar Bar's number of labels
-*/
-int VisuGUI_ScalarBarDlg::getNbLabels()
-{
-  return LabelSpin->value();
-}
-
-/*!
-  Returns true if imposed range is used
-*/
-bool VisuGUI_ScalarBarDlg::isIRange()
-{
-  return RBIrange->isChecked();
-}
-
-/*!
-  Gets Min value
-*/
-double VisuGUI_ScalarBarDlg::getMin()
-{
-  return MinEdit->text().toDouble();
-}
 
-/*!
-  Gets Max value
-*/
-double VisuGUI_ScalarBarDlg::getMax()
-{
-  return MaxEdit->text().toDouble();
-}
-
-/*!
-  return true if "save pref" flag is on
-*/
-bool VisuGUI_ScalarBarDlg::isToSave()
-{
-  return CBSave ? CBSave->isChecked() : false;
-}
-
-/*!
-  Returns true if "Logarithmic scaling" check box is on
-*/
-bool VisuGUI_ScalarBarDlg::isLogarithmic()
-{
-  return CBLog->isChecked();
-}
-
-/*!
-  Sets "Logarithmic scaling" check box on/off
-*/
-void VisuGUI_ScalarBarDlg::setLogarithmic( bool on )
-{
-  CBLog->setChecked( on );
-}
 
 /*!
   Called when <OK> button is clicked, validates data and closes dialog
 */
-void VisuGUI_ScalarBarDlg::accept()
+bool VisuGUI_ScalarBarPane::check()
 {
   double minVal = MinEdit->text().toDouble();
   double maxVal = MaxEdit->text().toDouble();
@@ -717,7 +789,7 @@ void VisuGUI_ScalarBarDlg::accept()
       QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
                             tr("MSG_MINMAX_VALUES"),
                             tr("VISU_BUT_OK"));
-      return;
+      return false;
     }
   }
   // check if logarithmic mode is on and check imposed range to not contain negative values
@@ -731,7 +803,7 @@ void VisuGUI_ScalarBarDlg::accept()
                                tr("VISU_WARNING"),
                                tr("WRN_LOGARITHMIC_RANGE"),
                                tr("VISU_BUT_OK"));
-       return;
+       return false;
       }
     }
     else {
@@ -747,9 +819,224 @@ void VisuGUI_ScalarBarDlg::accept()
        changeRange(1);
        //MinEdit->setText( QString::number( Rmin ) );
        //MaxEdit->setText( QString::number( Rmax ) );
-       return;
+       return false;
       }
     }
   }
-  QDialog::accept();
+  return true;
 }
+
+
+void VisuGUI_ScalarBarPane::onTextPref() {
+  myIsStoreTextProp = myTextDlg->exec();
+}
+
+
+
+
+
+//#######################################################################################
+
+
+/*!
+  Constructor
+*/
+VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
+    : QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  setName( "VisuGUI_ScalarBarDlg" );
+  setCaption( SetPref ? tr( "Scalar Bar Preferences" ) : tr( "Scalar Bar Properties" ) );
+  setSizeGripEnabled( TRUE );
+  
+  QVBoxLayout* TopLayout = new QVBoxLayout(this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref);
+  TopLayout->addWidget(myScalarPane);
+
+  // 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 );
+
+  TopLayout->addWidget( GroupButtons );
+
+  connect( buttonOk,     SIGNAL( clicked() ),      this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ),      this, SLOT( reject() ) );
+
+}
+
+
+
+/*!
+  Called when <OK> button is clicked, validates data and closes dialog
+*/
+void VisuGUI_ScalarBarDlg::accept()
+{
+  if (myScalarPane->check()) QDialog::accept();
+}
+
+
+
+
+
+//#######################################################################################
+
+
+
+
+
+VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg(QWidget* parent) :
+  QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  setName( "VisuGUI_TextPrefDlg" );
+  setCaption( tr("TIT_TEXT_PREF") );
+  setSizeGripEnabled( TRUE );
+  
+  QVBoxLayout* TopLayout = new QVBoxLayout(this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  QGroupBox* aTitleGrp = new QGroupBox( this );
+  aTitleGrp->setTitle(tr("LBL_TITLE"));
+  aTitleGrp->setColumnLayout(0, Qt::Vertical );
+  QGridLayout* aTitleLayout = new QGridLayout( aTitleGrp->layout() );
+  aTitleLayout->setSpacing( 6 );
+  aTitleLayout->setMargin( 3 );
+
+  myTitleEdt = new QLineEdit(aTitleGrp);
+  aTitleLayout->addMultiCellWidget(myTitleEdt, 0, 0, 0, 4);
+
+  QStrList aFontsLst;
+  aFontsLst.append("Arial");
+  aFontsLst.append("Courier");
+  aFontsLst.append("Times");
+
+  myTitColor = new QToolButton(aTitleGrp);
+  connect( myTitColor, SIGNAL(clicked()), this, SLOT(setTitleColor()) );
+  aTitleLayout->addWidget(myTitColor, 1, 0);
+
+  myTitFontCombo = new QComboBox(aTitleGrp);
+  myTitFontCombo->insertStrList(aFontsLst);
+  aTitleLayout->addWidget(myTitFontCombo, 1, 1);
+  
+  myTitBoldChk = new QCheckBox(tr("LBL_BOLD"), aTitleGrp);
+  aTitleLayout->addWidget(myTitBoldChk, 1, 2);
+
+  myTitItalicChk = new QCheckBox(tr("LBL_ITALIC"), aTitleGrp);
+  aTitleLayout->addWidget(myTitItalicChk, 1, 3);
+
+  myTitShadowChk = new QCheckBox(tr("LBL_SHADOW"), aTitleGrp);
+  aTitleLayout->addWidget(myTitShadowChk, 1, 4);
+
+  TopLayout->addWidget( aTitleGrp );
+
+  QGroupBox* aLabelsGrp = new QGroupBox( this );
+  aLabelsGrp->setTitle(tr("LBL_LABELS"));
+  aLabelsGrp->setColumnLayout(0, Qt::Vertical );
+  QGridLayout* aLabelLayout = new QGridLayout( aLabelsGrp->layout() );
+  aLabelLayout->setSpacing( 6 );
+  aLabelLayout->setMargin( 3 );
+
+  myLblColor = new QToolButton(aLabelsGrp);
+  connect( myLblColor, SIGNAL(clicked()), this, SLOT(setLabelColor()) );
+  aLabelLayout->addWidget(myLblColor, 0, 0);
+
+  myLblFontCombo = new QComboBox(aLabelsGrp);
+  myLblFontCombo->insertStrList(aFontsLst);
+  aLabelLayout->addWidget(myLblFontCombo, 0, 1);
+  
+  myLblBoldChk = new QCheckBox(tr("LBL_BOLD"), aLabelsGrp);
+  aLabelLayout->addWidget(myLblBoldChk, 0, 2);
+
+  myLblItalicChk = new QCheckBox(tr("LBL_ITALIC"), aLabelsGrp);
+  aLabelLayout->addWidget(myLblItalicChk, 0, 3);
+
+  myLblShadowChk = new QCheckBox(tr("LBL_SHADOW"), aLabelsGrp);
+  aLabelLayout->addWidget(myLblShadowChk, 0, 4);
+
+  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 );
+
+  TopLayout->addWidget( GroupButtons );
+
+  connect( buttonOk,     SIGNAL( clicked() ),      this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ),      this, SLOT( reject() ) );
+}
+
+
+void VisuGUI_TextPrefDlg::setTitleColor() {
+  QColor aColor = QColorDialog::getColor( getTitleColor(), this );
+  if (aColor.isValid()) setTitleColor(aColor);
+}
+
+void VisuGUI_TextPrefDlg::setLabelColor() {
+  QColor aColor = QColorDialog::getColor( getLabelColor(), this );
+  if (aColor.isValid()) setLabelColor(aColor);
+}
+
+
+
+#define GETFONT(FuncName, Control) \
+int VisuGUI_TextPrefDlg::FuncName() \
+{ \
+  switch (Control->currentItem()) { \
+  case 0: return VTK_ARIAL; \
+  case 1: return VTK_COURIER; \
+  case 2: return VTK_TIMES; \
+  } \
+}
+
+#define SETFONT(FuncName, Control) \
+void VisuGUI_TextPrefDlg::FuncName(int theFont) \
+{ \
+  switch (theFont) { \
+  case VTK_ARIAL: Control->setCurrentItem(0); break; \
+  case VTK_COURIER: Control->setCurrentItem(1); break; \
+  case VTK_TIMES: Control->setCurrentItem(2); break; \
+  } \
+}
+
+GETFONT(getTitleFont, myTitFontCombo);
+SETFONT(setTitleFont, myTitFontCombo);
+
+GETFONT(getLabelFont, myLblFontCombo);
+SETFONT(setLabelFont, myLblFontCombo);
+
+#undef GETFONT
+#undef SETFONT
index 7c2cf9bb5fc574a8aaaf5675a6824282ea188ad9..21bcd89779424419c4b2feee16faac71b32c6f56 100644 (file)
 #include <qspinbox.h>
 #include <qlineedit.h>
 #include <qcombobox.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
 
-namespace VISU{
-  class ScalarMap_i;
-}
+#include "VISU_ScalarMap_i.hh"
 
-class VisuGUI_ScalarBarDlg : public QDialog
-{ 
+
+class VisuGUI_TextPrefDlg: public QDialog 
+{
     Q_OBJECT
 
 public:
-    VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
-    ~VisuGUI_ScalarBarDlg();
+    VisuGUI_TextPrefDlg(QWidget* parent);
+    ~VisuGUI_TextPrefDlg() {};
+
+    bool isBoldTitle() { return myTitBoldChk->isChecked();}
+    void setBoldTitle(bool isBold) { myTitBoldChk->setChecked(isBold);}
+
+    bool isItalicTitle() { return myTitItalicChk->isChecked();}
+    void setItalicTitle(bool isItalic) { myTitItalicChk->setChecked(isItalic);}
+
+    bool isShadowTitle() { return myTitShadowChk->isChecked();}
+    void setShadowTitle(bool isShadow) { myTitShadowChk->setChecked(isShadow);}
+
+    QString getTitleText() { return myTitleEdt->text();}
+    void setTitleText(QString theText) { myTitleEdt->setText(theText);}
+
+    QColor getTitleColor() { return myTitColor->paletteBackgroundColor();}
+    void setTitleColor(QColor theColor) { myTitColor->setPaletteBackgroundColor(theColor);}
+
+    int getTitleFont();
+    void setTitleFont(int theFont);
+
+
+    bool isBoldLabel()   { return myLblBoldChk->isChecked();}
+    void setBoldLabel(bool isBold)   { myLblBoldChk->setChecked(isBold);}
 
-    void    setRange( double imin, double imax, double fmin, double fmax, bool sbRange );
-    bool    isIRange();
-    double  getMin();
-    double  getMax();
+    bool isItalicLabel() { return myLblItalicChk->isChecked();}
+    void setItalicLabel(bool isItalic) { myLblItalicChk->setChecked(isItalic);}
+
+    bool isShadowLabel() { return myLblShadowChk->isChecked();}
+    void setShadowLabel(bool isShadow) { myLblShadowChk->setChecked(isShadow);}
+
+    QColor getLabelColor() { return myLblColor->paletteBackgroundColor();}
+    void setLabelColor(QColor theColor) { myLblColor->setPaletteBackgroundColor(theColor);}
+
+    int getLabelFont();
+    void setLabelFont(int theFont);
+
+    void setTitleVisible(bool isVisible) 
+      { (isVisible)? myTitleEdt->show() : myTitleEdt->hide();}
+
+private slots:
+  void setTitleColor();
+  void setLabelColor(); 
+
+ private:
+    QLineEdit* myTitleEdt;
+    QComboBox* myTitFontCombo;
+    QCheckBox* myTitBoldChk;
+    QCheckBox* myTitItalicChk;
+    QCheckBox* myTitShadowChk;
+    QToolButton* myTitColor;
+
+    QComboBox* myLblFontCombo;
+    QCheckBox* myLblBoldChk;
+    QCheckBox* myLblItalicChk;
+    QCheckBox* myLblShadowChk;
+    QToolButton* myLblColor;
+};
+
+
+class VisuGUI_ScalarBarPane : public QVBox
+{
+    Q_OBJECT
+
+public:
+    VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
+    ~VisuGUI_ScalarBarPane() {};
+
+    void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+    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();
-    double  getY();
-    double  getWidth();
-    double  getHeight();
+    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();
-    int     getNbLabels();
-    bool    isLogarithmic();
-    void    setLogarithmic( bool on );
-    bool    isToSave();
+    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);
-    void storeToPrsObject(VISU::ScalarMap_i* thePrs);
+    int storeToPrsObject(VISU::ScalarMap_i* thePrs);
 
+    bool check();
 
 protected:
     QButtonGroup*   RangeGroup;
@@ -101,19 +168,47 @@ protected:
     QCheckBox*      CBLog;
     QLabel*         myModeLbl;
     QComboBox*      myModeCombo;
+    QPushButton*    myTextBtn;
+    VisuGUI_TextPrefDlg* myTextDlg;
     
-    double          Imin,   Imax,   Fmin,   Fmax,   Rmin,   Rmax;
+    double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
     double          myHorX, myHorY, myHorW, myHorH;
     double          myVerX, myVerY, myVerW, myVerH;
     int             myRangeMode;
-
-protected slots:
-    void accept();
+    bool myIsStoreTextProp;
 
 private slots:
     void changeDefaults( int );
     void changeRange( int );
     void XYChanged( double );
+    void onTextPref();
+};
+
+
+
+class VisuGUI_ScalarBarDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
+    ~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);}
+
+
+protected slots:
+    void accept();
+
+ protected:
+    VisuGUI_ScalarBarPane* myScalarPane;
+
 };
 
 #endif // VISUGUI_SCALARBARDLG_H
index 4bd329a68388351af91fbe0f4454bd16b5e1e2d3..72fd9ef5c760d37835c2ddf24058526e9f961e88 100644 (file)
@@ -32,6 +32,11 @@ using namespace std;
 #include "SALOME_Selection.h"
 #include "VISU_Actor.h"
 #include "VISU_PrsObject_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_PipeLine.hxx"
+#include "VisuGUI.h"
+#include "QAD_MessageBox.h"
+#include "VTKViewer_ViewFrame.h"
 
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
@@ -40,98 +45,374 @@ using namespace std;
 #include <qlabel.h>
 #include <qspinbox.h>
 #include <qlistbox.h>
+#include <qlayout.h>
+#include <qhbuttongroup.h>
+#include <qradiobutton.h>
 
 #include <vtkDataSet.h>
 #include <vtkCell.h>
+#include <qvalidator.h>
 
-#include "VisuGUI_CellsResultsDlg.h"
-#include "VisuGUI_PointsResultsDlg.h"
 #include "VisuGUI_Selection.h"
 
-template<class TData, class TDialog> void SetMessage(TData* theData, int theId, TDialog* theDialog){
-  // Scalar result
-  QString Msg_1;
-  if (vtkDataArray *Scalar = theData->GetScalars()){
-    float aVal = Scalar->GetTuple1(theId);
-    Msg_1.sprintf("%6.3g",aVal);
-  }else
-    Msg_1.sprintf("NO DATA");
-  theDialog->ScalValue->setText( Msg_1.latin1() );
+
+extern VisuGUI *visuGUI;
+
+
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg()    
+  : QDialog( QAD_Application::getDesktop(), 0, false, 
+            WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  setCaption( "Data on elements" );
+  setSizeGripEnabled( TRUE );
+  
+  QGridLayout* TopLayout = new QGridLayout(this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+  TopLayout->setRowStretch(0, 0);
+  TopLayout->setRowStretch(1, 0);
+  TopLayout->setRowStretch(2, 1);
+  TopLayout->setRowStretch(3, 0);
+
+  QHButtonGroup* aTypeBox = new QHButtonGroup("Selection", this);  
+  
+  QRadioButton* aPointBtn = new QRadioButton("Point", aTypeBox);
+  QRadioButton* aCellBtn = new QRadioButton("Cell", aTypeBox);
+  QRadioButton* aActorBtn = new QRadioButton("Actor", aTypeBox);
+  aPointBtn->setChecked(true);
+
+  connect(aTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int)));
+  
+  TopLayout->addWidget(aTypeBox, 0, 0);
+
+  QWidget* aNamePane = new QWidget(this);
+  QGridLayout* aNameLay = new QGridLayout(aNamePane);
+
+  QLabel* aMeshLbl = new QLabel("Mesh name: ", aNamePane);
+  myMeshName = new QLabel(aNamePane);
+
+  QLabel* aFieldLbl = new QLabel("Field name: ", aNamePane);
+  myFieldName = new QLabel(aNamePane);
+
+  aNameLay->addWidget(aMeshLbl, 0, 0);
+  aNameLay->addWidget(myMeshName, 0, 1);
+  aNameLay->addWidget(aFieldLbl, 1, 0);
+  aNameLay->addWidget(myFieldName, 1, 1);
+
+  TopLayout->addWidget(aNamePane, 1, 0);
+
+  myWidgetStack = new QWidgetStack(this);
+  
+  // Create Points pane
+  myPointsPane = new QVBox(myWidgetStack);
+  myPointsPane->layout()->setSpacing(6);
+  
+  QGroupBox* aDataGrp = new QGroupBox(2, Qt::Horizontal, "Data of Point", myPointsPane);
+  aDataGrp->layout()->setSpacing(6);
+
+  QLabel* aIDLbl = new QLabel("ID:", aDataGrp);
+  myIDValLbl = new QLineEdit("", aDataGrp);
+  QIntValidator* aIntValidator = new QIntValidator(myIDValLbl);
+  aIntValidator->setBottom(0);
+  myIDValLbl->setValidator(aIntValidator);
+  connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&)));
+
+  QLabel* aValueLbl = new QLabel("Scalar Value:", aDataGrp);
+  myScalarValLbl = new QLabel("", aDataGrp);
+  QLabel* aVectorLbl = new QLabel("Vector Value:", aDataGrp); 
+  myVectorValLbl = new QLabel("", aDataGrp);
+  myVectorValLbl->setMinimumWidth(150);
+
+  QGroupBox* aCoordGrp = new QGroupBox(2, Qt::Horizontal, "Coordinates", myPointsPane);
+  aCoordGrp->layout()->setSpacing(6);
+  QLabel* aXLbl = new QLabel("X:", aCoordGrp);
+  myXValLbl = new QLabel("", aCoordGrp);
+  QLabel* aYLbl = new QLabel("Y:", aCoordGrp);
+  myYValLbl = new QLabel("", aCoordGrp);
+  QLabel* aZLbl = new QLabel("Z:",aCoordGrp );  
+  myZValLbl = new QLabel("", aCoordGrp);
+
+
+  myWidgetStack->addWidget(myPointsPane, 0);
+  
+  // Create Cells pane
+  myCellsPane = new QWidget(myWidgetStack);
+  QGridLayout* aCellLayout = new QGridLayout(myCellsPane);
+  aCellLayout->setSpacing(6);
+  aCellLayout->setRowStretch(0, 0);
+  aCellLayout->setRowStretch(1, 1);
+
+  QGroupBox* aCellGrp = new QGroupBox(2, Qt::Horizontal, "Data of Cell", myCellsPane);
+  
+  QLabel* aCellIDLbl = new QLabel("ID:", aCellGrp);
+  myCellIDValLbl = new QLineEdit("", aCellGrp);
+  myCellIDValLbl->setValidator(aIntValidator);
+  connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&)));
+
+  QLabel* aCellValueLbl = new QLabel("Scalar Value:", aCellGrp);
+  myCellScalarValLbl = new QLabel("", aCellGrp);
+  QLabel* aCellVectorLbl = new QLabel("Vector Value:", aCellGrp);  
+  myCellVectorValLbl = new QLabel("", aCellGrp);
+
+  aCellLayout->addWidget(aCellGrp, 0, 0);
+
+  myListPoints = new QTable(myCellsPane);
+  myListPoints->setReadOnly(true);
+  myListPoints->setNumCols(6);
+  myListPoints->setNumRows(0);
+  myListPoints->setColumnWidth(0, 40);
+  myListPoints->setColumnWidth(1, 40);
+  myListPoints->setColumnWidth(2, 40);
+  myListPoints->setColumnWidth(3, 40);
+  myListPoints->setSelectionMode(QTable::NoSelection);
+  QHeader* aHeader = myListPoints->horizontalHeader();
+  aHeader->setLabel( 0, "ID" );
+  aHeader->setLabel( 1, "X" );
+  aHeader->setLabel( 2, "Y" );
+  aHeader->setLabel( 3, "Z" );
+  aHeader->setLabel( 4, "Scalar" );
+  aHeader->setLabel( 5, "Vector" );
+
+  aCellLayout->addWidget(myListPoints, 1, 0);
+
+  myWidgetStack->addWidget(myCellsPane, 1);
   
-  // Vector result
-  QString Msg_2;
-  if (vtkDataArray *Vector = theData->GetVectors()){
-    float *aVal = Vector->GetTuple3(theId);
-    Msg_2.sprintf("%6.3g; %6.3g; %6.3g",aVal[0],aVal[1],aVal[2]);
-  }else
-    Msg_2.sprintf("NO DATA");
-  theDialog->VectTxt->setText( Msg_2.latin1() );
+  // Actor Pane
+  myActorsPane = new QVBox(myWidgetStack);
+  myActorsPane->layout()->setSpacing(6);
+
+  QGroupBox* aPosGrp = new QGroupBox(2, Qt::Horizontal, "Position", myActorsPane);
+  aPosGrp->layout()->setSpacing(6);
+  QLabel* aXPosLbl = new QLabel("X:", aPosGrp);
+  myXPosLbl = new QLabel("0", aPosGrp);
+  QLabel* aYPosLbl = new QLabel("Y:", aPosGrp);
+  myYPosLbl = new QLabel("0", aPosGrp);
+  QLabel* aZPosLbl = new QLabel("Z:", aPosGrp);  
+  myZPosLbl = new QLabel("0", aPosGrp);
+
+  QGroupBox* aSizeGrp = new QGroupBox(2, Qt::Horizontal, "Size", myActorsPane);
+  aSizeGrp->layout()->setSpacing(6);
+  QLabel* aXSizeLbl = new QLabel("dX:", aSizeGrp);
+  myDXLbl = new QLabel("0", aSizeGrp);
+  QLabel* aYSizeLbl = new QLabel("dY:", aSizeGrp);
+  myDYLbl = new QLabel("0", aSizeGrp);
+  QLabel* aZSizeLbl = new QLabel("dZ:",aSizeGrp );  
+  myDZLbl = new QLabel("0", aSizeGrp);
+
+  myWidgetStack->addWidget(myActorsPane, 2);
+
+
+  TopLayout->addWidget(myWidgetStack, 2, 0);
+
+  // Create buttons group
+  QHBox* aBtnBox = new QHBox(this);
+  QHBoxLayout* aBtnLayout = (QHBoxLayout*)aBtnBox->layout(); 
+  aBtnLayout->addStretch();
+
+  QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+  connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
+  
+  TopLayout->addWidget(aBtnBox, 3, 0);
+
+  mySelection = SALOME_Selection::Selection(visuGUI->GetActiveStudy()->getSelection());
+  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
+  
+  onSelectionChange(0);
 }
 
-// ============================================================================================ //
-//                                     PICKING CELL                                            //
-// ============================================================================================ //
-
-void VisuGUI_Selection::PickingCell(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId){
-  if(theId >= 0){
-    VisuGUI_CellsResultsDlg *aResultsDlg = new VisuGUI_CellsResultsDlg(QAD_Application::getDesktop(), 0, TRUE, 0); 
-    vtkCellData *aData = theDataSet->GetCellData();
-    vtkCell *aCell = theDataSet->GetCell(theId);
-
-    float aPntCoord[12][3];
-    int aNbOfPoints = aCell->GetNumberOfPoints();
-    vtkIdList *aPointList = aCell->GetPointIds();
-    QListViewItem* anItem = NULL;
-    for(int i = 0; i < aNbOfPoints; i++){
-      float aCoord[3];
-      int idCurrent = aPointList->GetId(i);
-      theDataSet->GetPoint(idCurrent,aCoord);
-      for (int j=0; j<3; j++)
-       aPntCoord[i][j]=aCoord[j];
-      anItem = new QListViewItem(aResultsDlg->ListPoints, 
-                                anItem, 
-                                QString::number( idCurrent ),
-                                QString::number( aPntCoord[i][0] ),
-                                QString::number( aPntCoord[i][1] ),
-                                QString::number( aPntCoord[i][2] ));
-    }
 
-    SetMessage(aData,theId,aResultsDlg);
+void VisuGUI_SelectionDlg::onSelectionChange(int theId) {
+  clearFields();
+  switch (theId) {
+  case 0: // Points
+    myWidgetStack->raiseWidget(myPointsPane);    
+    QAD_Application::getDesktop()->SetSelectionMode(1, true);
+    break;
+  case 1: // Cells
+    myWidgetStack->raiseWidget(myCellsPane);
+    QAD_Application::getDesktop()->SetSelectionMode(3, true);
+    break;
+  case 2: // Actor
+    myWidgetStack->raiseWidget(myActorsPane);
+    QAD_Application::getDesktop()->SetSelectionMode(4, true);  
+  }
+  onSelectionEvent();
+//   if (VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame())
+//     vf->Repaint();
+}
+
 
-    aResultsDlg->IdCell->setText( QString::number( theId ) );
-    aResultsDlg->NbPoint->setText( QString::number( aNbOfPoints ) );
-    aResultsDlg->exec(); 
-    delete aResultsDlg;
+void VisuGUI_SelectionDlg::closeEvent(QCloseEvent* theEvent) {  
+  QAD_Application::getDesktop()->SetSelectionMode(4, true);
+  disconnect(mySelection,0,0,0);
+  QDialog::closeEvent(theEvent);
+}
+
+template<class TData> QString getValue(TData* theData, int theId){
+  if (vtkDataArray *aScalar = theData->GetScalars()){
+    float aVal = aScalar->GetTuple1(theId);
+    return QString::number(aVal);
+  } else {
+    return QString("No data");     
   }
 }
 
+template<class TData> QString getVector(TData* theData, int theId){
+  if (vtkDataArray *aVector = theData->GetVectors()) {
+    float *aVal = aVector->GetTuple3(theId);
+    return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]); 
+  } else {
+    return QString("No data");
+  }
+}
 
-// ============================================================================================ //
-//                                     PICKING POINT                                           //
-// ============================================================================================ //
 
-void VisuGUI_Selection::PickingPoint(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId){
-  if(theId >= 0){
-    VisuGUI_PointsResultsDlg *aResultsDlg = new VisuGUI_PointsResultsDlg(QAD_Application::getDesktop(), 0, TRUE, 0); 
-    vtkPointData *aData = theDataSet->GetPointData();
+#define ABS(a) (a>=0)?a:-a
 
-    float Coord[3];
-    theDataSet->GetPoint(theId,Coord);
-    aResultsDlg->CoordX->setText( QString::number( Coord[0] ) );
-    aResultsDlg->CoordY->setText( QString::number( Coord[1] ) );
-    aResultsDlg->CoordZ->setText( QString::number( Coord[2] ) );
-    aResultsDlg->IdPoint->setText( QString::number(theId) );
+void VisuGUI_SelectionDlg::onSelectionEvent() {
+  Handle(SALOME_InteractiveObject) anIO;
+  int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
+  if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){
+    SALOMEDS::SObject_var aSObject = visuGUI->GetStudyDocument()->FindObjectID(anIO->getEntry());
+    QString aMeshName = VisuGUI::getValue(aSObject, "myMeshName");
+    QString aFieldName = VisuGUI::getValue(aSObject, "myFieldName");
+    myMeshName->setText((aMeshName == "NULL")? QString("No name") : aMeshName);
+    myFieldName->setText((aFieldName == "NULL")? QString("No name") : aFieldName);
     
-    SetMessage(aData,theId,aResultsDlg);
+    VISU_Actor* anVISUActor = visuGUI->GetActor(aPrs3d);
+    if (anVISUActor) {
+      float aCoord[6];
+      anVISUActor->GetBounds(aCoord);
+      myXPosLbl->setText(QString::number( aCoord[0] ));
+      myYPosLbl->setText(QString::number( aCoord[2] ));
+      myZPosLbl->setText(QString::number( aCoord[4] ));
+      
+      myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) ));
+      myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) ));
+      myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) ));
+    }
+    TColStd_MapOfInteger aMapIndex;
+    mySelection->GetIndex(anIO, aMapIndex);
+    TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
+    if(anIter.More()){
+      VISU_Actor* anActor = visuGUI->GetActor(aPrs3d);  
+      vtkDataSet* aDataSet = anActor->GetMapper()->GetInput();
+      //      vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput();
+      int aID = anIter.Key();
+      vtkPointData* aPntData = aDataSet->GetPointData();
+      
+      switch (aType) {
+      case 0:
+       {
+         float aCoord[3];
+         aDataSet->GetPoint(aID, aCoord);
+         myXValLbl->setText( QString::number( aCoord[0] ) );
+         myYValLbl->setText( QString::number( aCoord[1] ) );
+         myZValLbl->setText( QString::number( aCoord[2] ) );
+         myIDValLbl->setText( QString::number(aID) );
+         myScalarValLbl->setText(getValue(aPntData, aID));
+         myVectorValLbl->setText(getVector(aPntData, aID));
+         //      adjustSize();
+         //qApp->processEvents();
+       }
+       break;
+      case 1:
+       {
+         int aMaxId = aDataSet->GetNumberOfCells();
+         //cout<<"### MaxId="<<aMaxId<<endl;
+         //cout<<"### SelectedId="<<aID<<endl;
+         vtkCellData* aData = aDataSet->GetCellData();
+         vtkCell* aCell = aDataSet->GetCell(aID);
+         if (aCell == NULL) return;
+
+         int aNbOfPoints = aCell->GetNumberOfPoints();
+         if (aNbOfPoints <=1 ) { // Cell is point
+           clearFields();
+           return;
+         }
+         
+         myCellIDValLbl->setText( QString::number(aID) );
+         myCellScalarValLbl->setText(getValue(aData, aID));
+         myCellVectorValLbl->setText(getVector(aData, aID));
+         
+         float aCoord[3];
+         vtkIdList *aPointList = aCell->GetPointIds();
+         QListViewItem* anItem = NULL;
+         myListPoints->setNumRows(aNbOfPoints);
+         for(int i = 0; i < aNbOfPoints; i++){
+           int idCurrent = aPointList->GetId(i);
+           aDataSet->GetPoint(idCurrent,aCoord);
+           myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
+           myListPoints->setText(i, 0, QString::number( idCurrent ));
+           myListPoints->setText(i, 1, QString::number( aCoord[0] ));
+           myListPoints->setText(i, 2, QString::number( aCoord[1] ));
+           myListPoints->setText(i, 3, QString::number( aCoord[2] ));
+           myListPoints->setText(i, 4, getValue(aPntData, idCurrent));
+           myListPoints->setText(i, 5, getVector(aPntData, idCurrent));
+         }
+       }
+       break;
+      }
+    }
+  } else {
+    clearFields();
+  }
+}
+#undef ABS
+
 
-    aResultsDlg->exec(); 
-    delete aResultsDlg;
+void VisuGUI_SelectionDlg::clearFields() {
+  int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
+  switch (aType) {
+  case 0:
+    myXValLbl->setText( "" );
+    myYValLbl->setText( "" );
+    myZValLbl->setText( "" );
+    myIDValLbl->setText( "" );
+    myScalarValLbl->setText("");
+    myVectorValLbl->setText("");
+    break;
+  case 1:
+    myCellIDValLbl->setText( "" );
+    myCellScalarValLbl->setText("");
+    myCellVectorValLbl->setText("");
+    myListPoints->setNumRows(0);
+    break;
+  case 2:
+    myXPosLbl->setText("");
+    myYPosLbl->setText("");
+    myZPosLbl->setText("");      
+    myDXLbl->setText("");
+    myDYLbl->setText("");
+    myDZLbl->setText("");
   }
 }
 
-void VisuGUI_Selection::Highlight(QAD_Study *theActiveStudy, const Handle(SALOME_InteractiveObject)& theIO, int theId){
-  MESSAGE("HighlightCell");
-  SALOME_Selection *aSel = SALOME_Selection::Selection(theActiveStudy->getSelection());
-  aSel->AddIObject(theIO);
-  aSel->AddOrRemoveIndex(theIO, theId, false);
-}                                     
+
+#define SELECTBYNUM(METHODNAME, DATASETMETHOD) \
+void VisuGUI_SelectionDlg::METHODNAME(const QString& theText) { \
+  int anId = theText.toInt(); \
+  Handle(SALOME_InteractiveObject) anIO; \
+  if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){ \
+    TColStd_MapOfInteger aMapIndex; \
+    mySelection->GetIndex(anIO, aMapIndex); \
+    TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex); \
+    if(anIter.More()){ \
+      vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput(); \
+      int aMaxId = aDataSet->DATASETMETHOD(); \
+      if(0 <= anId && anId < aMaxId){ \
+       mySelection->AddIObject(anIO); \
+       mySelection->AddOrRemoveIndex(anIO, anId, false); \
+      } \
+    } \
+  } else { \
+    myMeshName->setText(tr ("WRN_NO_AVAILABLE_DATA")); \
+    myFieldName->setText(""); \
+  } \
+}
+
+SELECTBYNUM(onPointIdEdit, GetNumberOfPoints);
+SELECTBYNUM(onCellIdEdit, GetNumberOfCells);
+
+#undef SELECTBYNUM
+
index 0148a53bbfa75b9c76ef3a323b242f247815af18..67bbae1b2f9e523b3438354c72b53cee49d45989 100644 (file)
 #include "SALOMEconfig.h"
 #include "QAD_Desktop.h"
 #include "VISU_Actor.h"
+#include "SALOME_Selection.h"
        
 #include <vtkDataSet.h>
-#define SelectionPoint 1
-#define SelectionEdge  2
-#define SelectionCell  3
-#define SelectionActor 4
-
-namespace VisuGUI_Selection{
-  void PickingCell(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
-  void PickingPoint(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
-  void Highlight(QAD_Study *theActiveStudy, const Handle(SALOME_InteractiveObject)& theIO, int theId);
+
+#include <qdialog.h>
+#include <qwidgetstack.h>
+#include <qhbox.h>
+#include <qvbox.h>
+#include <qtable.h>
+#include <qlineedit.h>
+
+
+class VisuGUI_SelectionDlg: public QDialog {
+  Q_OBJECT
+  
+public:
+  VisuGUI_SelectionDlg();
+  ~VisuGUI_SelectionDlg(){};
+
+protected:
+  void closeEvent(QCloseEvent* theEvent);
+
+private slots:
+  void onSelectionChange(int theId);
+  void onSelectionEvent();
+  void onPointIdEdit(const QString& theText);
+  void onCellIdEdit(const QString& theText);
+
+ private:
+  void clearFields();
+
+  QLabel* myMeshName;
+  QLabel* myFieldName;
+
+  QWidgetStack* myWidgetStack;
+  QVBox* myPointsPane;
+  QWidget* myCellsPane;
+  QLabel* myXValLbl;
+  QLabel* myYValLbl;
+  QLabel* myZValLbl;
+  
+  QLineEdit* myIDValLbl;
+  QLabel* myScalarValLbl;
+  QLabel* myVectorValLbl;
+
+  QTable* myListPoints;
+  QLineEdit* myCellIDValLbl;
+  QLabel* myCellScalarValLbl;
+  QLabel* myCellVectorValLbl;
+
+  QVBox* myActorsPane;
+  QLabel* myXPosLbl;
+  QLabel* myYPosLbl;
+  QLabel* myZPosLbl;
+  QLabel* myDXLbl;
+  QLabel* myDYLbl;
+  QLabel* myDZLbl;
+
+  SALOME_Selection* mySelection;
 };
 
+
 #endif
index 503347116b09dee25e0ecfc45fbd7d0c9021f9ed..161f6fb8571949393868a9252f8a5ece8dd6d3c6 100644 (file)
 #include <qlayout.h>
 #include <qgroupbox.h>
 #include <qcolordialog.h>
+#include <qtabwidget.h>
 
-using namespace std;
 
-extern VisuGUI *visuGUI;
+using namespace std;
 
 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
     : QDialog( QAD_Application::getDesktop(), "VisuGUI_StreamLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
 {
+  myPrs = NULL;
   setCaption("Stream lines Preferences");
   setSizeGripEnabled( TRUE );
 
-  QGridLayout* TopLayout = new QGridLayout( this ); 
-  TopLayout->setSpacing( 6 );
+  QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
+  aBoxLayout->setSpacing( 6 );
+  aBoxLayout->setMargin( 11 );
+
+  QTabWidget* aTabBox = new QTabWidget(this);
+
+  QFrame* aTopBox = new QFrame(this);
+  aTopBox->setMargin( 11 );
+  QGridLayout* TopLayout = new QGridLayout( aTopBox ); 
+  TopLayout->setAlignment( Qt::AlignTop );
+  TopLayout->setSpacing( 8 );
   TopLayout->setMargin( 11 );
 
   // Source box
-  QGroupBox* aSourceBox = new QGroupBox(tr("Source"), this);
+  QGroupBox* aSourceBox = new QGroupBox(tr("Source"), aTopBox);
   aSourceBox->setColumnLayout(0, Qt::Vertical);
   QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() ); 
   aSrcLayout->setSpacing( 6 );
@@ -149,42 +159,49 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
   TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
 
 
-  QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), this);
+  QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), aTopBox);
   TopLayout->addWidget(aStepLenLbl, 1, 0);
-  myStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+  myStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
   myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myStepLen, 1, 1);
   connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
 
-  QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), this);
+  QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), aTopBox);
   TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
-  myIntegStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+  myIntegStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
   myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myIntegStepLen, 2, 1);
   connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
   
-  QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), this);
+  QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), aTopBox);
   TopLayout->addWidget(aPropagationLbl, 3, 0);
-  myPropTime = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 1);
+  myPropTime = new QAD_SpinBoxDbl(aTopBox, DBL_MIN, DBL_MAX, 1);
   myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myPropTime, 3, 1);
   connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
   
-  QLabel* aDirLbl = new QLabel( tr( "Direction" ), this);
+  QLabel* aDirLbl = new QLabel( tr( "Direction" ),aTopBox);
   TopLayout->addWidget(aDirLbl, 4, 0);
-  myDirCombo = new QComboBox(this);
+  myDirCombo = new QComboBox(aTopBox);
   myDirCombo->insertItem("Forward");
   myDirCombo->insertItem("Backward");
   myDirCombo->insertItem("Both");
   TopLayout->addWidget(myDirCombo, 4, 1);
 
-  myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), this, "UseMagn" );
+  myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), aTopBox, "UseMagn" );
   connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
   TopLayout->addWidget(myUseScalar, 5, 0);
 
-  SelColor = new QPushButton( tr( "Use Color" ), this, "SelColor" );
+  SelColor = new QPushButton( tr( "Use Color" ), aTopBox, "SelColor" );
   connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
   TopLayout->addWidget( SelColor, 5, 1);
+
+  aTabBox->addTab(aTopBox, "Stream Lines");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");  
+
+  aBoxLayout->addWidget(aTabBox);
  
   QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
   aGroupButtons->setColumnLayout(0, Qt::Vertical );
@@ -207,21 +224,38 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
   aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
   connect( aOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-  TopLayout->addMultiCellWidget( aGroupButtons, 6, 6, 0, 1 );
+
+  aBoxLayout->addWidget(aGroupButtons);
+
   enableSetColor();
 }
 
 
 
 void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
-  myPropTime->setValue(thePrs->GetPropagationTime());
-
-  myStepLen->setRange(VISU_StreamLinesPL::GetMinStepLength(thePrs->GetIntegrationStep()),
-                     VISU_StreamLinesPL::GetMaxStepLength(thePrs->GetPropagationTime()));
-  myStepLen->setValue(thePrs->GetStepLength());
+  myScalarPane->initFromPrsObject(thePrs);
+
+  myPrs = thePrs;
+  static int aNbOfSteps = 30;
+  VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL();
+  float aMin, aMax;
+  aMin = aStreamLinesPL->GetMinPropagationTime();
+  aMax = aStreamLinesPL->GetMaxPropagationTime();
+  myPropTime->setRange(aMin,aMax);
+  myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
+  myPropTime->setLineStep((aMax-aMin)/aNbOfSteps);
+
+  aMin = aStreamLinesPL->GetMinStepLength();
+  aMax = aStreamLinesPL->GetMaxStepLength();
+  myStepLen->setRange(aMin,aMax);
+  myStepLen->setValue(aStreamLinesPL->GetStepLength());
+  myStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
   
-  myIntegStepLen->setRange(thePrs->GetMinIntegrationStep(),thePrs->GetMaxIntegrationStep());
-  myIntegStepLen->setValue(thePrs->GetIntegrationStep());
+  aMin = aStreamLinesPL->GetMinIntegrationStep();
+  aMax = aStreamLinesPL->GetMaxIntegrationStep();
+  myIntegStepLen->setRange(aMin,aMax);
+  myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
+  myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
   
   switch (thePrs->GetDirection()) {
   case VISU::StreamLines::FORWARD:
@@ -246,7 +280,7 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
   
 #define INITPRS(PRSLIST, PRSNUM) \
     for (int i = 0; i < PRSLIST.count(); i++) { \
-      VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i])); \
+      VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
       if (aPrs == NULL) continue; \
       if (aSrcEntry == aPrs->GetEntry()) { \
         onSourceTypeChange(PRSNUM); \
@@ -269,67 +303,72 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
 }
 
 
+int VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
+  bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
+  if(isAccepted){
+    thePrs->ShowColored(myUseScalar->isChecked());
+    if(!thePrs->IsColored()){
+      SALOMEDS::Color aColor;
+      aColor.R = myColor.red()/255.;
+      aColor.G = myColor.green()/255.;
+      aColor.B = myColor.blue()/255.;
+      thePrs->SetColor(aColor);
+    }
 
-void VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
-  //Order of setting of the values are important 
-  thePrs->SetIntegrationStep(myIntegStepLen->value());
-  thePrs->SetPropagationTime(myPropTime->value());
-  thePrs->SetStepLength(myStepLen->value());
-  switch (myDirCombo->currentItem()) {
-  case 0:
-    thePrs->SetDirection(VISU::StreamLines::FORWARD);
-    break;
-  case 1:
-    thePrs->SetDirection(VISU::StreamLines::BACKWARD);
-    break;
-  case 2:
-    thePrs->SetDirection(VISU::StreamLines::BOTH);
-  }
-  thePrs->ShowColored(myUseScalar->isChecked());
-  if(!thePrs->IsColored()){
-    SALOMEDS::Color aColor;
-    aColor.R = myColor.red()/255.;
-    aColor.G = myColor.green()/255.;
-    aColor.B = myColor.blue()/255.;
-    thePrs->SetColor(aColor);
-  }
-  thePrs->SetUsedPoints(myPntPercent->value());
-
-  int aSrcSelection = myUseSrcCombo->currentItem();
-  int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
-  if ((aSrcSelection > 0) && (aSrcItem > -1)) {
-    VISU::Prs3d_var aPrs;
-    VISU::VISUType aType;
-    QString aName;
-    switch (aSrcSelection){
-    case 1: // Entity
-      aPrs = myEntityList[aSrcItem];
-      aType = VISU::TENTITY;
-      aName = myEntitiesLst[aSrcItem];
+    VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
+    switch (myDirCombo->currentItem()) {
+    case 0:
+      aDirection = VISU::StreamLines::FORWARD;
       break;
-    case 2: // Family
-      aPrs = myFamilyList[aSrcItem];
-      aType = VISU::TFAMILY;
-      aName = myFamilisLst[aSrcItem];
-      break;
-    case 3: // Group
-      aPrs = myGroupList[aSrcItem];
-      aType = VISU::TGROUP;
-      aName = myGroupsLst[aSrcItem];
-      break;
-    case 4: // Presentation
-      aPrs = myPrsList[aSrcItem];
+    case 1:
+      aDirection = VISU::StreamLines::BACKWARD;
       break;
+    case 2:
+      aDirection = VISU::StreamLines::BOTH;
     }
-    if (!CORBA::is_nil( aPrs )) {
-      thePrs->SetSource(aPrs);
-    } else if (aSrcSelection == 4) {
-      thePrs->SetSource(VISU::Prs3d::_nil());
-    } else { // Create Mesh presentation
-      thePrs->SetSource(createMesh(aType, aName));
+
+    VISU::Prs3d_var aPrs;
+    int aSrcSelection = myUseSrcCombo->currentItem();
+    int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
+    if ((aSrcSelection > 0) && (aSrcItem > -1)) {
+      VISU::VISUType aType;
+      QString aName;
+      switch (aSrcSelection){
+      case 1: // Entity
+       aPrs = myEntityList[aSrcItem];
+       aType = VISU::TENTITY;
+       aName = myEntitiesLst[aSrcItem];
+       break;
+      case 2: // Family
+       aPrs = myFamilyList[aSrcItem];
+       aType = VISU::TFAMILY;
+       aName = myFamilisLst[aSrcItem];
+       break;
+      case 3: // Group
+       aPrs = myGroupList[aSrcItem];
+       aType = VISU::TGROUP;
+       aName = myGroupsLst[aSrcItem];
+       break;
+      case 4: // Presentation
+       aPrs = myPrsList[aSrcItem];
+       break;
+      }
+      if(CORBA::is_nil(aPrs) && aSrcSelection != 4){ 
+       aPrs = createMesh(aType, aName);
+      }
     }
-  } else 
-    thePrs->SetSource(VISU::Prs3d::_nil());  
+    isAccepted = thePrs->SetParams(myIntegStepLen->value(),
+                                  myPropTime->value(),
+                                  myStepLen->value(),
+                                  aPrs,
+                                  myPntPercent->value(),
+                                  aDirection);
+  }
+  if(!isAccepted)
+    QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
+                           tr ("ERR_CANT_BUILD_PRESENTATION"), 
+                           tr ("VISU_BUT_OK") ); 
+  return isAccepted;
 }
 
 /*!
@@ -374,12 +413,10 @@ void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){
 }
 
 void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
-  PropagationTimeChanged(myPropTime->value());
 }
 
 void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
-  myStepLen->setMinValue(VISU_StreamLinesPL::GetMinStepLength(myIntegStepLen->value()));
-  myStepLen->setMaxValue(VISU_StreamLinesPL::GetMaxStepLength(myPropTime->value()));
+  myStepLen->setMaxValue(theValue);
 }
 
 void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
@@ -407,7 +444,7 @@ void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
 }
 
 
-VISU::Mesh_var VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
+VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
   CORBA::Object_var anObject = VISU::SObjectToObject(mySelectionObj);
   VISU::Result_var aResult;
   if (!CORBA::is_nil(anObject)) {
@@ -444,7 +481,7 @@ VISU::Mesh_var VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QStrin
       }
     }
   }
-  CORBA::Object_var aMesh;
+  VISU::Mesh_var aMesh;
   QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
   switch (theType) {
   case VISU::TFAMILY: 
@@ -465,26 +502,27 @@ VISU::Mesh_var VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QStrin
     }
     break;
   }
-  VISU::Mesh_i* pPresent = NULL;
-  if(!CORBA::is_nil(aMesh)) 
-    pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
-  if (pPresent == NULL) {
+  if(!CORBA::is_nil(aMesh)){ // Create Actor
+    VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
+    if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()){
+      try{
+       pPresent->SetPresentationType(VISU::POINT);
+       VISU_Actor *anActor = pPresent->CreateActor();
+       vf->AddActor(anActor);
+      }catch(...){
+       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
+                               tr ("ERR_CANT_CREATE_ACTOR"), 
+                               tr ("VISU_BUT_OK") ); 
+      }
+    } 
+  }else{
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
                            tr ("ERR_CANT_BUILD_PRESENTATION"), 
                            tr ("VISU_BUT_OK") ); 
-    return VISU::Mesh::_nil();
   }
-  // Create Actor
-  if(VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame()){
-    try{
-      pPresent->SetPresentationType(VISU::POINT);
-      VISU_Actor *anActor = pPresent->CreateActor();
-      vf->AddActor(anActor);
-    }catch(std::runtime_error& exc){
-      QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
-                             tr ("ERR_CANT_CREATE_ACTOR"), 
-                             tr ("VISU_BUT_OK") ); 
-    }
-  } 
-  return pPresent->_this();
+  return aMesh._retn();
+}
+
+void VisuGUI_StreamLinesDlg::accept() {
+  if (myScalarPane->check())  QDialog::accept();
 }
index 0b9c78b671943ae7c1d6737a5f24800b10280d81..f302a65fd891a915178d6f9a429dea96d0091576 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef VISUGUI_STREAMLINESDLG_H
 #define VISUGUI_STREAMLINESDLG_H
 
+#include "VisuGUI_ScalarBarDlg.h"
 #include "QAD_SpinBoxDbl.h"
 
 #include <qdialog.h>
@@ -33,10 +34,13 @@ public:
     ~VisuGUI_StreamLinesDlg() {};
 
     void initFromPrsObject(VISU::StreamLines_i* thePrs);
-    void storeToPrsObject(VISU::StreamLines_i* thePrs);
+    int storeToPrsObject(VISU::StreamLines_i* thePrs);
     void setColor( QColor color );
     void enableMagnColor( bool enable );
 
+protected slots:
+  void accept();
+
 private slots:
   void onSelectionActive(bool theActive);
   void StepLengthChanged(double theValue);
@@ -45,7 +49,7 @@ private slots:
   void onSourceTypeChange(int theIndex);
 
 private:
-  VISU::Mesh_var createMesh(VISU::VISUType theType, QString theName);
+  VISU::Mesh_ptr createMesh(VISU::VISUType theType, QString theName);
 
     QAD_SpinBoxDbl* myStepLen;
     QAD_SpinBoxDbl* myIntegStepLen;
@@ -68,6 +72,8 @@ private:
     QStringList myPrsLst;
     SALOMEDS::SObject_var mySelectionObj;
 
+    VisuGUI_ScalarBarPane* myScalarPane;
+    VISU::StreamLines_i* myPrs;
 private slots:
   void setVColor();
   void enableSetColor();
index 3d1f175d41107d14141df6b5dedadd1db7c9b9ab..32ab47e06119828357d53e5f6b2d5a26ed7ff1a9 100644 (file)
@@ -127,12 +127,12 @@ SetupDlg::SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   connect( myTypeCombo, SIGNAL( activated(int) ), 
           this, SLOT( onTypeChanged(int) ) );
   
-  QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
-  connect( aBarBtn, SIGNAL( clicked() ), 
-          this, SLOT( onScalarBarDlg() ) );
+  //  QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
+  //connect( aBarBtn, SIGNAL( clicked() ), 
+  //      this, SLOT( onScalarBarDlg() ) );
  
   myPropBtn = new QPushButton("Properties...", aPropBox);
-  myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
+  //  myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
   connect( myPropBtn, SIGNAL( clicked() ), 
           this, SLOT( onPreferencesDlg() ) );
 
@@ -143,7 +143,7 @@ SetupDlg::SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout()); 
   aBtnLayout->addStretch();
   
-  QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+  QPushButton* aCloseBtn = new QPushButton(tr("VISU_BUT_OK"), aBtnBox);
   connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
   
   aMainLayout->addWidget(aBtnBox);
@@ -186,7 +186,7 @@ void SetupDlg::onFieldChange(int theIndex) {
     aData.myPrsType = VISU::TSTREAMLINES;
     break;
   }  
-  myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
+  //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
 }
 
 //************************************************************************
@@ -213,13 +213,13 @@ void SetupDlg::onTypeChanged(int theIndex) {
     break;
   }
   myAnimator->clearData(aData);
-  myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
+  //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
   //myAnimator->generatePresentations(myFieldLst->currentItem());
 }
 
 
 //************************************************************************
-void SetupDlg::onScalarBarDlg() {
+/*void SetupDlg::onScalarBarDlg() {
   QApplication::setOverrideCursor( Qt::waitCursor );
   FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
   if (aData.myPrs == 0) 
@@ -233,7 +233,7 @@ void SetupDlg::onScalarBarDlg() {
       aScalarBarDlg->storeToPrsObject(aData.myPrs[i]);
   }
 }
-
+*/
 //************************************************************************
 void SetupDlg::onPreferencesDlg() {
   QApplication::setOverrideCursor( Qt::waitCursor );
@@ -242,58 +242,48 @@ void SetupDlg::onPreferencesDlg() {
     myAnimator->generatePresentations(myFieldLst->currentItem());
   QApplication::restoreOverrideCursor();
 
+#define EDITPRS(TYPE, DLG) \
+    { \
+      DLG* aDlg = new DLG(); \
+      aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0])); \
+      if (aDlg->exec()) { \
+       for (int i = 0; i < aData.myNbFrames; i++) \
+         aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs[i])); \
+      } \
+      delete aDlg; \
+    }
+
+
   switch (myTypeCombo->currentItem()) {
+  case 0: //Scalar Map
+    EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
+    break;
   case 1: //Iso Surfaces
-    {
-      VisuGUI_IsoSurfacesDlg* aDlg = new VisuGUI_IsoSurfacesDlg();
-      aDlg->initFromPrsObject(dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[0]));
-      if (aDlg->exec()) {
-       for (int i = 0; i < aData.myNbFrames; i++)
-         aDlg->storeToPrsObject(dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]));
-      }
-    }
+    EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
     break;
   case 2: //Cut Planes
+    //    EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
     {
-      VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg();
+      VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, true);
       aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[0]));
       if (aDlg->exec()) {
        for (int i = 0; i < aData.myNbFrames; i++)
          aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[i]));
       }
+      delete aDlg;
     }
     break;
   case 3: //Deformed Shape
-    {
-      VisuGUI_MagnitudeDlg* aDlg = new VisuGUI_MagnitudeDlg();
-      aDlg->initFromPrsObject(dynamic_cast<VISU::DeformedShape_i*>(aData.myPrs[0]));      
-      if (aDlg->exec()) {
-       for (int i = 0; i < aData.myNbFrames; i++)
-         aDlg->storeToPrsObject(dynamic_cast<VISU::DeformedShape_i*>(aData.myPrs[i]));
-      }
-    }
+    EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
     break;
   case 4: //Vectors
-    {
-      VisuGUI_VectorsDlg* aDlg = new VisuGUI_VectorsDlg();
-      aDlg->initFromPrsObject(dynamic_cast<VISU::Vectors_i*>(aData.myPrs[0]));
-      if (aDlg->exec()) {
-       for (int i = 0; i < aData.myNbFrames; i++)
-         aDlg->storeToPrsObject(dynamic_cast<VISU::Vectors_i*>(aData.myPrs[i]));
-      }
-    }
+    EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
     break;
   case 5: //Stream Lines
-    {
-      VisuGUI_StreamLinesDlg* aDlg = new VisuGUI_StreamLinesDlg();
-      aDlg->initFromPrsObject(dynamic_cast<VISU::StreamLines_i*>(aData.myPrs[0]));
-      if (aDlg->exec()) {
-       for (int i = 0; i < aData.myNbFrames; i++)
-         aDlg->storeToPrsObject(dynamic_cast<VISU::StreamLines_i*>(aData.myPrs[i]));
-      }
-    }
+    EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
     break;
   }
+#undef EDITPRS
 }
 
 //************************************************************************
@@ -642,7 +632,7 @@ void VisuGUI_TimeAnimationDlg::createFrames() {
   if (myAnimator->getNbFrames() == 0) {
     myPlayFrame->setEnabled(false);
     QApplication::restoreOverrideCursor();
-   QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NO_ANIMATIONDATA")); 
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NO_ANIMATIONDATA")); 
     return;    
   }    
   mySlider->setMaxValue(myAnimator->getNbFrames()-1);
@@ -753,6 +743,7 @@ void VisuGUI_TimeAnimationDlg::onExecution(long theNewFrame, double theTime) {
 
 //************************************************************************
 void VisuGUI_TimeAnimationDlg::onSetupDlg() {
+  if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame();
   SetupDlg* aDlg = new SetupDlg(this, myAnimator);
   aDlg->exec();
   myPlayFrame->setEnabled(false);
@@ -761,7 +752,9 @@ void VisuGUI_TimeAnimationDlg::onSetupDlg() {
 
 //************************************************************************
 void VisuGUI_TimeAnimationDlg::onBrowse() {
-  myPathEdit->setText(QAD_FileDlg::getExistingDirectory(this, "/","Select path"));
+  QString aPath = QAD_FileDlg::getExistingDirectory(this, "/","Select path");
+  if (!aPath.isEmpty())
+    myPathEdit->setText(aPath);
 }
 
 
index 35f0d62534125ef9f700797f0e487bacc7a3d14f..1480326c1b9721fde41f43bc0a0e39947f677211 100644 (file)
@@ -39,7 +39,7 @@ public:
 private slots:
   void onFieldChange(int theIndex);
   void onTypeChanged(int theIndex); 
-  void onScalarBarDlg();
+  //  void onScalarBarDlg();
   void onPreferencesDlg();
   void onRangeCheck(bool theCheck);
   void onMinValue(double theVal);
index 2e471d3f4dc20ee31f9b724512f40216ae191227..82712b8920c044d89de4aa9fcdd9788c06ce3281 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <qlayout.h>
 #include <qcolordialog.h>
+#include <qtabwidget.h>
 
 using namespace std;
 
@@ -50,10 +51,15 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin( 11 );
 
-  TopGroup = new QButtonGroup( this, "TopGroup" );
+  QTabWidget* aTabBox = new QTabWidget(this);
+
+  QVBox* aBox = new QVBox(this);
+  aBox->setMargin( 11 );
+
+  TopGroup = new QButtonGroup( aBox, "TopGroup" );
   TopGroup->setColumnLayout(0, Qt::Vertical );
   TopGroup->layout()->setSpacing( 0 );
-  TopGroup->layout()->setMargin( 0 );
+  TopGroup->layout()->setMargin( 5 );
   QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
   TopGroupLayout->setAlignment( Qt::AlignTop );
   TopGroupLayout->setSpacing( 6 );
@@ -151,7 +157,12 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
 
   // top layout
-  TopLayout->addWidget( TopGroup );
+  aTabBox->addTab(aBox, "Vectors");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");  
+
+  TopLayout->addWidget( aTabBox );
   TopLayout->addWidget( GroupButtons );
   
   // signals and slots connections
@@ -171,15 +182,10 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   enableSetColor();
 }
 
-/*!
-  Destructor
-*/
-VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
-{
-}
 
 
 void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
+  myScalarPane->initFromPrsObject(thePrs);
   setScaleFactor(thePrs->GetScale());
   setLineWidth((int)thePrs->GetLineWidth());
   setUseMagnColor(thePrs->IsColored());
@@ -198,7 +204,8 @@ void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
 }
 
 
-void VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+  myScalarPane->storeToPrsObject(thePrs);
   thePrs->SetScale(getScaleFactor());
   thePrs->SetLineWidth(getLineWidth());
   thePrs->ShowColored(getUseMagnColor());
@@ -214,6 +221,7 @@ void VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
     thePrs->SetGlyphType(getGlyphType());
   } else 
     thePrs->SetGlyphType(VISU::Vectors::NONE);
+  return 1;
 }
 
 
@@ -392,4 +400,7 @@ void VisuGUI_VectorsDlg::enableMagnColor( bool enable )
 }
 
 
+void VisuGUI_VectorsDlg::accept() {
+  if (myScalarPane->check())  QDialog::accept();
+}
 
index d66af01717e010e525ab01c139abedd39b53682f..58cd32bae48e51c1bfa967236475af78304ced46 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef VISUGUI_VECTORSDLG_H
 #define VISUGUI_VECTORSDLG_H
 
+#include "VisuGUI_ScalarBarDlg.h"
 #include "QAD_SpinBoxDbl.h"
 
 #include <qdialog.h>
@@ -52,7 +53,7 @@ class VisuGUI_VectorsDlg : public QDialog
 
 public:
     VisuGUI_VectorsDlg();
-    ~VisuGUI_VectorsDlg();
+    ~VisuGUI_VectorsDlg() {};
 
     void   setScaleFactor( double sf );
     double getScaleFactor();
@@ -73,9 +74,11 @@ public:
     void   enableMagnColor( bool enable );
 
     void initFromPrsObject(VISU::Vectors_i* thePrs);
-    void storeToPrsObject(VISU::Vectors_i* thePrs);
-
+    int storeToPrsObject(VISU::Vectors_i* thePrs);
 
+protected slots:
+  void accept();
+   
 private:
     QGroupBox*      TopGroup;
     QCheckBox*      UseMagn;
@@ -99,11 +102,12 @@ private:
     QPushButton*    buttonCancel;
 
     QColor          myColor;
+    VisuGUI_ScalarBarPane* myScalarPane;
 
 private slots:
     void enableGlyphType();
- void setVColor();
- void enableSetColor();
   void setVColor();
   void enableSetColor();
 };
 
 #endif // VISUGUI_VECTORSDLG_H
index eb600e2cbfdc459bf766cc18b20e0e485a1f0ffb..abc4a5cbc08c1edb0c28aebf342d0ccdf9054105 100644 (file)
@@ -18,7 +18,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 # Libraries targets
 LIB = libVISUEngine.la
 LIB_SRC = VISUConfig.cc VISU_Gen_i.cc VISU_Result_i.cc \
-       VISU_ViewManager_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
+        VISU_ViewManager_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
        VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \
        VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \
        VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
@@ -27,7 +27,9 @@ LIB_SRC = VISUConfig.cc VISU_Gen_i.cc VISU_Result_i.cc \
 
 LIB_MOC = VISU_TimeAnimation.h
 
-LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl SALOME_Exception.idl SALOME_Session.idl MED.idl
+LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \
+                 SALOME_Exception.idl SALOME_GenericObj.idl \
+                 SALOME_Session.idl MED.idl
 LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
 
 # Executables targets
@@ -46,19 +48,21 @@ EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh VISU_Result_i.hh \
        VISU_TimeAnimation.h
 
 # additionnal information to compil and link file
-
 CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
-       $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS  += $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS -lSalomeHDFPersist \
-       -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer \
-       -lVisuConvertor -lVisuPipeLine -lVisuObject \
+       $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
+       -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS  += $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
+       -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer -lSalomeHDFPersist \
+       -lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj \
        -L${KERNEL_ROOT_DIR}/lib/salome
 
-LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d -lSalomeHDFPersist -lSALOMELocalTrace -lRegistry -lqsplitterP -lSalomeLifeCycleCORBA -lSalomeObject -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome
+LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d \
+       -L${KERNEL_ROOT_DIR}/lib/salome
 
 # additional file to be cleaned
 MOSTLYCLEAN =
 CLEAN =
 DISTCLEAN =
 
-@CONCLUDE@
+@CONCLUDE@
\ No newline at end of file
index 4b8567ab03ba05cca89e7822e371f33496a187c8..2395f74560ca903bafb8c467b79136fe2cb86f74 100644 (file)
@@ -38,16 +38,22 @@ namespace VISU{
   //===========================================================================
   QMutex* Base_i::myMutex = NULL; //apo - &VISUMutex;
   CORBA::ORB_var Base_i::myOrb;
-  PortableServer::POA_var Base_i::myPOA;
+  PortableServer::POA_var Base_i::myPoa;
   SALOME_NamingService* Base_i::myNamingService;
   SALOME_LifeCycleCORBA* Base_i::myEnginesLifeCycle;
   VISU_Gen_i* Base_i::myVisuGenImpl;
+
+  Base_i::Base_i() {}
+
   Base_i::~Base_i() {}
+
   char* Base_i::GetID(){ 
-    CORBA::Object_ptr anObject = _this();
-    CORBA::String_var aString = myOrb->object_to_string(anObject);
-    return aString._retn();
-    //return CORBA::string_dup(myOrb->object_to_string(_this()));
+    if(myID == ""){
+      CORBA::Object_var anObject = _this();
+      CORBA::String_var anIOR = myOrb->object_to_string(anObject);
+      myID = anIOR.in();
+    }
+    return CORBA::string_dup(myID.c_str());
   }
 
   //===========================================================================
@@ -89,7 +95,6 @@ namespace VISU{
     ToStream(strOut);
     strOut<<ends;
     if(MYDEBUG) MESSAGE("Storable::ToString - "<<strOut.str());
-    //apo - auto_ptr<char> aRet(strOut.str());
     return strOut.str(); 
   }
 
@@ -152,8 +157,6 @@ namespace VISU{
       QString strIn( theLocalPersistentID.c_str() );
       TRestoringMap aMap;        
       StrToMap(strIn,aMap);
-      //CORBA::String_var aResultID(GetResultSO(theSObject)->GetID());
-      //aMap.insert(TRestoringMap::value_type("ResultID", strdup(aResultID)));
       bool isExist;
       QString aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist);
       if ( isExist ) {
@@ -187,13 +190,14 @@ namespace VISU{
   
 
   //===========================================================================
-  PortableServer::Servant 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();
-      return aPOA->reference_to_servant(theObject);
+      PortableServer::Servant aServant = aPOA->reference_to_servant(theObject);
+      return aServant;
     } catch (...) {
-      INFOS("GetServant - Unknown exception was accured!"); 
+      INFOS("GetServant - Unknown exception was accured!!!"); 
       return NULL;
     }
   }
@@ -212,7 +216,7 @@ namespace VISU{
          anObj = anORB->string_to_object(aValue);
       }
     }catch(...){
-      INFOS("SObjectToObject - Unknown exception was accured!");
+      INFOS("SObjectToObject - Unknown exception was accured!!!");
     }
     return anObj;
   }
@@ -274,7 +278,7 @@ namespace VISU{
       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
       SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
       aCmnt->SetValue(theComment);
-    INFOS("CreateAttributes - Comment = "<<theComment);
+      INFOS("CreateAttributes - Comment = "<<theComment);
     }
     if(strcmp(theRefFatherEntry,"") != 0){
       SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
@@ -283,7 +287,8 @@ namespace VISU{
     }
     CORBA::String_var anEntry = newObj->GetID();
     string aRet(anEntry);
-    if(0 && MYDEBUG) MESSAGE("CreateAttributes - anEntry = "<<aRet<<"; IOR = "<<theIOR);
+    if(MYDEBUG) 
+      INFOS("CreateAttributes - StudyId = "<<theStudyDocument->StudyId()<<"; anEntry = "<<aRet<<"; IOR = '"<<theIOR<<"'");
     return aRet;
   }
 }
index a49c4b1679cda0c89e8be552ebe63acc410aa4b2..c51683ed710579007b03af57050e62830fe0d7b6 100644 (file)
@@ -59,19 +59,25 @@ namespace VISU{
                  public virtual PortableServer::RefCountServantBase
   {
   public:
+    Base_i();
     virtual ~Base_i();
     virtual char* GetID();
     virtual VISU::VISUType GetType() = 0;
+
+  protected:
+    std::string myID;
+
   protected:
     static QMutex* myMutex;
     static CORBA::ORB_var myOrb;
-    static PortableServer::POA_var myPOA;
+    static PortableServer::POA_var myPoa;
     static SALOME_NamingService* myNamingService;
     static VISU_Gen_i* myVisuGenImpl;
     static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
+
   public:
-    static CORBA::ORB_ptr GetORB() { return myOrb;}
-    static PortableServer::POA_ptr GetPOA() { return myPOA;}
+    static CORBA::ORB_var GetORB() { return myOrb;}
+    static PortableServer::POA_var GetPOA() { return myPoa;}
     static SALOME_NamingService* GetNS() { return myNamingService;}
     static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
     static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
@@ -118,7 +124,7 @@ namespace VISU{
   const CORBA::Boolean IsMultifile();
   QString GenerateName(const string& theFmt, int theId);
 
-  PortableServer::Servant GetServant(CORBA::Object_ptr theObject);
+  PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
   CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
 
   SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
index 6cda4f5b521851c111d9c890a44d000a7edb538c..9c6da1f5c5ee1b5c31a389b2c8be6f5bfe1896cd 100644 (file)
@@ -28,6 +28,7 @@
 //  Copyright (C) 2003  CEA/DEN, EDF R&D
 
 #include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <valarray>    
 #include <vtkCellType.h>
index bd214ff077d4c4d71d3166bcef2ed997fbd997ce..e4017fa5b222fd4f5c46fbaa70517bb6d22b2716 100644 (file)
@@ -45,9 +45,9 @@ static int MYDEBUGWITHFILES = 0;
 #endif
 
 int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                const char* theFieldName, int theIteration)
+                                const char* theFieldName, int theIteration, int isMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
 }
 
 int VISU::CutLines_i::myNbPresent = 0;
@@ -56,59 +56,64 @@ QString VISU::CutLines_i::GenerateName() { return VISU::GenerateName("CutLines",
 const string VISU::CutLines_i::myComment = "CUTLINES";
 const char* VISU::CutLines_i::GetComment() const { return myComment.c_str();}
 
-VISU::CutLines_i::CutLines_i(Result_i* theResult, bool theAddToStudy) :
+
+VISU::CutLines_i::CutLines_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject)
 {
   myCutLinesPL = NULL;
 }
 
-void VISU::CutLines_i::Destroy(){
-  ScalarMap_i::Destroy();
-}
+
 
 void VISU::CutLines_i::SameAs(const CutLines_i* theOrigin){
   CutLines_i* aCutLines = const_cast<CutLines_i*>(theOrigin);
   VISU::ScalarMap_i::SameAs(theOrigin);
-
-  //SetNbLines(aCutLines->GetNbLines());
-  //SetDisplacement(aCutLines->GetDisplacement());
-  //SetDisplacement2(aCutLines->GetDisplacement2());
-  //SetOrientationType(aCutLines->GetOrientationType());
-  //SetOrientationType2(aCutLines->GetOrientationType2());
-  //SetRotateX(aCutLines->GetRotateX());
-  //SetRotateY(aCutLines->GetRotateY());
-  //SetRotateX2(aCutLines->GetRotateX2());
-  //SetRotateY2(aCutLines->GetRotateY2());
 }
 
+
 VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity, 
                                         const char* theFieldName, int theIteration)
 {
   return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
 }
 
+
 VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap)
      throw(std::logic_error&)
 {
-  ScalarMap_i::Restore(theMap);
+  DoHook();
   SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
   SetDisplacement2(VISU::Storable::FindValue(theMap,"myDisplacement[1]").toDouble());
-  SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()));
-  SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()));
-  SetRotateX(VISU::Storable::FindValue(theMap,"aRot[0][0]").toDouble());
-  SetRotateY(VISU::Storable::FindValue(theMap,"aRot[0][1]").toDouble());
-  SetRotateX2(VISU::Storable::FindValue(theMap,"aRot[1][0]").toDouble());
-  SetRotateY2(VISU::Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+  SetOrientation(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()),
+                Storable::FindValue(theMap,"aRot[0][0]").toDouble(),
+                Storable::FindValue(theMap,"aRot[0][1]").toDouble());
+  SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
+                 Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
+                 Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+  if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
+    SetDefault();
+  else
+    SetBasePlanePosition(VISU::Storable::FindValue(theMap,"myBasePlanePosition").toDouble());
   
-  return Build(true);
+  QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLinePosition") );
+  QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLineCondition") );
+  for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++)
+    if(aCondList[i].toInt() == 0)
+      SetLinePosition(i,aPosList[i].toDouble());
+
+  return ScalarMap_i::Restore(theMap);
 }
 
+
 void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
   ScalarMap_i::ToStream(theStr);
-  Storable::DataToStream( theStr, "myNbLines",         int(GetNbLines()) );
+
+  int aNbLines = GetNbLines();
+  
+  Storable::DataToStream( theStr, "myNbLines",         aNbLines );
   Storable::DataToStream( theStr, "myDisplacement[0]", GetDisplacement() );
   Storable::DataToStream( theStr, "myDisplacement[1]", GetDisplacement2() );
   Storable::DataToStream( theStr, "myBasePlane[0]",    int(GetOrientationType()) );
@@ -117,31 +122,34 @@ void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "aRot[0][1]",        GetRotateY() );
   Storable::DataToStream( theStr, "aRot[1][0]",        GetRotateX2() );
   Storable::DataToStream( theStr, "aRot[1][1]",        GetRotateY2() );
-}
+  Storable::DataToStream( theStr, "myBasePlanePosition", GetBasePlanePosition() );
+  Storable::DataToStream( theStr, "myBasePlaneCondition", IsDefault() );
 
-VISU::Storable* VISU::CutLines_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                         const string& thePrefix, const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::CutLines_i* pResent = new VISU::CutLines_i(pResult);
-    return pResent->Restore(theMap);
+  QString aStrPos, aStrCon;
+  for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++){
+    aStrPos.append(QString::number(GetLinePosition(i)) + "|");
+    aStrCon.append(QString::number(IsDefaultPosition(i)) + "|");
   }
-  return NULL;
+  Storable::DataToStream( theStr, "myLinePosition",  aStrPos.latin1());
+  Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1());
 }
 
-
 VISU::CutLines_i::~CutLines_i(){
   if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()");
 }
 
 
-void VISU::CutLines_i::SetOrientationType(VISU::CutPlanes::Orientation theOrient){
-  myCutLinesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient));
+void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                                     CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+  myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+                              theXAngle,theYAngle);
 }
-void VISU::CutLines_i::SetOrientationType2(VISU::CutPlanes::Orientation theOrient){
-  myCutLinesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),1);
+void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+                                      CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+  myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+                              theXAngle,theYAngle,1);
 }
 
 VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() { 
@@ -151,6 +159,20 @@ VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType2() {
   return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1));
 }
 
+CORBA::Double VISU::CutLines_i::GetRotateX(){
+  return myCutLinesPL->GetRotateX();
+}
+CORBA::Double VISU::CutLines_i::GetRotateY(){
+  return myCutLinesPL->GetRotateY();
+}
+
+CORBA::Double VISU::CutLines_i::GetRotateX2(){
+  return myCutLinesPL->GetRotateX(1);
+}
+CORBA::Double VISU::CutLines_i::GetRotateY2(){
+  return myCutLinesPL->GetRotateY(1);
+}
+
 
 void VISU::CutLines_i::SetDisplacement(CORBA::Double theDisp) { 
   myCutLinesPL->SetDisplacement(theDisp);
@@ -209,34 +231,6 @@ CORBA::Long VISU::CutLines_i::GetNbLines() {
 }
 
 
-void VISU::CutLines_i::SetRotateX(CORBA::Double theAngle){
-  myCutLinesPL->SetRotateX(theAngle);
-}
-CORBA::Double VISU::CutLines_i::GetRotateX(){
-  return myCutLinesPL->GetRotateX();
-}
-
-void VISU::CutLines_i::SetRotateY(CORBA::Double theAngle){
-  myCutLinesPL->SetRotateY(theAngle);
-}
-CORBA::Double VISU::CutLines_i::GetRotateY(){
-  return myCutLinesPL->GetRotateY();
-}
-
-void VISU::CutLines_i::SetRotateX2(CORBA::Double theAngle){
-  myCutLinesPL->SetRotateX(theAngle,1);
-}
-CORBA::Double VISU::CutLines_i::GetRotateX2(){
-  return myCutLinesPL->GetRotateX(1);
-}
-
-void VISU::CutLines_i::SetRotateY2(CORBA::Double theAngle){
-  myCutLinesPL->SetRotateY(theAngle,1);
-}
-CORBA::Double VISU::CutLines_i::GetRotateY2(){
-  return myCutLinesPL->GetRotateY(1);
-}
-
 void VISU::CutLines_i::DoHook(){
   if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New();
   myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(myPipeLine);
@@ -245,132 +239,147 @@ void VISU::CutLines_i::DoHook(){
 }
 
 void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
-
-  if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
-  Update();
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-  anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
-  SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
-
-  typedef set<long> TLineCont;
-  typedef map<float,TLineCont> TXMap;
-  typedef map<float,float> TXYMap;
-  typedef vector<TXYMap> TCurveVect;
-
-  const VISU::TField::TValField& aValField = myField->myValField;
-  const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
-  const VISU::TField::TTime& aTime = aValForTime.myTime;
-  QString aTitle;
-  //aTitle.sprintf("%s %s",myTitle.c_str(),aTime.second.c_str());
-  aTitle.sprintf("%s",myTitle.c_str());
-  aTitle = aTitle.simplifyWhiteSpace();
-  aTableOfReal->SetTitle(aTitle.latin1());
-
-  int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs();
-  if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
-  TCurveVect aCurveVect(iLineEnd); 
-  TLineCont aLineCont;
-  TXMap aXMap;
-  const float *aDirLn = myCutLinesPL->GetDirLn();
-  const float *aBasePnt = myCutLinesPL->GetBasePnt();
-  const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
-  for(int iLine = 0; iLine < iLineEnd; iLine++){
-    vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
-    aDataSet->Update();
-    int aNbPoints = aDataSet->GetNumberOfPoints();
-    vtkPointData *aPointData = aDataSet->GetPointData();
-    vtkDataArray *aScalars = aPointData->GetScalars();
-    vtkCellDataToPointData *aFilter = NULL;
-    if(!aScalars) {
-      aFilter = vtkCellDataToPointData::New();
-      aFilter->SetInput(aDataSet);
-      aFilter->PassCellDataOn();
-      aDataSet = aFilter->GetOutput();
+  try{
+    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
+    Update();
+    SALOMEDS::GenericAttribute_var anAttr;
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+    anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
+    SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+    
+    typedef set<float> TXCont;
+    typedef map<float,float> TXYMap;
+    typedef map<int,TXYMap> TXYMapCont;
+    typedef map<long,long> TLineIdCont;
+    
+    const VISU::TField::TValField& aValField = myField->myValField;
+    const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
+    const VISU::TField::TTime& aTime = aValForTime.myTime;
+    QString aTitle;
+    //aTitle.sprintf("%s %s",myTitle.c_str(),aTime.second.c_str());
+    aTitle.sprintf("%s",myTitle.c_str());
+    aTitle = aTitle.simplifyWhiteSpace();
+    aTableOfReal->SetTitle(aTitle.latin1());
+    
+    int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs();
+    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
+    TXCont aXCont;
+    TXYMapCont aXYMapCont; 
+    TLineIdCont aLineIdCont;  // Define internal numeration of lines
+    const float *aDirLn = myCutLinesPL->GetDirLn();
+    const float *aBasePnt = myCutLinesPL->GetBasePnt();
+    const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
+    for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
+      vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
       aDataSet->Update();
+      int aNbPoints = aDataSet->GetNumberOfPoints();
+      if(!aNbPoints) continue;
+      vtkPointData *aPointData = aDataSet->GetPointData();
+      vtkDataArray *aScalars = aPointData->GetScalars();
+      vtkCellDataToPointData *aFilter = NULL;
+      if(!aScalars) {
+       aFilter = vtkCellDataToPointData::New();
+       aFilter->SetInput(aDataSet);
+       aFilter->PassCellDataOn();
+       aDataSet = aFilter->GetOutput();
+       aDataSet->Update();
+      }
+      aPointData = aDataSet->GetPointData();
+      aScalars = aPointData->GetScalars();
+      if(!aScalars) continue;
+      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
+      aLineIdCont[iLine] = jLine++;
+      TXYMap& aXYMap = aXYMapCont[iLine];
+      float aPnt[3], aVect[3], aDist;
+      for(int i = 0; i < aNbPoints; i++){
+       aDataSet->GetPoint(i,aPnt);
+       Sub(aPnt,aBasePnt,aVect);
+       aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+       // the workaround
+       if(aDist < 0.0) aDist = 0.0; 
+       if(aDist > 1.0) aDist = 1.0;
+       aXYMap[aDist] = aScalars->GetTuple1(i);
+      }
+      if(aFilter){
+       aFilter->UnRegisterAllOutputs();
+       aFilter->Delete();
+      }
     }
-    aPointData = aDataSet->GetPointData();
-    aScalars = aPointData->GetScalars();
-    if(!aScalars) continue;
-    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
-    aLineCont.insert(iLine);
-    TXYMap& aXYMap = aCurveVect[iLine];
-    float aPnt[3], aVect[3], aDist;
-    for(int i = 0; i < aNbPoints; i++){
-      aDataSet->GetPoint(i,aPnt);
-      Sub(aPnt,aBasePnt,aVect);
-      aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
-      // the workaround
-      if(aDist < 0.0) aDist = 0.0; 
-      if(aDist > 1.0) aDist = 1.0;
-      aXYMap[aDist] = aScalars->GetTuple1(i);
-      //aXMap[aDist].insert(iLine);
+    if(aXYMapCont.size() == 0)
+      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
+    //Resorting of theXYMap
+    TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
+    for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+      TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
+      if(aXYMap.size() > 2){  
+       // Try to smooth the values of the line by applying linear approximation
+       TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
+       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+       aXCont.insert(aXYMapIter[0]->first);
+       for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
+         float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
+         aY[2] = (aY[0] + aY[1])/2.0;
+         float aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
+         aX[2] = (aX[0] + aX[1])/2.0;
+         aNewXYMap[aX[2]] = aY[2];
+         aXCont.insert(aX[2]);
+       }
+       aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+       aXCont.insert(aXYMapIter[0]->first);
+       aXYMap = aNewXYMap;
+      }else{
+       TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+       for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
+         aXCont.insert(aXYMapIter->first);
+      }
     }
-    if(aFilter) aFilter->Delete();
-  }
-  iLineEnd = aLineCont.size();
-  if(iLineEnd == 0){
-    MESSAGE("CutPlanes_i::BuildTableOfReal aLineCont.size() == 0 !!!");
-    return;
-  }
-  //Resorting of theXYMap
-  for(int iLine = 0; iLine < iLineEnd; iLine++){
-    TXYMap& aXYMap = aCurveVect[iLine], aNewXYMap;
-    if(aXYMap.size() > 2){
-      TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
-      aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
-      aXMap[aXYMapIter[0]->first].insert(iLine);
-      for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
-       float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
-       aY[2] = (aY[0] + aY[1])/2.0;
-       float aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
-       aX[2] = (aX[0] + aX[1])/2.0;
-       aNewXYMap[aX[2]] = aY[2];
-       aXMap[aX[2]].insert(iLine);
+    if(aXCont.size() == 0)
+      throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
+    QString aString;
+    int iEnd = aXCont.size();
+    aTableOfReal->SetNbColumns(iEnd);
+    TXCont::const_iterator aXContIter = aXCont.begin();
+    for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
+      float aDist = *aXContIter; 
+      aTableOfReal->PutValue(aDist,1,i+1);
+      aString.sprintf("%d",i);
+      aTableOfReal->SetColumnTitle(i+1,aString.latin1());
+      if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
+      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+       long iLine = aXYMapContIter->first;
+       long iLineId = aLineIdCont[iLine];
+       const TXYMap& aXYMap = aXYMapCont[iLine];
+       TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
+       // Can we find some value that belong to the line and have the same X coordinate?
+       if(aXYMapIter == aXYMap.end()) continue;
+       float aVal = aXYMapIter->second;
+       aTableOfReal->PutValue(aVal,iLineId+2,i+1);
       }
-      aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
-      aXMap[aXYMapIter[0]->first].insert(iLine);
-      aXYMap = aNewXYMap;
-    }else{
-      TXYMap::const_iterator aXYMapIter = aXYMap.begin();
-      for(; aXYMapIter != aXYMap.end(); aXYMapIter++){
-       aXMap[aXYMapIter->first].insert(iLine);
-      }  
     }
-  }
-  QString aString;
-  aTableOfReal->SetNbColumns(aXMap.size());
-  TXMap::const_iterator aXMapIter = aXMap.begin();
-  for(long i = 0; aXMapIter != aXMap.end(); aXMapIter++, i++){
-    float aDist = aXMapIter->first; 
-    aTableOfReal->PutValue(aDist,1,i+1);
-    aString.sprintf("%d",i);
-    aTableOfReal->SetColumnTitle(i+1,aString.latin1());
-    const TLineCont& aLineCont = aXMapIter->second;
-    long jEnd = aLineCont.size();
-    if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist<<"; jEnd = "<<jEnd);
-    TLineCont::const_iterator aLineContIter = aLineCont.begin();
-    for(; aLineContIter != aLineCont.end(); aLineContIter++){
-      long iLine = *aLineContIter;
-      const TXYMap& aXYMap = aCurveVect[iLine];
-      TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
-      if(aXYMapIter == aXYMap.end()) continue;
-      float aVal = aXYMapIter->second;
-      aTableOfReal->PutValue(aVal,iLine+2,i+1);
+    {
+      aTableOfReal->SetRowTitle(1,"X");
+      aTableOfReal->SetRowUnit(1,"-");
+      QString aUnitName = myField->myUnitNames[0].c_str();
+      int aScalarMode = myCutLinesPL->GetScalarMode();
+      if(aScalarMode != 0) 
+       aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
+      aUnitName = aUnitName.simplifyWhiteSpace();
+      if(aUnitName.isEmpty()) aUnitName = "-";
+      TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+      for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+       long iLine = aXYMapContIter->first;
+       long iLineId = aLineIdCont[iLine];
+       aString.sprintf("Y%d",iLine);
+       if(MYDEBUG) 
+         MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<aString<<"')");
+       aTableOfReal->SetRowTitle(iLineId+2,aString.latin1());
+       aTableOfReal->SetRowUnit(iLineId+2,aUnitName.latin1());
+      }
     }
-  }
-  
-  aTableOfReal->SetRowTitle(1,"X");
-  TLineCont::const_iterator aLineContIter = aLineCont.begin();
-  QString aUnitName = myField->myUnitNames[0].c_str();
-  int aScalarMode = myCutLinesPL->GetScalarMode();
-  if(aScalarMode != 0) 
-    aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
-  aUnitName = aUnitName.simplifyWhiteSpace();
-  for(long i = 0; aLineContIter != aLineCont.end(); aLineContIter++, i++){
-    long iLine = *aLineContIter;
-    aString.sprintf("Y%d",iLine);
-    aTableOfReal->SetRowTitle(i+2,aString.latin1());
-    aTableOfReal->SetRowUnit(i+2,aUnitName.latin1());
+  }catch(std::runtime_error& exc){
+    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch (...){
+    INFOS("Unknown exception was accured !!!");
   }
 }
index 3ebd8331369d5a514d0064e4fdce7e7a8a4d2452..4c4a7e094335bbe4b3b7d3a1f2e9a107cd52699e 100644 (file)
@@ -39,19 +39,27 @@ namespace VISU{
     CutLines_i();
     CutLines_i(const CutLines_i&);
   public:
-    CutLines_i(Result_i* theResult, bool theAddToStudy = true);
+    CutLines_i(Result_i* theResult, bool theAddToStudy = true,
+              SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const CutLines_i* theOrigin);
     virtual ~CutLines_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TCUTLINES;};
 
-    virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient);
-    virtual VISU::CutPlanes::Orientation GetOrientationType();
+    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 void SetOrientationType2(VISU::CutPlanes::Orientation theOrient);
+    virtual VISU::CutPlanes::Orientation GetOrientationType();
     virtual VISU::CutPlanes::Orientation GetOrientationType2();
 
+    virtual CORBA::Double GetRotateX();
+    virtual CORBA::Double GetRotateY();
+
+    virtual CORBA::Double GetRotateX2();
+    virtual CORBA::Double GetRotateY2();
+
     virtual void SetDisplacement(CORBA::Double theDisp);
     virtual CORBA::Double GetDisplacement();
 
@@ -72,17 +80,6 @@ namespace VISU{
 
     virtual void SetNbLines(CORBA::Long theNb);
     virtual CORBA::Long GetNbLines();
-    
-    virtual void SetRotateX(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateX();
-    virtual void SetRotateY(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateY();
-
-    virtual void SetRotateX2(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateX2();
-    virtual void SetRotateY2(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateY2();
-
     typedef VISU::CutLines TInterface;
     VISU_CutLinesPL* GetCutLinesPL(){ return myCutLinesPL;}
 
@@ -93,7 +90,7 @@ namespace VISU{
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
                             const char* theFieldName, int theIteration);
 
@@ -101,9 +98,6 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-    throw(std::logic_error&);
 
     void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
 
index a4ede3a53df91c63117d74134c7d9402c329f09a..d48d6e0ae621d0fdb593a8e051603cdc4bd3bc4b 100644 (file)
@@ -41,9 +41,9 @@ static int MYDEBUGWITHFILES = 0;
 #endif
 
 int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                 const char* theFieldName, int theIteration)
+                                 const char* theFieldName, int theIteration, int isMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
 }
 
 
@@ -55,29 +55,18 @@ 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) :
+VISU::CutPlanes_i::CutPlanes_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject)
 {
   myCutPlanesPL = NULL;
 }
 
 
-void VISU::CutPlanes_i::Destroy(){
-  ScalarMap_i::Destroy();
-}
-
-
 void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){
   CutPlanes_i* aCutPlanes = const_cast<CutPlanes_i*>(theOrigin);
   VISU::ScalarMap_i::SameAs(theOrigin);
-
-  //SetNbPlanes(aCutPlanes->GetNbPlanes());
-  //SetDisplacement(aCutPlanes->GetDisplacement());
-  //SetOrientationType(aCutPlanes->GetOrientationType());
-  //SetRotateX(aCutPlanes->GetRotateX());
-  //SetRotateY(aCutPlanes->GetRotateY());
 }
 
 
@@ -91,39 +80,40 @@ VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity
 VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap)
   throw(std::logic_error&)
 {
-  ScalarMap_i::Restore(theMap);
-
+  DoHook();
   SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement").toDouble());
-  SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()));
-  SetRotateX(VISU::Storable::FindValue(theMap,"aRot[0]").toDouble());
-  SetRotateY(VISU::Storable::FindValue(theMap,"aRot[1]").toDouble());
+  SetOrientation(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
+                Storable::FindValue(theMap,"aRot[0]").toDouble(),
+                Storable::FindValue(theMap,"aRot[1]").toDouble());
+  QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlanePosition") );
+  QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlaneCondition") );
+  for(int i = 0, iEnd = GetNbPlanes(); i < iEnd; i++)
+    if(aCondList[i].toInt() == 0)
+      SetPlanePosition(i,aPosList[i].toDouble());
 
-  return Build(true);
+  return ScalarMap_i::Restore(theMap);
 }
 
 
 void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
   ScalarMap_i::ToStream(theStr);
 
-  Storable::DataToStream( theStr, "myNbPlanes",  int(GetNbPlanes()) );
-  Storable::DataToStream( theStr, "myDisplacement",  GetDisplacement() );
-  Storable::DataToStream( theStr, "myBasePlane", int(GetOrientationType()) );
-  Storable::DataToStream( theStr, "aRot[0]",     GetRotateX() );
-  Storable::DataToStream( theStr, "aRot[1]",     GetRotateY() );
-}
+  int aNbPlanes = GetNbPlanes();
 
+  Storable::DataToStream( theStr, "myNbPlanes", int(GetNbPlanes()));
+  Storable::DataToStream( theStr, "myDisplacement", GetDisplacement());
+  Storable::DataToStream( theStr, "myBasePlane", int(GetOrientationType()));
+  Storable::DataToStream( theStr, "aRot[0]", GetRotateX());
+  Storable::DataToStream( theStr, "aRot[1]", GetRotateY());
 
-VISU::Storable* VISU::CutPlanes_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                          const string& thePrefix, const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::CutPlanes_i* pResent = new VISU::CutPlanes_i(pResult);
-    return pResent->Restore(theMap);
+  QString aStrPos, aStrCon;
+  for(int i = 0, iEnd = GetNbPlanes(); i < iEnd; i++){
+    aStrPos.append(QString::number(GetPlanePosition(i)) + "|");
+    aStrCon.append(QString::number(IsDefault(i)) + "|");
   }
-  return NULL;
+  Storable::DataToStream( theStr, "myPlanePosition",  aStrPos.latin1());
+  Storable::DataToStream( theStr, "myPlaneCondition", aStrCon.latin1());
 }
 
 
@@ -132,12 +122,22 @@ VISU::CutPlanes_i::~CutPlanes_i(){
 }
 
 
-void VISU::CutPlanes_i::SetOrientationType(VISU::CutPlanes::Orientation theOrient){
-  myCutPlanesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient));
+void VISU::CutPlanes_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                                      CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+  myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+                               theXAngle,theYAngle);
 }
+
 VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() { 
   return VISU::CutPlanes::Orientation(myCutPlanesPL->GetPlaneOrientation());
 }
+CORBA::Double VISU::CutPlanes_i::GetRotateX(){
+  return myCutPlanesPL->GetRotateX();
+}
+CORBA::Double VISU::CutPlanes_i::GetRotateY(){
+  return myCutPlanesPL->GetRotateY();
+}
 
 
 void VISU::CutPlanes_i::SetDisplacement(CORBA::Double theDisp) { 
@@ -172,22 +172,6 @@ CORBA::Long VISU::CutPlanes_i::GetNbPlanes() {
 }
 
 
-void VISU::CutPlanes_i::SetRotateX(CORBA::Double theAngle){
-  myCutPlanesPL->SetRotateX(theAngle);
-}
-CORBA::Double VISU::CutPlanes_i::GetRotateX(){
-  return myCutPlanesPL->GetRotateX();
-}
-
-
-void VISU::CutPlanes_i::SetRotateY(CORBA::Double theAngle){
-  myCutPlanesPL->SetRotateY(theAngle);
-}
-CORBA::Double VISU::CutPlanes_i::GetRotateY(){
-  return myCutPlanesPL->GetRotateY();
-}
-
-
 void VISU::CutPlanes_i::DoHook(){
   if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New();
   myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(myPipeLine);
index a64190bcb0ffdb85ed3e7cfe2ad394805eaa6e9c..6d64f6e5a974737210841cd64a584a67b41d2b86 100644 (file)
@@ -39,16 +39,20 @@ namespace VISU{
     CutPlanes_i();
     CutPlanes_i(const CutPlanes_i&);
   public:
-    CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
+    CutPlanes_i(Result_i* theResult, bool theAddToStudy = true,
+               SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const CutPlanes_i* theOrigin);
     virtual ~CutPlanes_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
 
-    virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient);
-    virtual VISU::CutPlanes::Orientation GetOrientationType();
+    virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient,
+                               CORBA::Double theXAngle, CORBA::Double theYAngle);
 
+    virtual VISU::CutPlanes::Orientation GetOrientationType();
+    virtual CORBA::Double GetRotateX();
+    virtual CORBA::Double GetRotateY();
+    
     virtual void SetDisplacement(CORBA::Double theDisp);
     virtual CORBA::Double GetDisplacement();
 
@@ -61,12 +65,6 @@ namespace VISU{
     virtual void SetNbPlanes(CORBA::Long theNb);
     virtual CORBA::Long GetNbPlanes();
     
-    virtual void SetRotateX(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateX();
-
-    virtual void SetRotateY(CORBA::Double theAngle);
-    virtual CORBA::Double GetRotateY();
-    
     typedef VISU::CutPlanes TInterface;
     VISU_CutPlanesPL* GetCutPlanesPL(){ return myCutPlanesPL;}
 
@@ -77,17 +75,14 @@ namespace VISU{
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         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)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
     
     static const string myComment;
     virtual const char* GetComment() const;
index 19baed976976ffa0639a820e305098dc1e78d984..b53ec71274d4ec582cf12d0b0389b4cbe259dc43 100644 (file)
@@ -41,10 +41,10 @@ static int MYDEBUGWITHFILES = 0;
 #endif
 
 int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                     const char* theFieldName, int theIteration)
+                                     const char* theFieldName, int theIteration, int isMemoryCheck)
 {
   try{
-    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0;
     const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
     return aField.myNbComp > 1;
   }catch(std::runtime_error& exc){
@@ -61,25 +61,23 @@ QString VISU::DeformedShape_i::GenerateName() { return VISU::GenerateName("Def.S
 const string VISU::DeformedShape_i::myComment = "DEFORMEDSHAPE";
 const char* VISU::DeformedShape_i::GetComment() const { return myComment.c_str();}
 
-VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy) : 
+
+VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) : 
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject)
 {
   if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
   myDeformedShapePL = NULL;
 }
 
-void VISU::DeformedShape_i::Destroy(){
-  ScalarMap_i::Destroy();
-}
+
 
 void VISU::DeformedShape_i::SameAs(const DeformedShape_i* theOrigin)
 {
   DeformedShape_i* aDefShape = const_cast<DeformedShape_i*>(theOrigin);
   VISU::ScalarMap_i::SameAs(theOrigin);
 
-  //SetScale(aDefShape->GetScale());
   SetColor(aDefShape->GetColor());
   ShowColored(aDefShape->IsColored());
 }
@@ -93,21 +91,21 @@ VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Ent
   return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
 }
 
+
 VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
      throw(std::logic_error&)
 {
-  ScalarMap_i::Restore(theMap);
-
+  DoHook();
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-
   myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
   myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
   myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
   myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
 
-  return Build(true);
+  return ScalarMap_i::Restore(theMap);
 }
 
+
 void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
   ScalarMap_i::ToStream(theStr);
 
@@ -119,18 +117,6 @@ void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myColor.B", myColor.B );
 }
 
-VISU::Storable* VISU::DeformedShape_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                              const string& thePrefix, const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::DeformedShape_i* pResent = new VISU::DeformedShape_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
 
 VISU::DeformedShape_i::~DeformedShape_i(){
   if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()");
@@ -169,7 +155,7 @@ VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveOb
 }
 
 
-void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor){
+void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     if(IsColored()){
       anActor->SetBarVisibility(true);
index 1454fcbb61cee35b1c43951339fdb36e1aa4bc5b..2f36e8e1a7ee0fb10c3e21d88f33549a96a1e820 100644 (file)
@@ -39,10 +39,10 @@ namespace VISU{
     DeformedShape_i();
     DeformedShape_i(const DeformedShape_i&);
   public:
-    DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
+    DeformedShape_i(Result_i* theResult, bool theAddToStudy = true,
+                   SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const DeformedShape_i* theOrigin);
     virtual ~DeformedShape_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
 
@@ -67,7 +67,7 @@ namespace VISU{
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
                             const char* theFieldName, int theIteration);
 
@@ -79,17 +79,13 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
 
     virtual void SetMapScale(double theMapScale = 1.0);
 
     virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
       throw (std::runtime_error&);
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
   };
 }
-#endif
-
 
+#endif
index 61d85b138f31019465af25a7ae5f0fa67c7df1bc..cc88eefe84ea365d3f37ade66a0684d16aa8ba47 100644 (file)
@@ -69,13 +69,13 @@ static int MYDEBUG = 0;
 
 extern "C" {
   PortableServer::ObjectId * 
-    VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
-                      const char *instanceName, const char *interfaceName) 
-      {
-       if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
-       VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
-       return pVISU_Gen->getId() ;
-      }
+  VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
+                    const char *instanceName, const char *interfaceName) 
+  {
+    if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
+    VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
+    return pVISU_Gen->getId() ;
+  }
   VISU::VISU_Gen_ptr  
   GetVisuGen(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, 
             SALOME_NamingService* theNamingService, QMutex* theMutex)
@@ -104,8 +104,8 @@ namespace VISU{
       aSComponent = aStudyBuilder->NewComponent("VISU"); 
       SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-      //NRI      aName->SetValue("Visu");
 
+      //NRI      aName->SetValue("Visu");
       CORBA::ORB_var anORB = Base_i::GetORB();
       SALOME_NamingService *NamingService = new SALOME_NamingService( anORB );
       CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
@@ -130,14 +130,14 @@ namespace VISU{
 
   void RegistryStorable() throw(std::logic_error&) {
     Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
-    Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore));
-    Storable::Registry(ScalarMap_i::myComment.c_str(),&(ScalarMap_i::Restore));
-    Storable::Registry(DeformedShape_i::myComment.c_str(),&(DeformedShape_i::Restore));
-    Storable::Registry(CutPlanes_i::myComment.c_str(),&(CutPlanes_i::Restore));
-    Storable::Registry(CutLines_i::myComment.c_str(),&(CutLines_i::Restore));
-    Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(IsoSurfaces_i::Restore));
-    Storable::Registry(StreamLines_i::myComment.c_str(),&(StreamLines_i::Restore));
-    Storable::Registry(Vectors_i::myComment.c_str(),&(Vectors_i::Restore));
+    Storable::Registry(Mesh_i::myComment.c_str(),&(Restore<Mesh_i>));
+    Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
+    Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
+    Storable::Registry(CutPlanes_i::myComment.c_str(),&(Restore<CutPlanes_i>));
+    Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
+    Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(Restore<IsoSurfaces_i>));
+    Storable::Registry(StreamLines_i::myComment.c_str(),&(Restore<StreamLines_i>));
+    Storable::Registry(Vectors_i::myComment.c_str(),&(Restore<Vectors_i>));
     Storable::Registry(Table_i::myComment.c_str(),&(Table_i::Restore));
     Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
     Storable::Registry(Container_i::myComment.c_str(),&(Container_i::Restore));
@@ -168,10 +168,10 @@ namespace VISU{
     Engines_Component_i()
   {
     if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<<theMutex);
-    Mutex mt(theMutex,qApp);
+    //Mutex mt(theMutex,qApp);
     Base_i::myMutex = theMutex;  //apo
     Base_i::myOrb = CORBA::ORB::_duplicate(theORB);
-    Base_i::myPOA = PortableServer::POA::_duplicate(thePOA);
+    Base_i::myPoa = PortableServer::POA::_duplicate(thePOA);
     Base_i::myNamingService = theNamingService;
     static SALOME_LifeCycleCORBA aEnginesLifeCycle(theNamingService);
     Base_i::myEnginesLifeCycle = &aEnginesLifeCycle;
@@ -183,13 +183,10 @@ namespace VISU{
     SALOMEDS::ListOfOpenStudies_var aListOfOpenStudies = aStudyManager->GetOpenStudies();
     if(aListOfOpenStudies->length() > 0) {
       CORBA::String_var aStudyName = aListOfOpenStudies[0];
-      aFileInfo.setFile(aStudyName.in());
-      myStudyDocument = aStudyManager->GetStudyByName(aFileInfo.baseName());
-    }else{
+      //aFileInfo.setFile(aStudyName.in());
+      myStudyDocument = aStudyManager->GetStudyByName(aStudyName/*aFileInfo.baseName()*/);
+    }else
       if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : there is no opened study in StudyManager !!!");
-    }
-
-    Base_i::myPOA->activate_object(this);
   }
 
   VISU_Gen_i::~VISU_Gen_i(){
@@ -250,8 +247,7 @@ namespace VISU{
     if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - myMutex = "<<myMutex);
     if(myMutex){
       Mutex mt(myMutex,qApp);
-      CORBA::String_var aString = SALOMEDS_Tool::GetTmpDir();
-      TCollection_AsciiString aTmpDir = isMultiFile? (const Standard_CString)theURL: (const Standard_CString)aString.in();
+      TCollection_AsciiString aTmpDir = isMultiFile? strdup(theURL): SALOMEDS_Tool::GetTmpDir();
       if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
       int aCounter = 0;
       TColStd_SequenceOfAsciiString aFileNames;
@@ -261,20 +257,24 @@ namespace VISU{
        SALOMEDS::SObject_var gotBranch = itBig->Value();
        CORBA::Object_var anObj = SObjectToObject(gotBranch);
        if(CORBA::is_nil(anObj)) continue;
-       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
-       if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){
-         const QFileInfo& aFileInfo = pResult->GetFileInfo();
-         QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
-         QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
-         static QString aCommand;
-         aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
-         if(system(aCommand) == -1){
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
-           continue;
-         }else
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
-         TCollection_AsciiString aString(strdup(aFileName.latin1()));
-         aFileNames.Append(aString);
+       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in());
+       if(pResult){
+         const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+         if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+           const QFileInfo& aFileInfo = pResult->GetFileInfo();
+           QString aPrefix("");
+           if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+           QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
+           static QString aCommand;
+           aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
+           if(system(aCommand) == -1){
+             if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+             continue;
+           }else
+             if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aCommand = "<<aCommand);
+           TCollection_AsciiString aString(strdup(aFileName.latin1()));
+           aFileNames.Append(aString);
+         }
        }
       }
       SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
@@ -310,24 +310,28 @@ namespace VISU{
        SALOMEDS::SObject_var gotBranch = itBig->Value();
        CORBA::Object_var anObj = SObjectToObject(gotBranch);
        if(CORBA::is_nil(anObj)) continue;
-       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
-       if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){
-         const QFileInfo& aFileInfo = pResult->GetFileInfo();
-         QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
-         QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
-         static QString aCommand;
-         aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
-         
-         if(system(aCommand) == -1){
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
-           continue;
-         }else
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
-         TCollection_AsciiString aString(strdup(aFileName.latin1()));
-
-         HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);
-
-         aFileNames.Append(aString);
+       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in());
+       if(pResult){
+         const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+         if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+           const QFileInfo& aFileInfo = pResult->GetFileInfo();
+           QString aPrefix("");
+           if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+           QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
+           static QString aCommand;
+           aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
+           
+           if(system(aCommand) == -1){
+             if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+             continue;
+           }else
+             if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
+           TCollection_AsciiString aString(strdup(aFileName.latin1()));
+           
+           HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);
+           
+           aFileNames.Append(aString);
+         }
        }
       }
       SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
@@ -357,7 +361,7 @@ namespace VISU{
        CORBA::ORB_ptr anORB = GetORB();
        CORBA::Object_var anObj = anORB->string_to_object(aString);
        if(!CORBA::is_nil(anObj)){
-         Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj));
+         Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj).in());
          if(pStorable != NULL){
            Mutex mt(myMutex,qApp);
            aString = pStorable->ToString().c_str();
@@ -378,10 +382,15 @@ namespace VISU{
 
   void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){
     if(myMutex){
-      if(!CORBA::is_nil(theStudy))
+      if(CORBA::is_nil(theStudy)) 
+       INFOS("VISU_Gen_i::SetCurrentStudy : CORBA::is_nil(theStudy)");
+      if(!CORBA::is_nil(theStudy)){
+       CORBA::String_var aName = theStudy->Name();
+       INFOS("VISU_Gen_i::SetCurrentStudy - StudyId = "<<theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
        myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+      }
     }else
-      myVisuGen->SetCurrentStudy(SALOMEDS::Study::_duplicate(theStudy));
+      myVisuGen->SetCurrentStudy(theStudy);
   }
   SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
     if(myMutex)
@@ -410,18 +419,40 @@ namespace VISU{
     return myVisuGen->ImportTables(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){
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
       Mutex mt(myMutex,qApp);
-      VISU::Result_var aResult;
       aFileInfo.setFile(theFileName);
       Result_i* pResult = new Result_i(myStudyDocument);
+      if(pResult->Create(theFileName) != NULL) 
+       return pResult->_this();
+      else{
+       pResult->_remove_ref();
+       return VISU::Result::_nil();
+      }
+     }
+    return myVisuGen->ImportFile(theFileName);
+  }
+
+  Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
+    if(myMutex){
+      if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
+      Mutex mt(myMutex,qApp);
+      VISU::Result_var aResult;
+      aFileInfo.setFile(theFileName);
+      Result_i* pResult = new Result_i(myStudyDocument,Result_i::eRestoredFile);
       if(pResult->Create(theFileName) != NULL) 
        aResult = pResult->_this();
       return aResult._retn();
     }
-    return myVisuGen->ImportFile(theFileName);
+    return myVisuGen->CopyAndImportFile(theFileName);
   }
 
   Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
@@ -430,9 +461,12 @@ namespace VISU{
       if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
       Mutex mt(myMutex,qApp);
       Result_i* pResult = new Result_i(myStudyDocument);
-      if(pResult->Create(theMedSObject) != NULL) 
-       return Result::_duplicate(pResult->_this());
-      return Result::_nil();
+      if(pResult->Create(theMedSObject) != NULL)
+       return pResult->_this();
+      else{
+       pResult->_remove_ref();
+       return VISU::Result::_nil();
+      }
     }
     return myVisuGen->ImportMed(theMedSObject);
   }
@@ -443,9 +477,12 @@ namespace VISU{
       if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
       Mutex mt(myMutex,qApp);
       Result_i* pResult = new Result_i(myStudyDocument);
-      if(pResult->Create(theField) != NULL) 
-       return Result::_duplicate(pResult->_this());
-      return Result::_nil();
+      if(pResult->Create(theField) != NULL)
+       return pResult->_this();
+      else{
+       pResult->_remove_ref();
+       return VISU::Result::_nil();
+      }
     }
     return myVisuGen->ImportMedField(theField);
   }
@@ -455,11 +492,14 @@ namespace VISU{
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
       Mutex mt(myMutex,qApp);
-      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
       Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity) != NULL) 
-        return Mesh::_duplicate(aPresent->_this());
-      return Mesh::_nil();
+      if(aPresent->Create(theMeshName,theEntity) != NULL)
+       return aPresent->_this();
+      else{
+       aPresent->_remove_ref();
+       return VISU::Mesh::_nil();
+      }
     }
     return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
   }
@@ -471,11 +511,14 @@ namespace VISU{
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
       Mutex mt(myMutex,qApp);
-      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
       Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL) 
-        return Mesh::_duplicate(aPresent->_this());
-      return Mesh::_nil();
+      if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL)
+       return aPresent->_this();
+      else{
+       aPresent->_remove_ref();
+       return VISU::Mesh::_nil();
+      }
     }
     return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
   }
@@ -486,11 +529,14 @@ namespace VISU{
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
       Mutex mt(myMutex,qApp);
-      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
       Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theGroupName) != NULL) 
-        return Mesh::_duplicate(aPresent->_this());
-      return Mesh::_nil();
+      if(aPresent->Create(theMeshName,theGroupName) != NULL)
+       return aPresent->_this();
+      else{
+       aPresent->_remove_ref();
+       return VISU::Mesh::_nil();
+      }
     }
     return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
   }
@@ -498,49 +544,49 @@ namespace VISU{
   ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                             const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
     return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
   DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                     const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
   Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                     const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
   IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                     const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
   StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                     const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
   CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                     const char* theFieldName, CORBA::Double theIteration)
   {
-    if(myMutex) return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     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)
   {
-    if(myMutex) return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+    if(myMutex) return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
     return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
   }
 
@@ -549,10 +595,13 @@ namespace VISU{
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Table::_nil();
       Mutex mt(myMutex,qApp);
-      Table_i* aPresent = new Table_i(myStudyDocument,theTableEntry);
-      if(aPresent->Create() != NULL) 
-       return Table::_duplicate(aPresent->_this());
-      return Table::_nil();
+      Table_i* pPresent = new Table_i(myStudyDocument,theTableEntry);
+      if(pPresent->Create() != NULL)
+       return pPresent->_this();
+      else{
+       pPresent->_remove_ref();
+       return VISU::Table::_nil();
+      }
     }
     return myVisuGen->CreateTable(theTableEntry);
   }
@@ -564,11 +613,13 @@ namespace VISU{
       Mutex mt(myMutex,qApp);
       PortableServer::POA_ptr aPOA = GetPOA();
       Table_i* pTable = dynamic_cast<Table_i*>(aPOA->reference_to_servant(theTable));
-      Curve_i* aPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
-      if(aPresent->Create() != NULL) { 
-       return Curve::_duplicate(aPresent->_this());
+      Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
+      if(pPresent->Create() != NULL)
+       return pPresent->_this();
+      else{
+       pPresent->_remove_ref();
+       return VISU::Curve::_nil();
       }
-      return Curve::_nil();
     }
     return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
   }
@@ -577,11 +628,13 @@ namespace VISU{
     if(myMutex){
       if(myStudyDocument->GetProperties()->IsLocked()) return Container::_nil();
       Mutex mt(myMutex,qApp);
-      Container_i* aPresent = new Container_i(myStudyDocument);
-      if(aPresent->Create() != NULL) {
-       return Container::_duplicate(aPresent->_this());
+      Container_i* pPresent = new Container_i(myStudyDocument);
+      if(pPresent->Create() != NULL)
+       return pPresent->_this();
+      else{
+       pPresent->_remove_ref();
+       return VISU::Container::_nil();
       }
-      return Container::_nil();
     }
     return myVisuGen->CreateContainer();
   }
@@ -591,8 +644,11 @@ namespace VISU{
       if(myStudyDocument->GetProperties()->IsLocked()) return Animation::_nil();
       Mutex mt(myMutex,qApp);
       if(MYDEBUG) MESSAGE("VISU_Gen_i::CreateAnimation : "<<myMutex);
-      VISU_TimeAnimation* anAnim = new VISU_TimeAnimation(myStudyDocument,theView3D);
-      return Animation::_duplicate(anAnim->_this());
+      if(VISU_TimeAnimation* anAnim = new VISU_TimeAnimation(myStudyDocument,theView3D)){
+       return anAnim->_this();
+      }else
+       return VISU::Animation::_nil();
+       
     }
     return myVisuGen->CreateAnimation(theView3D);
   }
@@ -600,27 +656,40 @@ namespace VISU{
   void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
     if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : "<<myMutex);
     if(myMutex){
-      Mutex mt(myMutex,qApp);
-      SALOMEDS::Study_var aStudy = theComponent->GetStudy(); 
-      if(!aStudy->_is_nil()){
-       SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
-       for (int i = 0; itBig->More(); itBig->Next(),i++) {
-         SALOMEDS::SObject_var gotBranch = itBig->Value();
-         if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : itBig->Next() = "<<i);
-         CORBA::Object_var anObj = SObjectToObject(gotBranch);
-         if(CORBA::is_nil(anObj)) continue;
-         Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
-         if(!pResult) continue;
-         if(pResult->GetSourceId() == Result_i::eRestoredFile){ //Try remove its file and directory
-           const QFileInfo& aFileInfo = pResult->GetFileInfo();
-           static QString aCommand;
-           aCommand.sprintf("rm %s",aFileInfo.filePath().latin1());
-           if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
-           aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",aFileInfo.dirPath().latin1());
-           if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
-         }
-       }
-      }
+      //Mutex mt(myMutex,qApp);
+      //SALOMEDS::Study_var aStudy = theComponent->GetStudy(); 
+      //if(!aStudy->_is_nil()){
+      //       SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(theComponent);
+      //       aChildIter->InitEx(true);
+      //       for (int i = 0; aChildIter->More(); aChildIter->Next(),i++) {
+      //         SALOMEDS::SObject_var aSObject = aChildIter->Value();
+      //         if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : aChildIter->Next() = "<<i);
+      //         CORBA::Object_var anObj = SObjectToObject(aSObject);
+      //         if(CORBA::is_nil(anObj)) continue;
+      //         PortableServer::ServantBase_var aServant = GetServant(anObj);
+      //         if(aServant.in() == NULL) continue;
+      //         if(VISU::Base_i* pBase = dynamic_cast<VISU::Base_i*>(aServant.in())){
+      //           VISU::VISUType aType = pBase->GetType();
+      //           switch(aType){
+      //           case VISU::TRESULT:
+      //             if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(pBase)){
+      //               //Try remove its file and directory
+      //               if(pResult->GetSourceId() == Result_i::eRestoredFile){ 
+      //                 const QFileInfo& aFileInfo = pResult->GetFileInfo();
+      //                 static QString aCommand;
+      //                 aCommand.sprintf("rm %s",aFileInfo.filePath().latin1());
+      //                 if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+      //                 aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",aFileInfo.dirPath().latin1());
+      //                 if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+      //               }
+      //             }
+      //             break;
+      //           default:
+      //             break;
+      //           }
+      //         }
+      //       }
+      //}
       return;
     }
     myVisuGen->Close(theComponent);
@@ -645,7 +714,7 @@ namespace VISU{
     if(myMutex){
       Mutex mt(myMutex,qApp);
       SALOMEDS::SObject_var aResultSO;
-      Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject));
+      Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject).in());
       if (!aResultObj) return aResultSO._retn();
       const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
       CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID();
@@ -669,16 +738,17 @@ namespace VISU{
          if (!CORBA::is_nil(anObj)){
            Result_var aResultObj = Result::_narrow(anObj);
            if(!aResultObj->_is_nil()){
-             Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj));
-             if(pResult != NULL){
-               if(abs(pResult->GetSourceId()) > Result_i::eFile) 
-                 if((pResult->GetFileInfo()).filePath() == "MED") return false;
+             if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj).in())){
+               const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+               if(aSourceId == Result_i::eComponent || aSourceId == Result_i::eRestoredComponent)
+                 if((pResult->GetFileInfo()).filePath() == "MED") 
+                   return false;
                return true;
              }
            }
          }
        }
-      } catch (...) {
+      }catch (...){
        INFOS("Unknown exception was accured!");
       }
       return false;
@@ -687,7 +757,6 @@ namespace VISU{
   }
 
   SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
-    if(MYDEBUG) MESSAGE("VISU_Gen_i::CopyFrom : "<<myMutex);
     if(myMutex){
       Mutex mt(myMutex,qApp);
 
@@ -712,7 +781,7 @@ namespace VISU{
        return NULL;
       }
 
-      Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj));
+      Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj).in());
       if (!pStorable) {
        return NULL;
       }
@@ -778,14 +847,13 @@ namespace VISU{
       SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
 
       ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str());
-//        ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str(),ios::in);
       stmIn.seekg(0, ios::end);
       int aLength = stmIn.tellg();
       stmIn.seekg(0, ios::beg);
       char* aString = new char[aLength+1];
       stmIn.read(aString, aLength);
       aString[aLength] = 0;
-      myIsMultiFile = true;
+      myIsMultiFile = false;
 
       string aFileName(aTmpDir.in());
       if(aSeq->length() > 1) aFileName += aSeq[1].in();
index 08c4010cf44e46cdf4796bf64a6002a2d76ce734..2b4dfc34f4c98f5cfbe2930e8c8322b99f43c7fe 100644 (file)
@@ -44,9 +44,11 @@ namespace VISU{
     virtual ViewManager_ptr GetViewManager();
 
     virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
+    virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName );
 
     //Create Result
     virtual Result_ptr ImportFile(const char* theFileName);
+    virtual Result_ptr CopyAndImportFile(const char* theFileName);
     virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
     virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
 
@@ -57,19 +59,21 @@ namespace VISU{
     virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
 
     //Create 3D collored Presentation Of Different Types
-    template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_ptr_type 
+    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)
+              const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
     {
       typedef typename TPrs3d_i::TInterface TPrs3d;
+      typename TPrs3d::_var_type aPrs3d;
       if(myStudyDocument->GetProperties()->IsLocked()) return TPrs3d::_nil();
       Mutex mt(myMutex,qApp);
-      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+      Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
       if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
-       TPrs3d_i* aPresent = new TPrs3d_i(pResult);
-       if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL){
+       TPrs3d_i* aPresent = new TPrs3d_i(pResult,theAddToStudy);
+       if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL)
          return aPresent->_this();
-       }
+       else
+         aPresent->_remove_ref();
       }
       return TPrs3d::_nil();
     }
index d7e6bf15bb323b0664ccc22015a8a9f06e8ee1f3..57cfc08ae2c517ae4ee4cb1a1d734adc0a997062 100644 (file)
@@ -41,9 +41,9 @@ static int MYDEBUGWITHFILES = 0;
 #endif
 
 int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                   const char* theFieldName, int theIteration)
+                                   const char* theFieldName, int theIteration, int isMemoryCheck)
 {
-  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
 }
 
 int VISU::IsoSurfaces_i::myNbPresent = 0;
@@ -52,43 +52,40 @@ QString VISU::IsoSurfaces_i::GenerateName() { return VISU::GenerateName("IsoSurf
 const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES";
 const char* VISU::IsoSurfaces_i::GetComment() const { return myComment.c_str();}
 
-VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy) :
+
+VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject)
 {
   myIsoSurfacesPL = NULL;
 }
 
-void VISU::IsoSurfaces_i::Destroy(){
-  ScalarMap_i::Destroy();
-}
+
 
 void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) {
   IsoSurfaces_i* aIsoSurfaces = const_cast<IsoSurfaces_i*>(theOrigin);
   VISU::ScalarMap_i::SameAs(theOrigin);
-
-  //SetNbSurfaces(aIsoSurfaces->GetNbSurfaces());
-  //SetSubRange(aIsoSurfaces->GetSubMin(),aIsoSurfaces->GetSubMax());
 }
 
+
 VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, 
                                            const char* theFieldName, int theIteration)
 {
   return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
 }
 
+
 VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap)
      throw(std::logic_error&)
 {
-  ScalarMap_i::Restore(theMap);
-
+  DoHook();
   SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
   float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
   float aMax = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
   SetSubRange(aMin,aMax);
     
-  return Build(true);
+  return ScalarMap_i::Restore(theMap);
 }
 
 void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
@@ -99,18 +96,6 @@ void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myRange[1]", GetSubMax() );
 }
 
-VISU::Storable* VISU::IsoSurfaces_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::IsoSurfaces_i* pResent = new VISU::IsoSurfaces_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
 
 VISU::IsoSurfaces_i::~IsoSurfaces_i(){
   if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()");
index a5a6d208eedee43a6f6b254059af392db9e5e621..8d026d81b21f640357fb3a3a9f2115d684d26d22 100644 (file)
@@ -39,10 +39,10 @@ namespace VISU{
     IsoSurfaces_i();
     IsoSurfaces_i(const IsoSurfaces_i&);
   public:
-    IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
+    IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true,
+                 SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const IsoSurfaces_i* theOrigin);
     virtual ~IsoSurfaces_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
 
@@ -62,7 +62,7 @@ namespace VISU{
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
                             const char* theFieldName, int theIteration);
 
@@ -74,9 +74,6 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
 
     virtual void SetMapScale(double theMapScale = 1.0);
   };
index 0a5ad229b5f4f95a94cd5de6aa9b967844d6b8a7..e52fa832f8563436787da1559becdda8b6021101 100644 (file)
@@ -50,33 +50,33 @@ 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) : 
+VISU::Mesh_i::Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : 
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult)
+       Prs3d_i(theResult,theSObject)
 {
   myPipeLine = myMeshPL = VISU_MeshPL::New();;
 }
 
+
+void VISU::Mesh_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObject);
+}
+
+
 void VISU::Mesh_i::SameAs(const Mesh_i* theOrigin){
   return; // "SameAs" command for mesh is not valid in current architecture
 }
 
-void VISU::Mesh_i::Destroy(){
-  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(GetEntry());
-  if(!aSObj->_is_nil()){
-    SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-    aStudyBuilder->RemoveAttribute(aSObj,"AttributeIOR");
-  }
-  Prs3d_i::Destroy();
-}
+
 
 int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, Entity theEntity, const char* theFamilyName){
   try{
-    vtkIdType aSize = INCMEMORY*
+    INFOS("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+    float aSize = INCMEMORY*
       theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity,theFamilyName);
-    if(MYDEBUG) MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<aSize);
-    if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
-    return false;
+    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    return aResult;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
@@ -95,11 +95,12 @@ VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, Entity theEntity,
 
 int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName){
   try{
-    vtkIdType aSize = INCMEMORY*
+    INFOS("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+    float aSize = INCMEMORY*
       theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
-    if(MYDEBUG) MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<aSize);
-    if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
-    return false;
+    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    return aResult;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
@@ -107,6 +108,8 @@ int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, const
   }
   return 0;
 }
+
+
 VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGroupName){
   myMeshName = theMeshName;
   myEntity = VISU::TEntity(-1);
@@ -114,6 +117,7 @@ VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGro
   return Build(false);
 }
 
+
 VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap)
      throw(std::logic_error&)
 {
@@ -140,6 +144,7 @@ VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap)
   return Build(true);
 }
 
+
 void VISU::Mesh_i::ToStream(std::ostringstream& theStr){
   Prs3d_i::ToStream(theStr);
 
@@ -162,18 +167,6 @@ void VISU::Mesh_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myLinkColor.B", myLinkColor.B );
 }
 
-VISU::Storable* VISU::Mesh_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                     const string& thePrefix, const Storable::TRestoringMap& theMap)
-  throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::Mesh_i* pResent = new VISU::Mesh_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
 
 VISU::Mesh_i::~Mesh_i(){
   if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
@@ -181,6 +174,8 @@ VISU::Mesh_i::~Mesh_i(){
 
 
 VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
+  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+  aStudyBuilder->NewCommand();  // There is a transaction
   try{
     if(myResult->GetInput() == NULL) 
       throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
@@ -227,20 +222,22 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
       string aResultEntry = myResult->GetEntry();
       string anEntry = FindEntryWithComment(myStudy,aResultEntry.c_str(),aComment.latin1());
       if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
-      SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(anEntry.c_str());
+      mySObject = myStudy->FindObjectID(anEntry.c_str());
       SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObj,"AttributeIOR");
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR");
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
       CORBA::String_var aString = GetID();
       anIOR->SetValue(aString); 
     }
-    return this;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
+    return NULL;
   }catch(...){
     INFOS("Unknown exception was accured!");
+    return NULL;
   } 
-  return NULL;
+  aStudyBuilder->CommitCommand();
+  return this;
 }
 
 
@@ -258,7 +255,8 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th
   return anActor;
 }
  
-void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor){
+
+void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
   if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
     if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
     VISU::Prs3d_i::UpdateActor(anActor);
index 51668a8344cac0ef168f752ae84bf20c19c17508..56d23d536455ed19ffa1e71bb9515a969c4e89c4 100644 (file)
@@ -39,10 +39,10 @@ namespace VISU{
     Mesh_i();
     Mesh_i(const Mesh_i&);
   public:
-    Mesh_i(Result_i* theResult);
+    Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const Mesh_i* theOrigin);
     virtual ~Mesh_i();
-    virtual void Destroy();
+    virtual void RemoveFromStudy();
 
     virtual VISU::VISUType GetType() { return VISU::TMESH;};
 
@@ -89,13 +89,10 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
 
     virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
       throw (std::runtime_error&);
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
   };
 }
 
index 350c651d5aed96d8245f1b80393588ac9c00e3e3..ea2ae269c50e6caf018344c37aaa8a2e34906be7 100644 (file)
 #include "VISU_Result_i.hh"
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Actor.h"
+
+#include <vtkGeometryFilter.h>
+
 using namespace VISU;
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
-VISU::Prs3d_i::Prs3d_i(Result_i* theResult) : 
-       PrsObject_i(theResult->GetStudyDocument()), 
-       myResult(theResult) 
+VISU::Prs3d_i::Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : 
+  PrsObject_i(theResult->GetStudyDocument()), 
+  myResult(theResult) 
 {
+  myResult->Register();
+  mySObject = SALOMEDS::SObject::_duplicate(theSObject);
   myAddToStudy = true;
   myPipeLine = NULL;
+  CORBA::String_var aName = myStudy->Name();
+  INFOS("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
 }
 
 void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
@@ -54,19 +61,11 @@ void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
 }
 
 VISU::Prs3d_i::~Prs3d_i() {
-  if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i()");
+  INFOS("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
   myPipeLine->Delete();
+  myResult->Destroy();
 }
 
-void VISU::Prs3d_i::Destroy() {
-  CORBA::Object_var anObj = _this();
-  PortableServer::POA_ptr aPOA = Base_i::GetPOA();
-  PortableServer::ObjectId_var anId = aPOA->reference_to_id(anObj);
-  aPOA->deactivate_object(anId.in());
-  this->_remove_ref();
-}
-
-
 void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
   throw (std::runtime_error&)
 {
@@ -74,8 +73,10 @@ void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_Intera
     Update();
     if(myAddToStudy){
       Handle(SALOME_InteractiveObject) anIO = theIO;
-      if (anIO.IsNull())
-       anIO = new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",strdup(GetName()));
+      if(anIO.IsNull()){
+       CORBA::String_var anEntry = mySObject->GetID();
+       anIO = new SALOME_InteractiveObject(strdup(anEntry.in()),"VISU",strdup(GetName()));
+      }
       theActor->setIO(anIO); 
     }
     theActor->SetPipeLine(GetPipeLine());
@@ -83,13 +84,34 @@ void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_Intera
   }catch(std::runtime_error& ex){
     throw ex;
   }catch(...){
-    throw std::runtime_error("Prs3d_i::CreateActor >> unexpected exception was caught!!!");
+    throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
   }
 }
 
-void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor){
-  theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
-  theActor->Modified();
+void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) throw (std::runtime_error&){
+  try{
+    vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
+    vtkDataSet *aDataSet = theActor->GetMapper()->GetInput();
+    aGeometryFilter->SetInput(aDataSet);
+    vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
+    aPolyData->Update();
+    static int INCMEMORY = 7;
+    float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
+    int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
+    INFOS("UpdateActor - aSize = "<<aSize<<"; isPoss = "<<isPoss);
+    aPolyData->Delete();
+    if (aSize <= 0)
+      throw std::runtime_error("Prs3d_i::UpdateActor >> Actor is empty !!!");
+    if(!isPoss) 
+      throw std::runtime_error("Prs3d_i::UpdateActor >> There is no enough memory !!!");
+
+    theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+    theActor->Modified();
+  }catch(std::runtime_error& ex){
+    throw ex;
+  }catch(...){
+    throw std::runtime_error("Prs3d_i::UpdateActor >> unexpected exception was caught!!!");
+  }
 }
 
 VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
@@ -103,8 +125,12 @@ void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myName",   myName.c_str() );
 }
 
-void VISU::Prs3d_i::Update(){
-  myPipeLine->Update();
+void VISU::Prs3d_i::Update() throw (std::runtime_error&){
+  try{
+    myPipeLine->Update();
+  }catch(...){
+    throw std::runtime_error("Prs3d_i::Update >> unexpected exception was caught!!!");
+  }
 }
 
 VISU_PipeLine* VISU::Prs3d_i::GetPipeLine(){
@@ -115,9 +141,18 @@ VISU_PipeLine* VISU::Prs3d_i::GetPL(){
   return myPipeLine;
 }
 
-VISU::Result_i* VISU::Prs3d_i::GetResult(SALOMEDS::SObject_ptr theSObject){
+
+SALOMEDS::SObject_var VISU::Prs3d_i::GetSObject(){
+  return mySObject;
+}
+
+void VISU::Prs3d_i::GetBounds(float aBounds[6]){
+  myPipeLine->GetMapper()->GetBounds(aBounds);
+}
+
+VISU::Result_i* VISU::GetResult(SALOMEDS::SObject_ptr theSObject){
   VISU::Result_var aResult = FindResult(theSObject);
   if(!aResult->_is_nil())
-    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));
+    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
   return NULL;
 }
index 3ebbb965a135915dfb86afcd6fe819f886cd8059..5c125b41bf14ab2873074a2b8f469aa382c91b54 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_Prs3d_i_HeaderFile
 
 #include "VISU_PrsObject_i.hh"
+#include "SALOME_GenericObj_i.hh"
 #include "Handle_SALOME_InteractiveObject.hxx"
 #include "VISU_Convertor.hxx"
 
@@ -36,29 +37,37 @@ class VISU_Actor;
 
 namespace VISU{
   class Result_i;
-  class Prs3d_i : public virtual POA_VISU::Prs3d,
-                  public virtual PrsObject_i
+  class Prs3d_i : 
+    public virtual POA_VISU::Prs3d,
+    public virtual SALOME::GenericObj_i,
+    public virtual PrsObject_i
+                 
   {
     Prs3d_i();
     Prs3d_i(const Prs3d_i&);
+
   public:
-    Prs3d_i(Result_i* theResult);
+    Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const Prs3d_i* theOrigin);
     virtual ~Prs3d_i();
-    virtual void Destroy();
+    virtual void RemoveFromStudy() = 0;
 
   protected:
+    bool myAddToStudy;
     Result_i *myResult;
     VISU_PipeLine *myPipeLine;
+    SALOMEDS::SObject_var mySObject;
 
-    bool myAddToStudy;
-    void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL) throw (std::runtime_error&);
+    void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL) 
+      throw (std::runtime_error&);
+    virtual VISU_PipeLine* GetPipeLine();
 
   public:
-    virtual void Update();
-    virtual VISU_PipeLine* GetPipeLine();
+    virtual void Update() throw(std::runtime_error&);
     VISU_PipeLine* GetPL();
 
+    void GetBounds(float aBounds[6]);
+
     virtual const char* GetComment() const = 0;
     virtual QString GenerateName() = 0;
 
@@ -66,13 +75,26 @@ namespace VISU{
       throw(std::logic_error&);
     virtual void ToStream(std::ostringstream& theStr);
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) throw (std::runtime_error&) = 0;
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) 
+      throw (std::runtime_error&) = 0;
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
 
     Result_i* GetResult() const { return myResult;}
-
-    static Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+    virtual SALOMEDS::SObject_var GetSObject();
   };
+  Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+  template<class TPrs3d>
+  Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
+                   const string& thePrefix, const Storable::TRestoringMap& theMap)
+    throw(std::logic_error&)
+  {
+    VISU::Result_i* pResult = GetResult(theSObject);
+    if(pResult != NULL){
+      TPrs3d* pPrs3d = new TPrs3d(pResult,theSObject);
+      return pPrs3d->Restore(theMap);
+    }
+    return NULL;
+  }
 }
 
 #endif
index 5ba1f599d7801860425b6678dcab95244a3cc965..da77ebabaae23d0981e713980fde31d9af447094 100644 (file)
@@ -29,7 +29,7 @@ using namespace VISU;
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
@@ -40,7 +40,7 @@ void VISU::PrsObject_i::SetName( const char* theName )
 {
   myName = theName;
   SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
-  if ( !mySO->_is_nil() ) {
+  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 );
@@ -49,7 +49,11 @@ void VISU::PrsObject_i::SetName( const char* theName )
 }
 QString VISU::PrsObject_i::GetEntry() { 
   CORBA::String_var anIOR = GetID();
-  SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR);
-  CORBA::String_var anEntry = aSObject->GetID();
+  SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in());
+  CORBA::String_var anEntry;
+  if(!CORBA::is_nil(aSObject.in()))
+    anEntry = aSObject->GetID();
+  else
+    INFOS("PrsObject_i::GetEntry - Cannot find SObject in the Study with StudyId = "<<myStudy->StudyId()<<" !!!");
   return anEntry.in();
 }
index 5b7a705ba5afdbee33db6d95cacea2a7d7bc5218..f378c2c17eb89330a3b49b57adf2f4be27ffe0c6 100644 (file)
@@ -27,6 +27,7 @@
 #include "VISU_Result_i.hh"
 #include "VISU_Convertor_impl.hxx"
 #include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_PipeLine.hxx"
 
 #include "QAD_Config.h"
 #include "SALOMEDS_Tool.hxx"
@@ -35,6 +36,7 @@
 #include <qstring.h>
 #include <qfileinfo.h>
 
+#include <memory>
 #include <fstream>     
 
 #include <vtkUnstructuredGridReader.h>
@@ -68,6 +70,17 @@ VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){
   return aResult;
 }
 
+void VISU::RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly){
+  if(!theSObject->_is_nil()){
+    SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    if(theIsAttrOnly)
+      aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR");
+    else
+      aStudyBuilder->RemoveObjectWithChildren(theSObject);
+  }
+}
+
 QString GenerateName(const char* theName){
   typedef map<string,int> TNameMap;
   static TNameMap aMap;
@@ -115,15 +128,41 @@ string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){
 const string VISU::Result_i::myComment = "RESULT";
 const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
 
-VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
+VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId) {
   myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+  mySourceId = aSourceId;
   myInput = NULL;
   myIsDone = 0;
+  CORBA::String_var aName = theStudy->Name();
+  INFOS("Result_i::Result_i - this = "<<this<<"; StudyId = "<<
+       theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
+}
+
+
+void VISU::Result_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObject,false);
+}
+
+
+int VISU::Result_i::IsPossible(){
+  try{
+    float aSize = myInput->GetSize();
+    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    INFOS("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
+    return aResult;
+  }catch(std::runtime_error& exc){
+    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was accured!");
+  }
+  return 0;
 }
 
+
 CORBA::Boolean VISU::Result_i::BuildAll(){
   if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
   if(myIsDone) return 1;
+  if(!IsPossible()) return 0;
   try{
     const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
@@ -146,41 +185,56 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
          VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
-           myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+           try{
+             myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+           }catch(std::runtime_error& exc){
+             INFOS("Follow exception was accured :\n"<<exc.what());
+           }catch(...){
+             INFOS("Unknown exception was accured!!!");
+           }
          }
        }
-      }
-      //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
-      VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-      for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-       const string& aGroupName = aGroupMapIter->first;
-       myInput->GetMeshOnGroup(aMeshName,aGroupName);
-      }
-      //Import families
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
-       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-         const string& aFamilyName = aFamilyMapIter->first;
-         myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
-       }
-      }
-      //Import mesh on entity
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       myInput->GetMeshOnEntity(aMeshName,anEntity);
+       //Importing groups
+       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+         const string& aGroupName = aGroupMapIter->first;
+         try{
+           myInput->GetMeshOnGroup(aMeshName,aGroupName);
+         }catch(std::runtime_error& exc){
+           INFOS("Follow exception was accured :\n"<<exc.what());
+         }catch(...){
+           INFOS("Unknown exception was accured!!!");
+         }
+       }
+       //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;
+         try{
+           myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+         }catch(std::runtime_error& exc){
+           INFOS("Follow exception was accured :\n"<<exc.what());
+         }catch(...){
+           INFOS("Unknown exception was accured!!!");
+         }
+       }
+       //Import mesh on entity
+       try{
+         myInput->GetMeshOnEntity(aMeshName,anEntity);
+       }catch(std::runtime_error& exc){
+         INFOS("Follow exception was accured :\n"<<exc.what());
+       }catch(...){
+         INFOS("Unknown exception was accured!!!");
+       }
       }
     }
     myIsDone = 1;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was accured!!!");
   }
   return myIsDone;
 }
@@ -188,15 +242,20 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
 VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) 
      throw (std::runtime_error&)
 {
+  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+  aStudyBuilder->NewCommand();  // There is a transaction
   if(MYDEBUG) MESSAGE("Result_i::Build");
-  const TMeshMap& aMeshMap = myInput->GetMeshMap();
-  if(!aMeshMap.empty()) {//apo
+  try{
+    const TMeshMap& aMeshMap = myInput->GetMeshMap();
+    if(aMeshMap.empty()) 
+      throw std::runtime_error("Build - There is no any mesh information in the file !!!");
     mySComponent = FindOrCreateVisuComponent(myStudyDocument);
     CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
     string aRefFatherEntry = GetRefFatherEntry();
     QString aComment;
-    aComment.sprintf("myComment=%s;myType=%d;myFileName=%s",
-                    GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1());
+    aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+                    GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
+                    myInitFileName.c_str()); // Restoring of Python dump 
     string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
                                           anIOR,myName.c_str(),"",aComment.latin1(),true);
     mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
@@ -243,6 +302,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
+         const VISU::TFamily& aFamily = aFamilyMapIter->second;
          aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
                           VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
          CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
@@ -314,25 +374,44 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
        }
       }
     }
+    QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+    bool isBuildAll = aIsBuild.isEmpty()? 0 : aIsBuild.toInt();
+    if(isBuildAll) BuildAll();
+  }catch(std::runtime_error& exc){
+    INFOS("Follow exception was accured :\n"<<exc.what());
+    return NULL;
+  }catch(...){
+    INFOS("Unknown exception was accured!!!");
+    return NULL;
   }
-  QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
-  if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
+  aStudyBuilder->CommitCommand();
   return this;
 }
 
 VISU::Storable* VISU::Result_i::Create(const char* theFileName){
   try{
-    mySourceId = eFile;
-    myInput = CreateConvertor(theFileName);
-    if(myInput == NULL) return NULL;
     myFileInfo.setFile(theFileName);
+    myInitFileName = myFileInfo.filePath().latin1();
     myName = ::GenerateName(myFileInfo.fileName()).latin1();
-    VISU::Storable* aStorable = Build();
-    return aStorable;
+    if(GetSourceId() == eRestoredFile){
+      auto_ptr<char> aTmpDir(SALOMEDS_Tool::GetTmpDir());
+      static QString aCommand;
+      aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.get());
+      if(system(aCommand) == -1){
+       INFOS("Create - Can't execute the command :"<<aCommand);
+       return NULL;
+      }
+      if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
+      myFileInfo.setFile(QString(aTmpDir.get()) + myFileInfo.fileName());
+    }
+    myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
+    if(!myInput) 
+      throw std::runtime_error("Create - Cannot create a Convertor for this file!!!");
+    return Build();
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was accured!!!");
   }
   return NULL;
 }
@@ -340,7 +419,6 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){
 VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
   if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
   try{
-    mySourceId = eComponent;
     myInput = CreateMEDConvertor(theMedSObject);
     if(myInput == NULL) return NULL;
     string aCompDataType = GetComponentDataType(theMedSObject);
@@ -351,7 +429,7 @@ VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was accured!!!");
   }
   return NULL;
 }
@@ -359,18 +437,18 @@ VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
 VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
   if(MYDEBUG)  MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
   try{
-    mySourceId = eComponent;
     myInput = CreateMEDFieldConvertor(theField);
     if(myInput == NULL) return NULL;
     string aCompDataType = "MED";
     myFileInfo.setFile(aCompDataType.c_str());
+    myInitFileName = aCompDataType;
     myName = ::GenerateName("aResult").latin1();
     VISU::Storable* aStorable = Build();
     return aStorable;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was accured!!!");
   }
   return NULL;
 }
@@ -384,7 +462,8 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
     mySObject = SALOMEDS::SObject::_duplicate(theSObject);
     myStudyDocument = mySObject->GetStudy();
     mySComponent = mySObject->GetFatherComponent();
-    myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
+    myName = VISU::Storable::FindValue(theMap,"myName").latin1();
+    myInitFileName = VISU::Storable::FindValue(theMap,"myInitFileName").latin1();
     SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
     if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
       mySourceId = eRestoredComponent;
@@ -399,14 +478,15 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
       SALOMEDS::StudyBuilder_var  aStudyBuilder = myStudyDocument->NewBuilder();
       SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
       aStudyBuilder->LoadWith(aCompRefSObj,aDriver);
-      if(strcmp(aDataType,"MED") == 0){
+      if(strcmp(aDataType,"MED") == 0)
        myInput = CreateMEDConvertor(aTargetRefSObj);
-      }else
+      else
        throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
     }else{
       myFileInfo.setFile(thePrefix.c_str());
 
-      string aStudyPrefix(SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
+      string aStudyPrefix("");
+      if (IsMultifile()) aStudyPrefix = (SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
       if(!myFileInfo.isFile()){
        string aFileName = thePrefix + aStudyPrefix + "_" + myName;
        myFileInfo.setFile(aFileName.c_str());
@@ -435,18 +515,21 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
            return NULL;
          } else if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - "<<aCommand);
          SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
-         SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList, true);
+         SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList.in(), true);
        }
        mySourceId = eRestoredFile;
        delete(aResultPath);
        delete(aHDFFileName);
-      } else if (!IsMultifile()) mySourceId = eRestoredFile;
-      else mySourceId = eFile;
-
+      } else if (!IsMultifile()) 
+       mySourceId = eRestoredFile;
+      else 
+       mySourceId = eFile;
+      if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = "<<mySourceId);
       myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
       QString aComment;
-      aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
-                      GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
+      aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+                      GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
+                      myInitFileName.c_str()); // Restoring of Python dump 
       SALOMEDS::GenericAttribute_var anAttr;
       if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
        throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
@@ -454,12 +537,13 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
       aCmnt->SetValue(aComment.latin1());
     }
     QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
-    if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
+    if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) 
+      BuildAll();
     return this;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was accured!!!");
   }
   return NULL;
 }
@@ -471,6 +555,7 @@ VISU::Result_i::TInput* VISU::Result_i::GetInput() {
 void VISU::Result_i::ToStream(std::ostringstream& theStr){
   if(MYDEBUG) MESSAGE(GetComment());
   Storable::DataToStream(theStr,"myName",myName.c_str());
+  Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
 }
 
 VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, 
@@ -498,6 +583,13 @@ const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myS
 const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
 
 VISU::Result_i::~Result_i() {
-  if(MYDEBUG) MESSAGE("Result_i::~Result_i()");
+  INFOS("Result_i::~Result_i() - this = "<<this);
+  if(GetSourceId() == eRestoredFile){ 
+    static QString aCommand;
+    aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
+    INFOS("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+    aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",myFileInfo.dirPath().latin1());
+    INFOS("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+  }
   if(myInput) delete myInput;
 }
index 163231ec64ff0f86731c3896cc54d932d167dd7f..1da66a466b71422095696fb8cfe27e5d8c6532f8 100644 (file)
 #define __VISU_RESULT_I_H__
 
 #include "VISUConfig.hh"
+#include "SALOME_GenericObj_i.hh"
 
 class VISU_Convertor;
 
 namespace VISU{
   class Result_i : public virtual POA_VISU::Result,
-                   public virtual Storable
+                   public virtual Storable,
+                  public virtual SALOME::GenericObj_i
   {
     Result_i();
     Result_i(const Result_i &);
+
   public:
-    Result_i(SALOMEDS::Study_ptr theStudy);
+    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+    Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId = eFile);
     virtual ~Result_i();
+    virtual void RemoveFromStudy();
 
     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
     virtual CORBA::Boolean BuildAll();
 
     typedef VISU_Convertor TInput;
-    enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+
   private:
     TSourceId mySourceId;
     TInput *myInput;
     CORBA::Boolean myIsDone;
-    string myName;
+    string myName, myInitFileName;
     QFileInfo myFileInfo;
+
   protected:
     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) 
       throw (std::runtime_error&);
+
   public:
+    virtual int IsPossible();
+
     virtual Storable* Create(const char* theFileName);
     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
@@ -71,18 +80,23 @@ namespace VISU{
     TInput* GetInput();
     const string& GetName() const { return myName;}
     const QFileInfo& GetFileInfo() const { return myFileInfo;}
-    Result_i::TSourceId GetSourceId() const { return mySourceId;}
+    const Result_i::TSourceId& GetSourceId() const { return mySourceId;}
+
   private:
     SALOMEDS::SObject_var mySObject;
     SALOMEDS::Study_var myStudyDocument;
     SALOMEDS::SComponent_var mySComponent;
+
   public:
     string GetRefFatherEntry();
     string GetEntry();
     const SALOMEDS::SObject_var& GetSObject() const;
     const SALOMEDS::Study_var& GetStudyDocument() const;
     const SALOMEDS::SComponent_var& GetSComponent() const;
+
   };
+
   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
+  void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
 }
 #endif
index 270e77d48ad140e8dcc18e2a9ffaae60096c6661..e29cdbf8e2dcdde1d9dcf81e73c6992773b95c83 100644 (file)
@@ -44,14 +44,17 @@ static int MYDEBUGWITHFILES = 0;
 static int INCMEMORY = 4;
 
 int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                 const char* theFieldName, int theIteration)
+                                 const char* theFieldName, int theIteration, int isMemoryCheck)
 {
   try{
-    vtkIdType aSize = INCMEMORY*
+    float aSize = INCMEMORY*
       theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
-    if(MYDEBUG) MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<aSize);
-    if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
-    return false;
+    bool aResult = true;
+    if(isMemoryCheck){
+      aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+      INFOS("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    }
+    return aResult;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
@@ -66,23 +69,17 @@ QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap
 const string VISU::ScalarMap_i::myComment = "SCALARMAP";
 const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
 
-VISU::ScalarMap_i::ScalarMap_i(Result_i* theResult, bool theAddToStudy) : 
+VISU::ScalarMap_i::ScalarMap_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) : 
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult)
+       Prs3d_i(theResult,theSObject)
 {
   myAddToStudy = theAddToStudy;
   myScalarMapPL = NULL;
 }
 
-void VISU::ScalarMap_i::Destroy(){
-  if(myAddToStudy){
-    SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(GetEntry());
-    if(!aSObj->_is_nil()){
-      SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-      aStudyBuilder->RemoveObject(aSObj);
-    }
-  }
-  Prs3d_i::Destroy();
+
+void VISU::ScalarMap_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObject,false);
 }
 
 
@@ -104,13 +101,28 @@ void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin)
 
   SetScaling(aScalarMap->GetScaling());
 
-  SetOrientation(aScalarMap->GetOrientation());
+  SetBarOrientation(aScalarMap->GetBarOrientation());
   SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY());
   SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight());
   SetNbColors(aScalarMap->GetNbColors());
   SetLabels(aScalarMap->GetLabels());
   SetTitle(aScalarMap->GetTitle());
 
+  SetBoldTitle(aScalarMap->IsBoldTitle());
+  SetItalicTitle(aScalarMap->IsItalicTitle());
+  SetShadowTitle(aScalarMap->IsShadowTitle());
+  SetTitFontType(aScalarMap->GetTitFontType());
+  float r,g,b;
+  aScalarMap->GetTitleColor(&r,&g,&b);
+  SetTitleColor(r,g,b);
+
+  SetBoldLabel(aScalarMap->IsBoldLabel());
+  SetItalicLabel(aScalarMap->IsItalicLabel());
+  SetShadowLabel(aScalarMap->IsShadowLabel());
+  SetLblFontType(aScalarMap->GetLblFontType());
+  aScalarMap->GetLabelColor(&r,&g,&b);
+  SetLabelColor(r,g,b);
+
   Build(-1);
   Update();
 }
@@ -200,6 +212,78 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity
   else 
     SetScaling(VISU::LINEAR);
 
+  // Fonts properties definition
+  QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
+  myIsBoldTitle = (aIsBoldTitle.isEmpty())? true : (aIsBoldTitle.compare("true") == 0);
+
+  QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
+  myIsItalicTitle = (aIsItalicTitle.isEmpty())? true : (aIsItalicTitle.compare("true") == 0);
+
+  QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
+  myIsShadowTitle = (aIsShadowTitle.isEmpty())? true : (aIsShadowTitle.compare("true") == 0);
+
+  QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
+  if (!aTitFontType.isEmpty()) {
+    switch (aTitFontType.toInt()) {
+    case 0: myTitFontType = VTK_ARIAL; break;
+    case 1: myTitFontType = VTK_COURIER; break;
+    case 2: myTitFontType = VTK_TIMES; break;
+    }
+  } else {
+    myTitFontType = VTK_ARIAL;
+  }
+  QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
+  myTitleColor[0] = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
+  if (myTitleColor[0] > 1) myTitleColor[0] = 1;
+  if (myTitleColor[0] < 0) myTitleColor[0] = 0;
+  
+  QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
+  myTitleColor[1] = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
+  if (myTitleColor[1] > 1) myTitleColor[1] = 1;
+  if (myTitleColor[1] < 0) myTitleColor[1] = 0;
+  
+  QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
+  myTitleColor[2] = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
+  if (myTitleColor[2] > 1) myTitleColor[2] = 1;
+  if (myTitleColor[2] < 0) myTitleColor[2] = 0;
+  
+  ///
+
+  QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
+  myIsBoldLabel = (aIsBoldLabel.isEmpty())? true : (aIsBoldLabel.compare("true") == 0);
+
+  QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
+  myIsItalicLabel = (aIsItalicLabel.isEmpty())? true : (aIsItalicLabel.compare("true") == 0);
+
+  QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
+  myIsShadowLabel = (aIsShadowLabel.isEmpty())? true : (aIsShadowLabel.compare("true") == 0);
+
+  QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
+  if (!aLblFontType.isEmpty()) {
+    switch (aLblFontType.toInt()) {
+    case 0: myLblFontType = VTK_ARIAL; break;
+    case 1: myLblFontType = VTK_COURIER; break;
+    case 2: myLblFontType = VTK_TIMES; break;
+    }
+  } else {
+    myLblFontType = VTK_ARIAL;
+  }
+  QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
+  myLabelColor[0] = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
+  if (myLabelColor[0] > 1) myLabelColor[0] = 1;
+  if (myLabelColor[0] < 0) myLabelColor[0] = 0;
+  
+  QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
+  myLabelColor[1] = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
+  if (myLabelColor[1] > 1) myLabelColor[1] = 1;
+  if (myLabelColor[1] < 0) myLabelColor[1] = 0;
+  
+  QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
+  myLabelColor[2] = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
+  if (myLabelColor[2] > 1) myLabelColor[2] = 1;
+  if (myLabelColor[2] < 0) myLabelColor[2] = 0;
+    
+
   myMeshName = theMeshName;
   myEntity = (VISU::TEntity)theEntity;
   myFieldName =theFieldName;
@@ -210,14 +294,9 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity
 
 
 VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
+  throw(std::logic_error&)
 {
   DoHook();
-
-  Prs3d_i::Restore(theMap);
-
-  myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
-
   myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
   myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
   myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
@@ -239,6 +318,24 @@ VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap
   myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
   myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
 
+  myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
+  myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
+  myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
+  myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
+  myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
+  myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
+  myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
+
+  myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
+  myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
+  myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
+  myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
+  myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
+  myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
+  myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+
+  Prs3d_i::Restore(theMap);
+  myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
   return Build(true);
 }
 
@@ -265,6 +362,22 @@ void VISU::ScalarMap_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
   Storable::DataToStream( theStr, "myWidth",          myWidth );
   Storable::DataToStream( theStr, "myHeight",         myHeight );
+
+  Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
+  Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
+  Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
+  Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
+  Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
+  Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
+  Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
+
+  Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
+  Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
+  Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
+  Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
+  Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
+  Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
+  Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
 }
 
 
@@ -309,26 +422,14 @@ CORBA::Long VISU::ScalarMap_i::GetNbColors(){
 }
 
 
-VISU::Storable* VISU::ScalarMap_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                          const string& thePrefix, const Storable::TRestoringMap& theMap)
-  throw(std::logic_error&)
-{
-  if(VISU::Result_i* pResult = GetResult(theSObject)){
-    VISU::ScalarMap_i* pResent = new VISU::ScalarMap_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
-
-VISU::ScalarMap_i::~ScalarMap_i(){
-  if(MYDEBUG) MESSAGE("ScalarMap_i::~ScalarMap_i()");
-}
+VISU::ScalarMap_i::~ScalarMap_i(){}
 
 
 VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
   if(MYDEBUG) 
     MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
+  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+  if(myAddToStudy) aStudyBuilder->NewCommand();  // There is a transaction
   try{
     if(myResult->GetInput() == NULL) 
       throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
@@ -347,7 +448,7 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
       const VISU::TField::TValField& aValField = myField->myValField;
       const VISU::TField::TValForTime& aValForTime = aValField.find(myIteration)->second;
       aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime.myTime).c_str());
-      myTitle = aComment.simplifyWhiteSpace().latin1();
+      if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
     }
     if(myAddToStudy){
       myName = GenerateName().latin1();
@@ -361,14 +462,17 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
                       GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
       CORBA::String_var anIOR = GetID();
       CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
+      mySObject = myStudy->FindObjectIOR(anIOR);
     }
-    return this;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
+    return NULL;
   }catch(...){
     INFOS("Unknown exception was accured!");
+    return NULL;
   }
-  return NULL;
+  if(myAddToStudy) aStudyBuilder->CommitCommand();
+  return this;
 }
 
 
@@ -381,7 +485,7 @@ void VISU::ScalarMap_i::DoHook(){
   myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
 }
 
-void VISU::ScalarMap_i::Update(){
+void VISU::ScalarMap_i::Update() throw(std::runtime_error&){
   VISU::Prs3d_i::Update();
 }
 
@@ -406,7 +510,7 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject
   return anActor;
 }
 
-void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor){
+void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     VISU::Prs3d_i::UpdateActor(theActor);
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
@@ -418,6 +522,21 @@ void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor){
     aScalarBar->SetWidth(myWidth);
     aScalarBar->SetHeight(myHeight);
     aScalarBar->SetNumberOfLabels(myNumberOfLabels);
+    
+    vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
+    aTitleProp->SetFontFamily(myTitFontType);
+    aTitleProp->SetColor(myTitleColor);
+    (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+    (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+    (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+    
+    vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
+    aLabelProp->SetFontFamily(myLblFontType);
+    aLabelProp->SetColor(myLabelColor);
+    (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+    (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+    (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+    
     aScalarBar->Modified();
   }
 }
index f6dbca2a6145d30e8ccef7d75fe79bacb6835369..593213f0531e06dfb87ec374456529162d9d7f2b 100644 (file)
@@ -40,10 +40,11 @@ namespace VISU{
     ScalarMap_i(const ScalarMap_i&);
 
   public:
-    ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
+    ScalarMap_i(Result_i* theResult, bool theAddToStudy = true,
+               SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const ScalarMap_i* theOrigin);
     virtual ~ScalarMap_i();
-    virtual void Destroy();
+    virtual void RemoveFromStudy();
 
     virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
 
@@ -60,10 +61,10 @@ namespace VISU{
     virtual void SetNbColors(CORBA::Long theNbColors);
     virtual CORBA::Long GetNbColors();
 
-    virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation){ 
+    virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){ 
       myOrientation = theOrientation;
     }
-    virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
+    virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
 
     virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
     virtual CORBA::Double GetPosX() { return myPosition[0];} 
@@ -81,6 +82,41 @@ namespace VISU{
     virtual void SetTitle(const char* theName) { myTitle = theName;}
     virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
 
+    virtual bool IsBoldTitle() { return myIsBoldTitle;}
+    virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;}
+
+    virtual bool IsItalicTitle() { return myIsItalicTitle;}
+    virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;}
+
+    virtual bool IsShadowTitle() { return myIsShadowTitle;}
+    virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;}
+
+    virtual int GetTitFontType() { return myTitFontType;}
+    virtual void SetTitFontType(int theType) { myTitFontType = theType;}
+
+    virtual void GetTitleColor(float* theR, float* theG, float* theB) 
+    {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
+    virtual void SetTitleColor(float theR, float theG, float theB) 
+    {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
+
+    /////
+    virtual bool IsBoldLabel() { return myIsBoldLabel;}
+    virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;}
+
+    virtual bool IsItalicLabel() { return myIsItalicLabel;}
+    virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;}
+
+    virtual bool IsShadowLabel() { return myIsShadowLabel;}
+    virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;}
+
+    virtual int GetLblFontType() { return myLblFontType;}
+    virtual void SetLblFontType(int theType) { myLblFontType = theType;}
+
+    virtual void GetLabelColor(float* theR, float* theG, float* theB) 
+    {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
+    virtual void SetLabelColor(float theR, float theG, float theB) 
+    {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
+
     typedef VISU::ScalarMap TInterface;
     VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
 
@@ -103,9 +139,22 @@ namespace VISU{
     float myPosition[2], myWidth, myHeight;
     VISU::ScalarMap::Orientation myOrientation;
 
+    //Font management
+    bool myIsBoldTitle;
+    bool myIsItalicTitle;
+    bool myIsShadowTitle;
+    int  myTitFontType;
+    float myTitleColor[3];
+
+    bool myIsBoldLabel;
+    bool myIsItalicLabel;
+    bool myIsShadowLabel;
+    int  myLblFontType;
+    float myLabelColor[3];
+
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
                             const char* theFieldName, int theIteration);
 
@@ -121,7 +170,7 @@ namespace VISU{
                             const string& thePrefix, const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
 
-    virtual void Update();
+    virtual void Update() throw(std::runtime_error&);
     virtual void SetMapScale(double theMapScale = 1.0);
 
     const VISU::TField*  GetField() const { return myField;}
@@ -134,7 +183,7 @@ namespace VISU{
 
     virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
       throw (std::runtime_error&);
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
   };
 }
 
index 7eb2f3380afc3cf92680196028ced5d92e7a9c3f..bb50cc01a6b0330872d1a443cb873a9023e68363 100644 (file)
@@ -42,18 +42,16 @@ static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
-static int INCMEMORY = 2;
-
 int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                   const char* theFieldName, int theIteration)
+                                   const char* theFieldName, int theIteration, int isMemoryCheck)
 {
   try{
-    vtkIdType aSize = 
-      (VISU_StreamLinesPL::myMaxIncrementMemorySize+INCMEMORY)*
-      theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
-    if(MYDEBUG) MESSAGE("StreamLines_i::IsPossible - CheckAvailableMemory = "<<aSize);
-    if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
-    return false;
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) return 0;
+    VISU_Convertor::TOutput *anOutput = 
+      theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
+    bool aResult = VISU_StreamLinesPL::IsPossible(anOutput);
+    INFOS("StreamLines_i::IsPossible - aResult = "<<aResult);
+    return aResult;
   }catch(std::runtime_error& exc){
     INFOS("Follow exception was accured :\n"<<exc.what());
   }catch(...){
@@ -71,32 +69,19 @@ 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) :
+VISU::StreamLines_i::StreamLines_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy),
-       DeformedShape_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject),
+       DeformedShape_i(theResult,theAddToStudy,theSObject)
 {
   myStreamLinesPL = NULL;
+  myAppendFilter = vtkAppendFilter::New();
 }
 
-void VISU::StreamLines_i::Destroy(){
-  DeformedShape_i::Destroy();
-}
-
-
 void VISU::StreamLines_i::SameAs(const StreamLines_i* theOrigin) {
   StreamLines_i* aStreamLines = const_cast<StreamLines_i*>(theOrigin);
   VISU::DeformedShape_i::SameAs(theOrigin);
-
-  //Order of setting of the values are important 
-  //SetIntegrationStep(aStreamLines->GetIntegrationStep());
-  //SetPropagationTime(aStreamLines->GetPropagationTime());
-  //SetStepLength(aStreamLines->GetStepLength());
-
-  //SetUsedPoints(aStreamLines->GetUsedPoints());
-  //SetDirection(aStreamLines->GetDirection());
-
   SetSource(aStreamLines->GetSource());
 }
 
@@ -111,18 +96,23 @@ VISU::Storable* VISU::StreamLines_i::Create(const char* theMeshName, VISU::Entit
 VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theMap)
   throw(std::logic_error&)
 {
-  DeformedShape_i::Restore(theMap);
-
-  //Order of setting of the values are important 
-  SetIntegrationStep(VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble());
-  SetPropagationTime(VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble());
-  SetStepLength(VISU::Storable::FindValue(theMap,"myStepLength").toDouble());
-
-  SetDirection(VISU::StreamLines::Direction(VISU::Storable::FindValue(theMap,"myDirection").toInt()));
-  SetUsedPoints(VISU::Storable::FindValue(theMap,"myPercents").toDouble());
+  DoHook();
+  VISU::Storable* aStorable = DeformedShape_i::Restore(theMap);
+
+  double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
+  double aPropagationTime = VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble();
+  double aStepLength = VISU::Storable::FindValue(theMap,"myStepLength").toDouble();
+  int aDirection = VISU::StreamLines::Direction(VISU::Storable::FindValue(theMap,"myDirection").toInt());
+  double aPercents = VISU::Storable::FindValue(theMap,"myPercents").toDouble();
+  SetParams(anIntegrationStep,
+           aPropagationTime,
+           aStepLength,
+           VISU::Prs3d::_nil(),
+           aPercents,
+           VISU::StreamLines::Direction(aDirection));
   mySourceEntry = VISU::Storable::FindValue(theMap,"mySourceEntry").latin1();
 
-  return Build(true);
+  return aStorable;
 }
 
 
@@ -140,83 +130,86 @@ void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){
 }
 
 
-VISU::Storable* VISU::StreamLines_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-  throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::StreamLines_i* pResent = new VISU::StreamLines_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
-
 VISU::StreamLines_i::~StreamLines_i(){
   if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()");
+  myAppendFilter->UnRegisterAllOutputs();
+  myAppendFilter->Delete();
 }
 
 
-void VISU::StreamLines_i::SetDirection(VISU::StreamLines::Direction theDirection) { 
-  myStreamLinesPL->SetDirection(theDirection);
-}
-VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() { 
-  return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection());
+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::Prs3d_i* aPrs3di = NULL;
+  vtkPointSet* aSource = NULL;
+  if(!thePrs3d->_is_nil())
+    if(aPrs3di = 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());
+      aSource = myAppendFilter->GetOutput();
+    }
+  int isAccepted = myStreamLinesPL->SetParams(theIntStep,
+                                             thePropogationTime,
+                                             theStepLength,
+                                             aSource,
+                                             thePercents,
+                                             theDirection,
+                                             1);
+  if(isAccepted == 1) SetSource(aPrs3di);
+  return isAccepted == 1;
 }
 
 
-void VISU::StreamLines_i::SetStepLength(CORBA::Double theStep) { 
-  myStreamLinesPL->SetStepLength(theStep);
-}
-CORBA::Double VISU::StreamLines_i::GetStepLength() { 
-  return myStreamLinesPL->GetStepLength();
+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::SetPropagationTime(CORBA::Double theTime) { 
-  myStreamLinesPL->SetPropagationTime(theTime);
+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();
+  }
 }
-CORBA::Double VISU::StreamLines_i::GetPropagationTime() { 
-  return myStreamLinesPL->GetPropagationTime();
+void VISU::StreamLines_i::SetSource(){
+  if(!myStreamLinesPL->GetSource() && mySourceEntry == "") return;
+  if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) return;
+  VISU::Prs3d_var aPrs3d = GetSource();
+  SetParams(GetIntegrationStep(),
+           GetPropagationTime(),
+           GetStepLength(),
+           aPrs3d,
+           GetUsedPoints(),
+           GetDirection());
 }
 
 
-void VISU::StreamLines_i::SetIntegrationStep(CORBA::Double theStep) { 
-  myStreamLinesPL->SetIntegrationStep(theStep);
-}
 CORBA::Double VISU::StreamLines_i::GetIntegrationStep() { 
   return myStreamLinesPL->GetIntegrationStep();
 }
 
+CORBA::Double VISU::StreamLines_i::GetPropagationTime() { 
+  return myStreamLinesPL->GetPropagationTime();
+}
 
-void VISU::StreamLines_i::SetUsedPoints(CORBA::Double thePercents) { 
-  myStreamLinesPL->SetUsedPoints(thePercents);
+CORBA::Double VISU::StreamLines_i::GetStepLength() { 
+  return myStreamLinesPL->GetStepLength();
 }
-CORBA::Double VISU::StreamLines_i::GetUsedPoints() { 
-  return myStreamLinesPL->GetUsedPoints();
+
+VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() { 
+  return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection());
 }
 
 
-void VISU::StreamLines_i::SetSource(VISU::Prs3d_ptr thePrs3d){
-  if(!thePrs3d->_is_nil())
-    if(VISU::Prs3d_i* aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d))){
-      CORBA::String_var aString = thePrs3d->GetID();
-      SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(aString);
-      if(!CORBA::is_nil(aSObject)){
-       vtkAppendFilter* anAppendFilter = vtkAppendFilter::New();
-       anAppendFilter->AddInput(aPrs3di->GetPipeLine()->GetMapper()->GetInput());
-       myStreamLinesPL->SetSource(anAppendFilter->GetOutput());
-       anAppendFilter->Register(myStreamLinesPL);
-       anAppendFilter->Delete();
-       aString = aSObject->GetID();
-       mySourceEntry = aString.in();
-       return;
-      }
-    }
-  myStreamLinesPL->SetSource(NULL);
-  mySourceEntry = "";
-}
 VISU::Prs3d_ptr VISU::StreamLines_i::GetSource(){
   VISU::Prs3d_var aPrs3d;
   if(MYDEBUG) MESSAGE("StreamLines_i::GetSource() mySourceEntry = '"<<mySourceEntry<<"'");
@@ -228,25 +221,32 @@ VISU::Prs3d_ptr VISU::StreamLines_i::GetSource(){
   return aPrs3d._retn();
 }
 
-
-float VISU::StreamLines_i::GetMaxIntegrationStep(){
-  return myStreamLinesPL->GetMaxIntegrationStep();
+CORBA::Double VISU::StreamLines_i::GetUsedPoints() { 
+  return myStreamLinesPL->GetUsedPoints();
 }
 
 
-float VISU::StreamLines_i::GetMinIntegrationStep(){
-  return myStreamLinesPL->GetMinIntegrationStep();
+void VISU::StreamLines_i::DoHook(){
+  if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New();
+  myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(myPipeLine);
+
+  DeformedShape_i::DoHook();
 }
 
 
-float VISU::StreamLines_i::GetBasePropagationTime(){
-  return myStreamLinesPL->GetBasePropagationTime();
+void VISU::StreamLines_i::Update() throw(std::runtime_error&){
+  SetSource();
+  VISU::DeformedShape_i::Update();
 }
 
 
-void VISU::StreamLines_i::DoHook(){
-  if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New();
-  myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(myPipeLine);
+VISU_Actor* VISU::StreamLines_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+  throw (std::runtime_error&)
+{
+  return VISU::DeformedShape_i::CreateActor(theIO);
+}
 
-  DeformedShape_i::DoHook();
+
+void VISU::StreamLines_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
+  VISU::DeformedShape_i::UpdateActor(theActor);
 }
index 5ead8e9bb39f2824dd34cbb477fe9bc42ad3e9ab..cfcbc474da1e8fc821972a0a317ded808e78a608 100644 (file)
@@ -30,6 +30,7 @@
 #include "VISU_DeformedShape_i.hh"
 
 class VISU_StreamLinesPL;
+class vtkAppendFilter;
 
 namespace VISU{
   class StreamLines_i : public virtual POA_VISU::StreamLines,
@@ -39,61 +40,59 @@ namespace VISU{
     StreamLines_i();
     StreamLines_i(const StreamLines_i&);
   public:
-    StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
+    StreamLines_i(Result_i* theResult, bool theAddToStudy = true,
+                 SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const StreamLines_i* theOriginal);
     virtual ~StreamLines_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
 
-    virtual void SetDirection(VISU::StreamLines::Direction theDirection);
-    virtual VISU::StreamLines::Direction GetDirection();
-
-    virtual void SetStepLength(CORBA::Double theStep);
-    virtual CORBA::Double GetStepLength();
-
-    virtual void SetPropagationTime(CORBA::Double theTime);
-    virtual CORBA::Double GetPropagationTime();
-
-    virtual void SetIntegrationStep(CORBA::Double theStep);
+    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 void SetUsedPoints(CORBA::Double thePercents);
+    virtual CORBA::Double GetPropagationTime();
+    virtual CORBA::Double GetStepLength();
     virtual CORBA::Double GetUsedPoints();
-
-    virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
     virtual VISU::Prs3d_ptr GetSource();
+    virtual VISU::StreamLines::Direction GetDirection();
 
     typedef VISU::StreamLines TInterface;
     VISU_StreamLinesPL* GetStreamLinesPL(){ return myStreamLinesPL;}
 
   protected:
     virtual void DoHook();
+    virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
+    virtual void SetSource(VISU::Prs3d_i* thePrs3d);
+    virtual void SetSource();
 
     VISU_StreamLinesPL* myStreamLinesPL;
+    vtkAppendFilter* myAppendFilter;
     string mySourceEntry;
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         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)
-      throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
-    
     static const string myComment;
     virtual const char* GetComment() const;
     virtual QString GenerateName();
     
-    virtual float GetMinIntegrationStep();
-    virtual float GetMaxIntegrationStep();
-    virtual float GetBasePropagationTime();
+    virtual Storable* Restore(const Storable::TRestoringMap& theMap)
+      throw(std::logic_error&);
+    
+    virtual void Update() throw(std::runtime_error&);
+
+    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
+      throw (std::runtime_error&);
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
 
     virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
   };
index 12d15ee401aa66637f3f7fe1fee9f18cd2894739..0779e845318f18f1198776f4d1cb78be77d51553 100644 (file)
@@ -37,6 +37,7 @@
 #include <strstream>
 
 #include <qfileinfo.h>
+#include <qfile.h>
 
 using namespace std;
 
@@ -45,7 +46,6 @@ static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
-
 //----------------------------------------------------------------
 //                      Table Object
 //----------------------------------------------------------------
@@ -71,7 +71,7 @@ const char* VISU::Table_i::GetComment() const
 VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
      : PrsObject_i(theStudy)
 {
-  myObjectEntry = theObjectEntry; 
+  mySObj = SALOMEDS::SObject::_duplicate((theStudy->FindObjectID(theObjectEntry)));
   myOrientation = VISU::Table::HORIZONTAL;
 }
 /*!
@@ -79,13 +79,14 @@ VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry
 */
 VISU::Table_i::~Table_i()
 {
+  INFOS("Table_i::~Table_i");
 }
 /*!
   Gets number of rows in table
 */
 CORBA::Long VISU::Table_i::GetNbRows()
 {
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  SALOMEDS::SObject_var SO = mySObj;
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   if ( !SO->_is_nil() ) {
     SALOMEDS::GenericAttribute_var        anAttr;
@@ -105,7 +106,7 @@ CORBA::Long VISU::Table_i::GetNbRows()
 */
 CORBA::Long VISU::Table_i::GetNbColumns()
 {
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  SALOMEDS::SObject_var SO = mySObj;
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   if ( !SO->_is_nil() ) {
     SALOMEDS::GenericAttribute_var        anAttr;
@@ -137,59 +138,57 @@ VISU::Storable* VISU::Table_i::Create()
 */
 VISU::Storable* VISU::Table_i::Build( int theRestoring ) 
 {
+  
   // look for reference SObject with table attribute
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+  SALOMEDS::SObject_var SO = mySObj;
+
   if ( !SO->_is_nil() ) {
     CutLines_i* pCutLines = NULL;
     CORBA::Object_var anObj = SObjectToObject(SO);
     if(!CORBA::is_nil(anObj)){
       VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
       if(!aCutLines->_is_nil())
-       pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines));
+       pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
     }
     SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
     SALOMEDS::GenericAttribute_var anAttr;
-    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) || 
-        Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) || pCutLines) {
-      // look for component
-      if ( !theRestoring ) {
+    // look for component
+    if ( !theRestoring ) {
        SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
        // create SObject and set attributes
        QString aComment;
        aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TTABLE);
        string anEntry = CreateAttributes( myStudy, 
-                                          SComponent->GetID(),
-                                          "",
-                                          GetID(),
-                                          GetName(),
-                                          "",
-                                          aComment.latin1(), 
-                                          true );
+                                         SO->GetID(),//SComponent->GetID(),
+                                         "",
+                                         GetID(),
+                                         GetName(),
+                                         "",
+                                         aComment.latin1(), 
+                                         true );
        // create SObject referenced to real table object
-       SALOMEDS::SObject_var newSO = myStudy->FindObjectID( anEntry.c_str() );
+       mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID( anEntry.c_str() ));
        if(pCutLines) {
-         pCutLines->BuildTableOfReal(newSO);
-         myObjectEntry = anEntry;
+         pCutLines->BuildTableOfReal(mySObj);
        }
-       SALOMEDS::SObject_var refSO = Builder->NewObject( newSO );
+       SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj );
        Builder->Addreference( refSO, SO );
       }
-      return this;
-    }
+    return this;
   }
   return NULL;
 }
 /*!
   Restores table object from stream
 */
-VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap )
+VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
      throw( std::logic_error& )
 {
   if(MYDEBUG) MESSAGE(GetComment());
   myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
-  myObjectEntry = (const char *)(VISU::Storable::FindValue(theMap,"myObjectEntry"));
   myTitle = (const char*)(VISU::Storable::FindValue(theMap,"myTitle"));
   myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
+  mySObj = SALOMEDS::SObject::_duplicate(SO);
   return Build( true );
 }
 /*!
@@ -198,7 +197,6 @@ VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap )
 void VISU::Table_i::ToStream( std::ostringstream& theStr )
 {
   Storable::DataToStream( theStr, "myName",        myName.c_str() );
-  Storable::DataToStream( theStr, "myObjectEntry", myObjectEntry.c_str() );
   Storable::DataToStream( theStr, "myTitle",       myTitle.c_str() );
   Storable::DataToStream( theStr, "myOrientation", myOrientation );
 }
@@ -211,14 +209,14 @@ VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject,
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
   VISU::Table_i* pResent = new VISU::Table_i( aStudy, "" );
-  return pResent->Restore( theMap );
+  return pResent->Restore( theMap, theSObject);
 }
 /*!
   Gets title for the original table object
 */
 const char* VISU::Table_i::GetTableTitle()
 {
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( GetObjectEntry() );
+  SALOMEDS::SObject_var SO = mySObj;
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -242,14 +240,12 @@ const char* VISU::Table_i::GetTableTitle()
 /*!
   Restores table object from the stream [ static ]
 */
-static VISU::Table_i* GetTable( SALOMEDS::Study_var& theStudy, const VISU::Storable::TRestoringMap& theMap ) {
-  string anEntry = VISU::Storable::FindValue( theMap, "TableID" ).latin1();
-  SALOMEDS::SObject_var aSObject = theStudy->FindObjectID( anEntry.c_str() );
-  CORBA::Object_var anObject = VISU::SObjectToObject( aSObject );
+static VISU::Table_i* GetTable( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSO ) {
+  CORBA::Object_var anObject = VISU::SObjectToObject( theSO );
   if( !CORBA::is_nil( anObject ) ) {
     CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
     if( !CORBA::is_nil( aTable ) )
-      return dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+      return dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
   }
   return NULL;
 }
@@ -288,6 +284,7 @@ VISU::Curve_i::Curve_i(SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::L
 */
 VISU::Curve_i::~Curve_i()
 {
+  INFOS("Curve_i::~Curve_i");
 }
 /*!
   Creates curve object
@@ -304,13 +301,12 @@ VISU::Storable* VISU::Curve_i::Create()
 /*!
   Builds presentation of curve
 */
-VISU::Storable* VISU::Curve_i::Build( int theRestoring ) 
+VISU::Storable* VISU::Curve_i::Build(int theRestoring ) 
 {
   if ( myTable != NULL ) {
     // getting table SObject by it's entry
-    SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetEntry() );
     int nbRows = myTable->GetNbRows();
-    if ( !SO->_is_nil() && myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
+    if ( myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
       if ( !theRestoring ) {
        // look for component
        SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
@@ -318,13 +314,15 @@ VISU::Storable* VISU::Curve_i::Build( int theRestoring )
        QString aComment;
        aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
        string anEntry = CreateAttributes( myStudy, 
-                                          myTable->GetEntry(),
-                                          "",
-                                          GetID(),
-                                          GetName(),
-                                          "",
-                                          aComment.latin1(),
-                                          true );
+                                         myTable->GetObjectEntry(),
+                                         "",
+                                         GetID(),
+                                         GetName(),
+                                         "",
+                                         aComment.latin1(),
+                                         true );
+       // create SObject referenced to real table object
+       mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str()));
       }
       return this;
     }
@@ -338,7 +336,7 @@ 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::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -366,7 +364,7 @@ string VISU::Curve_i::GetHorTitle()
 {
   string title;
   // getting table SObject by it's entry
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -396,7 +394,7 @@ string VISU::Curve_i::GetVerTitle()
 {
   string title;
   // getting table SObject by it's entry
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -424,7 +422,7 @@ string VISU::Curve_i::GetHorUnits()
 {
   string units;
   // getting table SObject by it's entry
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -452,7 +450,7 @@ string VISU::Curve_i::GetVerUnits()
 {
   string units;
   // getting table SObject by it's entry
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -480,7 +478,7 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
 {
   theHorList = 0; theVerList = 0;
   // getting table SObject by it's entry
-  SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+  SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
   SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
@@ -567,19 +565,20 @@ Plot2d_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(strdup(GetEntry()),"VISU",strdup(GetName()))); 
+  crv->setIO(new SALOME_InteractiveObject(strdup(mySObj->GetID()),"VISU",strdup(GetName()))); 
   if ( myTable )
-    crv->setTableIO(new SALOME_InteractiveObject(strdup(myTable->GetEntry()),"VISU",strdup(myTable->GetName()))); 
+    crv->setTableIO(new SALOME_InteractiveObject(strdup(myTable->GetObjectEntry()),"VISU",strdup(myTable->GetName()))); 
   return crv;
 }
 /*!
   Restores curve object from stream
 */
-VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap )
+VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO)
      throw( std::logic_error& )
 {
   if(MYDEBUG) MESSAGE(GetComment());
-  myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
+  mySObj = SALOMEDS::SObject::_duplicate(theSO);
+  myName = VISU::Storable::FindValue(theMap,"myName").latin1();
   myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt();
   myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt();
   myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
@@ -587,6 +586,8 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap )
   myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
   myMarker = ( VISU::Curve::MarkerType )( VISU::Storable::FindValue(theMap,"myMarker").toInt() );
   myLine = ( VISU::Curve::LineType )( VISU::Storable::FindValue(theMap,"myLine").toInt() );
+  myLineWidth = VISU::Storable::FindValue(theMap,"myLineWidth").toInt();
+  myAuto = VISU::Storable::FindValue(theMap,"myAuto").toInt();
   return Build( true );
 }
 /*!
@@ -594,21 +595,22 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap )
 */
 void VISU::Curve_i::ToStream( std::ostringstream& theStr )
 {
-  Storable::DataToStream( theStr, "TableID",   GetTableID());
-  Storable::DataToStream( theStr, "myName",    myName.c_str() );
-  Storable::DataToStream( theStr, "myHRow",    myHRow );
-  Storable::DataToStream( theStr, "myVRow",    myVRow );
-  Storable::DataToStream( theStr, "myColor.R", myColor.R );
-  Storable::DataToStream( theStr, "myColor.G", myColor.G );
-  Storable::DataToStream( theStr, "myColor.B", myColor.B );
-  Storable::DataToStream( theStr, "myMarker",  myMarker );
-  Storable::DataToStream( theStr, "myLine",    myLine );
+  Storable::DataToStream( theStr, "myName",      myName.c_str() );
+  Storable::DataToStream( theStr, "myHRow",      myHRow );
+  Storable::DataToStream( theStr, "myVRow",      myVRow );
+  Storable::DataToStream( theStr, "myColor.R",   myColor.R );
+  Storable::DataToStream( theStr, "myColor.G",   myColor.G );
+  Storable::DataToStream( theStr, "myColor.B",   myColor.B );
+  Storable::DataToStream( theStr, "myMarker",    myMarker );
+  Storable::DataToStream( theStr, "myLine",      myLine );
+  Storable::DataToStream( theStr, "myLineWidth", myLineWidth );
+  Storable::DataToStream( theStr, "myAuto",      myAuto );
 }
 /*!
   Gets reference table's entry
 */
 const char* VISU::Curve_i::GetTableID() { 
-  return CORBA::string_dup(myTable->GetEntry());
+  return CORBA::string_dup(myTable->GetObjectEntry());
 }
 /*!
   Called from engine to restore curve from the file
@@ -618,10 +620,10 @@ VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
   throw(std::logic_error&)
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-  VISU::Table_i* pTable = GetTable( aStudy, theMap );
+  VISU::Table_i* pTable = GetTable(aStudy, theSObject->GetFather());
   if( pTable != NULL ) {
     VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0 );
-    return pResent->Restore( theMap );
+    return pResent->Restore( theMap, theSObject);
   }
   return NULL;
 }
@@ -636,7 +638,7 @@ const string VISU::Container_i::myComment  = "CONTAINER";
 */
 const char* VISU::Container_i::GenerateName() 
 { 
-  return VISU::GenerateName( "Container", ++myNbPresent ); 
+  return VISU::GenerateName( "Plot2DView", ++myNbPresent ); 
 }
 /*!
   Gets comment string
@@ -657,6 +659,7 @@ VISU::Container_i::Container_i( SALOMEDS::Study_ptr theStudy )
 */
 VISU::Container_i::~Container_i()
 {
+  INFOS("Container_i::~Container_i");
   myCurves.clear();
 }
 /*!
@@ -716,6 +719,7 @@ void VISU::Container_i::RemoveCurve( Curve_ptr theCurve )
 */
 CORBA::Long VISU::Container_i::GetNbCurves()
 {
+  Update();
   return myCurves.count();
 }
 /*!
@@ -848,7 +852,7 @@ VISU::Curve_i* VISU::Container_i::GetCurve( CORBA::Long theIndex )
       // if real Curve Object exists 
       CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
       if( !CORBA::is_nil( aCurve ) )
-      return dynamic_cast<VISU::Curve_i*>(VISU::GetServant( aCurve ) );
+      return dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
     }
   }
   return NULL;
@@ -860,7 +864,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa
      throw( std::logic_error& )
 {
   if(MYDEBUG) MESSAGE(GetComment());
-  myName = (const char*)(VISU::Storable::FindValue( theMap, "myName" )); 
+  myName = VISU::Storable::FindValue( theMap, "myName" ).latin1(); 
   QString val = VISU::Storable::FindValue( theMap, "myCurves" );
   myCurves = QStringList::split( QString( "*" ), val, false );
   return Build( true );
@@ -901,7 +905,7 @@ struct TRow{
 
 typedef vector<TRow> TRows;
 
-struct TTable2D{
+struct TTable2D {
   string myTitle;
   vector<string> myColumnUnits;
   vector<string> myColumnTitles;
@@ -1088,3 +1092,94 @@ SALOMEDS::SObject_var VISU::ImportTables(const char* theFileName, SALOMEDS::Stud
   }
   return aFileObject;
 }
+
+template<class TTableAttr> bool ExportTableToFile(const TTableAttr& aTabAttr,  
+                                                 const char* theFileName)
+{
+  if (!CORBA::is_nil(aTabAttr)) {
+    QFile aFile(theFileName);  
+    aFile.open(IO_WriteOnly);  
+
+    /* extract the tabe info and write it into file */ 
+    
+    QString aTitle(aTabAttr->GetTitle()); /*Table title*/ 
+    int aRowsNb = aTabAttr->GetNbRows();  
+    int aColNb  = aTabAttr->GetNbColumns(); 
+    
+    SALOMEDS::StringSeq_var aRowTitles = aTabAttr->GetRowTitles(); 
+    QString anAbscissTitle(aRowTitles[0]); /*Absciss row title (X coord)*/ 
+    anAbscissTitle.stripWhiteSpace();       
+
+    SALOMEDS::StringSeq_var aRowUnits = aTabAttr->GetRowUnits(); 
+    QString anAbscissUnit(aRowUnits[0]); 
+    anAbscissUnit.stripWhiteSpace();     
+    
+    SALOMEDS::StringSeq_var aColumnTitles = aTabAttr->GetColumnTitles(); 
+    if (aRowsNb > 2 && aTitle.length() )  aTitle = aTitle + " - ";
+
+    QString aLine;                      
+    for (int i = 2; i <= aRowsNb; i++ ) 
+      {                                 
+       /* TITLE */                     
+       QString anOrdinate(aRowTitles[i-1]), aTail; 
+       anOrdinate.stripWhiteSpace();                      
+
+       aLine = "#TITLE: " + aTitle +                              
+         ((anOrdinate.length())?  anOrdinate : 
+                                 (aRowsNb>2)? aTail.sprintf("%d",i-1) : aTail.sprintf("") ) + "\n"; 
+       aFile.writeBlock(aLine, aLine.length() );                               
+                                                                                   
+       /* COLUMN_TITLES */                                                     
+       if ( anAbscissTitle.length() || anOrdinate.length() ) {                    
+         aLine = "#COLUMN_TITLES: " + anAbscissTitle + " | " + anOrdinate + "\n";    
+         aFile.writeBlock(aLine, aLine.length() );                                
+       }                                                                          
+
+       /* COLUMN_UNITS */                           
+       aLine = anAbscissUnit + " " +aRowUnits[i-1]; 
+       if (!aLine.stripWhiteSpace().isEmpty()) {    
+         aLine = "#COLUMN_UNITS: " + aLine  + "\n"; 
+         aFile.writeBlock(aLine, aLine.length() );  
+       }    
+
+       /* CURVE COORDINATES */                      
+       for (int j = 1; j <= aColNb; j++)            
+         {                                          
+           if ( aTabAttr -> HasValue(i,j) &&  aTabAttr -> HasValue(1, j)) { 
+             aLine = aLine.sprintf("%.16g %.16g",            
+                                   (double)(aTabAttr->GetValue(1,j)),  
+                                   (double)(aTabAttr->GetValue(i,j)));  /* aTabAttr->GetValue(1,j) - X coord */ 
+             if ( !aLine.stripWhiteSpace().isEmpty() ) {     
+               QString aColTitle(aColumnTitles[j-1]);        
+               if ( !aColTitle.stripWhiteSpace().isEmpty() ) 
+                 aLine = aLine + "  #TITLE: " + aColTitle ;  
+               aFile.writeBlock(aLine + "\n", aLine.length() + 1); 
+             }     
+           }       
+         }   
+       aFile.writeBlock("\n", 1); 
+      }             
+    aFile.close();  
+    return true;    
+  }                 
+  return false;
+}
+bool VISU::ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName)
+{
+  //Find table
+  SALOMEDS::GenericAttribute_var anAttr ;
+  if (theTable->FindAttribute(anAttr, "AttributeTableOfReal"))
+    {
+      SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal ::_narrow(anAttr); 
+      return ExportTableToFile ( aTabAttr , theFileName);
+      
+    }
+  else if (theTable->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+
+    SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger ::_narrow(anAttr); 
+    return ExportTableToFile ( aTabAttr , theFileName);
+    
+  }
+  return false;
+}
index 2618e5cee49b74586b4a0a7e8ef180c33230bfad..25f9c4d9a9b6aca42c92a14dcf4cc838c450a9ca 100644 (file)
@@ -60,11 +60,11 @@ namespace VISU{
   protected:
     VISU::Table::Orientation myOrientation;
     string myTitle;
-    string myObjectEntry;
+    SALOMEDS::SObject_var mySObj;
 
   public:
     virtual Storable* Create();
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
       throw(std::logic_error&);
     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
                             const string& thePrefix, const Storable::TRestoringMap& theMap)
@@ -75,10 +75,10 @@ namespace VISU{
     virtual const char* GenerateName();
     virtual const char* GetTableTitle();
 
-    virtual char* GetObjectEntry() { return CORBA::string_dup( myObjectEntry.c_str() ); }
+    virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); }
   };
   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
-
+  bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
   //==============================================================================
   class Curve_i : public virtual POA_VISU::Curve,
                   public virtual PrsObject_i
@@ -118,10 +118,11 @@ namespace VISU{
     int                     myLineWidth;
     string                  myTitle;
     bool                    myAuto;
+    SALOMEDS::SObject_var   mySObj;
 
   public:
     virtual Storable* Create();
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO)
       throw(std::logic_error&);
     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
                             const string& thePrefix, const Storable::TRestoringMap& theMap)
index 49cd78fa76eb117bf31e41bafaeec42d35c9095a..381061681e5d4cc9a8ecce1c934a608dea8be602 100644 (file)
@@ -40,7 +40,7 @@ VISU_TimeAnimation::VISU_TimeAnimation(SALOMEDS::Study_var theStudy, VISU::View3
   myView = 0;
 
   if(!CORBA::is_nil(theView3D)){
-    VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D));
+    VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
     QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
     myView = VISU::GetViewFrame(aStudyFrame);
   }
@@ -135,7 +135,7 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
   SALOMEDS::SObject_var aTimeStamp;
   anIter->Next(); // First is reference on support
   long i = 0;
-  double aMin = 0, aMax = 0;
+  double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
   for(;anIter->More();anIter->Next()) {
     if (i == aData.myNbTimes) {
       MESSAGE("There are extra timestamps in field");
@@ -232,6 +232,10 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
   if (aFixRange.compare("true") != 0) {
     for (i = 0; i < aData.myNbFrames; i++) 
       aData.myPrs[i]->SetRange(aMin, aMax);
+    if(aData.myPrsType == VISU::TISOSURFACE)
+      for (i = 0; i < aData.myNbFrames; i++) 
+       if(VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]))
+          aPrs->SetSubRange(aMin, aMax);
   }
 }
 
@@ -448,7 +452,7 @@ void VISU_TimeAnimation::run() {
        aData.myActors[myFrame]->VisibilityOn();
       }
     }
-    myView->Repaint();
+    myView->Repaint(false);
     if (isDumping) {
       QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
       QString aFile(myDumpPath);
@@ -511,7 +515,7 @@ VISU::Result_i* VISU_TimeAnimation::createPresent(SALOMEDS::SObject_var theField
   aSObj = aSObj->GetFather();
   CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
   if(CORBA::is_nil(anObject)) return NULL;
-  return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
+  return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
 }
 
 
index 81a5664e7200207d0d43cf3134ed24cdd2d32049..2e271160de83142acb568e2b3307e1b73420a574 100644 (file)
@@ -40,10 +40,26 @@ static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
+static int INCMEMORY = 4+12;
+
 int VISU::Vectors_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                               const char* theFieldName, int theIteration)
+                               const char* theFieldName, int theIteration, int isMemoryCheck)
 {
-  return DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  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);
+      aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+      INFOS("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    }
+  }catch(std::runtime_error& exc){
+    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was accured!");
+  }
+  return aResult;
 }
 
 
@@ -55,28 +71,21 @@ 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) :
+VISU::Vectors_i::Vectors_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
        PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy),
-       DeformedShape_i(theResult, theAddToStudy)
+       Prs3d_i(theResult,theSObject),
+       ScalarMap_i(theResult,theAddToStudy,theSObject),
+       DeformedShape_i(theResult,theAddToStudy,theSObject)
 {
   myVectorsPL = NULL;
 }
 
 
-void VISU::Vectors_i::Destroy(){
-  DeformedShape_i::Destroy();
-}
-
-
 void VISU::Vectors_i::SameAs(const VISU::Vectors_i* theOrigin) {
   Vectors_i* aVectors = const_cast<Vectors_i*>(theOrigin);
   VISU::DeformedShape_i::SameAs(theOrigin);
 
   SetLineWidth(aVectors->GetLineWidth());
-  //SetGlyphType(aVectors->GetGlyphType());
-  //SetGlyphPos(aVectors->GetGlyphPos());
 }
 
 
@@ -91,15 +100,15 @@ VISU::Storable* VISU::Vectors_i::Create(const char* theMeshName, VISU::Entity th
 VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap)
      throw(std::logic_error&)
 {
-  DeformedShape_i::Restore(theMap);
-
+  DoHook();
   SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt()));
   SetGlyphPos(VISU::Vectors::GlyphPos(VISU::Storable::FindValue(theMap,"myPosGlyph").toInt()));
   SetLineWidth(VISU::Storable::FindValue(theMap,"myLineWidth").toDouble());
 
-  return Build(true);
+  return DeformedShape_i::Restore(theMap);
 }
 
+
 void VISU::Vectors_i::ToStream(std::ostringstream& theStr){
   DeformedShape_i::ToStream(theStr);
 
@@ -108,18 +117,6 @@ void VISU::Vectors_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myLineWidth", GetLineWidth());
 }
 
-VISU::Storable* VISU::Vectors_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                        const string& thePrefix, const Storable::TRestoringMap& theMap)
-  throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::Vectors_i* pResent = new VISU::Vectors_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
 
 VISU::Vectors_i::~Vectors_i(){
   if(MYDEBUG) MESSAGE("Vectors_i::~Vectors_i()");
@@ -185,7 +182,7 @@ 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) throw(std::runtime_error&){
   if(VISU_VectorsAct* anActor = dynamic_cast<VISU_VectorsAct*>(theActor)){
     VISU::DeformedShape_i::UpdateActor(anActor);
     anActor->GetProperty()->SetLineWidth(GetLineWidth());
index 1a2322d283803e3f45c97ae4b51c25a05d7f101a..fce5d7b01821c362c991c781911f928340162e8e 100644 (file)
@@ -39,10 +39,10 @@ namespace VISU{
     Vectors_i();
     Vectors_i(const Vectors_i&);
   public:
-    Vectors_i(Result_i* theResult, bool theAddToStudy = true);
+    Vectors_i(Result_i* theResult, bool theAddToStudy = true,
+             SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
     virtual void SameAs(const Vectors_i* theOrigin);
     virtual ~Vectors_i();
-    virtual void Destroy();
 
     virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
 
@@ -67,7 +67,7 @@ namespace VISU{
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                         const char* theFieldName, int theIteration);
+                         const char* theFieldName, int theIteration, int isMemoryCheck = true);
     virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, 
                             const char* theFieldName, int theIteration);
 
@@ -75,10 +75,6 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap)
       throw(std::logic_error&);
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap)
-      throw(std::logic_error&);
-
 
     static const string myComment;
     virtual const char* GetComment() const;
@@ -86,7 +82,7 @@ namespace VISU{
 
     virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
       throw (std::runtime_error&);
-    virtual void UpdateActor(VISU_Actor* theActor);
+    virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
   };
 }
 #endif
index 6c955c4179cf23d0fde9e59afa21e990f61ea2e6..3ea8d99f6038c8efb619b7406e0149baccbbd633 100644 (file)
@@ -126,7 +126,7 @@ namespace VISU{
        anVISUActor = thePrs->CreateActor();
        vf->AddActor(anVISUActor);
       }catch(std::runtime_error& exc){
-       INFOS("Null actor is created");
+       INFOS(exc.what());
        return NULL;
       }
     }
@@ -244,7 +244,9 @@ namespace VISU{
     if(!aStudy){
        CORBA::String_var aName = theStudy->Name();
        aFileInfo.setFile(aName.in());
-       aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+       if (aFileInfo.exists()) 
+         aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+       else aStudy = aDesktop->loadStudy(aName.in());
        if (!aStudy)
          MESSAGE("ViewManager_i::ERROR: Can't load study");
     }
@@ -310,7 +312,7 @@ namespace VISU{
     CORBA::Object_var aView = VISU::View::_narrow(theView);
     if(!CORBA::is_nil(aView)){
       if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - VISU::View"<<(!CORBA::is_nil(aView)));
-      VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(aView));
+      VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(aView).in());
       if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - dynamic_cast"<<pView);
       if(pView) {
        pView->Close();
@@ -344,7 +346,9 @@ namespace VISU{
     myStudy = aDesktop->findStudy(theStudy);
     if(!myStudy){
       aFileInfo.setFile(aName.in());
-      myStudy = aDesktop->loadStudy(aFileInfo.baseName());
+      if ( aFileInfo.exists() )
+       myStudy = aDesktop->loadStudy(aFileInfo.baseName());
+      else myStudy = aDesktop->loadStudy(aName.in());
     }
     if(MYDEBUG) MESSAGE("View_i::View_i - isStudyOpened = "<<myStudy<<"; aName = "<<aName.in());
   }
@@ -562,11 +566,11 @@ namespace VISU{
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
     // is it Curve ?
-    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
       UpdatePlot2d(myView,eDisplay,aCurve);
     }
     // is it Container ?
-    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
       int nbCurves = aContainer->GetNbCurves();
       for ( int i = 1; i <= nbCurves; i++ ) {
        VISU::Curve_i* aCurve = aContainer->GetCurve( i );
@@ -577,7 +581,7 @@ namespace VISU{
       myView->Repaint();
     }
     // is it Table ?
-    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
       SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
       if ( !TableSO->_is_nil() ) {
        SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
@@ -586,7 +590,7 @@ namespace VISU{
          if( !CORBA::is_nil( childObject ) ) {
            CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
            if( !CORBA::is_nil( aCurve ) )
-             UpdatePlot2d(myView,eDisplay,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+             UpdatePlot2d(myView,eDisplay,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
          }
        }
        myView->Repaint();
@@ -598,11 +602,11 @@ namespace VISU{
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
     // is it Curve ?
-    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
       UpdatePlot2d(myView,eErase,aCurve);
     }
     // is it Container ?
-    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
       int nbCurves = aContainer->GetNbCurves();
       for ( int i = 1; i <= nbCurves; i++ ) {
        VISU::Curve_i* aCurve = aContainer->GetCurve( i );
@@ -613,7 +617,7 @@ namespace VISU{
       myView->Repaint();
     }
     // is it Table ?
-    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
       SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
       if ( !TableSO->_is_nil() ) {
        SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
@@ -622,7 +626,7 @@ namespace VISU{
          if( !CORBA::is_nil( childObject ) ) {
            CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
            if( !CORBA::is_nil( aCurve ) )
-             UpdatePlot2d(myView,eErase,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+             UpdatePlot2d(myView,eErase,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
          }
        }
        myView->Repaint();
@@ -639,11 +643,11 @@ namespace VISU{
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
     // is it Curve ?
-    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+    if(Curve_i* aCurve =  dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
       UpdatePlot2d(myView,eDisplayOnly,aCurve);
     }
     // is it Container ?
-    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+    if(Container_i* aContainer =  dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
       int nbCurves = aContainer->GetNbCurves();
       for ( int i = 1; i <= nbCurves; i++ ) {
        VISU::Curve_i* aCurve = aContainer->GetCurve( i );
@@ -654,7 +658,7 @@ namespace VISU{
       myView->Repaint();
     }
     // is it Table ?
-    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+    if(Table_i* aTable =  dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
       SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
       if ( !TableSO->_is_nil() ) {
        SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
@@ -663,7 +667,7 @@ namespace VISU{
          if( !CORBA::is_nil( childObject ) ) {
            CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
            if( !CORBA::is_nil( aCurve ) )
-             UpdatePlot2d(myView,eDisplayOnly,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+             UpdatePlot2d(myView,eDisplayOnly,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
          }
        }
        myView->Repaint();
@@ -705,7 +709,7 @@ namespace VISU{
     if(MYDEBUG) MESSAGE("TableView_i::Create - "<<(!theTable->_is_nil()));
     Mutex mt(myMutex,qApp,MYDELAY);
     if(!theTable->_is_nil()){
-      VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable.in()));
+      VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable.in()).in());
       if(MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = "<<table);
       if(table != NULL) {
        SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectID(table->GetObjectEntry());
@@ -943,7 +947,7 @@ namespace VISU{
     aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
     aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
     
-    myStudyFrame->setTitle(myName.c_str());
+    //myStudyFrame->setTitle(myName.c_str());
     SetBackground(aColor);
     SetPointOfView(aPosition);
     SetViewUp(aViewUp);
@@ -1093,21 +1097,21 @@ namespace VISU{
     if(MYDEBUG) MESSAGE("View3D_i::Erase");
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
-    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
       UpdateViewer(myStudyFrame,eErase,aPrs);
   }
   void View3D_i::Display(PrsObject_ptr thePrsObj) {
     if(MYDEBUG) MESSAGE("View3D_i::Display"); 
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
-    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
       UpdateViewer(myStudyFrame,eDisplay,aPrs);
   }
   void View3D_i::DisplayOnly(PrsObject_ptr thePrsObj) {
     if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
     Mutex mt(myMutex,qApp,MYDELAY);
     CORBA::Object_ptr anObj = thePrsObj;
-    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+    if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
       UpdateViewer(myStudyFrame,eDisplayOnly,aPrs);
   }
 
index b81b2a870ad1784946933f8ce4c290305a99f1a2..ff40e7bca0df9610b2bbd7cd8b798ce3fbbb28c0 100644 (file)
@@ -45,7 +45,6 @@ EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py bat
        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_swig_test.py
-
 EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py
 
 LIB_CLIENT_IDL = 
@@ -55,4 +54,4 @@ CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(QT_INCLUDES) \
 LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine
 
 @CONCLUDE@
\ No newline at end of file
index e8c0afa7e1c2cf3c986b445ca0fb54a3a8cbac3d..fe85ef7595de88e4e67bf212233f6c8a1ad0cfba 100644 (file)
@@ -19,7 +19,7 @@ import math
 myBuilder = myStudy.NewBuilder()
 
 # >>> Getting (loading) VISU component =======================================
-myVisu = lcc.FindOrLoadComponent("FactoryServer", "Visu")
+myVisu = lcc.FindOrLoadComponent("FactoryServer", "VISU")
 myComponent = myStudy.FindComponent("VISU")
 myVisu.SetCurrentStudy(myStudy)
 if not myComponent:
index 1cb4f7ce684e5acbe3e5c047871d1b317fe5267d..86d8adc8a7392b8dccfdde36f65d6f9a3d58a542 100644 (file)
 import os
 import re
 from time import sleep
-#
 
 import VISU
 import SALOME
+import SALOME_Session_idl
 import SALOMEDS
 import SALOME_MED
 from omniORB import CORBA
@@ -39,6 +39,7 @@ def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, the
     myLifeCycleCORBA = theLifeCycleCORBA
     myLocalStudyManager = theStudyManager
     mySession = myNamingService.Resolve("/Kernel/Session")
+    mySession = mySession._narrow(SALOME.Session)
     mySession.GetInterface()
     myDelay = theDelay
     sleep(myDelay)
@@ -76,10 +77,10 @@ def HasValue(theList, theValue) :
 def CreateStudyForMed(theVisu, theFileName) :
     print "CreateStudyForMed ", theFileName,
     if os.path.isfile(theFileName) :
-        if os.path.splitext(theFileName)[1] == '.med' :
+        if re.search("\.med$", theFileName) is not None :
             print "OK"
             aStudyName = os.path.basename(theFileName)
-            aStudyName = os.path.splitext(aStudyName)[0]
+            aStudyName = re.sub(r'\.med', "", aStudyName)
             aStudyName = generateName(aStudyName)
             print "myLocalStudyManager.NewStudy -", aStudyName, "...",
             aStudy = myLocalStudyManager.NewStudy(aStudyName)
@@ -169,7 +170,7 @@ def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePict
         aVISUObjList.append(aResult)
         aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt))
         
-        aFolderIter = myLocalStudy.NewChildIterator(aMedSObj);
+        aFolderIter = myLocalStudy.NewChildIterator(aMedSObj.GetFather());
         while aFolderIter.More() :
             aFolderSObj = aFolderIter.Value()
             aFolderIter.Next()
@@ -242,7 +243,7 @@ def CreatePrsForFile(theVisu, theFileName, thePrsTypeList, thePictureDir, thePic
  #   try:
         aVISUObjList = [myLocalStudy, myViewManager, myView] = CreateStudyForMed(theVisu, theFileName)
 
-        print "theVisu.ImportMed..."
+        print "theVisu.ImportMed...",
         aResult = theVisu.ImportFile(theFileName)
         if aResult is None : raise RuntimeError, "Error"
         else : print "OK"
@@ -423,7 +424,7 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi
                                 aPrsObj = theVisu.CutPlanesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
                                 if aPrsObj is None : print "Error"
                                 else : print ",OK"
-                                aPrsObj.SetOrientationType(VISU.CutPlanes.ZX)
+                                aPrsObj.SetOrientation(VISU.CutPlanes.ZX,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
                                 theView.DisplayOnly(aPrsObj)
                                 theView.FitAll()
                                 aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTPLANES." + thePictureExt
@@ -436,8 +437,8 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi
                                 aPrsObj = theVisu.CutLinesOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
                                 if aPrsObj is None : print "Error"
                                 else : print ",OK"
-                                aPrsObj.SetOrientationType(VISU.CutPlanes.XY)
-                                aPrsObj.SetOrientationType2(VISU.CutPlanes.ZX)
+                                aPrsObj.SetOrientation(VISU.CutPlanes.XY,aPrsObj.GetRotateX(),aPrsObj.GetRotateY())
+                                aPrsObj.SetOrientation2(VISU.CutPlanes.ZX,aPrsObj.GetRotateX2(),aPrsObj.GetRotateY2())
                                 theView.DisplayOnly(aPrsObj)
                                 theView.FitAll()
                                 aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TCUTLINES." + thePictureExt
@@ -461,7 +462,7 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi
 
                                 if HasValue(thePrsTypeList,VISU.TVECTORS) :
                                     print "          Creating VectorsOnField",
-                                    aPrsObj = theVisu.VectorsOnField(theResult,aMeshNamePic,anEntity,aFieldName,aTimeStampId)
+                                    aPrsObj = theVisu.VectorsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId)
                                     if aPrsObj is None : print "Error"
                                     else : print ",OK"
                                     theView.DisplayOnly(aPrsObj)
@@ -632,10 +633,6 @@ def try_cutplanes_parameters(thePattern) :
     ind = random.randint(1,2)
     anObj = try_scalarmap_parameters(thePattern)
         
-    # --- ORIENTATION ---
-    anObj.SetOrientationType(ORIENT[random.randint(0,2)])
-
-    # --- NUMBER OF PLANES ---
     if ind%2 :   anObj.SetNbPlanes(random.randint(-40,40))
     else :       anObj.SetNbPlanes(random.randint(0,10)) #try behaivor if NbPlanes=0
 
@@ -660,8 +657,8 @@ def try_cutplanes_parameters(thePattern) :
             angle1 = random.random()*3.14
             angle2 = random.random()*3.14
         
-    anObj.SetRotateX(angle1)
-    anObj.SetRotateY(angle2)
+    # --- ORIENTATION ---
+    anObj.SetOrientation(ORIENT[random.randint(0,2)],angle1,angle2)
 
     return anObj
         
@@ -694,8 +691,12 @@ def try_cutlines_parameters(thePattern):
     anObj = try_scalarmap_parameters(thePattern)
 
     # --- ORIENTATION ---
-    anObj.SetOrientationType(ORIENT[random.randint(0,2)])
-    anObj.SetOrientationType2(ORIENT[random.randint(0,2)])
+    anObj.SetOrientation(ORIENT[random.randint(0,2)],
+                         random.randint(-100,100)*random.random(),
+                         random.randint(-100,100)*random.random())
+    anObj.SetOrientation2(ORIENT[random.randint(0,2)],
+                          random.randint(-100,100)*random.random(),
+                          random.randint(-100,100)*random.random())
 
     # --- Base Plane Position ---
     anObj.SetBasePlanePosition( random.random()*random.randint(-100000,100000))
@@ -704,12 +705,6 @@ def try_cutlines_parameters(thePattern):
     if ind%2:
             anObj.SetNbLines(random.randint(-5, 50))
 
-    # --- ROTATION ---
-    anObj.SetRotateX(random.randint(-100,100)*random.random())
-    anObj.SetRotateX2(random.randint(-100,100)*random.random())
-    anObj.SetRotateY(random.randint(-100,100)*random.random())
-    anObj.SetRotateY2(random.randint(-100,100)*random.random())
-
     return anObj
 
 def dump_cutlines_parameters(theObject):
index 15d18205f7ea0a8c02a0ffc06c41fab7b464e103..9a3317c4636ecfc2dfa90f6264172eea9bac6e28 100644 (file)
@@ -19,7 +19,7 @@ myStudy = salome.myStudy
 myBuilder = myStudy.NewBuilder()
 
 # >>> Getting (loading) VISU component =======================================
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
 myComponent = myStudy.FindComponent("VISU")
 myVisu.SetCurrentStudy(myStudy)
 if not myComponent:
index 2a75f06ac8bae9a29cca9d50b614b5e25d8a7af6..46f7bedfd0b86fc5ed8bcd8e2e37c398acbf144d 100644 (file)
@@ -53,7 +53,7 @@ def importMed(medFile):
     importMedFrom(medDir,medFile)
 
 #med_obj = getMedObjectFromStudy()
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
 print "Use importMed(medFile) or importMedFrom(medDir,medFile) functions !"
 
 #myField = getFieldObjectFromStudy(2,1)
index d8cba43139bae3933edada58b09dc7b186c34d81..002ebd103ef661aeab1936d14bbb4a450f935c83 100644 (file)
@@ -27,7 +27,7 @@ print medFile
 
 studyCurrent = salome.myStudyName
 
-med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "Med")
+med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
 #myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
 
 try:
index d39beaf73d627aa9a30df2600e1246dad8b117f5..38641bbd0a37721e8d8179128bc2a14b61b19b59 100644 (file)
@@ -19,7 +19,7 @@ myStudy = salome.myStudy
 myBuilder = myStudy.NewBuilder()
 
 # >>> Getting (loading) VISU component =======================================
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
 myComponent = myStudy.FindComponent("VISU")
 myVisu.SetCurrentStudy(myStudy)
 if not myComponent: